Allow BAL for HeavyWeightSwitcher.

The switcher dialog is started by the system and need to be able to
bring the chosen activity back to the foreground.

Test: CtsAppTestCases:android.app.cts.ActivityManagerProcessStateTest#testCantSaveStateLaunchAndSwitch
Bug: 277600629
Change-Id: Iddd9daed932fb4469492c895a041895a7f2cb416
This commit is contained in:
Achim Thesmann
2023-05-05 20:04:39 +00:00
parent 8d6ce3c4b2
commit e2c21cdada

View File

@@ -18,6 +18,7 @@ package com.android.internal.app;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.ActivityTaskManager;
import android.app.ActivityThread;
import android.app.IApplicationThread;
@@ -150,7 +151,12 @@ public class HeavyWeightSwitcherActivity extends Activity {
Intent.FLAG_ACTIVITY_FORWARD_RESULT,
Intent.FLAG_ACTIVITY_FORWARD_RESULT, 0);
} else {
startIntentSenderForResult(mStartIntent, -1, null, 0, 0, 0);
ActivityOptions activityOptions =
ActivityOptions.makeBasic()
.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
startIntentSenderForResult(mStartIntent, -1, null, 0, 0, 0,
activityOptions.toBundle());
}
} catch (IntentSender.SendIntentException ex) {
Log.w("HeavyWeightSwitcherActivity", "Failure starting", ex);