Loading services/core/java/com/android/server/wm/ActivityRecord.java +14 −0 Original line number Diff line number Diff line Loading @@ -3643,6 +3643,20 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return; } finishing = true; // Transfer the launch cookie to the next running activity above this in the same task. if (mLaunchCookie != null && mState != RESUMED && task != null && !task.mInRemoveTask && !task.isClearingToReuseTask()) { final ActivityRecord nextCookieTarget = task.getActivity( // Intend to only associate the same app by checking uid. r -> r.mLaunchCookie == null && !r.finishing && r.isUid(getUid()), this, false /* includeBoundary */, false /* traverseTopToBottom */); if (nextCookieTarget != null) { nextCookieTarget.mLaunchCookie = mLaunchCookie; mLaunchCookie = null; } } final TaskFragment taskFragment = getTaskFragment(); if (taskFragment != null) { final Task task = taskFragment.getTask(); Loading services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +13 −0 Original line number Diff line number Diff line Loading @@ -2217,6 +2217,19 @@ public class ActivityRecordTests extends WindowTestsBase { assertTrue(activity.pictureInPictureArgs.isLaunchIntoPip()); } @Test public void testTransferLaunchCookieWhenFinishing() { final ActivityRecord activity1 = createActivityWithTask(); final Binder launchCookie = new Binder(); activity1.mLaunchCookie = launchCookie; final ActivityRecord activity2 = createActivityRecord(activity1.getTask()); activity1.setState(PAUSED, "test"); activity1.makeFinishingLocked(); assertEquals(launchCookie, activity2.mLaunchCookie); assertNull(activity1.mLaunchCookie); } private void verifyProcessInfoUpdate(ActivityRecord activity, State state, boolean shouldUpdate, boolean activityChange) { reset(activity.app); Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +14 −0 Original line number Diff line number Diff line Loading @@ -3643,6 +3643,20 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return; } finishing = true; // Transfer the launch cookie to the next running activity above this in the same task. if (mLaunchCookie != null && mState != RESUMED && task != null && !task.mInRemoveTask && !task.isClearingToReuseTask()) { final ActivityRecord nextCookieTarget = task.getActivity( // Intend to only associate the same app by checking uid. r -> r.mLaunchCookie == null && !r.finishing && r.isUid(getUid()), this, false /* includeBoundary */, false /* traverseTopToBottom */); if (nextCookieTarget != null) { nextCookieTarget.mLaunchCookie = mLaunchCookie; mLaunchCookie = null; } } final TaskFragment taskFragment = getTaskFragment(); if (taskFragment != null) { final Task task = taskFragment.getTask(); Loading
services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +13 −0 Original line number Diff line number Diff line Loading @@ -2217,6 +2217,19 @@ public class ActivityRecordTests extends WindowTestsBase { assertTrue(activity.pictureInPictureArgs.isLaunchIntoPip()); } @Test public void testTransferLaunchCookieWhenFinishing() { final ActivityRecord activity1 = createActivityWithTask(); final Binder launchCookie = new Binder(); activity1.mLaunchCookie = launchCookie; final ActivityRecord activity2 = createActivityRecord(activity1.getTask()); activity1.setState(PAUSED, "test"); activity1.makeFinishingLocked(); assertEquals(launchCookie, activity2.mLaunchCookie); assertNull(activity1.mLaunchCookie); } private void verifyProcessInfoUpdate(ActivityRecord activity, State state, boolean shouldUpdate, boolean activityChange) { reset(activity.app); Loading