diff options
2 files changed, 12 insertions, 2 deletions
diff --git a/services/companion/java/com/android/server/companion/AssociationRequestsProcessor.java b/services/companion/java/com/android/server/companion/AssociationRequestsProcessor.java index 69647633eaff..52a8f9ed10d4 100644 --- a/services/companion/java/com/android/server/companion/AssociationRequestsProcessor.java +++ b/services/companion/java/com/android/server/companion/AssociationRequestsProcessor.java @@ -37,6 +37,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SuppressLint; import android.annotation.UserIdInt; +import android.app.ActivityOptions; import android.app.PendingIntent; import android.companion.AssociatedDevice; import android.companion.AssociationInfo; @@ -398,7 +399,11 @@ class AssociationRequestsProcessor { pendingIntent = PendingIntent.getActivityAsUser( mContext, /*requestCode */ packageUid, intent, FLAG_ONE_SHOT | FLAG_CANCEL_CURRENT | FLAG_IMMUTABLE, - /* options= */ null, UserHandle.CURRENT); + ActivityOptions.makeBasic() + .setPendingIntentCreatorBackgroundActivityStartMode( + ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED) + .toBundle(), + UserHandle.CURRENT); } finally { Binder.restoreCallingIdentity(token); } diff --git a/services/companion/java/com/android/server/companion/datatransfer/SystemDataTransferProcessor.java b/services/companion/java/com/android/server/companion/datatransfer/SystemDataTransferProcessor.java index bd646fa6bfbc..4e471f5b0bc9 100644 --- a/services/companion/java/com/android/server/companion/datatransfer/SystemDataTransferProcessor.java +++ b/services/companion/java/com/android/server/companion/datatransfer/SystemDataTransferProcessor.java @@ -27,6 +27,7 @@ import static com.android.server.companion.Utils.prepareForIpc; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.UserIdInt; +import android.app.ActivityOptions; import android.app.PendingIntent; import android.companion.AssociationInfo; import android.companion.DeviceNotAssociatedException; @@ -186,7 +187,11 @@ public class SystemDataTransferProcessor { final long token = Binder.clearCallingIdentity(); try { return PendingIntent.getActivityAsUser(mContext, /*requestCode */ associationId, intent, - FLAG_ONE_SHOT | FLAG_CANCEL_CURRENT | FLAG_IMMUTABLE, /* options= */ null, + FLAG_ONE_SHOT | FLAG_CANCEL_CURRENT | FLAG_IMMUTABLE, + ActivityOptions.makeBasic() + .setPendingIntentCreatorBackgroundActivityStartMode( + ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED) + .toBundle(), UserHandle.CURRENT); } finally { Binder.restoreCallingIdentity(token); |