diff options
| author | 2023-05-26 04:55:07 +0000 | |
|---|---|---|
| committer | 2023-05-30 15:24:40 +0000 | |
| commit | c983c6385e4bf6fe4b9560439b0b73690a6e2e4c (patch) | |
| tree | f7dc4680ed04c4fa7c2b650db6d3cdb4274fa637 | |
| parent | 08abe7a653759d89c6fc6febaf0de97c90dcaa78 (diff) | |
Opt in SysUI code to allow BAL
We see some calls from android.uid.systemui being blocked in our logs. Unfortunately we cannot exactly identify the source of these calls, but in a manual review we identified some invocations that may be affected. To avoid activities being blocked and functionality regression, this change will revert those code paths back to T behavior by opting into allowing the launch if the PI sender (systemUI) is in the foreground. Maybe not all these changes are required, but any missed change might cause functionality to break, while extra changes have no functional impact.
The change is relatively safe since it won't block anything, only allow the launch, as it was allowed by default in T.
Bug: 284486752
Test: compile + presubmit
Change-Id: I78f838ba762e7d41d908aff6f003e081ab9b4b7c
6 files changed, 28 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/DetailDialog.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/DetailDialog.kt index 7cbd1f53612b..be50a1468f07 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/ui/DetailDialog.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/ui/DetailDialog.kt @@ -162,7 +162,11 @@ class DetailDialog( broadcastSender.closeSystemDialogs() // not sent as interactive, lest the higher-importance activity launch // be impacted - pendingIntent.send() + val options = ActivityOptions.makeBasic() + .setPendingIntentBackgroundActivityStartMode( + ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED) + .toBundle() + pendingIntent.send(options) false } if (keyguardStateController.isUnlocked()) { diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/StatusBehavior.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/StatusBehavior.kt index 116f3ca898c0..84cda5a541e3 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/ui/StatusBehavior.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/ui/StatusBehavior.kt @@ -16,6 +16,7 @@ package com.android.systemui.controls.ui +import android.app.ActivityOptions import android.app.AlertDialog import android.app.PendingIntent import android.content.DialogInterface @@ -74,7 +75,11 @@ class StatusBehavior : Behavior { R.string.controls_open_app, DialogInterface.OnClickListener { dialog, _ -> try { - cws.control?.getAppIntent()?.send() + val options = ActivityOptions.makeBasic() + .setPendingIntentBackgroundActivityStartMode( + ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED) + .toBundle() + cws.control?.getAppIntent()?.send(options) context.sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) } catch (e: PendingIntent.CanceledException) { cvh.setErrorStatus() diff --git a/packages/SystemUI/src/com/android/systemui/smartspace/dagger/SmartspaceViewComponent.kt b/packages/SystemUI/src/com/android/systemui/smartspace/dagger/SmartspaceViewComponent.kt index ba9d13d57a74..6d951bf4d83b 100644 --- a/packages/SystemUI/src/com/android/systemui/smartspace/dagger/SmartspaceViewComponent.kt +++ b/packages/SystemUI/src/com/android/systemui/smartspace/dagger/SmartspaceViewComponent.kt @@ -15,6 +15,7 @@ */ package com.android.systemui.smartspace.dagger +import android.app.ActivityOptions import android.app.PendingIntent import android.content.Intent import android.view.View @@ -81,7 +82,11 @@ interface SmartspaceViewComponent { showOnLockscreen: Boolean ) { if (showOnLockscreen) { - pi.send() + val options = ActivityOptions.makeBasic() + .setPendingIntentBackgroundActivityStartMode( + ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED) + .toBundle() + pi.send(options) } else { activityStarter.startPendingIntentDismissingKeyguard(pi) } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt index 7cc917f3b0b8..518825cea5e0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.lockscreen +import android.app.ActivityOptions import android.app.PendingIntent import android.app.smartspace.SmartspaceConfig import android.app.smartspace.SmartspaceManager @@ -358,7 +359,11 @@ constructor( showOnLockscreen: Boolean ) { if (showOnLockscreen) { - pi.send() + val options = ActivityOptions.makeBasic() + .setPendingIntentBackgroundActivityStartMode( + ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED) + .toBundle() + pi.send(options) } else { activityStarter.postStartActivityDismissingKeyguard(pi) } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt index df1a47abea98..1827a46958f8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt @@ -572,6 +572,9 @@ constructor( // TODO b/221255671: restrict this to only be set for // notifications options.isEligibleForLegacyPermissionPrompt = true + options.setPendingIntentBackgroundActivityStartMode( + ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED + ) return intent.sendAndReturnResult( null, 0, diff --git a/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletView.java b/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletView.java index dfc6392404a4..cab47a3c4b4b 100644 --- a/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletView.java +++ b/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletView.java @@ -307,6 +307,8 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard BroadcastOptions options = BroadcastOptions.makeBasic(); options.setInteractive(true); + options.setPendingIntentBackgroundActivityStartMode( + BroadcastOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED); walletCard.getPendingIntent().send(options.toBundle()); } catch (PendingIntent.CanceledException e) { Log.w(TAG, "Error sending pending intent for wallet card."); |