From 8f52e2fe0ff8f075681ad1fc9541869db9ead94e Mon Sep 17 00:00:00 2001 From: Paul Hu Date: Mon, 29 Jun 2020 12:31:12 +0000 Subject: [PATCH] Correct PendingIntent#getActivity() flags TetheringNotificationUpdater create a PendingIntent with Intent#FLAG_ACTIVITY_NEW_TASK flag. But this flag is used for Intent only. Thus, move this flag into Intent. Bug: 158639789 Test: atest TetheringTests Change-Id: I4c3af75c87b797bcde9356a94c835c7422dac1c6 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1329013 Change-Id: Ia843da82bc8fa03aca33a51fc309b65e73dfdc8f Merged-In: I4c3af75c87b797bcde9356a94c835c7422dac1c6 (cherry picked from commit 2ad5f4e82f20b1def7d9223aae7bded8d7ad5344) --- .../tethering/TetheringNotificationUpdater.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Tethering/src/com/android/networkstack/tethering/TetheringNotificationUpdater.java b/Tethering/src/com/android/networkstack/tethering/TetheringNotificationUpdater.java index 593d04a06b..a0198cc9c1 100644 --- a/Tethering/src/com/android/networkstack/tethering/TetheringNotificationUpdater.java +++ b/Tethering/src/com/android/networkstack/tethering/TetheringNotificationUpdater.java @@ -273,8 +273,9 @@ public class TetheringNotificationUpdater { mContext.createContextAsUser(UserHandle.CURRENT, 0 /* flags */), 0 /* requestCode */, new Intent(Settings.ACTION_TETHER_SETTINGS) - .setPackage(getSettingsPackageName(mContext.getPackageManager())), - Intent.FLAG_ACTIVITY_NEW_TASK | PendingIntent.FLAG_IMMUTABLE, + .setPackage(getSettingsPackageName(mContext.getPackageManager())) + .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK), + PendingIntent.FLAG_IMMUTABLE, null /* options */); showNotification(R.drawable.stat_sys_tether_general, title, message, @@ -317,8 +318,9 @@ public class TetheringNotificationUpdater { mContext.createContextAsUser(UserHandle.CURRENT, 0 /* flags */), 0 /* requestCode */, new Intent(Settings.ACTION_TETHER_SETTINGS) - .setPackage(getSettingsPackageName(mContext.getPackageManager())), - Intent.FLAG_ACTIVITY_NEW_TASK | PendingIntent.FLAG_IMMUTABLE, + .setPackage(getSettingsPackageName(mContext.getPackageManager())) + .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK), + PendingIntent.FLAG_IMMUTABLE, null /* options */); showNotification(R.drawable.stat_sys_tether_general, title, message,