Merge "Removed DisplayWindowController (43/n)."
diff --git a/services/core/java/com/android/server/wm/ActivityDisplay.java b/services/core/java/com/android/server/wm/ActivityDisplay.java
index da997ba..10542d5 100644
--- a/services/core/java/com/android/server/wm/ActivityDisplay.java
+++ b/services/core/java/com/android/server/wm/ActivityDisplay.java
@@ -48,12 +48,16 @@
import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.RootActivityContainer.FindTaskResult;
import static com.android.server.wm.RootActivityContainer.TAG_STATES;
+import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_FOCUS_LIGHT;
+import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
+import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL;
import android.annotation.Nullable;
import android.app.ActivityOptions;
import android.app.WindowConfiguration;
import android.content.res.Configuration;
import android.graphics.Point;
+import android.os.IBinder;
import android.os.UserHandle;
import android.util.IntArray;
import android.util.Slog;
@@ -86,6 +90,8 @@
private ActivityTaskManagerService mService;
private RootActivityContainer mRootActivityContainer;
+ // TODO: Remove once unification is complete.
+ DisplayContent mDisplayContent;
/** Actual Display this object tracks. */
int mDisplayId;
Display mDisplay;
@@ -138,8 +144,6 @@
// Used in updating the display size
private Point mTmpDisplaySize = new Point();
- private DisplayWindowController mWindowContainerController;
-
private final FindTaskResult mTmpFindTaskResult = new FindTaskResult();
ActivityDisplay(RootActivityContainer root, Display display) {
@@ -147,19 +151,15 @@
mService = root.mService;
mDisplayId = display.getDisplayId();
mDisplay = display;
- mWindowContainerController = createWindowContainerController();
+ mDisplayContent = createDisplayContent();
updateBounds();
}
- protected DisplayWindowController createWindowContainerController() {
- return new DisplayWindowController(mDisplay, this);
+ protected DisplayContent createDisplayContent() {
+ return mService.mWindowManager.mRoot.createDisplayContent(mDisplay, this);
}
- DisplayWindowController getWindowContainerController() {
- return mWindowContainerController;
- }
-
- void updateBounds() {
+ private void updateBounds() {
mDisplay.getRealSize(mTmpDisplaySize);
setBounds(0, 0, mTmpDisplaySize.x, mTmpDisplaySize.y);
}
@@ -178,7 +178,10 @@
}
updateBounds();
- mWindowContainerController.onDisplayChanged();
+ if (mDisplayContent != null) {
+ mDisplayContent.updateDisplayInfo();
+ mService.mWindowManager.requestTraversal();
+ }
}
@Override
@@ -270,9 +273,9 @@
// ActivityStack#getWindowContainerController() can be null. In this special case,
// since DisplayContest#positionStackAt() is called in TaskStack#onConfigurationChanged(),
// we don't have to call WindowContainerController#positionChildAt() here.
- if (stack.getWindowContainerController() != null) {
- mWindowContainerController.positionChildAt(stack.getWindowContainerController(),
- insertPosition, includingParents);
+ if (stack.getWindowContainerController() != null && mDisplayContent != null) {
+ mDisplayContent.positionStackAt(insertPosition,
+ stack.getWindowContainerController().mContainer, includingParents);
}
if (!wasContained) {
stack.setParent(this);
@@ -958,17 +961,23 @@
getRequestedOverrideConfiguration().windowConfiguration.getRotation();
if (currRotation != ROTATION_UNDEFINED
&& currRotation != overrideConfiguration.windowConfiguration.getRotation()
- && getWindowContainerController() != null) {
- getWindowContainerController().applyRotation(currRotation,
+ && mDisplayContent != null) {
+ mDisplayContent.applyRotationLocked(currRotation,
overrideConfiguration.windowConfiguration.getRotation());
}
super.onRequestedOverrideConfigurationChanged(overrideConfiguration);
+ if (mDisplayContent != null) {
+ mService.mWindowManager.setNewDisplayOverrideConfiguration(
+ overrideConfiguration, mDisplayContent);
+ }
}
@Override
public void onConfigurationChanged(Configuration newParentConfig) {
// update resources before cascade so that docked/pinned stacks use the correct info
- getWindowContainerController().preOnConfigurationChanged();
+ if (mDisplayContent != null) {
+ mDisplayContent.preOnConfigurationChanged();
+ }
super.onConfigurationChanged(newParentConfig);
}
@@ -1099,8 +1108,8 @@
private void releaseSelfIfNeeded() {
if (mStacks.isEmpty() && mRemoved) {
- mWindowContainerController.removeContainer();
- mWindowContainerController = null;
+ mDisplayContent.removeIfPossible();
+ mDisplayContent = null;
mRootActivityContainer.removeChild(this);
mRootActivityContainer.mStackSupervisor
.getKeyguardController().onDisplayRemoved(mDisplayId);
@@ -1122,7 +1131,7 @@
* @see Display#FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS
*/
boolean supportsSystemDecorations() {
- return mWindowContainerController.supportsSystemDecorations();
+ return mDisplayContent.supportsSystemDecorations();
}
@VisibleForTesting
@@ -1136,7 +1145,30 @@
}
void setFocusedApp(ActivityRecord r, boolean moveFocusNow) {
- mWindowContainerController.setFocusedApp(r.appToken, moveFocusNow);
+ if (mDisplayContent == null) {
+ return;
+ }
+ final AppWindowToken newFocus;
+ final IBinder token = r.appToken;
+ if (token == null) {
+ if (DEBUG_FOCUS_LIGHT) Slog.v(TAG_WM, "Clearing focused app, displayId="
+ + mDisplayId);
+ newFocus = null;
+ } else {
+ newFocus = mService.mWindowManager.mRoot.getAppWindowToken(token);
+ if (newFocus == null) {
+ Slog.w(TAG_WM, "Attempted to set focus to non-existing app token: " + token
+ + ", displayId=" + mDisplayId);
+ }
+ if (DEBUG_FOCUS_LIGHT) Slog.v(TAG_WM, "Set focused app to: " + newFocus
+ + " moveFocusNow=" + moveFocusNow + " displayId=" + mDisplayId);
+ }
+
+ final boolean changed = mDisplayContent.setFocusedApp(newFocus);
+ if (moveFocusNow && changed) {
+ mService.mWindowManager.updateFocusedWindowLocked(UPDATE_FOCUS_NORMAL,
+ true /*updateInputWindows*/);
+ }
}
/**
@@ -1284,17 +1316,21 @@
}
/**
- * See {@link DisplayWindowController#deferUpdateImeTarget()}
+ * See {@link DisplayContent#deferUpdateImeTarget()}
*/
public void deferUpdateImeTarget() {
- mWindowContainerController.deferUpdateImeTarget();
+ if (mDisplayContent != null) {
+ mDisplayContent.deferUpdateImeTarget();
+ }
}
/**
- * See {@link DisplayWindowController#deferUpdateImeTarget()}
+ * See {@link DisplayContent#deferUpdateImeTarget()}
*/
public void continueUpdateImeTarget() {
- mWindowContainerController.continueUpdateImeTarget();
+ if (mDisplayContent != null) {
+ mDisplayContent.continueUpdateImeTarget();
+ }
}
public void dump(PrintWriter pw, String prefix) {
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index 26a4cef..4e9c5ab 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -2942,7 +2942,7 @@
final ActivityLifecycleItem lifecycleItem;
if (andResume) {
lifecycleItem = ResumeActivityItem.obtain(
- getDisplay().getWindowContainerController().isNextTransitionForward());
+ getDisplay().mDisplayContent.isNextTransitionForward());
} else {
lifecycleItem = PauseActivityItem.obtain();
}
diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java
index c41a173..7683172 100644
--- a/services/core/java/com/android/server/wm/ActivityStack.java
+++ b/services/core/java/com/android/server/wm/ActivityStack.java
@@ -574,7 +574,7 @@
// bounds were on the pre-rotated display.
if (prevRotation != newRotation) {
mTmpRect2.set(mTmpRect);
- getDisplay().getWindowContainerController().mContainer
+ getDisplay().mDisplayContent
.rotateBounds(newParentConfig.windowConfiguration.getBounds(),
prevRotation, newRotation, mTmpRect2);
hasNewOverrideBounds = true;
@@ -609,8 +609,8 @@
} else if (
getRequestedOverrideWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY) {
Rect dockedBounds = display.getSplitScreenPrimaryStack().getBounds();
- final boolean isMinimizedDock = getDisplay().getWindowContainerController()
- .mContainer.getDockedDividerController().isMinimizedDock();
+ final boolean isMinimizedDock =
+ getDisplay().mDisplayContent.getDockedDividerController().isMinimizedDock();
if (isMinimizedDock) {
TaskRecord topTask = display.getSplitScreenPrimaryStack().topTask();
if (topTask != null) {
@@ -2714,16 +2714,16 @@
// that the previous one will be hidden soon. This way it can know
// to ignore it when computing the desired screen orientation.
boolean anim = true;
- final DisplayWindowController dwc = getDisplay().getWindowContainerController();
+ final DisplayContent dc = getDisplay().mDisplayContent;
if (prev != null) {
if (prev.finishing) {
if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION,
"Prepare close transition: prev=" + prev);
if (mStackSupervisor.mNoAnimActivities.contains(prev)) {
anim = false;
- dwc.prepareAppTransition(TRANSIT_NONE, false);
+ dc.prepareAppTransition(TRANSIT_NONE, false);
} else {
- dwc.prepareAppTransition(
+ dc.prepareAppTransition(
prev.getTaskRecord() == next.getTaskRecord() ? TRANSIT_ACTIVITY_CLOSE
: TRANSIT_TASK_CLOSE, false);
}
@@ -2733,9 +2733,9 @@
"Prepare open transition: prev=" + prev);
if (mStackSupervisor.mNoAnimActivities.contains(next)) {
anim = false;
- dwc.prepareAppTransition(TRANSIT_NONE, false);
+ dc.prepareAppTransition(TRANSIT_NONE, false);
} else {
- dwc.prepareAppTransition(
+ dc.prepareAppTransition(
prev.getTaskRecord() == next.getTaskRecord() ? TRANSIT_ACTIVITY_OPEN
: next.mLaunchTaskBehind ? TRANSIT_TASK_OPEN_BEHIND
: TRANSIT_TASK_OPEN, false);
@@ -2745,9 +2745,9 @@
if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION, "Prepare open transition: no previous");
if (mStackSupervisor.mNoAnimActivities.contains(next)) {
anim = false;
- dwc.prepareAppTransition(TRANSIT_NONE, false);
+ dc.prepareAppTransition(TRANSIT_NONE, false);
} else {
- dwc.prepareAppTransition(TRANSIT_ACTIVITY_OPEN, false);
+ dc.prepareAppTransition(TRANSIT_ACTIVITY_OPEN, false);
}
}
@@ -2869,8 +2869,7 @@
next.clearOptionsLocked();
transaction.setLifecycleStateRequest(
ResumeActivityItem.obtain(next.app.getReportedProcState(),
- getDisplay().getWindowContainerController()
- .isNextTransitionForward()));
+ getDisplay().mDisplayContent.isNextTransitionForward()));
mService.getLifecycleManager().scheduleTransaction(transaction);
if (DEBUG_STATES) Slog.d(TAG_STATES, "resumeTopActivityLocked: Resumed "
@@ -3072,11 +3071,11 @@
task.setFrontOfTask();
if (!isHomeOrRecentsStack() || numActivities() > 0) {
- final DisplayWindowController dwc = getDisplay().getWindowContainerController();
+ final DisplayContent dc = getDisplay().mDisplayContent;
if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION,
"Prepare open transition: starting " + r);
if ((r.intent.getFlags() & Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) {
- dwc.prepareAppTransition(TRANSIT_NONE, keepCurTransition);
+ dc.prepareAppTransition(TRANSIT_NONE, keepCurTransition);
mStackSupervisor.mNoAnimActivities.add(r);
} else {
int transit = TRANSIT_ACTIVITY_OPEN;
@@ -3095,7 +3094,7 @@
transit = TRANSIT_TASK_OPEN;
}
}
- dwc.prepareAppTransition(transit, keepCurTransition);
+ dc.prepareAppTransition(transit, keepCurTransition);
mStackSupervisor.mNoAnimActivities.remove(r);
}
boolean doShow = true;
@@ -3724,7 +3723,7 @@
int taskNdx = mTaskHistory.indexOf(finishedTask);
final TaskRecord task = finishedTask;
int activityNdx = task.mActivities.indexOf(r);
- getDisplay().getWindowContainerController().prepareAppTransition(
+ getDisplay().mDisplayContent.prepareAppTransition(
TRANSIT_CRASHING_ACTIVITY_CLOSE, false /* alwaysKeepCurrent */);
finishActivityLocked(r, Activity.RESULT_CANCELED, null, reason, false);
finishedTask = task;
@@ -3890,7 +3889,7 @@
mService.getTaskChangeNotificationController().notifyTaskRemovalStarted(
task.taskId);
}
- getDisplay().getWindowContainerController().prepareAppTransition(transit, false);
+ getDisplay().mDisplayContent.prepareAppTransition(transit, false);
// Tell window manager to prepare for this one to be removed.
r.setVisibility(false);
@@ -3945,10 +3944,10 @@
}
private void prepareActivityHideTransitionAnimation(ActivityRecord r, int transit) {
- final DisplayWindowController dwc = getDisplay().getWindowContainerController();
- dwc.prepareAppTransition(transit, false);
+ final DisplayContent dc = getDisplay().mDisplayContent;
+ dc.prepareAppTransition(transit, false);
r.setVisibility(false);
- dwc.executeAppTransition();
+ dc.executeAppTransition();
if (!mStackSupervisor.mActivitiesWaitingForVisibleActivity.contains(r)) {
mStackSupervisor.mActivitiesWaitingForVisibleActivity.add(r);
}
@@ -4692,7 +4691,7 @@
ActivityOptions.abort(options);
}
}
- getDisplay().getWindowContainerController().prepareAppTransition(transit, false);
+ getDisplay().mDisplayContent.prepareAppTransition(transit, false);
}
private void updateTaskMovement(TaskRecord task, boolean toFront) {
@@ -4761,8 +4760,7 @@
if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION, "Prepare to front transition: task=" + tr);
if (noAnimation) {
- getDisplay().getWindowContainerController().prepareAppTransition(
- TRANSIT_NONE, false);
+ getDisplay().mDisplayContent.prepareAppTransition(TRANSIT_NONE, false);
if (r != null) {
mStackSupervisor.mNoAnimActivities.add(r);
}
@@ -4844,8 +4842,7 @@
mTaskHistory.add(0, tr);
updateTaskMovement(tr, false);
- getDisplay().getWindowContainerController().prepareAppTransition(
- TRANSIT_TASK_TO_BACK, false);
+ getDisplay().mDisplayContent.prepareAppTransition(TRANSIT_TASK_TO_BACK, false);
moveToBack("moveTaskToBackLocked", tr);
if (inPinnedWindowingMode()) {
@@ -5170,7 +5167,7 @@
+ r.intent.getComponent().flattenToShortString());
// Force the destroy to skip right to removal.
r.app = null;
- getDisplay().getWindowContainerController().prepareAppTransition(
+ getDisplay().mDisplayContent.prepareAppTransition(
TRANSIT_CRASHING_ACTIVITY_CLOSE, false /* alwaysKeepCurrent */);
finishCurrentActivityLocked(r, FINISH_IMMEDIATELY, false,
"handleAppCrashedLocked");
@@ -5508,7 +5505,7 @@
}
void executeAppTransition(ActivityOptions options) {
- getDisplay().getWindowContainerController().executeAppTransition();
+ getDisplay().mDisplayContent.executeAppTransition();
ActivityOptions.abort(options);
}
diff --git a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
index d92a9f2..e761ad8 100644
--- a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
@@ -818,7 +818,7 @@
final ClientTransaction clientTransaction = ClientTransaction.obtain(
proc.getThread(), r.appToken);
- final DisplayWindowController dwc = r.getDisplay().getWindowContainerController();
+ final DisplayContent dc = r.getDisplay().mDisplayContent;
clientTransaction.addCallback(LaunchActivityItem.obtain(new Intent(r.intent),
System.identityHashCode(r), r.info,
// TODO: Have this take the merged configuration instead of separate global
@@ -827,12 +827,12 @@
mergedConfiguration.getOverrideConfiguration(), r.compat,
r.launchedFromPackage, task.voiceInteractor, proc.getReportedProcState(),
r.icicle, r.persistentState, results, newIntents,
- dwc.isNextTransitionForward(), profilerInfo));
+ dc.isNextTransitionForward(), profilerInfo));
// Set desired final state.
final ActivityLifecycleItem lifecycleItem;
if (andResume) {
- lifecycleItem = ResumeActivityItem.obtain(dwc.isNextTransitionForward());
+ lifecycleItem = ResumeActivityItem.obtain(dc.isNextTransitionForward());
} else {
lifecycleItem = PauseActivityItem.obtain();
}
diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java
index bc2136e..4538d36 100644
--- a/services/core/java/com/android/server/wm/ActivityStarter.java
+++ b/services/core/java/com/android/server/wm/ActivityStarter.java
@@ -1565,7 +1565,7 @@
mTargetStack.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS);
// Go ahead and tell window manager to execute app transition for this activity
// since the app transition will not be triggered through the resume channel.
- mTargetStack.getDisplay().getWindowContainerController().executeAppTransition();
+ mTargetStack.getDisplay().mDisplayContent.executeAppTransition();
} else {
// If the target stack was not previously focusable (previous top running activity
// on that stack was not visible) then any prior calls to move the stack to the
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 0301a5b..182d1a0 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -1738,7 +1738,7 @@
if (self.isState(
ActivityStack.ActivityState.RESUMED, ActivityStack.ActivityState.PAUSING)) {
- self.getDisplay().getWindowContainerController().overridePendingAppTransition(
+ self.getDisplay().mDisplayContent.mAppTransition.overridePendingAppTransition(
packageName, enterAnim, exitAnim, null);
}
@@ -3073,12 +3073,11 @@
// Get top display of front most application.
final ActivityStack focusedStack = getTopDisplayFocusedStack();
if (focusedStack != null) {
- final DisplayWindowController dwc =
- focusedStack.getDisplay().getWindowContainerController();
- dwc.prepareAppTransition(TRANSIT_TASK_IN_PLACE, false);
- dwc.overridePendingAppTransitionInPlace(activityOptions.getPackageName(),
+ final DisplayContent dc = focusedStack.getDisplay().mDisplayContent;
+ dc.prepareAppTransition(TRANSIT_TASK_IN_PLACE, false);
+ dc.mAppTransition.overrideInPlaceAppTransition(activityOptions.getPackageName(),
activityOptions.getCustomInPlaceResId());
- dwc.executeAppTransition();
+ dc.executeAppTransition();
}
}
@@ -5770,17 +5769,18 @@
if (activityDisplay == null) {
return;
}
- final DisplayWindowController dwc = activityDisplay.getWindowContainerController();
- final boolean wasTransitionSet = dwc.getPendingAppTransition() != TRANSIT_NONE;
+ final DisplayContent dc = activityDisplay.mDisplayContent;
+ final boolean wasTransitionSet =
+ dc.mAppTransition.getAppTransition() != TRANSIT_NONE;
if (!wasTransitionSet) {
- dwc.prepareAppTransition(TRANSIT_NONE, false /* alwaysKeepCurrent */);
+ dc.prepareAppTransition(TRANSIT_NONE, false /* alwaysKeepCurrent */);
}
mRootActivityContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS);
// If there was a transition set already we don't want to interfere with it as we
// might be starting it too early.
if (!wasTransitionSet) {
- dwc.executeAppTransition();
+ dc.executeAppTransition();
}
}
if (callback != null) {
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index aba2eb3..2f4c5ca 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -59,8 +59,11 @@
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
+import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN;
import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;
+import static android.view.WindowManager.TRANSIT_TASK_OPEN;
+import static android.view.WindowManager.TRANSIT_TASK_TO_FRONT;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT;
@@ -207,6 +210,9 @@
/** Unique identifier of this stack. */
private final int mDisplayId;
+ // TODO: Remove once unification is complete.
+ ActivityDisplay mAcitvityDisplay;
+
/** The containers below are the only child containers the display can have. */
// Contains all window containers that are related to apps (Activities)
private final TaskStackContainers mTaskStackContainers = new TaskStackContainers(mWmService);
@@ -227,7 +233,6 @@
private WindowState mTmpWindow;
private WindowState mTmpWindow2;
- private WindowAnimator mTmpWindowAnimator;
private boolean mTmpRecoveringMemory;
private boolean mUpdateImeTarget;
private boolean mTmpInitial;
@@ -827,12 +832,12 @@
* initialize direct children.
* @param display May not be null.
* @param service You know.
- * @param controller The controller for the display container.
+ * @param activityDisplay The ActivityDisplay for the display container.
*/
DisplayContent(Display display, WindowManagerService service,
- DisplayWindowController controller) {
+ ActivityDisplay activityDisplay) {
super(service);
- setController(controller);
+ mAcitvityDisplay = activityDisplay;
if (service.mRoot.getDisplayContent(display.getDisplayId()) != null) {
throw new IllegalArgumentException("Display with ID=" + display.getDisplayId()
+ " already exists=" + service.mRoot.getDisplayContent(display.getDisplayId())
@@ -1020,11 +1025,6 @@
}
@Override
- DisplayWindowController getController() {
- return (DisplayWindowController) super.getController();
- }
-
- @Override
public Display getDisplay() {
return mDisplay;
}
@@ -1138,6 +1138,17 @@
return true;
}
+ /**
+ * The display content may have configuration set from {@link #DisplayWindowSettings}. This
+ * callback let the owner of container know there is existing configuration to prevent the
+ * values from being replaced by the initializing {@link #ActivityDisplay}.
+ */
+ void initializeDisplayOverrideConfiguration() {
+ if (mAcitvityDisplay != null) {
+ mAcitvityDisplay.onInitializeOverrideConfiguration(getRequestedOverrideConfiguration());
+ }
+ }
+
/** Notify the configuration change of this display. */
void sendNewConfiguration() {
mWmService.mH.obtainMessage(SEND_NEW_CONFIGURATION, this).sendToTarget();
@@ -4686,6 +4697,11 @@
}
void prepareAppTransition(@WindowManager.TransitionType int transit,
+ boolean alwaysKeepCurrent) {
+ prepareAppTransition(transit, alwaysKeepCurrent, 0 /* flags */, false /* forceOverride */);
+ }
+
+ void prepareAppTransition(@WindowManager.TransitionType int transit,
boolean alwaysKeepCurrent, @WindowManager.TransitionFlags int flags,
boolean forceOverride) {
final boolean prepared = mAppTransition.prepareAppTransitionLocked(
@@ -4737,6 +4753,14 @@
pendingLayoutChanges |= changes;
}
+ /** Check if pending app transition is for activity / task launch. */
+ boolean isNextTransitionForward() {
+ final int transit = mAppTransition.getAppTransition();
+ return transit == TRANSIT_ACTIVITY_OPEN
+ || transit == TRANSIT_TASK_OPEN
+ || transit == TRANSIT_TASK_TO_FRONT;
+ }
+
/**
* @see Display#FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS
*/
diff --git a/services/core/java/com/android/server/wm/DisplayWindowController.java b/services/core/java/com/android/server/wm/DisplayWindowController.java
deleted file mode 100644
index c7eadf9..0000000
--- a/services/core/java/com/android/server/wm/DisplayWindowController.java
+++ /dev/null
@@ -1,357 +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;
-
-import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN;
-import static android.view.WindowManager.TRANSIT_TASK_OPEN;
-import static android.view.WindowManager.TRANSIT_TASK_TO_FRONT;
-
-import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_DISPLAY;
-import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_FOCUS_LIGHT;
-import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STACK;
-import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
-import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL;
-
-import android.content.res.Configuration;
-import android.graphics.GraphicBuffer;
-import android.os.Binder;
-import android.os.IBinder;
-import android.os.IRemoteCallback;
-import android.util.Slog;
-import android.view.AppTransitionAnimationSpec;
-import android.view.Display;
-import android.view.WindowManager;
-import android.view.WindowManager.TransitionType;
-
-import com.android.internal.annotations.VisibleForTesting;
-
-/**
- * Controller for the display container. This is created by activity manager to link activity
- * displays to the display content they use in window manager.
- */
-public class DisplayWindowController
- extends WindowContainerController<DisplayContent, WindowContainerListener> {
-
- private final int mDisplayId;
-
- public DisplayWindowController(Display display, WindowContainerListener listener) {
- super(listener, WindowManagerService.getInstance());
- mDisplayId = display.getDisplayId();
-
- synchronized (mGlobalLock) {
- final long callingIdentity = Binder.clearCallingIdentity();
- try {
- mRoot.createDisplayContent(display, this /* controller */);
- } finally {
- Binder.restoreCallingIdentity(callingIdentity);
- }
-
- if (mContainer == null) {
- throw new IllegalArgumentException("Trying to add display=" + display
- + " dc=" + mRoot.getDisplayContent(mDisplayId));
- }
- }
- }
-
- @VisibleForTesting
- public DisplayWindowController(Display display, WindowManagerService service) {
- super(null, service);
- mDisplayId = display.getDisplayId();
- }
-
- @Override
- public void removeContainer() {
- synchronized (mGlobalLock) {
- if(mContainer == null) {
- if (DEBUG_DISPLAY) Slog.i(TAG_WM, "removeDisplay: could not find displayId="
- + mDisplayId);
- return;
- }
- mContainer.removeIfPossible();
- super.removeContainer();
- }
- }
-
- @Override
- public void onRequestedOverrideConfigurationChanged(Configuration overrideConfiguration) {
- synchronized (mGlobalLock) {
- if (mContainer != null) {
- mContainer.mWmService.setNewDisplayOverrideConfiguration(overrideConfiguration,
- mContainer);
- }
- }
- }
-
- /**
- * Updates the docked/pinned controller resources to the current system context.
- */
- public void preOnConfigurationChanged() {
- synchronized (mGlobalLock) {
- if (mContainer != null) {
- mContainer.preOnConfigurationChanged();
- }
- }
- }
-
- /**
- * @see DisplayContent#applyRotationLocked(int, int)
- */
- public void applyRotation(int oldRotation, int newRotation) {
- synchronized (mGlobalLock) {
- if (mContainer != null) {
- mContainer.applyRotationLocked(oldRotation, newRotation);
- }
- }
- }
-
- public int getDisplayId() {
- return mDisplayId;
- }
-
- /**
- * Called when the corresponding display receives
- * {@link android.hardware.display.DisplayManager.DisplayListener#onDisplayChanged(int)}.
- */
- public void onDisplayChanged() {
- synchronized (mGlobalLock) {
- if (mContainer == null) {
- if (DEBUG_DISPLAY) Slog.i(TAG_WM, "onDisplayChanged: could not find display="
- + mDisplayId);
- return;
- }
- mContainer.updateDisplayInfo();
- mService.mWindowPlacerLocked.requestTraversal();
- }
- }
-
- /**
- * Positions the task stack at the given position in the task stack container.
- */
- public void positionChildAt(StackWindowController child, int position,
- boolean includingParents) {
- synchronized (mGlobalLock) {
- if (DEBUG_STACK) Slog.i(TAG_WM, "positionTaskStackAt: positioning stack=" + child
- + " at " + position);
- if (mContainer == null) {
- if (DEBUG_STACK) Slog.i(TAG_WM,
- "positionTaskStackAt: could not find display=" + mContainer);
- return;
- }
- if (child.mContainer == null) {
- if (DEBUG_STACK) Slog.i(TAG_WM,
- "positionTaskStackAt: could not find stack=" + this);
- return;
- }
- mContainer.positionStackAt(position, child.mContainer, includingParents);
- }
- }
-
- /**
- * Starts deferring the ability to update the IME target. This is needed when a call will
- * attempt to update the IME target before all information about the Windows have been updated.
- */
- public void deferUpdateImeTarget() {
- synchronized (mGlobalLock) {
- final DisplayContent dc = mRoot.getDisplayContent(mDisplayId);
- if (dc != null) {
- dc.deferUpdateImeTarget();
- }
- }
- }
-
- /**
- * Resumes updating the IME target after deferring. See {@link #deferUpdateImeTarget()}
- */
- public void continueUpdateImeTarget() {
- synchronized (mGlobalLock) {
- final DisplayContent dc = mRoot.getDisplayContent(mDisplayId);
- if (dc != null) {
- dc.continueUpdateImeTarget();
- }
- }
- }
-
- /**
- * Sets a focused app on this display.
- *
- * @param token Specifies which app should be focused.
- * @param moveFocusNow Specifies if we should update the focused window immediately.
- */
- public void setFocusedApp(IBinder token, boolean moveFocusNow) {
- synchronized (mGlobalLock) {
- if (mContainer == null) {
- if (DEBUG_FOCUS_LIGHT) Slog.i(TAG_WM, "setFocusedApp: could not find displayId="
- + mDisplayId);
- return;
- }
- final AppWindowToken newFocus;
- if (token == null) {
- if (DEBUG_FOCUS_LIGHT) Slog.v(TAG_WM, "Clearing focused app, displayId="
- + mDisplayId);
- newFocus = null;
- } else {
- newFocus = mRoot.getAppWindowToken(token);
- if (newFocus == null) {
- Slog.w(TAG_WM, "Attempted to set focus to non-existing app token: " + token
- + ", displayId=" + mDisplayId);
- }
- if (DEBUG_FOCUS_LIGHT) Slog.v(TAG_WM, "Set focused app to: " + newFocus
- + " moveFocusNow=" + moveFocusNow + " displayId=" + mDisplayId);
- }
-
- final boolean changed = mContainer.setFocusedApp(newFocus);
- if (moveFocusNow && changed) {
- mService.updateFocusedWindowLocked(UPDATE_FOCUS_NORMAL,
- true /*updateInputWindows*/);
- }
- }
- }
-
- public void prepareAppTransition(@WindowManager.TransitionType int transit,
- boolean alwaysKeepCurrent) {
- prepareAppTransition(transit, alwaysKeepCurrent, 0 /* flags */, false /* forceOverride */);
- }
-
- /**
- * @param transit What kind of transition is happening. Use one of the constants
- * AppTransition.TRANSIT_*.
- * @param alwaysKeepCurrent If true and a transition is already set, new transition will NOT
- * be set.
- * @param flags Additional flags for the app transition, Use a combination of the constants
- * AppTransition.TRANSIT_FLAG_*.
- * @param forceOverride Always override the transit, not matter what was set previously.
- */
- public void prepareAppTransition(@WindowManager.TransitionType int transit,
- boolean alwaysKeepCurrent, @WindowManager.TransitionFlags int flags,
- boolean forceOverride) {
- synchronized (mGlobalLock) {
- mRoot.getDisplayContent(mDisplayId).prepareAppTransition(transit, alwaysKeepCurrent,
- flags, forceOverride);
- }
- }
-
- public void executeAppTransition() {
- synchronized (mGlobalLock) {
- mRoot.getDisplayContent(mDisplayId).executeAppTransition();
- }
- }
-
- public void overridePendingAppTransition(String packageName,
- int enterAnim, int exitAnim, IRemoteCallback startedCallback) {
- synchronized (mGlobalLock) {
- mRoot.getDisplayContent(mDisplayId).mAppTransition.overridePendingAppTransition(
- packageName, enterAnim, exitAnim, startedCallback);
- }
- }
-
- public void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth,
- int startHeight) {
- synchronized (mGlobalLock) {
- mRoot.getDisplayContent(mDisplayId).mAppTransition.overridePendingAppTransitionScaleUp(
- startX, startY, startWidth, startHeight);
- }
- }
-
- public void overridePendingAppTransitionClipReveal(int startX, int startY,
- int startWidth, int startHeight) {
- synchronized (mGlobalLock) {
- mRoot.getDisplayContent(mDisplayId)
- .mAppTransition.overridePendingAppTransitionClipReveal(startX, startY,
- startWidth, startHeight);
- }
- }
-
- public void overridePendingAppTransitionThumb(GraphicBuffer srcThumb, int startX,
- int startY, IRemoteCallback startedCallback, boolean scaleUp) {
- synchronized (mGlobalLock) {
- mRoot.getDisplayContent(mDisplayId)
- .mAppTransition.overridePendingAppTransitionThumb(srcThumb, startX, startY,
- startedCallback, scaleUp);
- }
- }
-
- public void overridePendingAppTransitionAspectScaledThumb(GraphicBuffer srcThumb, int startX,
- int startY, int targetWidth, int targetHeight, IRemoteCallback startedCallback,
- boolean scaleUp) {
- synchronized (mGlobalLock) {
- mRoot.getDisplayContent(mDisplayId)
- .mAppTransition.overridePendingAppTransitionAspectScaledThumb(srcThumb, startX,
- startY, targetWidth, targetHeight, startedCallback, scaleUp);
- }
- }
-
- public void overridePendingAppTransitionMultiThumb(AppTransitionAnimationSpec[] specs,
- IRemoteCallback onAnimationStartedCallback, IRemoteCallback onAnimationFinishedCallback,
- boolean scaleUp) {
- synchronized (mGlobalLock) {
- mRoot.getDisplayContent(mDisplayId)
- .mAppTransition.overridePendingAppTransitionMultiThumb(specs,
- onAnimationStartedCallback, onAnimationFinishedCallback, scaleUp);
- }
- }
-
- public void overridePendingAppTransitionStartCrossProfileApps() {
- synchronized (mGlobalLock) {
- mRoot.getDisplayContent(mDisplayId)
- .mAppTransition.overridePendingAppTransitionStartCrossProfileApps();
- }
- }
-
- public void overridePendingAppTransitionInPlace(String packageName, int anim) {
- synchronized (mGlobalLock) {
- mRoot.getDisplayContent(mDisplayId)
- .mAppTransition.overrideInPlaceAppTransition(packageName, anim);
- }
- }
-
- /**
- * Get Pending App transition of display.
- *
- * @return The pending app transition of the display.
- */
- public @TransitionType int getPendingAppTransition() {
- synchronized (mGlobalLock) {
- return mRoot.getDisplayContent(mDisplayId).mAppTransition.getAppTransition();
- }
- }
-
- /**
- * Check if pending app transition is for activity / task launch.
- */
- public boolean isNextTransitionForward() {
- final int transit = getPendingAppTransition();
- return transit == TRANSIT_ACTIVITY_OPEN
- || transit == TRANSIT_TASK_OPEN
- || transit == TRANSIT_TASK_TO_FRONT;
- }
-
- /**
- * Checks if system decorations should be shown on this display.
- *
- * @see Display#FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS
- */
- public boolean supportsSystemDecorations() {
- synchronized (mGlobalLock) {
- return mContainer.supportsSystemDecorations();
- }
- }
-
- @Override
- public String toString() {
- return "{DisplayWindowController displayId=" + mDisplayId + "}";
- }
-}
diff --git a/services/core/java/com/android/server/wm/KeyguardController.java b/services/core/java/com/android/server/wm/KeyguardController.java
index 4ef3513..5f56fe5 100644
--- a/services/core/java/com/android/server/wm/KeyguardController.java
+++ b/services/core/java/com/android/server/wm/KeyguardController.java
@@ -174,7 +174,7 @@
mWindowManager.deferSurfaceLayout();
try {
setKeyguardGoingAway(true);
- mRootActivityContainer.getDefaultDisplay().getWindowContainerController()
+ mRootActivityContainer.getDefaultDisplay().mDisplayContent
.prepareAppTransition(TRANSIT_KEYGUARD_GOING_AWAY,
false /* alwaysKeepCurrent */, convertTransitFlags(flags),
false /* forceOverride */);
@@ -302,7 +302,7 @@
if (isKeyguardLocked()) {
mWindowManager.deferSurfaceLayout();
try {
- mRootActivityContainer.getDefaultDisplay().getWindowContainerController()
+ mRootActivityContainer.getDefaultDisplay().mDisplayContent
.prepareAppTransition(resolveOccludeTransit(),
false /* alwaysKeepCurrent */, 0 /* flags */,
true /* forceOverride */);
@@ -332,11 +332,11 @@
// If we are about to unocclude the Keyguard, but we can dismiss it without security,
// we immediately dismiss the Keyguard so the activity gets shown without a flicker.
- final DisplayWindowController dwc =
- mRootActivityContainer.getDefaultDisplay().getWindowContainerController();
+ final DisplayContent dc =
+ mRootActivityContainer.getDefaultDisplay().mDisplayContent;
if (mKeyguardShowing && canDismissKeyguard()
- && dwc.getPendingAppTransition() == TRANSIT_KEYGUARD_UNOCCLUDE) {
- dwc.prepareAppTransition(mBeforeUnoccludeTransit, false /* alwaysKeepCurrent */,
+ && dc.mAppTransition.getAppTransition() == TRANSIT_KEYGUARD_UNOCCLUDE) {
+ dc.prepareAppTransition(mBeforeUnoccludeTransit, false /* alwaysKeepCurrent */,
0 /* flags */, true /* forceOverride */);
mRootActivityContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS);
mWindowManager.executeAppTransition();
@@ -355,10 +355,10 @@
}
private int resolveOccludeTransit() {
- final DisplayWindowController dwc =
- mRootActivityContainer.getDefaultDisplay().getWindowContainerController();
+ final DisplayContent dc =
+ mService.mRootActivityContainer.getDefaultDisplay().mDisplayContent;
if (mBeforeUnoccludeTransit != TRANSIT_UNSET
- && dwc.getPendingAppTransition() == TRANSIT_KEYGUARD_UNOCCLUDE
+ && dc.mAppTransition.getAppTransition() == TRANSIT_KEYGUARD_UNOCCLUDE
// TODO(b/113840485): Handle app transition for individual display.
&& isDisplayOccluded(DEFAULT_DISPLAY)) {
@@ -369,7 +369,7 @@
} else if (!isDisplayOccluded(DEFAULT_DISPLAY)) {
// Save transit in case we dismiss/occlude Keyguard shortly after.
- mBeforeUnoccludeTransit = dwc.getPendingAppTransition();
+ mBeforeUnoccludeTransit = dc.mAppTransition.getAppTransition();
return TRANSIT_KEYGUARD_UNOCCLUDE;
} else {
return TRANSIT_KEYGUARD_OCCLUDE;
diff --git a/services/core/java/com/android/server/wm/LockTaskController.java b/services/core/java/com/android/server/wm/LockTaskController.java
index d2f2863..3b66f7d 100644
--- a/services/core/java/com/android/server/wm/LockTaskController.java
+++ b/services/core/java/com/android/server/wm/LockTaskController.java
@@ -582,7 +582,7 @@
mSupervisor.mRootActivityContainer.resumeFocusedStacksTopActivities();
final ActivityStack stack = task.getStack();
if (stack != null) {
- stack.getDisplay().getWindowContainerController().executeAppTransition();
+ stack.getDisplay().mDisplayContent.executeAppTransition();
}
} else if (lockTaskModeState != LOCK_TASK_MODE_NONE) {
mSupervisor.handleNonResizableTaskIfNeeded(task, WINDOWING_MODE_UNDEFINED,
diff --git a/services/core/java/com/android/server/wm/RecentsAnimation.java b/services/core/java/com/android/server/wm/RecentsAnimation.java
index 9422182..86fcf64 100644
--- a/services/core/java/com/android/server/wm/RecentsAnimation.java
+++ b/services/core/java/com/android/server/wm/RecentsAnimation.java
@@ -93,12 +93,12 @@
Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "RecentsAnimation#startRecentsActivity");
// TODO(multi-display) currently only support recents animation in default display.
- final DisplayWindowController dwc =
- mService.mRootActivityContainer.getDefaultDisplay().getWindowContainerController();
+ final DisplayContent dc =
+ mService.mRootActivityContainer.getDefaultDisplay().mDisplayContent;
if (!mWindowManager.canStartRecentsAnimation()) {
notifyAnimationCancelBeforeStart(recentsAnimationRunner);
if (DEBUG) Slog.d(TAG, "Can't start recents animation, nextAppTransition="
- + dwc.getPendingAppTransition());
+ + dc.mAppTransition.getAppTransition());
return;
}
diff --git a/services/core/java/com/android/server/wm/RootActivityContainer.java b/services/core/java/com/android/server/wm/RootActivityContainer.java
index f7877c0..c5b42f9 100644
--- a/services/core/java/com/android/server/wm/RootActivityContainer.java
+++ b/services/core/java/com/android/server/wm/RootActivityContainer.java
@@ -914,7 +914,7 @@
void executeAppTransitionForAllDisplay() {
for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) {
final ActivityDisplay display = mActivityDisplays.get(displayNdx);
- display.getWindowContainerController().executeAppTransition();
+ display.mDisplayContent.executeAppTransition();
}
}
@@ -1254,9 +1254,8 @@
}
// TODO: remove after object merge with RootWindowContainer
- void onChildPositionChanged(DisplayWindowController childController, int position) {
+ void onChildPositionChanged(ActivityDisplay display, int position) {
// Assume AM lock is held from positionChildAt of controller in each hierarchy.
- final ActivityDisplay display = getActivityDisplay(childController.getDisplayId());
if (display != null) {
positionChildAt(display, position);
}
@@ -1281,8 +1280,7 @@
@VisibleForTesting
void addChild(ActivityDisplay activityDisplay, int position) {
positionChildAt(activityDisplay, position);
- mRootWindowContainer.positionChildAt(position,
- activityDisplay.getWindowContainerController().mContainer);
+ mRootWindowContainer.positionChildAt(position, activityDisplay.mDisplayContent);
}
void removeChild(ActivityDisplay activityDisplay) {
diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java
index 3a5c578..3bbef92 100644
--- a/services/core/java/com/android/server/wm/RootWindowContainer.java
+++ b/services/core/java/com/android/server/wm/RootWindowContainer.java
@@ -224,7 +224,7 @@
return null;
}
- DisplayContent createDisplayContent(final Display display, DisplayWindowController controller) {
+ DisplayContent createDisplayContent(final Display display, ActivityDisplay activityDisplay) {
final int displayId = display.getDisplayId();
// In select scenarios, it is possible that a DisplayContent will be created on demand
@@ -233,17 +233,17 @@
final DisplayContent existing = getDisplayContent(displayId);
if (existing != null) {
- initializeDisplayOverrideConfiguration(controller, existing);
- existing.setController(controller);
+ existing.mAcitvityDisplay = activityDisplay;
+ existing.initializeDisplayOverrideConfiguration();
return existing;
}
- final DisplayContent dc = new DisplayContent(display, mWmService, controller);
+ final DisplayContent dc = new DisplayContent(display, mWmService, activityDisplay);
if (DEBUG_DISPLAY) Slog.v(TAG_WM, "Adding display=" + display);
mWmService.mDisplayWindowSettings.applySettingsToDisplayLocked(dc);
- initializeDisplayOverrideConfiguration(controller, dc);
+ dc.initializeDisplayOverrideConfiguration();
if (mWmService.mDisplayManagerInternal != null) {
mWmService.mDisplayManagerInternal.setDisplayInfoOverrideFromWindowManager(
@@ -256,19 +256,6 @@
return dc;
}
- /**
- * The display content may have configuration set from {@link #DisplayWindowSettings}. This
- * callback let the owner of container know there is existing configuration to prevent the
- * values from being replaced by the initializing {@link #ActivityDisplay}.
- */
- private void initializeDisplayOverrideConfiguration(DisplayWindowController controller,
- DisplayContent displayContent) {
- if (controller != null && controller.mListener != null) {
- controller.mListener.onInitializeOverrideConfiguration(
- displayContent.getRequestedOverrideConfiguration());
- }
- }
-
boolean isLayoutNeeded() {
final int numDisplays = mChildren.size();
for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
@@ -1040,7 +1027,7 @@
void positionChildAt(int position, DisplayContent child, boolean includingParents) {
super.positionChildAt(position, child, includingParents);
if (mRootActivityContainer != null) {
- mRootActivityContainer.onChildPositionChanged(child.getController(), position);
+ mRootActivityContainer.onChildPositionChanged(child.mAcitvityDisplay, position);
}
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
index 3a56419..f553c35 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
@@ -408,6 +408,7 @@
initialize(intentFirewall, intentController, looper);
initRootActivityContainerMocks(wm);
setWindowManager(wm);
+ createDefaultDisplay();
}
void initRootActivityContainerMocks(WindowManagerService wm) {
@@ -424,7 +425,9 @@
// Called when moving activity to pinned stack.
doNothing().when(mRootActivityContainer).ensureActivitiesVisible(any(), anyInt(),
anyBoolean());
+ }
+ void createDefaultDisplay() {
// Create a default display and put a home stack on it so that we'll always have
// something focusable.
mDefaultDisplay = TestActivityDisplay.create(mStackSupervisor, DEFAULT_DISPLAY);
@@ -598,10 +601,8 @@
}
@Override
- protected DisplayWindowController createWindowContainerController() {
- DisplayWindowController out = mock(DisplayWindowController.class);
- out.mContainer = WindowTestUtils.createTestDisplayContent();
- return out;
+ protected DisplayContent createDisplayContent() {
+ return WindowTestUtils.createTestDisplayContent();
}
void removeAllTasks() {
@@ -616,6 +617,7 @@
private static WindowManagerService prepareMockWindowManager() {
final WindowManagerService service = mock(WindowManagerService.class);
+ service.mRoot = mock(RootWindowContainer.class);
doAnswer((InvocationOnMock invocationOnMock) -> {
final Runnable runnable = invocationOnMock.<Runnable>getArgument(0);
diff --git a/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java b/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java
index 577859c..fa42289 100644
--- a/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java
@@ -80,7 +80,7 @@
@Test
public void testForceOverride() {
mWm.prepareAppTransition(TRANSIT_KEYGUARD_UNOCCLUDE, false /* alwaysKeepCurrent */);
- mDc.getController().prepareAppTransition(TRANSIT_ACTIVITY_OPEN,
+ mDc.prepareAppTransition(TRANSIT_ACTIVITY_OPEN,
false /* alwaysKeepCurrent */, 0 /* flags */, true /* forceOverride */);
assertEquals(TRANSIT_ACTIVITY_OPEN, mDc.mAppTransition.getAppTransition());
}
@@ -102,8 +102,8 @@
@Test
public void testAppTransitionStateForMultiDisplay() {
// Create 2 displays & presume both display the state is ON for ready to display & animate.
- final DisplayContent dc1 = createNewDisplayWithController(Display.STATE_ON);
- final DisplayContent dc2 = createNewDisplayWithController(Display.STATE_ON);
+ final DisplayContent dc1 = createNewDisplay(Display.STATE_ON);
+ final DisplayContent dc2 = createNewDisplay(Display.STATE_ON);
// Create 2 app window tokens to represent 2 activity window.
final WindowTestUtils.TestAppWindowToken token1 = createTestAppWindowToken(dc1,
@@ -117,10 +117,10 @@
// Simulate activity resume / finish flows to prepare app transition & set visibility,
// make sure transition is set as expected for each display.
- dc1.getController().prepareAppTransition(TRANSIT_ACTIVITY_OPEN,
+ dc1.prepareAppTransition(TRANSIT_ACTIVITY_OPEN,
false /* alwaysKeepCurrent */, 0 /* flags */, false /* forceOverride */);
assertEquals(TRANSIT_ACTIVITY_OPEN, dc1.mAppTransition.getAppTransition());
- dc2.getController().prepareAppTransition(TRANSIT_ACTIVITY_CLOSE,
+ dc2.prepareAppTransition(TRANSIT_ACTIVITY_CLOSE,
false /* alwaysKeepCurrent */, 0 /* flags */, false /* forceOverride */);
assertEquals(TRANSIT_ACTIVITY_CLOSE, dc2.mAppTransition.getAppTransition());
// One activity window is visible for resuming & the other activity window is invisible
@@ -138,8 +138,8 @@
@Test
public void testCleanAppTransitionWhenTaskStackReparent() {
// Create 2 displays & presume both display the state is ON for ready to display & animate.
- final DisplayContent dc1 = createNewDisplayWithController(Display.STATE_ON);
- final DisplayContent dc2 = createNewDisplayWithController(Display.STATE_ON);
+ final DisplayContent dc1 = createNewDisplay(Display.STATE_ON);
+ final DisplayContent dc2 = createNewDisplay(Display.STATE_ON);
final TaskStack stack1 = createTaskStackOnDisplay(dc1);
final Task task1 = createTaskInStack(stack1, 0 /* userId */);
@@ -151,7 +151,7 @@
dc1.mClosingApps.add(token1);
assertTrue(dc1.mClosingApps.size() > 0);
- dc1.getController().prepareAppTransition(TRANSIT_ACTIVITY_OPEN,
+ dc1.prepareAppTransition(TRANSIT_ACTIVITY_OPEN,
false /* alwaysKeepCurrent */, 0 /* flags */, false /* forceOverride */);
assertEquals(TRANSIT_ACTIVITY_OPEN, dc1.mAppTransition.getAppTransition());
assertTrue(dc1.mAppTransition.isTransitionSet());
diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java
index 3c7b4b1..3e025f6 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java
@@ -875,8 +875,8 @@
}
@Override
- void initRootActivityContainerMocks(WindowManagerService wm) {
- super.initRootActivityContainerMocks(wm);
+ void createDefaultDisplay() {
+ super.createDefaultDisplay();
mDisplay = mRootActivityContainer.getActivityDisplay(DEFAULT_DISPLAY);
mOtherDisplay = TestActivityDisplay.create(mTestStackSupervisor, DEFAULT_DISPLAY + 1);
mRootActivityContainer.addChild(mOtherDisplay, ActivityDisplay.POSITION_TOP);
diff --git a/services/tests/wmtests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java
index 612f9ad..8854ede 100644
--- a/services/tests/wmtests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java
@@ -49,7 +49,7 @@
mDisplayContent.mUnknownAppVisibilityController.notifyRelayouted(token);
// Make sure our handler processed the message.
- SystemClock.sleep(100);
+ mWm.mH.runWithScissors(() -> { }, 0);
assertTrue(mDisplayContent.mUnknownAppVisibilityController.allResolved());
}
@@ -65,7 +65,7 @@
mDisplayContent.mUnknownAppVisibilityController.notifyRelayouted(token2);
// Make sure our handler processed the message.
- SystemClock.sleep(100);
+ mWm.mH.runWithScissors(() -> { }, 0);
assertTrue(mDisplayContent.mUnknownAppVisibilityController.allResolved());
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java b/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java
index 50fd188..522ab9f 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java
@@ -149,10 +149,9 @@
mService.onInitReady();
final Display display = mService.mDisplayManager.getDisplay(DEFAULT_DISPLAY);
- final DisplayWindowController dcw = new DisplayWindowController(display, mService);
// Display creation is driven by the ActivityManagerService via
// ActivityStackSupervisor. We emulate those steps here.
- mService.mRoot.createDisplayContent(display, dcw);
+ mService.mRoot.createDisplayContent(display, mock(ActivityDisplay.class));
}
private void removeServices() {
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java b/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java
index aa0ecf8..65e1835 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java
@@ -58,8 +58,8 @@
public static class TestDisplayContent extends DisplayContent {
private TestDisplayContent(Display display, WindowManagerService service,
- DisplayWindowController controller) {
- super(display, service, controller);
+ ActivityDisplay activityDisplay) {
+ super(display, service, activityDisplay);
}
/**
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
index 4394f9a..5c3368b 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
@@ -360,21 +360,17 @@
final Display display = new Display(DisplayManagerGlobal.getInstance(), displayId,
displayInfo, DEFAULT_DISPLAY_ADJUSTMENTS);
synchronized (mWm.mGlobalLock) {
- return new DisplayContent(display, mWm, mock(DisplayWindowController.class));
+ return new DisplayContent(display, mWm, mock(ActivityDisplay.class));
}
}
/**
* Creates a {@link DisplayContent} with given display state and adds it to the system.
*
- * Unlike {@link #createNewDisplay()} that uses a mock {@link DisplayWindowController} to
- * initialize {@link DisplayContent}, this method used real controller object when the test
- * need to verify its related flows.
- *
* @param displayState For initializing the state of the display. See
* {@link Display#getState()}.
*/
- DisplayContent createNewDisplayWithController(int displayState) {
+ DisplayContent createNewDisplay(int displayState) {
// Leverage main display info & initialize it with display state for given displayId.
DisplayInfo displayInfo = new DisplayInfo();
displayInfo.copyFrom(mDisplayInfo);
@@ -382,11 +378,11 @@
final int displayId = sNextDisplayId++;
final Display display = new Display(DisplayManagerGlobal.getInstance(), displayId,
displayInfo, DEFAULT_DISPLAY_ADJUSTMENTS);
- final DisplayWindowController dcw = new DisplayWindowController(display, mWm);
synchronized (mWm.mGlobalLock) {
// Display creation is driven by DisplayWindowController via ActivityStackSupervisor.
// We skip those steps here.
- return mWm.mRoot.createDisplayContent(display, dcw);
+ final ActivityDisplay mockAd = mock(ActivityDisplay.class);
+ return mWm.mRoot.createDisplayContent(display, mockAd);
}
}