Loading services/core/java/com/android/server/wm/RootActivityContainer.java +12 −10 Original line number Diff line number Diff line Loading @@ -129,8 +129,8 @@ import java.util.Set; * TODO: This class is mostly temporary to separate things out of ActivityStackSupervisor.java. The * intention is to have this merged with RootWindowContainer.java as part of unifying the hierarchy. */ class RootActivityContainer extends ConfigurationContainer implements DisplayManager.DisplayListener, RootWindowContainerListener { class RootActivityContainer extends ConfigurationContainer implements DisplayManager.DisplayListener { private static final String TAG = TAG_WITH_CLASS_NAME ? "RootActivityContainer" : TAG_ATM; static final String TAG_TASKS = TAG + POSTFIX_TASKS; Loading Loading @@ -162,7 +162,8 @@ class RootActivityContainer extends ConfigurationContainer implements WindowManagerService mWindowManager; DisplayManager mDisplayManager; private DisplayManagerInternal mDisplayManagerInternal; private RootWindowContainerController mWindowContainerController; // TODO: Remove after object merge with RootWindowContainer. private RootWindowContainer mRootWindowContainer; /** * List of displays which contain activities, sorted by z-order. Loading Loading @@ -224,13 +225,14 @@ class RootActivityContainer extends ConfigurationContainer implements } @VisibleForTesting void setWindowContainerController(RootWindowContainerController controller) { mWindowContainerController = controller; void setWindowContainer(RootWindowContainer container) { mRootWindowContainer = container; mRootWindowContainer.setRootActivityContainer(this); } void setWindowManager(WindowManagerService wm) { mWindowManager = wm; setWindowContainerController(new RootWindowContainerController(this)); setWindowContainer(mWindowManager.mRoot); mDisplayManager = mService.mContext.getSystemService(DisplayManager.class); mDisplayManager.registerDisplayListener(this, mService.mH); mDisplayManagerInternal = LocalServices.getService(DisplayManagerInternal.class); Loading Loading @@ -1251,8 +1253,8 @@ class RootActivityContainer extends ConfigurationContainer implements return null; } @Override public void onChildPositionChanged(DisplayWindowController childController, int position) { // TODO: remove after object merge with RootWindowContainer void onChildPositionChanged(DisplayWindowController childController, int position) { // Assume AM lock is held from positionChildAt of controller in each hierarchy. final ActivityDisplay display = getActivityDisplay(childController.getDisplayId()); if (display != null) { Loading @@ -1279,8 +1281,8 @@ class RootActivityContainer extends ConfigurationContainer implements @VisibleForTesting void addChild(ActivityDisplay activityDisplay, int position) { positionChildAt(activityDisplay, position); mWindowContainerController.positionChildAt( activityDisplay.getWindowContainerController(), position); mRootWindowContainer.positionChildAt(position, activityDisplay.getWindowContainerController().mContainer); } void removeChild(ActivityDisplay activityDisplay) { Loading services/core/java/com/android/server/wm/RootWindowContainer.java +14 −9 Original line number Diff line number Diff line Loading @@ -82,12 +82,16 @@ import java.util.ArrayList; import java.util.function.Consumer; /** Root {@link WindowContainer} for the device. */ class RootWindowContainer extends WindowContainer<DisplayContent> { class RootWindowContainer extends WindowContainer<DisplayContent> implements ConfigurationContainerListener { private static final String TAG = TAG_WITH_CLASS_NAME ? "RootWindowContainer" : TAG_WM; private static final int SET_SCREEN_BRIGHTNESS_OVERRIDE = 1; private static final int SET_USER_ACTIVITY_TIMEOUT = 2; // TODO: Remove after object merge with RootActivityContainer. private RootActivityContainer mRootActivityContainer; private Object mLastWindowFreezeSource = null; private Session mHoldScreen = null; private float mScreenBrightness = -1; Loading Loading @@ -145,6 +149,13 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { mHandler = new MyHandler(service.mH.getLooper()); } void setRootActivityContainer(RootActivityContainer container) { mRootActivityContainer = container; if (container != null) { container.registerConfigurationChangeListener(this); } } boolean updateFocusedWindowLocked(int mode, boolean updateInputWindows) { boolean changed = false; int topFocusedDisplayId = INVALID_DISPLAY; Loading Loading @@ -1012,9 +1023,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { @Override void positionChildAt(int position, DisplayContent child, boolean includingParents) { super.positionChildAt(position, child, includingParents); final RootWindowContainerController controller = getController(); if (controller != null) { controller.onChildPositionChanged(child, position); if (mRootActivityContainer != null) { mRootActivityContainer.onChildPositionChanged(child.getController(), position); } } Loading @@ -1023,11 +1033,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { super.positionChildAt(position, child, false /* includingParents */); } @Override RootWindowContainerController getController() { return (RootWindowContainerController) super.getController(); } @Override void scheduleAnimation() { mService.scheduleAnimationLocked(); Loading services/core/java/com/android/server/wm/RootWindowContainerController.javadeleted 100644 → 0 +0 −46 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.server.wm; /** * Controller for the root container. This is created by activity manager to link activity * stack supervisor to the root window container they use in window manager. */ public class RootWindowContainerController extends WindowContainerController<RootWindowContainer, RootWindowContainerListener> { public RootWindowContainerController(RootWindowContainerListener listener) { super(listener, WindowManagerService.getInstance()); synchronized (mGlobalLock) { mRoot.setController(this); } } void onChildPositionChanged(DisplayContent child, int position) { // This callback invokes to AM directly so here assumes AM lock is held. If there is another // path called only with WM lock, it should change to use handler to post or move outside of // WM lock with adding AM lock. mListener.onChildPositionChanged(child.getController(), position); } /** Move the display to the given position. */ public void positionChildAt(DisplayWindowController child, int position) { synchronized (mGlobalLock) { mContainer.positionChildAt(position, child.mContainer); } } } services/core/java/com/android/server/wm/RootWindowContainerListener.javadeleted 100644 → 0 +0 −26 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.server.wm; /** * Interface used by the creator of {@link RootWindowContainerController} to notify the changes to * the display container in activity manager. */ public interface RootWindowContainerListener extends WindowContainerListener { /** Called when the z-order of display is changed. */ void onChildPositionChanged(DisplayWindowController childController, int position); } services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java +1 −2 Original line number Diff line number Diff line Loading @@ -411,8 +411,7 @@ class ActivityTestsBase { void initRootActivityContainerMocks(WindowManagerService wm) { spyOn(mRootActivityContainer); mRootActivityContainer.setWindowContainerController( mock(RootWindowContainerController.class)); mRootActivityContainer.setWindowContainer(mock(RootWindowContainer.class)); mRootActivityContainer.mWindowManager = wm; mRootActivityContainer.mDisplayManager = (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE); Loading Loading
services/core/java/com/android/server/wm/RootActivityContainer.java +12 −10 Original line number Diff line number Diff line Loading @@ -129,8 +129,8 @@ import java.util.Set; * TODO: This class is mostly temporary to separate things out of ActivityStackSupervisor.java. The * intention is to have this merged with RootWindowContainer.java as part of unifying the hierarchy. */ class RootActivityContainer extends ConfigurationContainer implements DisplayManager.DisplayListener, RootWindowContainerListener { class RootActivityContainer extends ConfigurationContainer implements DisplayManager.DisplayListener { private static final String TAG = TAG_WITH_CLASS_NAME ? "RootActivityContainer" : TAG_ATM; static final String TAG_TASKS = TAG + POSTFIX_TASKS; Loading Loading @@ -162,7 +162,8 @@ class RootActivityContainer extends ConfigurationContainer implements WindowManagerService mWindowManager; DisplayManager mDisplayManager; private DisplayManagerInternal mDisplayManagerInternal; private RootWindowContainerController mWindowContainerController; // TODO: Remove after object merge with RootWindowContainer. private RootWindowContainer mRootWindowContainer; /** * List of displays which contain activities, sorted by z-order. Loading Loading @@ -224,13 +225,14 @@ class RootActivityContainer extends ConfigurationContainer implements } @VisibleForTesting void setWindowContainerController(RootWindowContainerController controller) { mWindowContainerController = controller; void setWindowContainer(RootWindowContainer container) { mRootWindowContainer = container; mRootWindowContainer.setRootActivityContainer(this); } void setWindowManager(WindowManagerService wm) { mWindowManager = wm; setWindowContainerController(new RootWindowContainerController(this)); setWindowContainer(mWindowManager.mRoot); mDisplayManager = mService.mContext.getSystemService(DisplayManager.class); mDisplayManager.registerDisplayListener(this, mService.mH); mDisplayManagerInternal = LocalServices.getService(DisplayManagerInternal.class); Loading Loading @@ -1251,8 +1253,8 @@ class RootActivityContainer extends ConfigurationContainer implements return null; } @Override public void onChildPositionChanged(DisplayWindowController childController, int position) { // TODO: remove after object merge with RootWindowContainer void onChildPositionChanged(DisplayWindowController childController, int position) { // Assume AM lock is held from positionChildAt of controller in each hierarchy. final ActivityDisplay display = getActivityDisplay(childController.getDisplayId()); if (display != null) { Loading @@ -1279,8 +1281,8 @@ class RootActivityContainer extends ConfigurationContainer implements @VisibleForTesting void addChild(ActivityDisplay activityDisplay, int position) { positionChildAt(activityDisplay, position); mWindowContainerController.positionChildAt( activityDisplay.getWindowContainerController(), position); mRootWindowContainer.positionChildAt(position, activityDisplay.getWindowContainerController().mContainer); } void removeChild(ActivityDisplay activityDisplay) { Loading
services/core/java/com/android/server/wm/RootWindowContainer.java +14 −9 Original line number Diff line number Diff line Loading @@ -82,12 +82,16 @@ import java.util.ArrayList; import java.util.function.Consumer; /** Root {@link WindowContainer} for the device. */ class RootWindowContainer extends WindowContainer<DisplayContent> { class RootWindowContainer extends WindowContainer<DisplayContent> implements ConfigurationContainerListener { private static final String TAG = TAG_WITH_CLASS_NAME ? "RootWindowContainer" : TAG_WM; private static final int SET_SCREEN_BRIGHTNESS_OVERRIDE = 1; private static final int SET_USER_ACTIVITY_TIMEOUT = 2; // TODO: Remove after object merge with RootActivityContainer. private RootActivityContainer mRootActivityContainer; private Object mLastWindowFreezeSource = null; private Session mHoldScreen = null; private float mScreenBrightness = -1; Loading Loading @@ -145,6 +149,13 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { mHandler = new MyHandler(service.mH.getLooper()); } void setRootActivityContainer(RootActivityContainer container) { mRootActivityContainer = container; if (container != null) { container.registerConfigurationChangeListener(this); } } boolean updateFocusedWindowLocked(int mode, boolean updateInputWindows) { boolean changed = false; int topFocusedDisplayId = INVALID_DISPLAY; Loading Loading @@ -1012,9 +1023,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { @Override void positionChildAt(int position, DisplayContent child, boolean includingParents) { super.positionChildAt(position, child, includingParents); final RootWindowContainerController controller = getController(); if (controller != null) { controller.onChildPositionChanged(child, position); if (mRootActivityContainer != null) { mRootActivityContainer.onChildPositionChanged(child.getController(), position); } } Loading @@ -1023,11 +1033,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { super.positionChildAt(position, child, false /* includingParents */); } @Override RootWindowContainerController getController() { return (RootWindowContainerController) super.getController(); } @Override void scheduleAnimation() { mService.scheduleAnimationLocked(); Loading
services/core/java/com/android/server/wm/RootWindowContainerController.javadeleted 100644 → 0 +0 −46 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.server.wm; /** * Controller for the root container. This is created by activity manager to link activity * stack supervisor to the root window container they use in window manager. */ public class RootWindowContainerController extends WindowContainerController<RootWindowContainer, RootWindowContainerListener> { public RootWindowContainerController(RootWindowContainerListener listener) { super(listener, WindowManagerService.getInstance()); synchronized (mGlobalLock) { mRoot.setController(this); } } void onChildPositionChanged(DisplayContent child, int position) { // This callback invokes to AM directly so here assumes AM lock is held. If there is another // path called only with WM lock, it should change to use handler to post or move outside of // WM lock with adding AM lock. mListener.onChildPositionChanged(child.getController(), position); } /** Move the display to the given position. */ public void positionChildAt(DisplayWindowController child, int position) { synchronized (mGlobalLock) { mContainer.positionChildAt(position, child.mContainer); } } }
services/core/java/com/android/server/wm/RootWindowContainerListener.javadeleted 100644 → 0 +0 −26 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.server.wm; /** * Interface used by the creator of {@link RootWindowContainerController} to notify the changes to * the display container in activity manager. */ public interface RootWindowContainerListener extends WindowContainerListener { /** Called when the z-order of display is changed. */ void onChildPositionChanged(DisplayWindowController childController, int position); }
services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java +1 −2 Original line number Diff line number Diff line Loading @@ -411,8 +411,7 @@ class ActivityTestsBase { void initRootActivityContainerMocks(WindowManagerService wm) { spyOn(mRootActivityContainer); mRootActivityContainer.setWindowContainerController( mock(RootWindowContainerController.class)); mRootActivityContainer.setWindowContainer(mock(RootWindowContainer.class)); mRootActivityContainer.mWindowManager = wm; mRootActivityContainer.mDisplayManager = (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE); Loading