Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bde91e94 authored by Louis Chang's avatar Louis Chang
Browse files

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
parent a3662b91
Loading
Loading
Loading
Loading
+399 −555

File changed.

Preview size limit exceeded, changes collapsed.

+7 −0
Original line number Diff line number Diff line
@@ -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.
     */
+1 −0
Original line number Diff line number Diff line
@@ -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();