Streamline activity start flow
Refactor activity start logic by moving the similar operations together and remove code duplications. The reusable task is selected in earlier stage, so that some permission and security check could be performed before manipulating the task (reparenting or finishing activities). Also fix two activity start cases that didn't work as expected. Bug: 139449647 Bug: 139390610 Bug: 139333063 Test: atest WmTests CtsWindowManagerDeviceTestCases Change-Id: Icbaaa29d79fd6cb13a1dff60d45289a6253d20f9
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -279,6 +279,13 @@ public class LockTaskController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if currently in the lock task mode, otherwise, return false.
|
||||
*/
|
||||
boolean isInLockTaskMode() {
|
||||
return !mLockTaskModeTasks.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether the requested task is disallowed to be launched.
|
||||
*/
|
||||
|
||||
@@ -499,6 +499,7 @@ public class ActivityStarterTests extends ActivityTestsBase {
|
||||
final ActivityStarter starter = prepareStarter(0);
|
||||
|
||||
final LockTaskController lockTaskController = mService.getLockTaskController();
|
||||
doReturn(true).when(lockTaskController).isInLockTaskMode();
|
||||
doReturn(true).when(lockTaskController).isLockTaskModeViolation(any());
|
||||
|
||||
final int result = starter.setReason("testTaskModeViolation").execute();
|
||||
|
||||
Reference in New Issue
Block a user