diff options
| author | 2022-04-05 16:04:08 -0700 | |
|---|---|---|
| committer | 2022-04-05 16:04:08 -0700 | |
| commit | 8abd49be00dba564fbda56384e348f7d4e9c02f8 (patch) | |
| tree | 7e5e6f0314518d0f9d791aac85b80517a1848c0a | |
| parent | 17c1c80c0bcda772d3bb8537f27a44dd13dd5ef7 (diff) | |
Update the PendingIntent to launch Settings on bg restriction alert
Bug: 203105544
Bug: 227947723
Bug: 227615380
Test: Manual - trigger a bg restriction alert and tap on it.
Change-Id: Iddfabb8b81a995b9f5839c88c34a0d453b733919
| -rw-r--r-- | services/core/java/com/android/server/am/AppRestrictionController.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/am/AppRestrictionController.java b/services/core/java/com/android/server/am/AppRestrictionController.java index 708bd1662a77..313bedb37164 100644 --- a/services/core/java/com/android/server/am/AppRestrictionController.java +++ b/services/core/java/com/android/server/am/AppRestrictionController.java @@ -2289,9 +2289,10 @@ public final class AppRestrictionController { void postRequestBgRestrictedIfNecessary(String packageName, int uid) { final Intent intent = new Intent(Settings.ACTION_VIEW_ADVANCED_POWER_USAGE_DETAIL); intent.setData(Uri.fromParts(PACKAGE_SCHEME, packageName, null)); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); final PendingIntent pendingIntent = PendingIntent.getActivityAsUser(mContext, 0, - intent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE, null, + intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE, null, UserHandle.of(UserHandle.getUserId(uid))); Notification.Action[] actions = null; final boolean hasForegroundServices = @@ -2347,13 +2348,14 @@ public final class AppRestrictionController { intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND); // Task manager runs in SystemUI, which is SYSTEM user only. pendingIntent = PendingIntent.getBroadcastAsUser(mContext, 0, - intent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE, + intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE, UserHandle.SYSTEM); } else { final Intent intent = new Intent(Settings.ACTION_VIEW_ADVANCED_POWER_USAGE_DETAIL); intent.setData(Uri.fromParts(PACKAGE_SCHEME, packageName, null)); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); pendingIntent = PendingIntent.getActivityAsUser(mContext, 0, - intent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE, + intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE, null, UserHandle.of(UserHandle.getUserId(uid))); } |