Merge "Opt in systemui for BAL" into udc-qpr-dev

This commit is contained in:
Achim Thesmann
2023-07-06 22:33:30 +00:00
committed by Android (Google) Code Review
11 changed files with 41 additions and 7 deletions

View File

@@ -1253,6 +1253,9 @@ class MediaDataManager(
return try {
val options = BroadcastOptions.makeBasic()
options.setInteractive(true)
options.setPendingIntentBackgroundActivityStartMode(
BroadcastOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED
)
intent.send(options.toBundle())
true
} 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.AnimatorInflater;
import android.animation.AnimatorSet;
import android.app.ActivityOptions;
import android.app.BroadcastOptions;
import android.app.PendingIntent;
import android.app.WallpaperColors;
@@ -535,7 +536,10 @@ public class MediaControlPanel {
mLockscreenUserManager.getCurrentUserId());
if (showOverLockscreen) {
try {
clickIntent.send();
ActivityOptions opts = ActivityOptions.makeBasic();
opts.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
clickIntent.send(opts.toBundle());
} catch (PendingIntent.CanceledException e) {
Log.e(TAG, "Pending intent for " + key + " was cancelled");
}
@@ -684,6 +688,8 @@ public class MediaControlPanel {
try {
BroadcastOptions options = BroadcastOptions.makeBasic();
options.setInteractive(true);
options.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
deviceIntent.send(options.toBundle());
} catch (PendingIntent.CanceledException e) {
Log.e(TAG, "Device pending intent was canceled");

View File

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

View File

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

View File

@@ -55,7 +55,8 @@ public class SmartActionsReceiver extends BroadcastReceiver {
Log.d(TAG, "Executing smart action [" + actionType + "]:" + pendingIntent.getIntent());
}
ActivityOptions opts = ActivityOptions.makeBasic();
opts.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
try {
pendingIntent.send(context, 0, fillIn, null, null, null, opts.toBundle());
} 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 android.app.ActivityOptions;
import android.app.KeyguardManager;
import android.app.Notification;
import android.app.admin.DevicePolicyManager;
@@ -158,7 +159,11 @@ public class NotificationLockscreenUserManagerImpl implements
final String notificationKey = intent.getStringExtra(Intent.EXTRA_INDEX);
if (intentSender != null) {
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) {
/* ignore */
}

View File

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

View File

@@ -16,6 +16,7 @@
package com.android.systemui.statusbar.policy
import android.app.ActivityOptions
import android.app.Notification
import android.app.PendingIntent
import android.app.RemoteInput
@@ -275,7 +276,10 @@ class RemoteInputViewControllerImpl @Inject constructor(
entry.sbn.instanceId)
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) {
Log.i(TAG, "Unable to send remote input result", e)
uiEventLogger.logWithInstanceId(

View File

@@ -16,6 +16,7 @@
package com.android.systemui.statusbar.policy
import android.app.ActivityOptions
import android.app.Notification
import android.app.Notification.Action.SEMANTIC_ACTION_MARK_CONVERSATION_AS_PRIORITY
import android.app.PendingIntent
@@ -491,7 +492,11 @@ class SmartReplyInflaterImpl @Inject constructor(
entry.setHasSentReply()
try {
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) {
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) {
BroadcastOptions options = BroadcastOptions.makeBasic();
options.setInteractive(true);
options.setPendingIntentBackgroundActivityStartMode(
BroadcastOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
mPendingIntent.send(options.toBundle());
}
} catch (PendingIntent.CanceledException e) {

View File

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