Loading services/core/java/com/android/server/wm/RootWindowContainer.java +26 −14 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ import static com.android.server.wm.Task.ActivityState.STOPPED; import static com.android.server.wm.Task.ActivityState.STOPPING; import static com.android.server.wm.Task.REPARENT_LEAVE_STACK_IN_PLACE; import static com.android.server.wm.Task.REPARENT_MOVE_STACK_TO_FRONT; import static com.android.server.wm.Task.STACK_VISIBILITY_INVISIBLE; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYOUT_REPEATS; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WALLPAPER_LIGHT; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WINDOW_TRACE; Loading Loading @@ -1907,22 +1908,33 @@ class RootWindowContainer extends WindowContainer<DisplayContent> } boolean attachApplication(WindowProcessController app) throws RemoteException { final String processName = app.mName; boolean didSomething = false; for (int displayNdx = getChildCount() - 1; displayNdx >= 0; --displayNdx) { mTmpRemoteException = null; mTmpBoolean = false; // Set to true if an activity was started. final DisplayContent display = getChildAt(displayNdx); final Task stack = display.getFocusedStack(); if (stack == null) { continue; display.forAllTaskDisplayAreas(displayArea -> { if (mTmpRemoteException != null) { return; } for (int taskNdx = displayArea.getStackCount() - 1; taskNdx >= 0; --taskNdx) { final Task rootTask = displayArea.getStackAt(taskNdx); if (rootTask.getVisibility(null /*starting*/) == STACK_VISIBILITY_INVISIBLE) { break; } mTmpRemoteException = null; mTmpBoolean = false; // Set to true if an activity was started. final PooledFunction c = PooledLambda.obtainFunction( RootWindowContainer::startActivityForAttachedApplicationIfNeeded, this, PooledLambda.__(ActivityRecord.class), app, stack.topRunningActivity()); stack.forAllActivities(c); PooledLambda.__(ActivityRecord.class), app, rootTask.topRunningActivity()); rootTask.forAllActivities(c); c.recycle(); if (mTmpRemoteException != null) { return; } } }); if (mTmpRemoteException != null) { throw mTmpRemoteException; } Loading @@ -1942,8 +1954,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent> } try { if (mStackSupervisor.realStartActivityLocked(r, app, top == r /*andResume*/, true /*checkConfig*/)) { if (mStackSupervisor.realStartActivityLocked(r, app, top == r && r.isFocusable() /*andResume*/, true /*checkConfig*/)) { mTmpBoolean = true; } } catch (RemoteException e) { Loading services/core/java/com/android/server/wm/Task.java +13 −0 Original line number Diff line number Diff line Loading @@ -318,6 +318,7 @@ class Task extends WindowContainer<WindowContainer> { // Do not move the stack as a part of reparenting static final int REPARENT_LEAVE_STACK_IN_PLACE = 2; // TODO (b/157876447): switch to Task related name @IntDef(prefix = {"STACK_VISIBILITY"}, value = { STACK_VISIBILITY_VISIBLE, STACK_VISIBILITY_VISIBLE_BEHIND_TRANSLUCENT, Loading Loading @@ -4112,6 +4113,10 @@ class Task extends WindowContainer<WindowContainer> { return STACK_VISIBILITY_INVISIBLE; } if (isTopActivityLaunchedBehind()) { return STACK_VISIBILITY_VISIBLE; } boolean gotSplitScreenStack = false; boolean gotOpaqueSplitScreenPrimary = false; boolean gotOpaqueSplitScreenSecondary = false; Loading Loading @@ -4229,6 +4234,14 @@ class Task extends WindowContainer<WindowContainer> { : STACK_VISIBILITY_VISIBLE; } private boolean isTopActivityLaunchedBehind() { final ActivityRecord top = topRunningActivity(); if (top != null && top.mLaunchTaskBehind) { return true; } return false; } ActivityRecord isInTask(ActivityRecord r) { if (r == null) { return null; Loading services/core/java/com/android/server/wm/TaskDisplayArea.java +2 −0 Original line number Diff line number Diff line Loading @@ -1596,10 +1596,12 @@ final class TaskDisplayArea extends DisplayArea<Task> { return topRunning; } // TODO (b/157876447): switch to Task related name protected int getStackCount() { return mChildren.size(); } // TODO (b/157876447): switch to Task related name protected Task getStackAt(int index) { return mChildren.get(index); } Loading services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +1 −1 Original line number Diff line number Diff line Loading @@ -550,7 +550,7 @@ public class ActivityRecordTests extends WindowTestsBase { final Task stack = new TaskBuilder(mSupervisor).setCreateActivity(true).build(); try { doReturn(false).when(stack).isTranslucent(any()); assertFalse(mStack.shouldBeVisible(null /* starting */)); assertTrue(mStack.shouldBeVisible(null /* starting */)); mActivity.setLastReportedConfiguration(new MergedConfiguration(new Configuration(), mActivity.getConfiguration())); Loading Loading
services/core/java/com/android/server/wm/RootWindowContainer.java +26 −14 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ import static com.android.server.wm.Task.ActivityState.STOPPED; import static com.android.server.wm.Task.ActivityState.STOPPING; import static com.android.server.wm.Task.REPARENT_LEAVE_STACK_IN_PLACE; import static com.android.server.wm.Task.REPARENT_MOVE_STACK_TO_FRONT; import static com.android.server.wm.Task.STACK_VISIBILITY_INVISIBLE; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYOUT_REPEATS; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WALLPAPER_LIGHT; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WINDOW_TRACE; Loading Loading @@ -1907,22 +1908,33 @@ class RootWindowContainer extends WindowContainer<DisplayContent> } boolean attachApplication(WindowProcessController app) throws RemoteException { final String processName = app.mName; boolean didSomething = false; for (int displayNdx = getChildCount() - 1; displayNdx >= 0; --displayNdx) { mTmpRemoteException = null; mTmpBoolean = false; // Set to true if an activity was started. final DisplayContent display = getChildAt(displayNdx); final Task stack = display.getFocusedStack(); if (stack == null) { continue; display.forAllTaskDisplayAreas(displayArea -> { if (mTmpRemoteException != null) { return; } for (int taskNdx = displayArea.getStackCount() - 1; taskNdx >= 0; --taskNdx) { final Task rootTask = displayArea.getStackAt(taskNdx); if (rootTask.getVisibility(null /*starting*/) == STACK_VISIBILITY_INVISIBLE) { break; } mTmpRemoteException = null; mTmpBoolean = false; // Set to true if an activity was started. final PooledFunction c = PooledLambda.obtainFunction( RootWindowContainer::startActivityForAttachedApplicationIfNeeded, this, PooledLambda.__(ActivityRecord.class), app, stack.topRunningActivity()); stack.forAllActivities(c); PooledLambda.__(ActivityRecord.class), app, rootTask.topRunningActivity()); rootTask.forAllActivities(c); c.recycle(); if (mTmpRemoteException != null) { return; } } }); if (mTmpRemoteException != null) { throw mTmpRemoteException; } Loading @@ -1942,8 +1954,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent> } try { if (mStackSupervisor.realStartActivityLocked(r, app, top == r /*andResume*/, true /*checkConfig*/)) { if (mStackSupervisor.realStartActivityLocked(r, app, top == r && r.isFocusable() /*andResume*/, true /*checkConfig*/)) { mTmpBoolean = true; } } catch (RemoteException e) { Loading
services/core/java/com/android/server/wm/Task.java +13 −0 Original line number Diff line number Diff line Loading @@ -318,6 +318,7 @@ class Task extends WindowContainer<WindowContainer> { // Do not move the stack as a part of reparenting static final int REPARENT_LEAVE_STACK_IN_PLACE = 2; // TODO (b/157876447): switch to Task related name @IntDef(prefix = {"STACK_VISIBILITY"}, value = { STACK_VISIBILITY_VISIBLE, STACK_VISIBILITY_VISIBLE_BEHIND_TRANSLUCENT, Loading Loading @@ -4112,6 +4113,10 @@ class Task extends WindowContainer<WindowContainer> { return STACK_VISIBILITY_INVISIBLE; } if (isTopActivityLaunchedBehind()) { return STACK_VISIBILITY_VISIBLE; } boolean gotSplitScreenStack = false; boolean gotOpaqueSplitScreenPrimary = false; boolean gotOpaqueSplitScreenSecondary = false; Loading Loading @@ -4229,6 +4234,14 @@ class Task extends WindowContainer<WindowContainer> { : STACK_VISIBILITY_VISIBLE; } private boolean isTopActivityLaunchedBehind() { final ActivityRecord top = topRunningActivity(); if (top != null && top.mLaunchTaskBehind) { return true; } return false; } ActivityRecord isInTask(ActivityRecord r) { if (r == null) { return null; Loading
services/core/java/com/android/server/wm/TaskDisplayArea.java +2 −0 Original line number Diff line number Diff line Loading @@ -1596,10 +1596,12 @@ final class TaskDisplayArea extends DisplayArea<Task> { return topRunning; } // TODO (b/157876447): switch to Task related name protected int getStackCount() { return mChildren.size(); } // TODO (b/157876447): switch to Task related name protected Task getStackAt(int index) { return mChildren.get(index); } Loading
services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +1 −1 Original line number Diff line number Diff line Loading @@ -550,7 +550,7 @@ public class ActivityRecordTests extends WindowTestsBase { final Task stack = new TaskBuilder(mSupervisor).setCreateActivity(true).build(); try { doReturn(false).when(stack).isTranslucent(any()); assertFalse(mStack.shouldBeVisible(null /* starting */)); assertTrue(mStack.shouldBeVisible(null /* starting */)); mActivity.setLastReportedConfiguration(new MergedConfiguration(new Configuration(), mActivity.getConfiguration())); Loading