Use setTaskOverlay to launch ConfirmDeviceCredentialActivity.

WorkLockActivity is launched as a task overlay activity. If it needs to
launch an activity on top of it, the activity should also be a task
overlay.

Bug: 142853039
Test: Follow the issue description
Test: atest WmTests:ActivityOptionsTest
Change-Id: If4cdc892f608df5337223f70333538e33ff593ca
This commit is contained in:
wilsonshih
2019-11-01 18:47:05 +08:00
parent 07d87c037d
commit 3c1e53ddaa
2 changed files with 8 additions and 3 deletions

View File

@@ -1301,8 +1301,8 @@ public class ActivityOptions {
/**
* Set's whether the activity launched with this option should be a task overlay. That is the
* activity will always be the top activity of the task. If {@param canResume} is true, then
* the task will also not be moved to the front of the stack.
* activity will always be the top activity of the task.
* @param canResume {@code false} if the task will also not be moved to the front of the stack.
* @hide
*/
@TestApi

View File

@@ -175,7 +175,12 @@ public class WorkLockActivity extends Activity {
credential.putExtra(EXTRA_FROM_WORK_LOCK_ACTIVITY, true);
}
startActivityForResult(credential, REQUEST_CODE_CONFIRM_CREDENTIALS);
final ActivityOptions launchOptions = ActivityOptions.makeBasic();
launchOptions.setLaunchTaskId(getTaskId());
launchOptions.setTaskOverlay(true /* taskOverlay */, true /* canResume */);
startActivityForResult(credential, REQUEST_CODE_CONFIRM_CREDENTIALS,
launchOptions.toBundle());
}
@Override