Removed RootWindowContainerController/Listener files (41/n).
A step towards merge RootWindowContainer and RootActivityContainer classes. Bug: 80414790 Test: Existing tests pass Change-Id: I58333f3867d9ab128cc113921fd4296df5f0928f
This commit is contained in:
@@ -129,8 +129,8 @@ import java.util.Set;
|
|||||||
* TODO: This class is mostly temporary to separate things out of ActivityStackSupervisor.java. The
|
* 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.
|
* intention is to have this merged with RootWindowContainer.java as part of unifying the hierarchy.
|
||||||
*/
|
*/
|
||||||
class RootActivityContainer extends ConfigurationContainer implements
|
class RootActivityContainer extends ConfigurationContainer
|
||||||
DisplayManager.DisplayListener, RootWindowContainerListener {
|
implements DisplayManager.DisplayListener {
|
||||||
|
|
||||||
private static final String TAG = TAG_WITH_CLASS_NAME ? "RootActivityContainer" : TAG_ATM;
|
private static final String TAG = TAG_WITH_CLASS_NAME ? "RootActivityContainer" : TAG_ATM;
|
||||||
static final String TAG_TASKS = TAG + POSTFIX_TASKS;
|
static final String TAG_TASKS = TAG + POSTFIX_TASKS;
|
||||||
@@ -162,7 +162,8 @@ class RootActivityContainer extends ConfigurationContainer implements
|
|||||||
WindowManagerService mWindowManager;
|
WindowManagerService mWindowManager;
|
||||||
DisplayManager mDisplayManager;
|
DisplayManager mDisplayManager;
|
||||||
private DisplayManagerInternal mDisplayManagerInternal;
|
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.
|
* List of displays which contain activities, sorted by z-order.
|
||||||
@@ -224,13 +225,14 @@ class RootActivityContainer extends ConfigurationContainer implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void setWindowContainerController(RootWindowContainerController controller) {
|
void setWindowContainer(RootWindowContainer container) {
|
||||||
mWindowContainerController = controller;
|
mRootWindowContainer = container;
|
||||||
|
mRootWindowContainer.setRootActivityContainer(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setWindowManager(WindowManagerService wm) {
|
void setWindowManager(WindowManagerService wm) {
|
||||||
mWindowManager = wm;
|
mWindowManager = wm;
|
||||||
setWindowContainerController(new RootWindowContainerController(this));
|
setWindowContainer(mWindowManager.mRoot);
|
||||||
mDisplayManager = mService.mContext.getSystemService(DisplayManager.class);
|
mDisplayManager = mService.mContext.getSystemService(DisplayManager.class);
|
||||||
mDisplayManager.registerDisplayListener(this, mService.mH);
|
mDisplayManager.registerDisplayListener(this, mService.mH);
|
||||||
mDisplayManagerInternal = LocalServices.getService(DisplayManagerInternal.class);
|
mDisplayManagerInternal = LocalServices.getService(DisplayManagerInternal.class);
|
||||||
@@ -1251,8 +1253,8 @@ class RootActivityContainer extends ConfigurationContainer implements
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// TODO: remove after object merge with RootWindowContainer
|
||||||
public void onChildPositionChanged(DisplayWindowController childController, int position) {
|
void onChildPositionChanged(DisplayWindowController childController, int position) {
|
||||||
// Assume AM lock is held from positionChildAt of controller in each hierarchy.
|
// Assume AM lock is held from positionChildAt of controller in each hierarchy.
|
||||||
final ActivityDisplay display = getActivityDisplay(childController.getDisplayId());
|
final ActivityDisplay display = getActivityDisplay(childController.getDisplayId());
|
||||||
if (display != null) {
|
if (display != null) {
|
||||||
@@ -1279,8 +1281,8 @@ class RootActivityContainer extends ConfigurationContainer implements
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void addChild(ActivityDisplay activityDisplay, int position) {
|
void addChild(ActivityDisplay activityDisplay, int position) {
|
||||||
positionChildAt(activityDisplay, position);
|
positionChildAt(activityDisplay, position);
|
||||||
mWindowContainerController.positionChildAt(
|
mRootWindowContainer.positionChildAt(position,
|
||||||
activityDisplay.getWindowContainerController(), position);
|
activityDisplay.getWindowContainerController().mContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeChild(ActivityDisplay activityDisplay) {
|
void removeChild(ActivityDisplay activityDisplay) {
|
||||||
|
|||||||
@@ -82,12 +82,16 @@ import java.util.ArrayList;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
/** Root {@link WindowContainer} for the device. */
|
/** 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 String TAG = TAG_WITH_CLASS_NAME ? "RootWindowContainer" : TAG_WM;
|
||||||
|
|
||||||
private static final int SET_SCREEN_BRIGHTNESS_OVERRIDE = 1;
|
private static final int SET_SCREEN_BRIGHTNESS_OVERRIDE = 1;
|
||||||
private static final int SET_USER_ACTIVITY_TIMEOUT = 2;
|
private static final int SET_USER_ACTIVITY_TIMEOUT = 2;
|
||||||
|
|
||||||
|
// TODO: Remove after object merge with RootActivityContainer.
|
||||||
|
private RootActivityContainer mRootActivityContainer;
|
||||||
|
|
||||||
private Object mLastWindowFreezeSource = null;
|
private Object mLastWindowFreezeSource = null;
|
||||||
private Session mHoldScreen = null;
|
private Session mHoldScreen = null;
|
||||||
private float mScreenBrightness = -1;
|
private float mScreenBrightness = -1;
|
||||||
@@ -145,6 +149,13 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
|
|||||||
mHandler = new MyHandler(service.mH.getLooper());
|
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 updateFocusedWindowLocked(int mode, boolean updateInputWindows) {
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
int topFocusedDisplayId = INVALID_DISPLAY;
|
int topFocusedDisplayId = INVALID_DISPLAY;
|
||||||
@@ -1015,9 +1026,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
|
|||||||
@Override
|
@Override
|
||||||
void positionChildAt(int position, DisplayContent child, boolean includingParents) {
|
void positionChildAt(int position, DisplayContent child, boolean includingParents) {
|
||||||
super.positionChildAt(position, child, includingParents);
|
super.positionChildAt(position, child, includingParents);
|
||||||
final RootWindowContainerController controller = getController();
|
if (mRootActivityContainer != null) {
|
||||||
if (controller != null) {
|
mRootActivityContainer.onChildPositionChanged(child.getController(), position);
|
||||||
controller.onChildPositionChanged(child, position);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1026,11 +1036,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
|
|||||||
super.positionChildAt(position, child, false /* includingParents */);
|
super.positionChildAt(position, child, false /* includingParents */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
RootWindowContainerController getController() {
|
|
||||||
return (RootWindowContainerController) super.getController();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void scheduleAnimation() {
|
void scheduleAnimation() {
|
||||||
mService.scheduleAnimationLocked();
|
mService.scheduleAnimationLocked();
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
@@ -410,8 +410,7 @@ class ActivityTestsBase {
|
|||||||
|
|
||||||
void initRootActivityContainerMocks(WindowManagerService wm) {
|
void initRootActivityContainerMocks(WindowManagerService wm) {
|
||||||
spyOn(mRootActivityContainer);
|
spyOn(mRootActivityContainer);
|
||||||
mRootActivityContainer.setWindowContainerController(
|
mRootActivityContainer.setWindowContainer(mock(RootWindowContainer.class));
|
||||||
mock(RootWindowContainerController.class));
|
|
||||||
mRootActivityContainer.mWindowManager = wm;
|
mRootActivityContainer.mWindowManager = wm;
|
||||||
mRootActivityContainer.mDisplayManager =
|
mRootActivityContainer.mDisplayManager =
|
||||||
(DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE);
|
(DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE);
|
||||||
|
|||||||
Reference in New Issue
Block a user