-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3228 from TeamAmaze/feature/gradle-7.4-lib-upgrades
Upgrade Gradle to 7.4 + lib upgrades + Target SDK 31 + publish test report at Github actions
- Loading branch information
Showing
37 changed files
with
381 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,11 @@ | |
|
||
package com.amaze.filemanager.asynchronous.services; | ||
|
||
import static android.app.PendingIntent.FLAG_IMMUTABLE; | ||
import static android.app.PendingIntent.FLAG_UPDATE_CURRENT; | ||
import static android.os.Build.VERSION.SDK_INT; | ||
import static android.os.Build.VERSION_CODES.S; | ||
|
||
import java.util.ArrayList; | ||
|
||
import org.slf4j.Logger; | ||
|
@@ -35,7 +40,6 @@ | |
import com.amaze.filemanager.utils.ProgressHandler; | ||
import com.amaze.filemanager.utils.Utils; | ||
|
||
import android.app.NotificationManager; | ||
import android.app.PendingIntent; | ||
import android.app.Service; | ||
import android.content.Context; | ||
|
@@ -47,6 +51,7 @@ | |
import androidx.annotation.CallSuper; | ||
import androidx.annotation.StringRes; | ||
import androidx.core.app.NotificationCompat; | ||
import androidx.core.app.NotificationManagerCompat; | ||
|
||
/** | ||
* @author Emmanuel Messulam <[email protected]> on 28/11/2017, at 19:32. | ||
|
@@ -72,7 +77,7 @@ public void onCreate() { | |
wakeLock.setReferenceCounted(false); | ||
} | ||
|
||
protected abstract NotificationManager getNotificationManager(); | ||
protected abstract NotificationManagerCompat getNotificationManager(); | ||
|
||
protected abstract NotificationCompat.Builder getNotificationBuilder(); | ||
|
||
|
@@ -342,7 +347,7 @@ void finalizeNotification(ArrayList<HybridFile> failedOps, boolean move) { | |
intent.putExtra("move", move); | ||
|
||
PendingIntent pIntent = | ||
PendingIntent.getActivity(this, 101, intent, PendingIntent.FLAG_UPDATE_CURRENT); | ||
PendingIntent.getActivity(this, 101, intent, getPendingIntentFlag(FLAG_UPDATE_CURRENT)); | ||
|
||
mBuilder.setContentIntent(pIntent); | ||
mBuilder.setSmallIcon(R.drawable.ic_folder_lock_open_white_36dp); | ||
|
@@ -383,4 +388,20 @@ public void initNotificationViews() { | |
.setProgressBar(R.id.notification_service_progressBar_big, 0, 0, true); | ||
getNotificationManager().notify(getNotificationId(), getNotificationBuilder().build()); | ||
} | ||
|
||
/** | ||
* For compatibility purposes. Wraps the pending intent flag, return with FLAG_IMMUTABLE if device | ||
* SDK >= 32. | ||
* | ||
* @see PendingIntent.FLAG_IMMUTABLE | ||
* @param pendingIntentFlag proposed PendingIntent flag | ||
* @return original PendingIntent flag if SDK < 32, otherwise adding FLAG_IMMUTABLE flag. | ||
*/ | ||
public static int getPendingIntentFlag(final int pendingIntentFlag) { | ||
if (SDK_INT < S) { | ||
return pendingIntentFlag; | ||
} else { | ||
return pendingIntentFlag | FLAG_IMMUTABLE; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.