Merge "Opt in systemui for BAL" into udc-qpr-dev am: 4c52b985de

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23798583

Change-Id: I8d36b488a07353e22868e099145f322fbee69444
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Achim Thesmann
2023-07-06 23:00:04 +00:00
committed by Automerger Merge Worker
11 changed files with 41 additions and 7 deletions

View File

@@ -1253,6 +1253,9 @@ class MediaDataManager(
return try { return try {
val options = BroadcastOptions.makeBasic() val options = BroadcastOptions.makeBasic()
options.setInteractive(true) options.setInteractive(true)
options.setPendingIntentBackgroundActivityStartMode(
BroadcastOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED
)
intent.send(options.toBundle()) intent.send(options.toBundle())
true true
} catch (e: PendingIntent.CanceledException) { } catch (e: PendingIntent.CanceledException) {

View File

@@ -23,6 +23,7 @@ import static com.android.systemui.media.controls.models.recommendation.Smartspa
import android.animation.Animator; import android.animation.Animator;
import android.animation.AnimatorInflater; import android.animation.AnimatorInflater;
import android.animation.AnimatorSet; import android.animation.AnimatorSet;
import android.app.ActivityOptions;
import android.app.BroadcastOptions; import android.app.BroadcastOptions;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.app.WallpaperColors; import android.app.WallpaperColors;
@@ -535,7 +536,10 @@ public class MediaControlPanel {
mLockscreenUserManager.getCurrentUserId()); mLockscreenUserManager.getCurrentUserId());
if (showOverLockscreen) { if (showOverLockscreen) {
try { try {
clickIntent.send(); ActivityOptions opts = ActivityOptions.makeBasic();
opts.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
clickIntent.send(opts.toBundle());
} catch (PendingIntent.CanceledException e) { } catch (PendingIntent.CanceledException e) {
Log.e(TAG, "Pending intent for " + key + " was cancelled"); Log.e(TAG, "Pending intent for " + key + " was cancelled");
} }
@@ -684,6 +688,8 @@ public class MediaControlPanel {
try { try {
BroadcastOptions options = BroadcastOptions.makeBasic(); BroadcastOptions options = BroadcastOptions.makeBasic();
options.setInteractive(true); options.setInteractive(true);
options.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
deviceIntent.send(options.toBundle()); deviceIntent.send(options.toBundle());
} catch (PendingIntent.CanceledException e) { } catch (PendingIntent.CanceledException e) {
Log.e(TAG, "Device pending intent was canceled"); Log.e(TAG, "Device pending intent was canceled");

View File

@@ -71,6 +71,8 @@ public class ActionProxyReceiver extends BroadcastReceiver {
ActivityOptions opts = ActivityOptions.makeBasic(); ActivityOptions opts = ActivityOptions.makeBasic();
opts.setDisallowEnterPictureInPictureWhileLaunching( opts.setDisallowEnterPictureInPictureWhileLaunching(
intent.getBooleanExtra(EXTRA_DISALLOW_ENTER_PIP, false)); intent.getBooleanExtra(EXTRA_DISALLOW_ENTER_PIP, false));
opts.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
try { try {
actionIntent.send(context, 0, null, null, null, null, opts.toBundle()); actionIntent.send(context, 0, null, null, null, null, opts.toBundle());
if (intent.getBooleanExtra(ScreenshotController.EXTRA_OVERRIDE_TRANSITION, false)) { if (intent.getBooleanExtra(ScreenshotController.EXTRA_OVERRIDE_TRANSITION, false)) {

View File

@@ -99,6 +99,8 @@ public class OverlayActionChip extends FrameLayout {
try { try {
BroadcastOptions options = BroadcastOptions.makeBasic(); BroadcastOptions options = BroadcastOptions.makeBasic();
options.setInteractive(true); options.setInteractive(true);
options.setPendingIntentBackgroundActivityStartMode(
BroadcastOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
intent.send(options.toBundle()); intent.send(options.toBundle());
finisher.run(); finisher.run();
} catch (PendingIntent.CanceledException e) { } catch (PendingIntent.CanceledException e) {

View File

@@ -55,7 +55,8 @@ public class SmartActionsReceiver extends BroadcastReceiver {
Log.d(TAG, "Executing smart action [" + actionType + "]:" + pendingIntent.getIntent()); Log.d(TAG, "Executing smart action [" + actionType + "]:" + pendingIntent.getIntent());
} }
ActivityOptions opts = ActivityOptions.makeBasic(); ActivityOptions opts = ActivityOptions.makeBasic();
opts.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
try { try {
pendingIntent.send(context, 0, fillIn, null, null, null, opts.toBundle()); pendingIntent.send(context, 0, fillIn, null, null, null, opts.toBundle());
} catch (PendingIntent.CanceledException e) { } catch (PendingIntent.CanceledException e) {

View File

@@ -19,6 +19,7 @@ import static android.app.admin.DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER
import static com.android.systemui.DejankUtils.whitelistIpcs; import static com.android.systemui.DejankUtils.whitelistIpcs;
import android.app.ActivityOptions;
import android.app.KeyguardManager; import android.app.KeyguardManager;
import android.app.Notification; import android.app.Notification;
import android.app.admin.DevicePolicyManager; import android.app.admin.DevicePolicyManager;
@@ -158,7 +159,11 @@ public class NotificationLockscreenUserManagerImpl implements
final String notificationKey = intent.getStringExtra(Intent.EXTRA_INDEX); final String notificationKey = intent.getStringExtra(Intent.EXTRA_INDEX);
if (intentSender != null) { if (intentSender != null) {
try { try {
mContext.startIntentSender(intentSender, null, 0, 0, 0); ActivityOptions options = ActivityOptions.makeBasic();
options.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
mContext.startIntentSender(intentSender, null, 0, 0, 0,
options.toBundle());
} catch (IntentSender.SendIntentException e) { } catch (IntentSender.SendIntentException e) {
/* ignore */ /* ignore */
} }

View File

@@ -42,6 +42,7 @@ import static com.android.systemui.statusbar.phone.BarTransitions.TransitionMode
import android.annotation.Nullable; import android.annotation.Nullable;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.IWallpaperManager; import android.app.IWallpaperManager;
import android.app.KeyguardManager; import android.app.KeyguardManager;
import android.app.Notification; import android.app.Notification;
@@ -1773,7 +1774,10 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
EventLog.writeEvent(EventLogTags.SYSUI_HEADS_UP_ESCALATION, EventLog.writeEvent(EventLogTags.SYSUI_HEADS_UP_ESCALATION,
sbn.getKey()); sbn.getKey());
wakeUpForFullScreenIntent(); wakeUpForFullScreenIntent();
notification.fullScreenIntent.send(); ActivityOptions opts = ActivityOptions.makeBasic();
opts.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
notification.fullScreenIntent.send(opts.toBundle());
entry.notifyFullScreenIntentLaunched(); entry.notifyFullScreenIntentLaunched();
} catch (PendingIntent.CanceledException e) { } catch (PendingIntent.CanceledException e) {
} }

View File

@@ -16,6 +16,7 @@
package com.android.systemui.statusbar.policy package com.android.systemui.statusbar.policy
import android.app.ActivityOptions
import android.app.Notification import android.app.Notification
import android.app.PendingIntent import android.app.PendingIntent
import android.app.RemoteInput import android.app.RemoteInput
@@ -275,7 +276,10 @@ class RemoteInputViewControllerImpl @Inject constructor(
entry.sbn.instanceId) entry.sbn.instanceId)
try { try {
pendingIntent.send(view.context, 0, intent) val options = ActivityOptions.makeBasic()
options.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED)
pendingIntent.send(view.context, 0, intent, null, null, null, options.toBundle())
} catch (e: PendingIntent.CanceledException) { } catch (e: PendingIntent.CanceledException) {
Log.i(TAG, "Unable to send remote input result", e) Log.i(TAG, "Unable to send remote input result", e)
uiEventLogger.logWithInstanceId( uiEventLogger.logWithInstanceId(

View File

@@ -16,6 +16,7 @@
package com.android.systemui.statusbar.policy package com.android.systemui.statusbar.policy
import android.app.ActivityOptions
import android.app.Notification import android.app.Notification
import android.app.Notification.Action.SEMANTIC_ACTION_MARK_CONVERSATION_AS_PRIORITY import android.app.Notification.Action.SEMANTIC_ACTION_MARK_CONVERSATION_AS_PRIORITY
import android.app.PendingIntent import android.app.PendingIntent
@@ -491,7 +492,11 @@ class SmartReplyInflaterImpl @Inject constructor(
entry.setHasSentReply() entry.setHasSentReply()
try { try {
val intent = createRemoteInputIntent(smartReplies, choice) val intent = createRemoteInputIntent(smartReplies, choice)
smartReplies.pendingIntent.send(context, 0, intent) val opts = ActivityOptions.makeBasic()
opts.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED)
smartReplies.pendingIntent.send(context, 0, intent, /* onFinished */null,
/* handler */ null, /* requiredPermission */ null, opts.toBundle())
} catch (e: PendingIntent.CanceledException) { } catch (e: PendingIntent.CanceledException) {
Log.w(TAG, "Unable to send smart reply", e) Log.w(TAG, "Unable to send smart reply", e)
} }

View File

@@ -103,6 +103,8 @@ public class TvNotificationAdapter extends RecyclerView.Adapter<RecyclerView.Vie
if (mPendingIntent != null) { if (mPendingIntent != null) {
BroadcastOptions options = BroadcastOptions.makeBasic(); BroadcastOptions options = BroadcastOptions.makeBasic();
options.setInteractive(true); options.setInteractive(true);
options.setPendingIntentBackgroundActivityStartMode(
BroadcastOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
mPendingIntent.send(options.toBundle()); mPendingIntent.send(options.toBundle());
} }
} catch (PendingIntent.CanceledException e) { } catch (PendingIntent.CanceledException e) {

View File

@@ -1793,7 +1793,7 @@ public class MediaControlPanelTest : SysuiTestCase() {
// THEN it sends the PendingIntent without dismissing keyguard first, // THEN it sends the PendingIntent without dismissing keyguard first,
// and does not use the Intent directly (see b/271845008) // and does not use the Intent directly (see b/271845008)
captor.value.onClick(viewHolder.player) captor.value.onClick(viewHolder.player)
verify(pendingIntent).send() verify(pendingIntent).send(any(Bundle::class.java))
verify(pendingIntent, never()).getIntent() verify(pendingIntent, never()).getIntent()
verify(activityStarter, never()).postStartActivityDismissingKeyguard(eq(clickIntent), any()) verify(activityStarter, never()).postStartActivityDismissingKeyguard(eq(clickIntent), any())
} }