diff options
14 files changed, 170 insertions, 375 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 5e644d3b06ce..008620e0144f 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -7187,7 +7187,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A Slog.v(TAG, "Eval win " + w + ": isDrawn=" + w.isDrawn() + ", isAnimationSet=" + isAnimationSet); if (!w.isDrawn()) { - Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurfaceController + Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurfaceControl + " pv=" + w.isVisibleByPolicy() + " mDrawState=" + winAnimator.drawStateToString() + " ph=" + w.isParentWindowHidden() + " th=" + mVisibleRequested diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 3652c4d11cb3..93711497f590 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -4082,12 +4082,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp final Transaction t = mWmService.mTransactionFactory.get(); forAllWindows(w -> { final WindowStateAnimator wsa = w.mWinAnimator; - if (wsa.mSurfaceController == null) { + if (wsa.mSurfaceControl == null) { return; } if (!mWmService.mSessions.contains(wsa.mSession)) { Slog.w(TAG_WM, "LEAKED SURFACE (session doesn't exist): " - + w + " surface=" + wsa.mSurfaceController + + w + " surface=" + wsa.mSurfaceControl + " token=" + w.mToken + " pid=" + w.mSession.mPid + " uid=" + w.mSession.mUid); @@ -4096,7 +4096,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mTmpWindow = w; } else if (w.mActivityRecord != null && !w.mActivityRecord.isClientVisible()) { Slog.w(TAG_WM, "LEAKED SURFACE (app token hidden): " - + w + " surface=" + wsa.mSurfaceController + + w + " surface=" + wsa.mSurfaceControl + " token=" + w.mActivityRecord); ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE LEAK DESTROY: %s", w); wsa.destroySurface(t); diff --git a/services/core/java/com/android/server/wm/InputMonitor.java b/services/core/java/com/android/server/wm/InputMonitor.java index 74dbd15d1399..b496a65ba4a6 100644 --- a/services/core/java/com/android/server/wm/InputMonitor.java +++ b/services/core/java/com/android/server/wm/InputMonitor.java @@ -623,7 +623,7 @@ final class InputMonitor { // occlusion detection depending on the type or if it's a trusted overlay. populateOverlayInputInfo(inputWindowHandle, w); setInputWindowInfoIfNeeded(mInputTransaction, - w.mWinAnimator.mSurfaceController.mSurfaceControl, inputWindowHandle); + w.mWinAnimator.mSurfaceControl, inputWindowHandle); return; } // Skip this window because it cannot possibly receive input. @@ -687,7 +687,7 @@ final class InputMonitor { if (w.mWinAnimator.hasSurface()) { populateInputWindowHandle(inputWindowHandle, w); setInputWindowInfoIfNeeded(mInputTransaction, - w.mWinAnimator.mSurfaceController.mSurfaceControl, inputWindowHandle); + w.mWinAnimator.mSurfaceControl, inputWindowHandle); } } } diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java index 99697de6e2fa..f2ccbc4e1aeb 100644 --- a/services/core/java/com/android/server/wm/RootWindowContainer.java +++ b/services/core/java/com/android/server/wm/RootWindowContainer.java @@ -667,7 +667,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent> boolean reclaimSomeSurfaceMemory(WindowStateAnimator winAnimator, String operation, boolean secure) { - final WindowSurfaceController surfaceController = winAnimator.mSurfaceController; + final SurfaceControl surfaceControl = winAnimator.mSurfaceControl; boolean leakedSurface = false; boolean killedApps = false; EventLogTags.writeWmNoSurfaceMemory(winAnimator.mWin.toString(), @@ -692,7 +692,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent> return; } final WindowStateAnimator wsa = w.mWinAnimator; - if (wsa.mSurfaceController != null) { + if (wsa.mSurfaceControl != null) { pidCandidates.append(wsa.mSession.mPid, wsa.mSession.mPid); } }, false /* traverseTopToBottom */); @@ -717,7 +717,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent> // app to request another one. Slog.w(TAG_WM, "Looks like we have reclaimed some memory, clearing surface for retry."); - if (surfaceController != null) { + if (surfaceControl != null) { ProtoLog.i(WM_SHOW_SURFACE_ALLOC, "SURFACE RECOVER DESTROY: %s", winAnimator.mWin); SurfaceControl.Transaction t = mWmService.mTransactionFactory.get(); diff --git a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java index 31fda77a8a7d..db0374e52b1a 100644 --- a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java +++ b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java @@ -324,7 +324,7 @@ class ScreenRotationAnimation { if (!w.mToken.mRoundedCornerOverlay || !w.isVisible() || !w.mWinAnimator.hasSurface()) { return; } - t.setSkipScreenshot(w.mWinAnimator.mSurfaceController.mSurfaceControl, skipScreenshot); + t.setSkipScreenshot(w.mWinAnimator.mSurfaceControl, skipScreenshot); }, false); if (!skipScreenshot) { // Use sync apply to apply the change immediately, so that the next diff --git a/services/core/java/com/android/server/wm/Session.java b/services/core/java/com/android/server/wm/Session.java index 75e3e6547aa8..f5108f5bc93f 100644 --- a/services/core/java/com/android/server/wm/Session.java +++ b/services/core/java/com/android/server/wm/Session.java @@ -109,8 +109,8 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { private final String mStringName; SurfaceSession mSurfaceSession; private final ArrayList<WindowState> mAddedWindows = new ArrayList<>(); - /** Set of visible alert/app-overlay window surfaces connected to this session. */ - private final ArraySet<WindowSurfaceController> mAlertWindowSurfaces = new ArraySet<>(); + /** Set of visible alert/app-overlay windows connected to this session. */ + private final ArraySet<WindowState> mAlertWindows = new ArraySet<>(); private final DragDropController mDragDropController; final boolean mCanAddInternalSystemWindow; boolean mCanForceShowingInsets; @@ -769,9 +769,8 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { return !mAddedWindows.isEmpty(); } - void onWindowSurfaceVisibilityChanged(WindowSurfaceController surfaceController, - boolean visible, int type) { - + void onWindowSurfaceVisibilityChanged(WindowState window, boolean visible) { + final int type = window.mAttrs.type; if (!isSystemAlertWindowType(type)) { return; } @@ -782,7 +781,7 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { final boolean noSystemOverlayPermission = !mCanAddInternalSystemWindow && !mCanCreateSystemApplicationOverlay; if (visible) { - changed = mAlertWindowSurfaces.add(surfaceController); + changed = mAlertWindows.add(window); if (type == TYPE_APPLICATION_OVERLAY) { MetricsLoggerWrapper.logAppOverlayEnter(mUid, mPackageName, changed, type, false /* set false to only log for TYPE_APPLICATION_OVERLAY */); @@ -791,7 +790,7 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { true /* only log for non-TYPE_APPLICATION_OVERLAY */); } } else { - changed = mAlertWindowSurfaces.remove(surfaceController); + changed = mAlertWindows.remove(window); if (type == TYPE_APPLICATION_OVERLAY) { MetricsLoggerWrapper.logAppOverlayExit(mUid, mPackageName, changed, type, false /* set false to only log for TYPE_APPLICATION_OVERLAY */); @@ -802,7 +801,7 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { } if (changed && noSystemOverlayPermission) { - if (mAlertWindowSurfaces.isEmpty()) { + if (mAlertWindows.isEmpty()) { cancelAlertWindowNotification(); } else if (mAlertWindowNotification == null && !isSatellitePointingUiPackage()) { mAlertWindowNotification = new AlertWindowNotification(mService, mPackageName); @@ -815,7 +814,7 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { if (changed && mPid != WindowManagerService.MY_PID) { // Notify activity manager that the process contains overlay/alert windows, so it can // adjust the importance score for the process. - setHasOverlayUi(!mAlertWindowSurfaces.isEmpty()); + setHasOverlayUi(!mAlertWindows.isEmpty()); } } @@ -859,7 +858,7 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { } mSurfaceSession = null; mAddedWindows.clear(); - mAlertWindowSurfaces.clear(); + mAlertWindows.clear(); setHasOverlayUi(false); cancelAlertWindowNotification(); } @@ -880,7 +879,7 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { void dump(PrintWriter pw, String prefix) { pw.print(prefix); pw.print("numWindow="); pw.print(mAddedWindows.size()); pw.print(" mCanAddInternalSystemWindow="); pw.print(mCanAddInternalSystemWindow); - pw.print(" mAlertWindowSurfaces="); pw.print(mAlertWindowSurfaces); + pw.print(" mAlertWindows="); pw.print(mAlertWindows); pw.print(" mClientDead="); pw.print(mClientDead); pw.print(" mSurfaceSession="); pw.println(mSurfaceSession); pw.print(prefix); pw.print("mPackageName="); pw.println(mPackageName); @@ -896,9 +895,9 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { /** @return {@code true} if there is an alert window surface on the given display. */ boolean hasAlertWindowSurfaces(DisplayContent displayContent) { - for (int i = mAlertWindowSurfaces.size() - 1; i >= 0; i--) { - final WindowSurfaceController surfaceController = mAlertWindowSurfaces.valueAt(i); - if (surfaceController.mAnimator.mWin.getDisplayContent() == displayContent) { + for (int i = mAlertWindows.size() - 1; i >= 0; i--) { + final WindowState window = mAlertWindows.valueAt(i); + if (window.mDisplayContent == displayContent) { return true; } } diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 803312214fc3..a8f406026206 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -2569,7 +2569,7 @@ public class WindowManagerService extends IWindowManager.Stub // surface, let the client use that, but don't create new surface at this // point. Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "relayoutWindow: getSurface"); - winAnimator.mSurfaceController.getSurfaceControl(outSurfaceControl); + winAnimator.getSurfaceControl(outSurfaceControl); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } else { if (DEBUG_VISIBILITY) Slog.i(TAG_WM, "Releasing surface in: " + win); @@ -2765,15 +2765,15 @@ public class WindowManagerService extends IWindowManager.Stub result |= RELAYOUT_RES_SURFACE_CHANGED; } - WindowSurfaceController surfaceController; + SurfaceControl surfaceControl; try { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "createSurfaceControl"); - surfaceController = winAnimator.createSurfaceLocked(); + surfaceControl = winAnimator.createSurfaceLocked(); } finally { Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } - if (surfaceController != null) { - surfaceController.getSurfaceControl(outSurfaceControl); + if (surfaceControl != null) { + winAnimator.getSurfaceControl(outSurfaceControl); ProtoLog.i(WM_SHOW_TRANSACTIONS, "OUT SURFACE %s: copied", outSurfaceControl); } else { @@ -6772,11 +6772,11 @@ public class WindowManagerService extends IWindowManager.Stub if (windowState == null) { return false; } - WindowSurfaceController surfaceController = windowState.mWinAnimator.mSurfaceController; - if (surfaceController == null) { + final SurfaceControl surfaceControl = windowState.mWinAnimator.mSurfaceControl; + if (surfaceControl == null) { return false; } - return surfaceController.clearWindowContentFrameStats(); + return surfaceControl.clearContentFrameStats(); } } @@ -6791,15 +6791,15 @@ public class WindowManagerService extends IWindowManager.Stub if (windowState == null) { return null; } - WindowSurfaceController surfaceController = windowState.mWinAnimator.mSurfaceController; - if (surfaceController == null) { + final SurfaceControl surfaceControl = windowState.mWinAnimator.mSurfaceControl; + if (surfaceControl == null) { return null; } if (mTempWindowRenderStats == null) { mTempWindowRenderStats = new WindowContentFrameStats(); } WindowContentFrameStats stats = mTempWindowRenderStats; - if (!surfaceController.getWindowContentFrameStats(stats)) { + if (!surfaceControl.getContentFrameStats(stats)) { return null; } return stats; diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index de73e6cfad12..1461c89c4a98 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -1497,7 +1497,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP if (isDrawn()) { ProtoLog.v(WM_DEBUG_ORIENTATION, "Orientation not waiting for draw in %s, surfaceController %s", this, - winAnimator.mSurfaceController); + winAnimator.mSurfaceControl); setOrientationChanging(false); mLastFreezeDuration = (int)(SystemClock.elapsedRealtime() - mWmService.mDisplayFreezeTime); @@ -2417,7 +2417,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP ProtoLog.v(WM_DEBUG_FOCUS, "Remove client=%x, surfaceController=%s Callers=%s", System.identityHashCode(mClient.asBinder()), - mWinAnimator.mSurfaceController, + mWinAnimator.mSurfaceControl, Debug.getCallers(5)); final DisplayContent displayContent = getDisplayContent(); @@ -2428,10 +2428,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mOnBackInvokedCallbackInfo = null; ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, - "Remove %s: mSurfaceController=%s mAnimatingExit=%b mRemoveOnExit=%b " + "Remove %s: mSurfaceControl=%s mAnimatingExit=%b mRemoveOnExit=%b " + "mHasSurface=%b surfaceShowing=%b animating=%b app-animation=%b " + "mDisplayFrozen=%b callers=%s", - this, mWinAnimator.mSurfaceController, mAnimatingExit, mRemoveOnExit, + this, mWinAnimator.mSurfaceControl, mAnimatingExit, mRemoveOnExit, mHasSurface, mWinAnimator.getShown(), isAnimating(TRANSITION | PARENTS), mActivityRecord != null && mActivityRecord.isAnimating(PARENTS | TRANSITION), @@ -2608,7 +2608,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP + isVisibleRequestedOrAdding() + " isVisible: " + (isVisible() && mActivityRecord != null && mActivityRecord.isVisible())); if (!isVisibleRequestedOrAdding()) { - Slog.i(TAG_WM, " mSurfaceController=" + mWinAnimator.mSurfaceController + Slog.i(TAG_WM, " mSurfaceControl=" + mWinAnimator.mSurfaceControl + " relayoutCalled=" + mRelayoutCalled + " viewVis=" + mViewVisibility + " policyVis=" + isVisibleByPolicy() @@ -4434,7 +4434,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP for (int i = mChildren.size() - 1; i >= 0; --i) { final WindowState c = mChildren.get(i); - if (c.mWinAnimator.mSurfaceController != null) { + if (c.mWinAnimator.mSurfaceControl != null) { c.performShowLocked(); // It hadn't been shown, which means layout not performed on it, so now we // want to make sure to do a layout. If called from within the transaction @@ -4891,7 +4891,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP Slog.v(TAG, "Win " + this + ": isDrawn=" + isDrawn() + ", animating=" + isAnimating(TRANSITION | PARENTS)); if (!isDrawn()) { - Slog.v(TAG, "Not displayed: s=" + mWinAnimator.mSurfaceController + Slog.v(TAG, "Not displayed: s=" + mWinAnimator.mSurfaceControl + " pv=" + isVisibleByPolicy() + " mDrawState=" + mWinAnimator.mDrawState + " ph=" + isParentWindowHidden() @@ -5512,13 +5512,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // been defined and so we can use static layers and leave it that way. if (w.mAttrs.type == TYPE_APPLICATION_MEDIA) { if (mWinAnimator.hasSurface()) { - w.assignRelativeLayer(t, mWinAnimator.mSurfaceController.mSurfaceControl, -2); + w.assignRelativeLayer(t, mWinAnimator.mSurfaceControl, -2); } else { w.assignLayer(t, -2); } } else if (w.mAttrs.type == TYPE_APPLICATION_MEDIA_OVERLAY) { if (mWinAnimator.hasSurface()) { - w.assignRelativeLayer(t, mWinAnimator.mSurfaceController.mSurfaceControl, -1); + w.assignRelativeLayer(t, mWinAnimator.mSurfaceControl, -1); } else { w.assignLayer(t, -1); } @@ -5694,7 +5694,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } SurfaceControl getClientViewRootSurface() { - return mWinAnimator.getSurfaceControl(); + return mWinAnimator.mSurfaceControl; } /** Drops a buffer for this window's view-root from a transaction */ @@ -6094,11 +6094,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } getPendingTransaction().setSecure(mSurfaceControl, isSecure); } else { - if (mWinAnimator.mSurfaceController == null - || mWinAnimator.mSurfaceController.mSurfaceControl == null) { + if (mWinAnimator.mSurfaceControl == null) { return; } - getPendingTransaction().setSecure(mWinAnimator.mSurfaceController.mSurfaceControl, + getPendingTransaction().setSecure(mWinAnimator.mSurfaceControl, isSecure); } if (mDisplayContent != null) { diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index 397a6357fb66..24a2a626fe50 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -16,6 +16,10 @@ package com.android.server.wm; +import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; +import static android.view.SurfaceControl.METADATA_OWNER_PID; +import static android.view.SurfaceControl.METADATA_OWNER_UID; +import static android.view.SurfaceControl.METADATA_WINDOW_TYPE; import static android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; @@ -44,6 +48,7 @@ import static com.android.server.wm.WindowManagerService.logWithStack; import static com.android.server.wm.WindowStateAnimatorProto.DRAW_STATE; import static com.android.server.wm.WindowStateAnimatorProto.SURFACE; import static com.android.server.wm.WindowStateAnimatorProto.SYSTEM_DECOR_RECT; +import static com.android.server.wm.WindowSurfaceControllerProto.SHOWN; import static com.android.window.flags.Flags.secureWindowState; import static com.android.window.flags.Flags.setScPropertiesInClient; @@ -52,6 +57,7 @@ import android.graphics.PixelFormat; import android.graphics.Rect; import android.os.Debug; import android.os.Trace; +import android.util.EventLog; import android.util.Slog; import android.util.proto.ProtoOutputStream; import android.view.Surface.OutOfResourcesException; @@ -95,12 +101,13 @@ class WindowStateAnimator { final Session mSession; final WindowManagerPolicy mPolicy; final Context mContext; - final boolean mIsWallpaper; private final WallpaperController mWallpaperControllerLocked; boolean mAnimationIsEntrance; - WindowSurfaceController mSurfaceController; + SurfaceControl mSurfaceControl; + private boolean mSurfaceShown; + private String mTitle; float mShownAlpha = 0; float mAlpha = 0; @@ -164,7 +171,6 @@ class WindowStateAnimator { mWin = win; mSession = win.mSession; mAttrType = win.mAttrs.type; - mIsWallpaper = win.mIsWallpaper; mWallpaperControllerLocked = win.getDisplayContent().mWallpaperController; } @@ -198,16 +204,32 @@ class WindowStateAnimator { } void hide(SurfaceControl.Transaction transaction, String reason) { - if (!mLastHidden) { - //dump(); - mLastHidden = true; + if (mLastHidden) { + return; + } + mLastHidden = true; + if (mSurfaceControl == null || !mSurfaceShown) { + return; + } + ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE HIDE ( %s ): %s", reason, mTitle); - if (mSurfaceController != null) { - mSurfaceController.hide(transaction, reason); - } + setShown(false); + transaction.hide(mSurfaceControl); + if (mWin.mIsWallpaper) { + final DisplayContent dc = mWin.getDisplayContent(); + EventLog.writeEvent(EventLogTags.WM_WALLPAPER_SURFACE, + dc.mDisplayId, 0 /* request hidden */, + String.valueOf(dc.mWallpaperController.getWallpaperTarget())); } } + private void setShown(boolean surfaceShown) { + mSurfaceShown = surfaceShown; + mService.updateNonSystemOverlayWindowsVisibilityIfNeeded(mWin, surfaceShown); + mWin.onSurfaceShownChanged(surfaceShown); + mSession.onWindowSurfaceVisibilityChanged(mWin, mSurfaceShown); + } + boolean finishDrawingLocked(SurfaceControl.Transaction postDrawTransaction) { final boolean startingWindow = mWin.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; @@ -221,7 +243,7 @@ class WindowStateAnimator { if (mDrawState == DRAW_PENDING) { ProtoLog.v(WM_DEBUG_DRAW, "finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING %s in %s", mWin, - mSurfaceController); + mSurfaceControl); if (startingWindow) { ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Draw state now committed in %s", mWin); } @@ -248,7 +270,7 @@ class WindowStateAnimator { return false; } ProtoLog.i(WM_DEBUG_ANIM, "commitFinishDrawingLocked: mDrawState=READY_TO_SHOW %s", - mSurfaceController); + mSurfaceControl); mDrawState = READY_TO_SHOW; boolean result = false; final ActivityRecord activity = mWin.mActivityRecord; @@ -271,11 +293,11 @@ class WindowStateAnimator { } } - WindowSurfaceController createSurfaceLocked() { + SurfaceControl createSurfaceLocked() { final WindowState w = mWin; - if (mSurfaceController != null) { - return mSurfaceController; + if (mSurfaceControl != null) { + return mSurfaceControl; } w.setHasSurface(false); @@ -312,10 +334,22 @@ class WindowStateAnimator { final boolean isHwAccelerated = (attrs.flags & FLAG_HARDWARE_ACCELERATED) != 0; final int format = isHwAccelerated ? PixelFormat.TRANSLUCENT : attrs.format; - mSurfaceController = new WindowSurfaceController(attrs.getTitle().toString(), format, - flags, this, attrs.type); + mTitle = attrs.getTitle().toString(); + Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "new SurfaceControl"); + mSurfaceControl = mWin.makeSurface() + .setParent(mWin.mSurfaceControl) + .setName(mTitle) + .setFormat(format) + .setFlags(flags) + .setMetadata(METADATA_WINDOW_TYPE, attrs.type) + .setMetadata(METADATA_OWNER_UID, mSession.mUid) + .setMetadata(METADATA_OWNER_PID, mSession.mPid) + .setCallsite("WindowSurfaceController") + .setBLASTLayer().build(); + Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); + if (!setScPropertiesInClient()) { - mSurfaceController.setColorSpaceAgnostic(w.getPendingTransaction(), + setColorSpaceAgnosticLocked( (attrs.privateFlags & LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC) != 0); } @@ -326,7 +360,7 @@ class WindowStateAnimator { ProtoLog.i(WM_SHOW_SURFACE_ALLOC, " CREATE SURFACE %s IN SESSION %s: pid=%d format=%d flags=0x%x / %s", - mSurfaceController, mSession.mSurfaceSession, mSession.mPid, attrs.format, + mSurfaceControl, mSession.mSurfaceSession, mSession.mPid, attrs.format, flags, this); } catch (OutOfResourcesException e) { Slog.w(TAG, "OutOfResourcesException creating surface"); @@ -340,7 +374,7 @@ class WindowStateAnimator { } if (DEBUG) { - Slog.v(TAG, "Got surface: " + mSurfaceController + Slog.v(TAG, "Got surface: " + mSurfaceControl + ", set left=" + w.getFrame().left + " top=" + w.getFrame().top); } @@ -353,15 +387,19 @@ class WindowStateAnimator { mLastHidden = true; if (DEBUG) Slog.v(TAG, "Created surface " + this); - return mSurfaceController; + return mSurfaceControl; } boolean hasSurface() { - return mSurfaceController != null && mSurfaceController.hasSurface(); + return mSurfaceControl != null; + } + + void getSurfaceControl(SurfaceControl outSurfaceControl) { + outSurfaceControl.copyFrom(mSurfaceControl, "WindowStateAnimator.getSurfaceControl"); } void destroySurfaceLocked(SurfaceControl.Transaction t) { - if (mSurfaceController == null) { + if (mSurfaceControl == null) { return; } @@ -370,7 +408,7 @@ class WindowStateAnimator { try { if (DEBUG_VISIBILITY) { logWithStack(TAG, "Window " + this + " destroying surface " - + mSurfaceController + ", session " + mSession); + + mSurfaceControl + ", session " + mSession); } ProtoLog.i(WM_SHOW_SURFACE_ALLOC, "SURFACE DESTROY: %s. %s", mWin, new RuntimeException().fillInStackTrace()); @@ -384,23 +422,13 @@ class WindowStateAnimator { } } catch (RuntimeException e) { Slog.w(TAG, "Exception thrown when destroying Window " + this - + " surface " + mSurfaceController + " session " + mSession + ": " + + " surface " + mSurfaceControl + " session " + mSession + ": " + e.toString()); } - - // Whether the surface was preserved (and copied to mPendingDestroySurface) or not, it - // needs to be cleared to match the WindowState.mHasSurface state. It is also necessary - // so it can be recreated successfully in mPendingDestroySurface case. - mWin.setHasSurface(false); - if (mSurfaceController != null) { - mSurfaceController.setShown(false); - } - mSurfaceController = null; - mDrawState = NO_SURFACE; } void computeShownFrameLocked() { - if (mIsWallpaper && mService.mRoot.mWallpaperActionPending) { + if (mWin.mIsWallpaper && mService.mRoot.mWallpaperActionPending) { return; } else if (mWin.isDragResizeChanged()) { // This window is awaiting a relayout because user just started (or ended) @@ -454,14 +482,13 @@ class WindowStateAnimator { mLastAlpha = mShownAlpha; ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE controller=%s alpha=%f HScale=%f, VScale=%f: %s", - mSurfaceController, mShownAlpha, w.mHScale, w.mVScale, w); + mSurfaceControl, mShownAlpha, w.mHScale, w.mVScale, w); - boolean prepared = - mSurfaceController.prepareToShowInTransaction(t, mShownAlpha); + t.setAlpha(mSurfaceControl, mShownAlpha); - if (prepared && mDrawState == HAS_DRAWN) { + if (mDrawState == HAS_DRAWN) { if (mLastHidden) { - mSurfaceController.showRobustly(t); + showRobustly(t); mLastHidden = false; final DisplayContent displayContent = w.getDisplayContent(); if (!displayContent.getLastHasContent()) { @@ -494,18 +521,38 @@ class WindowStateAnimator { } } + private void showRobustly(SurfaceControl.Transaction t) { + if (mSurfaceShown) { + return; + } + + ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE SHOW (performLayout): %s", mTitle); + if (DEBUG_VISIBILITY) Slog.v(TAG, "Showing " + this + " during relayout"); + setShown(true); + t.show(mSurfaceControl); + if (mWin.mIsWallpaper) { + final DisplayContent dc = mWin.mDisplayContent; + EventLog.writeEvent(EventLogTags.WM_WALLPAPER_SURFACE, + dc.mDisplayId, 1 /* request shown */, + String.valueOf(dc.mWallpaperController.getWallpaperTarget())); + } + } + void setOpaqueLocked(boolean isOpaque) { - if (mSurfaceController == null) { + if (mSurfaceControl == null) { return; } - mSurfaceController.setOpaque(isOpaque); + ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE isOpaque=%b: %s", isOpaque, mTitle); + mWin.getPendingTransaction().setOpaque(mSurfaceControl, isOpaque); + mService.scheduleAnimationLocked(); } void setColorSpaceAgnosticLocked(boolean agnostic) { - if (mSurfaceController == null) { + if (mSurfaceControl == null) { return; } - mSurfaceController.setColorSpaceAgnostic(mWin.getPendingTransaction(), agnostic); + ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE isColorSpaceAgnostic=%b: %s", agnostic, mTitle); + mWin.getPendingTransaction().setColorSpaceAgnostic(mSurfaceControl, agnostic); } void applyEnterAnimationLocked() { @@ -521,7 +568,7 @@ class WindowStateAnimator { // should be controlled by ActivityRecord in general. Wallpaper is also excluded because // WallpaperController should handle it. Also skip play enter animation for the window // below starting window. - if (mAttrType != TYPE_BASE_APPLICATION && !mIsWallpaper + if (mAttrType != TYPE_BASE_APPLICATION && !mWin.mIsWallpaper && !(mWin.mActivityRecord != null && mWin.mActivityRecord.hasStartingWindow())) { applyAnimationLocked(transit, true); } @@ -614,8 +661,10 @@ class WindowStateAnimator { void dumpDebug(ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); - if (mSurfaceController != null) { - mSurfaceController.dumpDebug(proto, SURFACE); + if (mSurfaceControl != null) { + final long dumpToken = proto.start(SURFACE); + proto.write(SHOWN, mSurfaceShown); + proto.end(dumpToken); } proto.write(DRAW_STATE, mDrawState); mSystemDecorRect.dumpDebug(proto, SYSTEM_DECOR_RECT); @@ -626,8 +675,11 @@ class WindowStateAnimator { if (mAnimationIsEntrance) { pw.print(prefix); pw.print(" mAnimationIsEntrance="); pw.print(mAnimationIsEntrance); } - if (mSurfaceController != null) { - mSurfaceController.dump(pw, prefix, dumpAll); + if (mSurfaceControl != null) { + if (dumpAll) { + pw.print(prefix); pw.print("mSurface="); pw.println(mSurfaceControl); + } + pw.print(prefix); pw.print("Surface: shown="); pw.print(mSurfaceShown); } if (dumpAll) { pw.print(prefix); pw.print("mDrawState="); pw.print(drawStateToString()); @@ -659,31 +711,24 @@ class WindowStateAnimator { } boolean getShown() { - if (mSurfaceController != null) { - return mSurfaceController.getShown(); - } - return false; + return mSurfaceControl != null && mSurfaceShown; } void destroySurface(SurfaceControl.Transaction t) { - try { - if (mSurfaceController != null) { - mSurfaceController.destroy(t); - } - } catch (RuntimeException e) { - Slog.w(TAG, "Exception thrown when destroying surface " + this - + " surface " + mSurfaceController + " session " + mSession + ": " + e); - } finally { - mWin.setHasSurface(false); - mSurfaceController = null; - mDrawState = NO_SURFACE; + if (mSurfaceControl == null) { + return; } - } - - SurfaceControl getSurfaceControl() { - if (!hasSurface()) { - return null; + ProtoLog.i(WM_SHOW_SURFACE_ALLOC, + "Destroying surface %s called by %s", this, Debug.getCallers(8)); + if (mWin.mIsWallpaper && !mWin.mWindowRemovalAllowed && !mWin.mRemoveOnExit) { + // The wallpaper surface should have the same lifetime as its window. + Slog.e(TAG, "Unexpected removing wallpaper surface of " + mWin + + " by " + Debug.getCallers(8)); } - return mSurfaceController.mSurfaceControl; + t.remove(mSurfaceControl); + setShown(false); + mSurfaceControl = null; + mWin.setHasSurface(false); + mDrawState = NO_SURFACE; } } diff --git a/services/core/java/com/android/server/wm/WindowSurfaceController.java b/services/core/java/com/android/server/wm/WindowSurfaceController.java deleted file mode 100644 index d9766e0dfa61..000000000000 --- a/services/core/java/com/android/server/wm/WindowSurfaceController.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (C) 2015 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.os.Trace.TRACE_TAG_WINDOW_MANAGER; -import static android.view.SurfaceControl.METADATA_OWNER_PID; -import static android.view.SurfaceControl.METADATA_OWNER_UID; -import static android.view.SurfaceControl.METADATA_WINDOW_TYPE; - -import static com.android.internal.protolog.ProtoLogGroup.WM_SHOW_SURFACE_ALLOC; -import static com.android.internal.protolog.ProtoLogGroup.WM_SHOW_TRANSACTIONS; -import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_VISIBILITY; -import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME; -import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; -import static com.android.server.wm.WindowSurfaceControllerProto.SHOWN; - -import android.os.Debug; -import android.os.Trace; -import android.util.EventLog; -import android.util.Slog; -import android.util.proto.ProtoOutputStream; -import android.view.SurfaceControl; -import android.view.WindowContentFrameStats; - -import com.android.internal.protolog.ProtoLog; - -import java.io.PrintWriter; - -class WindowSurfaceController { - static final String TAG = TAG_WITH_CLASS_NAME ? "WindowSurfaceController" : TAG_WM; - - final WindowStateAnimator mAnimator; - - SurfaceControl mSurfaceControl; - - // Should only be set from within setShown(). - private boolean mSurfaceShown = false; - - private final String title; - - private final WindowManagerService mService; - - private final int mWindowType; - private final Session mWindowSession; - - - WindowSurfaceController(String name, int format, int flags, WindowStateAnimator animator, - int windowType) { - mAnimator = animator; - - title = name; - - mService = animator.mService; - final WindowState win = animator.mWin; - mWindowType = windowType; - mWindowSession = win.mSession; - - Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "new SurfaceControl"); - mSurfaceControl = win.makeSurface() - .setParent(win.getSurfaceControl()) - .setName(name) - .setFormat(format) - .setFlags(flags) - .setMetadata(METADATA_WINDOW_TYPE, windowType) - .setMetadata(METADATA_OWNER_UID, mWindowSession.mUid) - .setMetadata(METADATA_OWNER_PID, mWindowSession.mPid) - .setCallsite("WindowSurfaceController") - .setBLASTLayer().build(); - - Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); - } - - void hide(SurfaceControl.Transaction transaction, String reason) { - ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE HIDE ( %s ): %s", reason, title); - - if (mSurfaceShown) { - hideSurface(transaction); - } - } - - private void hideSurface(SurfaceControl.Transaction transaction) { - if (mSurfaceControl == null) { - return; - } - setShown(false); - try { - transaction.hide(mSurfaceControl); - if (mAnimator.mIsWallpaper) { - final DisplayContent dc = mAnimator.mWin.getDisplayContent(); - EventLog.writeEvent(EventLogTags.WM_WALLPAPER_SURFACE, - dc.mDisplayId, 0 /* request hidden */, - String.valueOf(dc.mWallpaperController.getWallpaperTarget())); - } - } catch (RuntimeException e) { - Slog.w(TAG, "Exception hiding surface in " + this); - } - } - - void destroy(SurfaceControl.Transaction t) { - ProtoLog.i(WM_SHOW_SURFACE_ALLOC, - "Destroying surface %s called by %s", this, Debug.getCallers(8)); - try { - if (mSurfaceControl != null) { - if (mAnimator.mIsWallpaper && !mAnimator.mWin.mWindowRemovalAllowed - && !mAnimator.mWin.mRemoveOnExit) { - // The wallpaper surface should have the same lifetime as its window. - Slog.e(TAG, "Unexpected removing wallpaper surface of " + mAnimator.mWin - + " by " + Debug.getCallers(8)); - } - t.remove(mSurfaceControl); - } - } catch (RuntimeException e) { - Slog.w(TAG, "Error destroying surface in: " + this, e); - } finally { - setShown(false); - mSurfaceControl = null; - } - } - - boolean prepareToShowInTransaction(SurfaceControl.Transaction t, float alpha) { - if (mSurfaceControl == null) { - return false; - } - - t.setAlpha(mSurfaceControl, alpha); - return true; - } - - void setOpaque(boolean isOpaque) { - ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE isOpaque=%b: %s", isOpaque, title); - - if (mSurfaceControl == null) { - return; - } - - mAnimator.mWin.getPendingTransaction().setOpaque(mSurfaceControl, isOpaque); - mService.scheduleAnimationLocked(); - } - - void setColorSpaceAgnostic(SurfaceControl.Transaction t, boolean agnostic) { - ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE isColorSpaceAgnostic=%b: %s", agnostic, title); - - if (mSurfaceControl == null) { - return; - } - t.setColorSpaceAgnostic(mSurfaceControl, agnostic); - } - - void showRobustly(SurfaceControl.Transaction t) { - ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE SHOW (performLayout): %s", title); - if (DEBUG_VISIBILITY) Slog.v(TAG, "Showing " + this - + " during relayout"); - - if (mSurfaceShown) { - return; - } - - setShown(true); - t.show(mSurfaceControl); - if (mAnimator.mIsWallpaper) { - final DisplayContent dc = mAnimator.mWin.getDisplayContent(); - EventLog.writeEvent(EventLogTags.WM_WALLPAPER_SURFACE, - dc.mDisplayId, 1 /* request shown */, - String.valueOf(dc.mWallpaperController.getWallpaperTarget())); - } - } - - boolean clearWindowContentFrameStats() { - if (mSurfaceControl == null) { - return false; - } - return mSurfaceControl.clearContentFrameStats(); - } - - boolean getWindowContentFrameStats(WindowContentFrameStats outStats) { - if (mSurfaceControl == null) { - return false; - } - return mSurfaceControl.getContentFrameStats(outStats); - } - - boolean hasSurface() { - return mSurfaceControl != null; - } - - void getSurfaceControl(SurfaceControl outSurfaceControl) { - outSurfaceControl.copyFrom(mSurfaceControl, "WindowSurfaceController.getSurfaceControl"); - } - - boolean getShown() { - return mSurfaceShown; - } - - void setShown(boolean surfaceShown) { - mSurfaceShown = surfaceShown; - - mService.updateNonSystemOverlayWindowsVisibilityIfNeeded(mAnimator.mWin, surfaceShown); - - mAnimator.mWin.onSurfaceShownChanged(surfaceShown); - - if (mWindowSession != null) { - mWindowSession.onWindowSurfaceVisibilityChanged(this, mSurfaceShown, mWindowType); - } - } - - void dumpDebug(ProtoOutputStream proto, long fieldId) { - final long token = proto.start(fieldId); - proto.write(SHOWN, mSurfaceShown); - proto.end(token); - } - - public void dump(PrintWriter pw, String prefix, boolean dumpAll) { - if (dumpAll) { - pw.print(prefix); pw.print("mSurface="); pw.println(mSurfaceControl); - } - pw.print(prefix); pw.print("Surface: shown="); pw.print(mSurfaceShown); - } - - @Override - public String toString() { - return mSurfaceControl.toString(); - } -} diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java index c1be5ca562b1..63e3e5cf865a 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java @@ -714,7 +714,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase { // Simulate when the window is exiting and cleanupAnimation invoked // (e.g. screen off during RecentsAnimation animating), will expect the window receives // onExitAnimationDone to destroy the surface when the removal is allowed. - win1.mWinAnimator.mSurfaceController = mock(WindowSurfaceController.class); + win1.mWinAnimator.mSurfaceControl = mock(SurfaceControl.class); win1.mHasSurface = true; win1.mAnimatingExit = true; win1.mRemoveOnExit = true; diff --git a/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java index 11d9629cf25e..0bf27d11493b 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java @@ -43,8 +43,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.anyFloat; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; @@ -758,12 +756,9 @@ public class RemoteAnimationControllerTest extends WindowTestsBase { // Simulating win1 has shown IME and being IME layering/input target mDisplayContent.setImeLayeringTarget(win1); mDisplayContent.setImeInputTarget(win1); - mImeWindow.mWinAnimator.mSurfaceController = mock(WindowSurfaceController.class); mImeWindow.mWinAnimator.hide(mDisplayContent.getPendingTransaction(), "test"); spyOn(mDisplayContent); - doReturn(true).when(mImeWindow.mWinAnimator.mSurfaceController).hasSurface(); - doReturn(true).when(mImeWindow.mWinAnimator.mSurfaceController) - .prepareToShowInTransaction(any(), anyFloat()); + mImeWindow.mWinAnimator.mSurfaceControl = mock(SurfaceControl.class); makeWindowVisibleAndDrawn(mImeWindow); assertTrue(mImeWindow.isOnScreen()); assertFalse(mImeWindow.isParentWindowHidden()); diff --git a/services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java index 9b48cb9d328c..c65b76efd614 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java @@ -31,7 +31,6 @@ import static android.view.WindowManager.TRANSIT_OPEN; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock; import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; -import static com.android.dx.mockito.inline.extended.ExtendedMockito.when; import static com.android.window.flags.Flags.multiCrop; import static com.google.common.truth.Truth.assertThat; @@ -551,10 +550,9 @@ public class WallpaperControllerTests extends WindowTestsBase { } private static void makeWallpaperWindowShown(WindowState w) { - final WindowSurfaceController windowSurfaceController = mock(WindowSurfaceController.class); - w.mWinAnimator.mSurfaceController = windowSurfaceController; w.mWinAnimator.mLastAlpha = 1; - when(windowSurfaceController.getShown()).thenReturn(true); + spyOn(w.mWinAnimator); + doReturn(true).when(w.mWinAnimator).getShown(); } private WindowState createWallpaperWindow(DisplayContent dc, int width, int height) { diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java index fcf7a3fe79c1..62c9b22fa574 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java @@ -253,22 +253,18 @@ public class WindowManagerServiceTests extends WindowTestsBase { final Session session = createTestSession(mAtm, wpc.getPid(), wpc.mUid); spyOn(session); assertTrue(session.mCanAddInternalSystemWindow); - final WindowSurfaceController winSurface = mock(WindowSurfaceController.class); - session.onWindowSurfaceVisibilityChanged(winSurface, true /* visible */, - LayoutParams.TYPE_PHONE); + final WindowState window = createWindow(null, LayoutParams.TYPE_PHONE, "win"); + session.onWindowSurfaceVisibilityChanged(window, true /* visible */); verify(session).setHasOverlayUi(true); - session.onWindowSurfaceVisibilityChanged(winSurface, false /* visible */, - LayoutParams.TYPE_PHONE); + session.onWindowSurfaceVisibilityChanged(window, false /* visible */); verify(session).setHasOverlayUi(false); } @Test public void testRelayoutExitingWindow() { final WindowState win = createWindow(null, TYPE_BASE_APPLICATION, "appWin"); - final WindowSurfaceController surfaceController = mock(WindowSurfaceController.class); - win.mWinAnimator.mSurfaceController = surfaceController; win.mWinAnimator.mDrawState = WindowStateAnimator.HAS_DRAWN; - doReturn(true).when(surfaceController).hasSurface(); + win.mWinAnimator.mSurfaceControl = mock(SurfaceControl.class); spyOn(win.mTransitionController); doReturn(true).when(win.mTransitionController).isShellTransitionsEnabled(); doReturn(true).when(win.mTransitionController).inTransition( @@ -306,7 +302,7 @@ public class WindowManagerServiceTests extends WindowTestsBase { // and WMS#tryStartExitingAnimation() will destroy the surface directly. assertFalse(win.mAnimatingExit); assertFalse(win.mHasSurface); - assertNull(win.mWinAnimator.mSurfaceController); + assertNull(win.mWinAnimator.mSurfaceControl); // Invisible requested activity should not get the last config even if its view is visible. mWm.relayoutWindow(win.mSession, win.mClient, win.mAttrs, w, h, View.VISIBLE, 0, 0, 0, |