Loading services/core/java/com/android/server/wm/ActivityStack.java +14 −3 Original line number Diff line number Diff line Loading @@ -3596,6 +3596,16 @@ class ActivityStack extends ConfigurationContainer { return taskInsertionPoint; } /** * Reset the task by reparenting the activities that have same affinity to the task or * reparenting the activities that have different affinityies out of the task, while these * activities allow task reparenting. * * @param taskTop Top activity of the task might be reset. * @param newActivity The activity that going to be started. * @return The non-finishing top activity of the task after reset or the original task top * activity if all activities within the task are finishing. */ final ActivityRecord resetTaskIfNeededLocked(ActivityRecord taskTop, ActivityRecord newActivity) { final boolean forceReset = Loading Loading @@ -3626,9 +3636,10 @@ class ActivityStack extends ConfigurationContainer { int taskNdx = mTaskHistory.indexOf(task); if (taskNdx >= 0) { do { taskTop = mTaskHistory.get(taskNdx--).getTopActivity(); } while (taskTop == null && taskNdx >= 0); ActivityRecord newTop = mTaskHistory.get(taskNdx).getTopActivity(); if (newTop != null) { taskTop = newTop; } } if (topOptions != null) { Loading services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java +13 −0 Original line number Diff line number Diff line Loading @@ -1109,6 +1109,19 @@ public class ActivityStackTests extends ActivityTestsBase { assertTrue(listener.mChanged); } @Test public void testResetTaskWithFinishingActivities() { final ActivityRecord taskTop = new ActivityBuilder(mService).setStack(mStack).setCreateTask(true).build(); // Make all activities in the task are finishing to simulate TaskRecord#getTopActivity // returns null. taskTop.finishing = true; final ActivityRecord newR = new ActivityBuilder(mService).build(); final ActivityRecord result = mStack.resetTaskIfNeededLocked(taskTop, newR); assertThat(result).isEqualTo(taskTop); } private void verifyShouldSleepActivities(boolean focusedStack, boolean keyguardGoingAway, boolean displaySleeping, boolean expected) { final ActivityDisplay display = mock(ActivityDisplay.class); Loading Loading
services/core/java/com/android/server/wm/ActivityStack.java +14 −3 Original line number Diff line number Diff line Loading @@ -3596,6 +3596,16 @@ class ActivityStack extends ConfigurationContainer { return taskInsertionPoint; } /** * Reset the task by reparenting the activities that have same affinity to the task or * reparenting the activities that have different affinityies out of the task, while these * activities allow task reparenting. * * @param taskTop Top activity of the task might be reset. * @param newActivity The activity that going to be started. * @return The non-finishing top activity of the task after reset or the original task top * activity if all activities within the task are finishing. */ final ActivityRecord resetTaskIfNeededLocked(ActivityRecord taskTop, ActivityRecord newActivity) { final boolean forceReset = Loading Loading @@ -3626,9 +3636,10 @@ class ActivityStack extends ConfigurationContainer { int taskNdx = mTaskHistory.indexOf(task); if (taskNdx >= 0) { do { taskTop = mTaskHistory.get(taskNdx--).getTopActivity(); } while (taskTop == null && taskNdx >= 0); ActivityRecord newTop = mTaskHistory.get(taskNdx).getTopActivity(); if (newTop != null) { taskTop = newTop; } } if (topOptions != null) { Loading
services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java +13 −0 Original line number Diff line number Diff line Loading @@ -1109,6 +1109,19 @@ public class ActivityStackTests extends ActivityTestsBase { assertTrue(listener.mChanged); } @Test public void testResetTaskWithFinishingActivities() { final ActivityRecord taskTop = new ActivityBuilder(mService).setStack(mStack).setCreateTask(true).build(); // Make all activities in the task are finishing to simulate TaskRecord#getTopActivity // returns null. taskTop.finishing = true; final ActivityRecord newR = new ActivityBuilder(mService).build(); final ActivityRecord result = mStack.resetTaskIfNeededLocked(taskTop, newR); assertThat(result).isEqualTo(taskTop); } private void verifyShouldSleepActivities(boolean focusedStack, boolean keyguardGoingAway, boolean displaySleeping, boolean expected) { final ActivityDisplay display = mock(ActivityDisplay.class); Loading