Loading services/core/java/com/android/server/wm/AppWindowToken.java +108 −25 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WINDOW_MOVEME 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.WindowManagerService.H.NOTIFY_ACTIVITY_DRAWN; import static com.android.server.wm.WindowManagerService.H.NOTIFY_STARTING_WINDOW_DRAWN; import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_NONE; import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES; import static com.android.server.wm.WindowManagerService.logWithStack; Loading Loading @@ -91,19 +92,22 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree // an activity have been drawn, so they can be made visible together // at the same time. // initialize so that it doesn't match mTransactionSequence which is an int. long lastTransactionSequence = Long.MIN_VALUE; int numInterestingWindows; int numDrawnWindows; private long mLastTransactionSequence = Long.MIN_VALUE; private int mNumInterestingWindows; private int mNumDrawnWindows; boolean inPendingTransaction; boolean allDrawn; // Set to true when this app creates a surface while in the middle of an animation. In that // case do not clear allDrawn until the animation completes. boolean deferClearAllDrawn; // These are to track the app's real drawing status if there were no saved surfaces. /** * These are to track the app's real drawing status if there were no saved surfaces. * @see #updateDrawnWindowStates */ boolean allDrawnExcludingSaved; int numInterestingWindowsExcludingSaved; int numDrawnWindowsExcludingSaved; private int mNumInterestingWindowsExcludingSaved; private int mNumDrawnWindowsExcludingSaved; // Is this window's surface needed? This is almost like hidden, except // it will sometimes be true a little earlier: when the token has Loading @@ -118,7 +122,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree boolean reportedVisible; // Last drawn state we reported to the app token. boolean reportedDrawn; private boolean reportedDrawn; // Set to true when the token has been removed from the window mgr. boolean removed; Loading Loading @@ -146,7 +150,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree boolean mAppStopped; int mRotationAnimationHint; int mPendingRelaunchCount; private int mPendingRelaunchCount; private ArrayList<WindowSurfaceController.SurfaceControlWithBackground> mSurfaceViewBackgrounds = new ArrayList<>(); Loading Loading @@ -1040,7 +1044,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree stopFreezingScreen(false, true); if (DEBUG_ORIENTATION) Slog.i(TAG, "Setting mOrientationChangeComplete=true because wtoken " + this + " numInteresting=" + numInterestingWindows + " numDrawn=" + numDrawnWindows); + " numInteresting=" + mNumInterestingWindows + " numDrawn=" + mNumDrawnWindows); // This will set mOrientationChangeComplete and cause a pass through layout. setAppLayoutChanges(FINISH_LAYOUT_REDO_WALLPAPER, "checkAppWindowsReadyToShow: freezingScreen", displayId); Loading @@ -1054,30 +1058,28 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree } } @Override void updateAllDrawn(int displayId) { final DisplayContent displayContent = mService.mRoot.getDisplayContentOrCreate(displayId); void updateAllDrawn(DisplayContent dc) { if (!allDrawn) { final int numInteresting = numInterestingWindows; if (numInteresting > 0 && numDrawnWindows >= numInteresting) { final int numInteresting = mNumInterestingWindows; if (numInteresting > 0 && mNumDrawnWindows >= numInteresting) { if (DEBUG_VISIBILITY) Slog.v(TAG, "allDrawn: " + this + " interesting=" + numInteresting + " drawn=" + numDrawnWindows); + " interesting=" + numInteresting + " drawn=" + mNumDrawnWindows); allDrawn = true; // Force an additional layout pass where // WindowStateAnimator#commitFinishDrawingLocked() will call performShowLocked(). displayContent.setLayoutNeeded(); dc.setLayoutNeeded(); mService.mH.obtainMessage(NOTIFY_ACTIVITY_DRAWN, token).sendToTarget(); } } if (!allDrawnExcludingSaved) { int numInteresting = numInterestingWindowsExcludingSaved; if (numInteresting > 0 && numDrawnWindowsExcludingSaved >= numInteresting) { int numInteresting = mNumInterestingWindowsExcludingSaved; if (numInteresting > 0 && mNumDrawnWindowsExcludingSaved >= numInteresting) { if (DEBUG_VISIBILITY) Slog.v(TAG, "allDrawnExcludingSaved: " + this + " interesting=" + numInteresting + " drawn=" + numDrawnWindowsExcludingSaved); + " drawn=" + mNumDrawnWindowsExcludingSaved); allDrawnExcludingSaved = true; displayContent.setLayoutNeeded(); dc.setLayoutNeeded(); if (isAnimatingInvisibleWithSavedSurface() && !mService.mFinishedEarlyAnim.contains(this)) { mService.mFinishedEarlyAnim.add(this); Loading @@ -1086,6 +1088,87 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree } } /** * Updated this app token tracking states for interesting and drawn windows based on the window. * * @return Returns true if the input window is considered interesting and drawn while all the * windows in this app token where not considered drawn as of the last pass. */ boolean updateDrawnWindowStates(WindowState w) { if (DEBUG_STARTING_WINDOW && w == startingWindow) { Slog.d(TAG, "updateWindows: starting " + w + " isOnScreen=" + w.isOnScreen() + " allDrawn=" + allDrawn + " freezingScreen=" + mAppAnimator.freezingScreen); } if (allDrawn && allDrawnExcludingSaved && !mAppAnimator.freezingScreen) { return false; } if (mLastTransactionSequence != mService.mTransactionSequence) { mLastTransactionSequence = mService.mTransactionSequence; mNumInterestingWindows = mNumDrawnWindows = 0; mNumInterestingWindowsExcludingSaved = 0; mNumDrawnWindowsExcludingSaved = 0; startingDisplayed = false; } final WindowStateAnimator winAnimator = w.mWinAnimator; boolean isInterestingAndDrawn = false; if (!allDrawn && w.mightAffectAllDrawn(false /* visibleOnly */)) { if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) { Slog.v(TAG, "Eval win " + w + ": isDrawn=" + w.isDrawnLw() + ", isAnimationSet=" + winAnimator.isAnimationSet()); if (!w.isDrawnLw()) { Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurfaceController + " pv=" + w.mPolicyVisibility + " mDrawState=" + winAnimator.drawStateToString() + " ph=" + w.isParentWindowHidden() + " th=" + hiddenRequested + " a=" + winAnimator.mAnimating); } } if (w != startingWindow) { if (w.isInteresting()) { mNumInterestingWindows++; if (w.isDrawnLw()) { mNumDrawnWindows++; if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) Slog.v(TAG, "tokenMayBeDrawn: " + this + " w=" + w + " numInteresting=" + mNumInterestingWindows + " freezingScreen=" + mAppAnimator.freezingScreen + " mAppFreezing=" + w.mAppFreezing); isInterestingAndDrawn = true; } } } else if (w.isDrawnLw()) { mService.mH.sendEmptyMessage(NOTIFY_STARTING_WINDOW_DRAWN); startingDisplayed = true; } } if (!allDrawnExcludingSaved && w.mightAffectAllDrawn(true /* visibleOnly */)) { if (w != startingWindow && w.isInteresting()) { mNumInterestingWindowsExcludingSaved++; if (w.isDrawnLw() && !w.isAnimatingWithSavedSurface()) { mNumDrawnWindowsExcludingSaved++; if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) Slog.v(TAG, "tokenMayBeDrawnExcludingSaved: " + this + " w=" + w + " numInteresting=" + mNumInterestingWindowsExcludingSaved + " freezingScreen=" + mAppAnimator.freezingScreen + " mAppFreezing=" + w.mAppFreezing); isInterestingAndDrawn = true; } } } return isInterestingAndDrawn; } @Override void stepAppWindowsAnimation(long currentTime, int displayId) { mAppAnimator.wasAnimating = mAppAnimator.animating; Loading Loading @@ -1147,11 +1230,11 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree if (mAppStopped) { pw.print(prefix); pw.print("mAppStopped="); pw.println(mAppStopped); } if (numInterestingWindows != 0 || numDrawnWindows != 0 if (mNumInterestingWindows != 0 || mNumDrawnWindows != 0 || allDrawn || mAppAnimator.allDrawn) { pw.print(prefix); pw.print("numInterestingWindows="); pw.print(numInterestingWindows); pw.print(" numDrawnWindows="); pw.print(numDrawnWindows); pw.print(prefix); pw.print("mNumInterestingWindows="); pw.print(mNumInterestingWindows); pw.print(" mNumDrawnWindows="); pw.print(mNumDrawnWindows); pw.print(" inPendingTransaction="); pw.print(inPendingTransaction); pw.print(" allDrawn="); pw.print(allDrawn); pw.print(" (animator="); pw.print(mAppAnimator.allDrawn); Loading services/core/java/com/android/server/wm/DisplayContent.java +0 −4 Original line number Diff line number Diff line Loading @@ -240,10 +240,6 @@ class DisplayContent extends WindowContainer<TaskStack> { super.checkAppWindowsReadyToShow(mDisplayId); } void updateAllDrawn() { super.updateAllDrawn(mDisplayId); } void stepAppWindowsAnimation(long currentTime) { super.stepAppWindowsAnimation(currentTime, mDisplayId); } Loading services/core/java/com/android/server/wm/RootWindowContainer.java +16 −107 Original line number Diff line number Diff line Loading @@ -41,12 +41,12 @@ import com.android.server.input.InputWindowHandle; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.LinkedList; import static android.app.ActivityManager.StackId.DOCKED_STACK_ID; import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE; import static android.view.WindowManager.LayoutParams.TYPE_DREAM; import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG; Loading @@ -65,7 +65,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYOUT_REPEAT import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ORIENTATION; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_POWER; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STACK; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STARTING_WINDOW; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_TOKEN_MOVEMENT; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_VISIBILITY; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WALLPAPER_LIGHT; Loading @@ -76,7 +75,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.SHOW_TRANSACTIONS; import static com.android.server.wm.WindowManagerDebugConfig.TAG_KEEP_SCREEN_ON; 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.WindowManagerService.H.NOTIFY_STARTING_WINDOW_DRAWN; import static com.android.server.wm.WindowManagerService.H.REPORT_LOSING_FOCUS; import static com.android.server.wm.WindowManagerService.H.SEND_NEW_CONFIGURATION; import static com.android.server.wm.WindowManagerService.LAYOUT_REPEAT_THRESHOLD; Loading Loading @@ -136,6 +134,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { private final ArrayList<Integer> mChangedStackList = new ArrayList(); private final LinkedList<AppWindowToken> mTmpUpdateAllDrawn = new LinkedList(); // State for the RemoteSurfaceTrace system used in testing. If this is enabled SurfaceControl // instances will be replaced with an instance that writes a binary representation of all // commands to mSurfaceTraceFd. Loading Loading @@ -707,7 +707,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { ">>> OPEN TRANSACTION performLayoutAndPlaceSurfaces"); mService.openSurfaceTransaction(); try { mService.mRoot.applySurfaceChangesTransaction(recoveringMemory, defaultDw, defaultDh); applySurfaceChangesTransaction(recoveringMemory, defaultDw, defaultDh); } catch (RuntimeException e) { Slog.wtf(TAG, "Unhandled exception in Window Manager", e); } finally { Loading Loading @@ -990,7 +990,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { final int count = mChildren.size(); for (int j = 0; j < count; ++j) { final DisplayContent dc = mChildren.get(j); boolean updateAllDrawn = false; WindowList windows = dc.getWindowList(); DisplayInfo displayInfo = dc.getDisplayInfo(); final int displayId = dc.getDisplayId(); Loading @@ -1003,6 +1002,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { mDisplayHasContent = false; mPreferredRefreshRate = 0; mPreferredModeId = 0; mTmpUpdateAllDrawn.clear(); int repeats = 0; do { Loading Loading @@ -1086,44 +1086,13 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { if (isDefaultDisplay && obscuredChanged && w.isVisibleLw() && mService.mWallpaperControllerLocked.isWallpaperTarget(w)) { // This is the wallpaper target and its obscured state changed... make sure the // current wallaper's visibility has been updated accordingly. // current wallpaper's visibility has been updated accordingly. mService.mWallpaperControllerLocked.updateWallpaperVisibility(); } final WindowStateAnimator winAnimator = w.mWinAnimator; // If the window has moved due to its containing content frame changing, then // notify the listeners and optionally animate it. Simply checking a change of // position is not enough, because being move due to dock divider is not a trigger // for animation. if (w.hasMoved()) { // Frame has moved, containing content frame has also moved, and we're not // currently animating... let's do something. final int left = w.mFrame.left; final int top = w.mFrame.top; final boolean adjustedForMinimizedDockOrIme = task != null && (task.mStack.isAdjustedForMinimizedDockedStack() || task.mStack.isAdjustedForIme()); if (mService.okToDisplay() && (w.mAttrs.privateFlags & PRIVATE_FLAG_NO_MOVE_ANIMATION) == 0 && !w.isDragResizing() && !adjustedForMinimizedDockOrIme && (task == null || w.getTask().mStack.hasMovementAnimations()) && !w.mWinAnimator.mLastHidden) { winAnimator.setMoveAnimation(left, top); } //TODO (multidisplay): Accessibility supported only for the default display. if (mService.mAccessibilityController != null && displayId == Display.DEFAULT_DISPLAY) { mService.mAccessibilityController.onSomeWindowResizedOrMovedLocked(); } w.handleWindowMovedIfNeeded(); try { w.mClient.moved(left, top); } catch (RemoteException e) { } w.mMovedByResize = false; } final WindowStateAnimator winAnimator = w.mWinAnimator; //Slog.i(TAG, "Window " + this + " clearing mContentChanged - done placing"); w.mContentChanged = false; Loading Loading @@ -1171,71 +1140,10 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { } final AppWindowToken atoken = w.mAppToken; if (DEBUG_STARTING_WINDOW && atoken != null && w == atoken.startingWindow) { Slog.d(TAG, "updateWindows: starting " + w + " isOnScreen=" + w.isOnScreen() + " allDrawn=" + atoken.allDrawn + " freezingScreen=" + atoken.mAppAnimator.freezingScreen); } if (atoken != null && (!atoken.allDrawn || !atoken.allDrawnExcludingSaved || atoken.mAppAnimator.freezingScreen)) { if (atoken.lastTransactionSequence != mService.mTransactionSequence) { atoken.lastTransactionSequence = mService.mTransactionSequence; atoken.numInterestingWindows = atoken.numDrawnWindows = 0; atoken.numInterestingWindowsExcludingSaved = 0; atoken.numDrawnWindowsExcludingSaved = 0; atoken.startingDisplayed = false; } if (!atoken.allDrawn && w.mightAffectAllDrawn(false /* visibleOnly */)) { if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) { Slog.v(TAG, "Eval win " + w + ": isDrawn=" + w.isDrawnLw() + ", isAnimationSet=" + winAnimator.isAnimationSet()); if (!w.isDrawnLw()) { Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurfaceController + " pv=" + w.mPolicyVisibility + " mDrawState=" + winAnimator.drawStateToString() + " ph=" + w.isParentWindowHidden() + " th=" + atoken.hiddenRequested + " a=" + winAnimator.mAnimating); } } if (w != atoken.startingWindow) { if (w.isInteresting()) { atoken.numInterestingWindows++; if (w.isDrawnLw()) { atoken.numDrawnWindows++; if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) Slog.v(TAG, "tokenMayBeDrawn: " + atoken + " w=" + w + " numInteresting=" + atoken.numInterestingWindows + " freezingScreen=" + atoken.mAppAnimator.freezingScreen + " mAppFreezing=" + w.mAppFreezing); updateAllDrawn = true; } } } else if (w.isDrawnLw()) { mService.mH.sendEmptyMessage(NOTIFY_STARTING_WINDOW_DRAWN); atoken.startingDisplayed = true; } } if (!atoken.allDrawnExcludingSaved && w.mightAffectAllDrawn(true /* visibleOnly */)) { if (w != atoken.startingWindow && w.isInteresting()) { atoken.numInterestingWindowsExcludingSaved++; if (w.isDrawnLw() && !w.isAnimatingWithSavedSurface()) { atoken.numDrawnWindowsExcludingSaved++; if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) Slog.v(TAG, "tokenMayBeDrawnExcludingSaved: " + atoken + " w=" + w + " numInteresting=" + atoken.numInterestingWindowsExcludingSaved + " freezingScreen=" + atoken.mAppAnimator.freezingScreen + " mAppFreezing=" + w.mAppFreezing); updateAllDrawn = true; } } if (atoken != null) { final boolean updateAllDrawn = atoken.updateDrawnWindowStates(w); if (updateAllDrawn && !mTmpUpdateAllDrawn.contains(atoken)) { mTmpUpdateAllDrawn.add(atoken); } } Loading @@ -1244,7 +1152,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { focusDisplayed = true; } mService.updateResizingWindows(w); w.updateResizingWindowIfNeeded(); } mService.mDisplayManagerInternal.setDisplayProperties(displayId, Loading @@ -1255,10 +1163,11 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { dc.stopDimmingIfNeeded(); if (updateAllDrawn) { while (!mTmpUpdateAllDrawn.isEmpty()) { final AppWindowToken atoken = mTmpUpdateAllDrawn.removeLast(); // See if any windows have been drawn, so they (and others associated with them) // can now be shown. dc.updateAllDrawn(); atoken.updateAllDrawn(dc); } } Loading services/core/java/com/android/server/wm/WindowContainer.java +0 −13 Original line number Diff line number Diff line Loading @@ -381,19 +381,6 @@ class WindowContainer<E extends WindowContainer> implements Comparable<WindowCon } } /** * Updates the current all drawn status for this container. That is all its children * that should draw something have done so. */ // TODO: The displayId shouldn't be needed as there shouldn't be a container on more than one // display. Remove once we migrate DisplayContent to use WindowContainer. void updateAllDrawn(int displayId) { for (int i = mChildren.size() - 1; i >= 0; --i) { final WindowContainer wc = mChildren.get(i); wc.updateAllDrawn(displayId); } } /** Step currently ongoing animation for App window containers. */ // TODO: The displayId shouldn't be needed as there shouldn't be a container on more than one // display. Remove once we migrate DisplayContent to use WindowContainer. Loading services/core/java/com/android/server/wm/WindowManagerService.java +0 −102 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
services/core/java/com/android/server/wm/AppWindowToken.java +108 −25 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WINDOW_MOVEME 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.WindowManagerService.H.NOTIFY_ACTIVITY_DRAWN; import static com.android.server.wm.WindowManagerService.H.NOTIFY_STARTING_WINDOW_DRAWN; import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_NONE; import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES; import static com.android.server.wm.WindowManagerService.logWithStack; Loading Loading @@ -91,19 +92,22 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree // an activity have been drawn, so they can be made visible together // at the same time. // initialize so that it doesn't match mTransactionSequence which is an int. long lastTransactionSequence = Long.MIN_VALUE; int numInterestingWindows; int numDrawnWindows; private long mLastTransactionSequence = Long.MIN_VALUE; private int mNumInterestingWindows; private int mNumDrawnWindows; boolean inPendingTransaction; boolean allDrawn; // Set to true when this app creates a surface while in the middle of an animation. In that // case do not clear allDrawn until the animation completes. boolean deferClearAllDrawn; // These are to track the app's real drawing status if there were no saved surfaces. /** * These are to track the app's real drawing status if there were no saved surfaces. * @see #updateDrawnWindowStates */ boolean allDrawnExcludingSaved; int numInterestingWindowsExcludingSaved; int numDrawnWindowsExcludingSaved; private int mNumInterestingWindowsExcludingSaved; private int mNumDrawnWindowsExcludingSaved; // Is this window's surface needed? This is almost like hidden, except // it will sometimes be true a little earlier: when the token has Loading @@ -118,7 +122,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree boolean reportedVisible; // Last drawn state we reported to the app token. boolean reportedDrawn; private boolean reportedDrawn; // Set to true when the token has been removed from the window mgr. boolean removed; Loading Loading @@ -146,7 +150,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree boolean mAppStopped; int mRotationAnimationHint; int mPendingRelaunchCount; private int mPendingRelaunchCount; private ArrayList<WindowSurfaceController.SurfaceControlWithBackground> mSurfaceViewBackgrounds = new ArrayList<>(); Loading Loading @@ -1040,7 +1044,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree stopFreezingScreen(false, true); if (DEBUG_ORIENTATION) Slog.i(TAG, "Setting mOrientationChangeComplete=true because wtoken " + this + " numInteresting=" + numInterestingWindows + " numDrawn=" + numDrawnWindows); + " numInteresting=" + mNumInterestingWindows + " numDrawn=" + mNumDrawnWindows); // This will set mOrientationChangeComplete and cause a pass through layout. setAppLayoutChanges(FINISH_LAYOUT_REDO_WALLPAPER, "checkAppWindowsReadyToShow: freezingScreen", displayId); Loading @@ -1054,30 +1058,28 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree } } @Override void updateAllDrawn(int displayId) { final DisplayContent displayContent = mService.mRoot.getDisplayContentOrCreate(displayId); void updateAllDrawn(DisplayContent dc) { if (!allDrawn) { final int numInteresting = numInterestingWindows; if (numInteresting > 0 && numDrawnWindows >= numInteresting) { final int numInteresting = mNumInterestingWindows; if (numInteresting > 0 && mNumDrawnWindows >= numInteresting) { if (DEBUG_VISIBILITY) Slog.v(TAG, "allDrawn: " + this + " interesting=" + numInteresting + " drawn=" + numDrawnWindows); + " interesting=" + numInteresting + " drawn=" + mNumDrawnWindows); allDrawn = true; // Force an additional layout pass where // WindowStateAnimator#commitFinishDrawingLocked() will call performShowLocked(). displayContent.setLayoutNeeded(); dc.setLayoutNeeded(); mService.mH.obtainMessage(NOTIFY_ACTIVITY_DRAWN, token).sendToTarget(); } } if (!allDrawnExcludingSaved) { int numInteresting = numInterestingWindowsExcludingSaved; if (numInteresting > 0 && numDrawnWindowsExcludingSaved >= numInteresting) { int numInteresting = mNumInterestingWindowsExcludingSaved; if (numInteresting > 0 && mNumDrawnWindowsExcludingSaved >= numInteresting) { if (DEBUG_VISIBILITY) Slog.v(TAG, "allDrawnExcludingSaved: " + this + " interesting=" + numInteresting + " drawn=" + numDrawnWindowsExcludingSaved); + " drawn=" + mNumDrawnWindowsExcludingSaved); allDrawnExcludingSaved = true; displayContent.setLayoutNeeded(); dc.setLayoutNeeded(); if (isAnimatingInvisibleWithSavedSurface() && !mService.mFinishedEarlyAnim.contains(this)) { mService.mFinishedEarlyAnim.add(this); Loading @@ -1086,6 +1088,87 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree } } /** * Updated this app token tracking states for interesting and drawn windows based on the window. * * @return Returns true if the input window is considered interesting and drawn while all the * windows in this app token where not considered drawn as of the last pass. */ boolean updateDrawnWindowStates(WindowState w) { if (DEBUG_STARTING_WINDOW && w == startingWindow) { Slog.d(TAG, "updateWindows: starting " + w + " isOnScreen=" + w.isOnScreen() + " allDrawn=" + allDrawn + " freezingScreen=" + mAppAnimator.freezingScreen); } if (allDrawn && allDrawnExcludingSaved && !mAppAnimator.freezingScreen) { return false; } if (mLastTransactionSequence != mService.mTransactionSequence) { mLastTransactionSequence = mService.mTransactionSequence; mNumInterestingWindows = mNumDrawnWindows = 0; mNumInterestingWindowsExcludingSaved = 0; mNumDrawnWindowsExcludingSaved = 0; startingDisplayed = false; } final WindowStateAnimator winAnimator = w.mWinAnimator; boolean isInterestingAndDrawn = false; if (!allDrawn && w.mightAffectAllDrawn(false /* visibleOnly */)) { if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) { Slog.v(TAG, "Eval win " + w + ": isDrawn=" + w.isDrawnLw() + ", isAnimationSet=" + winAnimator.isAnimationSet()); if (!w.isDrawnLw()) { Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurfaceController + " pv=" + w.mPolicyVisibility + " mDrawState=" + winAnimator.drawStateToString() + " ph=" + w.isParentWindowHidden() + " th=" + hiddenRequested + " a=" + winAnimator.mAnimating); } } if (w != startingWindow) { if (w.isInteresting()) { mNumInterestingWindows++; if (w.isDrawnLw()) { mNumDrawnWindows++; if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) Slog.v(TAG, "tokenMayBeDrawn: " + this + " w=" + w + " numInteresting=" + mNumInterestingWindows + " freezingScreen=" + mAppAnimator.freezingScreen + " mAppFreezing=" + w.mAppFreezing); isInterestingAndDrawn = true; } } } else if (w.isDrawnLw()) { mService.mH.sendEmptyMessage(NOTIFY_STARTING_WINDOW_DRAWN); startingDisplayed = true; } } if (!allDrawnExcludingSaved && w.mightAffectAllDrawn(true /* visibleOnly */)) { if (w != startingWindow && w.isInteresting()) { mNumInterestingWindowsExcludingSaved++; if (w.isDrawnLw() && !w.isAnimatingWithSavedSurface()) { mNumDrawnWindowsExcludingSaved++; if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) Slog.v(TAG, "tokenMayBeDrawnExcludingSaved: " + this + " w=" + w + " numInteresting=" + mNumInterestingWindowsExcludingSaved + " freezingScreen=" + mAppAnimator.freezingScreen + " mAppFreezing=" + w.mAppFreezing); isInterestingAndDrawn = true; } } } return isInterestingAndDrawn; } @Override void stepAppWindowsAnimation(long currentTime, int displayId) { mAppAnimator.wasAnimating = mAppAnimator.animating; Loading Loading @@ -1147,11 +1230,11 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree if (mAppStopped) { pw.print(prefix); pw.print("mAppStopped="); pw.println(mAppStopped); } if (numInterestingWindows != 0 || numDrawnWindows != 0 if (mNumInterestingWindows != 0 || mNumDrawnWindows != 0 || allDrawn || mAppAnimator.allDrawn) { pw.print(prefix); pw.print("numInterestingWindows="); pw.print(numInterestingWindows); pw.print(" numDrawnWindows="); pw.print(numDrawnWindows); pw.print(prefix); pw.print("mNumInterestingWindows="); pw.print(mNumInterestingWindows); pw.print(" mNumDrawnWindows="); pw.print(mNumDrawnWindows); pw.print(" inPendingTransaction="); pw.print(inPendingTransaction); pw.print(" allDrawn="); pw.print(allDrawn); pw.print(" (animator="); pw.print(mAppAnimator.allDrawn); Loading
services/core/java/com/android/server/wm/DisplayContent.java +0 −4 Original line number Diff line number Diff line Loading @@ -240,10 +240,6 @@ class DisplayContent extends WindowContainer<TaskStack> { super.checkAppWindowsReadyToShow(mDisplayId); } void updateAllDrawn() { super.updateAllDrawn(mDisplayId); } void stepAppWindowsAnimation(long currentTime) { super.stepAppWindowsAnimation(currentTime, mDisplayId); } Loading
services/core/java/com/android/server/wm/RootWindowContainer.java +16 −107 Original line number Diff line number Diff line Loading @@ -41,12 +41,12 @@ import com.android.server.input.InputWindowHandle; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.LinkedList; import static android.app.ActivityManager.StackId.DOCKED_STACK_ID; import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE; import static android.view.WindowManager.LayoutParams.TYPE_DREAM; import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG; Loading @@ -65,7 +65,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYOUT_REPEAT import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ORIENTATION; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_POWER; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STACK; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STARTING_WINDOW; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_TOKEN_MOVEMENT; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_VISIBILITY; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WALLPAPER_LIGHT; Loading @@ -76,7 +75,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.SHOW_TRANSACTIONS; import static com.android.server.wm.WindowManagerDebugConfig.TAG_KEEP_SCREEN_ON; 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.WindowManagerService.H.NOTIFY_STARTING_WINDOW_DRAWN; import static com.android.server.wm.WindowManagerService.H.REPORT_LOSING_FOCUS; import static com.android.server.wm.WindowManagerService.H.SEND_NEW_CONFIGURATION; import static com.android.server.wm.WindowManagerService.LAYOUT_REPEAT_THRESHOLD; Loading Loading @@ -136,6 +134,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { private final ArrayList<Integer> mChangedStackList = new ArrayList(); private final LinkedList<AppWindowToken> mTmpUpdateAllDrawn = new LinkedList(); // State for the RemoteSurfaceTrace system used in testing. If this is enabled SurfaceControl // instances will be replaced with an instance that writes a binary representation of all // commands to mSurfaceTraceFd. Loading Loading @@ -707,7 +707,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { ">>> OPEN TRANSACTION performLayoutAndPlaceSurfaces"); mService.openSurfaceTransaction(); try { mService.mRoot.applySurfaceChangesTransaction(recoveringMemory, defaultDw, defaultDh); applySurfaceChangesTransaction(recoveringMemory, defaultDw, defaultDh); } catch (RuntimeException e) { Slog.wtf(TAG, "Unhandled exception in Window Manager", e); } finally { Loading Loading @@ -990,7 +990,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { final int count = mChildren.size(); for (int j = 0; j < count; ++j) { final DisplayContent dc = mChildren.get(j); boolean updateAllDrawn = false; WindowList windows = dc.getWindowList(); DisplayInfo displayInfo = dc.getDisplayInfo(); final int displayId = dc.getDisplayId(); Loading @@ -1003,6 +1002,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { mDisplayHasContent = false; mPreferredRefreshRate = 0; mPreferredModeId = 0; mTmpUpdateAllDrawn.clear(); int repeats = 0; do { Loading Loading @@ -1086,44 +1086,13 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { if (isDefaultDisplay && obscuredChanged && w.isVisibleLw() && mService.mWallpaperControllerLocked.isWallpaperTarget(w)) { // This is the wallpaper target and its obscured state changed... make sure the // current wallaper's visibility has been updated accordingly. // current wallpaper's visibility has been updated accordingly. mService.mWallpaperControllerLocked.updateWallpaperVisibility(); } final WindowStateAnimator winAnimator = w.mWinAnimator; // If the window has moved due to its containing content frame changing, then // notify the listeners and optionally animate it. Simply checking a change of // position is not enough, because being move due to dock divider is not a trigger // for animation. if (w.hasMoved()) { // Frame has moved, containing content frame has also moved, and we're not // currently animating... let's do something. final int left = w.mFrame.left; final int top = w.mFrame.top; final boolean adjustedForMinimizedDockOrIme = task != null && (task.mStack.isAdjustedForMinimizedDockedStack() || task.mStack.isAdjustedForIme()); if (mService.okToDisplay() && (w.mAttrs.privateFlags & PRIVATE_FLAG_NO_MOVE_ANIMATION) == 0 && !w.isDragResizing() && !adjustedForMinimizedDockOrIme && (task == null || w.getTask().mStack.hasMovementAnimations()) && !w.mWinAnimator.mLastHidden) { winAnimator.setMoveAnimation(left, top); } //TODO (multidisplay): Accessibility supported only for the default display. if (mService.mAccessibilityController != null && displayId == Display.DEFAULT_DISPLAY) { mService.mAccessibilityController.onSomeWindowResizedOrMovedLocked(); } w.handleWindowMovedIfNeeded(); try { w.mClient.moved(left, top); } catch (RemoteException e) { } w.mMovedByResize = false; } final WindowStateAnimator winAnimator = w.mWinAnimator; //Slog.i(TAG, "Window " + this + " clearing mContentChanged - done placing"); w.mContentChanged = false; Loading Loading @@ -1171,71 +1140,10 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { } final AppWindowToken atoken = w.mAppToken; if (DEBUG_STARTING_WINDOW && atoken != null && w == atoken.startingWindow) { Slog.d(TAG, "updateWindows: starting " + w + " isOnScreen=" + w.isOnScreen() + " allDrawn=" + atoken.allDrawn + " freezingScreen=" + atoken.mAppAnimator.freezingScreen); } if (atoken != null && (!atoken.allDrawn || !atoken.allDrawnExcludingSaved || atoken.mAppAnimator.freezingScreen)) { if (atoken.lastTransactionSequence != mService.mTransactionSequence) { atoken.lastTransactionSequence = mService.mTransactionSequence; atoken.numInterestingWindows = atoken.numDrawnWindows = 0; atoken.numInterestingWindowsExcludingSaved = 0; atoken.numDrawnWindowsExcludingSaved = 0; atoken.startingDisplayed = false; } if (!atoken.allDrawn && w.mightAffectAllDrawn(false /* visibleOnly */)) { if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) { Slog.v(TAG, "Eval win " + w + ": isDrawn=" + w.isDrawnLw() + ", isAnimationSet=" + winAnimator.isAnimationSet()); if (!w.isDrawnLw()) { Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurfaceController + " pv=" + w.mPolicyVisibility + " mDrawState=" + winAnimator.drawStateToString() + " ph=" + w.isParentWindowHidden() + " th=" + atoken.hiddenRequested + " a=" + winAnimator.mAnimating); } } if (w != atoken.startingWindow) { if (w.isInteresting()) { atoken.numInterestingWindows++; if (w.isDrawnLw()) { atoken.numDrawnWindows++; if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) Slog.v(TAG, "tokenMayBeDrawn: " + atoken + " w=" + w + " numInteresting=" + atoken.numInterestingWindows + " freezingScreen=" + atoken.mAppAnimator.freezingScreen + " mAppFreezing=" + w.mAppFreezing); updateAllDrawn = true; } } } else if (w.isDrawnLw()) { mService.mH.sendEmptyMessage(NOTIFY_STARTING_WINDOW_DRAWN); atoken.startingDisplayed = true; } } if (!atoken.allDrawnExcludingSaved && w.mightAffectAllDrawn(true /* visibleOnly */)) { if (w != atoken.startingWindow && w.isInteresting()) { atoken.numInterestingWindowsExcludingSaved++; if (w.isDrawnLw() && !w.isAnimatingWithSavedSurface()) { atoken.numDrawnWindowsExcludingSaved++; if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) Slog.v(TAG, "tokenMayBeDrawnExcludingSaved: " + atoken + " w=" + w + " numInteresting=" + atoken.numInterestingWindowsExcludingSaved + " freezingScreen=" + atoken.mAppAnimator.freezingScreen + " mAppFreezing=" + w.mAppFreezing); updateAllDrawn = true; } } if (atoken != null) { final boolean updateAllDrawn = atoken.updateDrawnWindowStates(w); if (updateAllDrawn && !mTmpUpdateAllDrawn.contains(atoken)) { mTmpUpdateAllDrawn.add(atoken); } } Loading @@ -1244,7 +1152,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { focusDisplayed = true; } mService.updateResizingWindows(w); w.updateResizingWindowIfNeeded(); } mService.mDisplayManagerInternal.setDisplayProperties(displayId, Loading @@ -1255,10 +1163,11 @@ class RootWindowContainer extends WindowContainer<DisplayContent> { dc.stopDimmingIfNeeded(); if (updateAllDrawn) { while (!mTmpUpdateAllDrawn.isEmpty()) { final AppWindowToken atoken = mTmpUpdateAllDrawn.removeLast(); // See if any windows have been drawn, so they (and others associated with them) // can now be shown. dc.updateAllDrawn(); atoken.updateAllDrawn(dc); } } Loading
services/core/java/com/android/server/wm/WindowContainer.java +0 −13 Original line number Diff line number Diff line Loading @@ -381,19 +381,6 @@ class WindowContainer<E extends WindowContainer> implements Comparable<WindowCon } } /** * Updates the current all drawn status for this container. That is all its children * that should draw something have done so. */ // TODO: The displayId shouldn't be needed as there shouldn't be a container on more than one // display. Remove once we migrate DisplayContent to use WindowContainer. void updateAllDrawn(int displayId) { for (int i = mChildren.size() - 1; i >= 0; --i) { final WindowContainer wc = mChildren.get(i); wc.updateAllDrawn(displayId); } } /** Step currently ongoing animation for App window containers. */ // TODO: The displayId shouldn't be needed as there shouldn't be a container on more than one // display. Remove once we migrate DisplayContent to use WindowContainer. Loading
services/core/java/com/android/server/wm/WindowManagerService.java +0 −102 File changed.Preview size limit exceeded, changes collapsed. Show changes