Loading services/core/java/com/android/server/wm/WindowManagerService.java +36 −28 Original line number Diff line number Diff line Loading @@ -110,6 +110,7 @@ import android.util.Log; import android.util.Pair; import android.util.Slog; import android.util.SparseArray; import android.util.SparseBooleanArray; import android.util.SparseIntArray; import android.util.TimeUtils; import android.util.TypedValue; Loading Loading @@ -405,7 +406,7 @@ public class WindowManagerService extends IWindowManager.Stub /** * Windows whose surface should be destroyed. */ final ArrayList<WindowState> mDestroySurface = new ArrayList<>(); private final ArrayList<WindowState> mDestroySurface = new ArrayList<>(); /** * Windows with a preserved surface waiting to be destroyed. These windows Loading Loading @@ -442,11 +443,11 @@ public class WindowManagerService extends IWindowManager.Stub WindowState[] mRebuildTmp = new WindowState[20]; /** * Stores for each user whether screencapture is disabled * Stores for each user whether screencapture is disabled for all their windows. * This array is essentially a cache for all userId for * {@link android.app.admin.DevicePolicyManager#getScreenCaptureDisabled} */ SparseArray<Boolean> mScreenCaptureDisabled = new SparseArray<>(); private SparseBooleanArray mScreenCaptureDisabled = new SparseBooleanArray(); IInputMethodManager mInputMethodManager; Loading Loading @@ -2108,25 +2109,11 @@ public class WindowManagerService extends IWindowManager.Stub executeAppTransition(); } /** * Returns whether screen capture is disabled for all windows of a specific user. */ boolean isScreenCaptureDisabledLocked(int userId) { Boolean disabled = mScreenCaptureDisabled.get(userId); if (disabled == null) { return false; } return disabled; } boolean isSecureLocked(WindowState w) { if ((w.mAttrs.flags&WindowManager.LayoutParams.FLAG_SECURE) != 0) { if ((w.mAttrs.flags & FLAG_SECURE) != 0) { return true; } if (isScreenCaptureDisabledLocked(UserHandle.getUserId(w.mOwnerUid))) { return true; } return false; return mScreenCaptureDisabled.get(UserHandle.getUserId(w.mOwnerUid)); } /** Loading Loading @@ -2650,8 +2637,10 @@ public class WindowManagerService extends IWindowManager.Stub Slog.i(TAG, "Relayout " + win + ": oldVis=" + oldVisibility + " newVis=" + viewVisibility, stack); } if (viewVisibility == View.VISIBLE && (win.mAppToken == null || !win.mAppToken.clientHidden)) { final AppWindowToken appToken = win.mAppToken; final boolean visible = viewVisibility == View.VISIBLE && (appToken == null ? win.mPolicyVisibility : !appToken.clientHidden); if (visible) { result = relayoutVisibleWindow(outConfig, result, win, winAnimator, attrChanges, oldVisibility); try { Loading Loading @@ -2737,8 +2726,8 @@ public class WindowManagerService extends IWindowManager.Stub mWallpaperControllerLocked.updateWallpaperOffset( win, displayInfo.logicalWidth, displayInfo.logicalHeight, false); } if (win.mAppToken != null) { win.mAppToken.updateReportedVisibilityLocked(); if (appToken != null) { appToken.updateReportedVisibilityLocked(); } if (winAnimator.mReportSurfaceResized) { winAnimator.mReportSurfaceResized = false; Loading Loading @@ -10152,14 +10141,33 @@ public class WindowManagerService extends IWindowManager.Stub } } boolean isDockedStackResizingLocked() { return getDefaultDisplayContentLocked().getDockedDividerController().isResizing(); } static int dipToPixel(int dip, DisplayMetrics displayMetrics) { return (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dip, displayMetrics); } void scheduleSurfaceDestroy(WindowState win) { mDestroySurface.add(win); } boolean destroySurfacesLocked() { boolean wallpaperDestroyed = false; for (int i = mDestroySurface.size() - 1; i >= 0; i--) { WindowState win = mDestroySurface.get(i); win.mDestroying = false; if (mInputMethodWindow == win) { mInputMethodWindow = null; } if (mWallpaperControllerLocked.isWallpaperTarget(win)) { wallpaperDestroyed = true; } if (!win.shouldSaveSurface()) { win.mWinAnimator.destroySurfaceLocked(); } } mDestroySurface.clear(); return wallpaperDestroyed; } private final class LocalService extends WindowManagerInternal { @Override public void requestTraversalFromDisplayManager() { Loading services/core/java/com/android/server/wm/WindowState.java +17 −6 Original line number Diff line number Diff line Loading @@ -411,6 +411,10 @@ final class WindowState implements WindowManagerPolicy.WindowState { final private Rect mTmpRect = new Rect(); // This window often remains added but hidden, so we want to destroy its surface when it's not // visible. private final boolean mDestroySurfaceWhenHidden; WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token, WindowState attachedWindow, int appOp, int seq, WindowManager.LayoutParams a, int viewVisibility, final DisplayContent displayContent) { Loading Loading @@ -458,6 +462,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { mSubLayer = 0; mInputWindowHandle = null; mWinAnimator = null; mDestroySurfaceWhenHidden = false; return; } mDeathRecipient = deathRecipient; Loading Loading @@ -556,6 +561,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { mInputWindowHandle = new InputWindowHandle( mAppToken != null ? mAppToken.mInputApplicationHandle : null, this, displayContent.getDisplayId()); mDestroySurfaceWhenHidden = mAttrs.type == TYPE_DOCK_DIVIDER; } void attach() { Loading Loading @@ -1313,6 +1319,10 @@ final class WindowState implements WindowManagerPolicy.WindowState { mHasSurface = hasSurface; } boolean shouldDestroySurfaceWhenAnimationFinishes() { return mExiting || (mDestroySurfaceWhenHidden && !mPolicyVisibilityAfterAnim); } private final class DeadWindowEventReceiver extends InputEventReceiver { DeadWindowEventReceiver(InputChannel inputChannel) { super(inputChannel, mService.mH.getLooper()); Loading Loading @@ -1589,6 +1599,10 @@ final class WindowState implements WindowManagerPolicy.WindowState { // Already showing. return false; } if (!mHasSurface) { mDestroying = false; mWinAnimator.createSurfaceLocked(); } if (DEBUG_VISIBILITY) Slog.v(TAG, "Policy visibility true: " + this); if (doAnimation) { if (DEBUG_VISIBILITY) Slog.v(TAG, "doAnimation: mPolicyVisibility=" Loading Loading @@ -1624,8 +1638,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { doAnimation = false; } } boolean current = doAnimation ? mPolicyVisibilityAfterAnim : mPolicyVisibility; final boolean current = doAnimation ? mPolicyVisibilityAfterAnim : mPolicyVisibility; if (!current) { // Already hiding. return false; Loading @@ -1636,11 +1649,9 @@ final class WindowState implements WindowManagerPolicy.WindowState { doAnimation = false; } } if (doAnimation) { mPolicyVisibilityAfterAnim = false; } else { if (!doAnimation) { if (DEBUG_VISIBILITY) Slog.v(TAG, "Policy visibility false: " + this); mPolicyVisibilityAfterAnim = false; mPolicyVisibility = false; // Window is no longer visible -- make sure if we were waiting // for it to be displayed before enabling the display, that Loading services/core/java/com/android/server/wm/WindowStateAnimator.java +11 −10 Original line number Diff line number Diff line Loading @@ -446,7 +446,7 @@ class WindowStateAnimator { } } if (!mWin.mExiting) { if (!mWin.shouldDestroySurfaceWhenAnimationFinishes()) { return; } Loading @@ -454,12 +454,13 @@ class WindowStateAnimator { return; } if (WindowManagerService.localLOGV) Slog.v( TAG, "Exit animation finished in " + this + ": remove=" + mWin.mRemoveOnExit); if (localLOGV) Slog.v(TAG, "Exit animation finished in " + this + ": remove=" + mWin.mRemoveOnExit); if (mSurfaceController != null && mSurfaceController.hasSurface()) { mService.mDestroySurface.add(mWin); mService.scheduleSurfaceDestroy(mWin); if (mWin.mExiting) { mWin.mDestroying = true; } hide("finishExit"); } mWin.mExiting = false; Loading Loading @@ -645,7 +646,7 @@ class WindowStateAnimator { return null; } if (WindowManagerService.localLOGV) { if (localLOGV) { Slog.v(TAG, "Got surface: " + mSurfaceController + ", set left=" + w.mFrame.left + " top=" + w.mFrame.top + ", animLayer=" + mAnimLayer); Loading @@ -666,7 +667,7 @@ class WindowStateAnimator { mAnimLayer); mLastHidden = true; if (WindowManagerService.localLOGV) Slog.v( if (localLOGV) Slog.v( TAG, "Created surface " + this); } return mSurfaceController; Loading Loading @@ -973,7 +974,7 @@ class WindowStateAnimator { //Slog.i(TAG, "Not applying alpha transform"); } if ((DEBUG_SURFACE_TRACE || WindowManagerService.localLOGV) if ((DEBUG_SURFACE_TRACE || localLOGV) && (mShownAlpha == 1.0 || mShownAlpha == 0.0)) Slog.v( TAG, "computeShownFrameLocked: Animating " + this + " mAlpha=" + mAlpha + " self=" + (selfTransformation ? mTransformation.getAlpha() : "null") Loading @@ -994,7 +995,7 @@ class WindowStateAnimator { return; } if (WindowManagerService.localLOGV) Slog.v( if (localLOGV) Slog.v( TAG, "computeShownFrameLocked: " + this + " not attached, mAlpha=" + mAlpha); Loading services/core/java/com/android/server/wm/WindowSurfaceController.java +2 −4 Original line number Diff line number Diff line Loading @@ -296,10 +296,8 @@ class WindowSurfaceController { } boolean showRobustlyInTransaction() { if (SHOW_TRANSACTIONS) logSurface( "SHOW (performLayout)", null); if (DEBUG_VISIBILITY) Slog.v(TAG, "Showing " + this + " during relayout"); if (SHOW_TRANSACTIONS) logSurface("SHOW (performLayout)", null); if (DEBUG_VISIBILITY) Slog.v(TAG, "Showing " + this + " during relayout"); if (mHiddenForCrop) { return false; Loading services/core/java/com/android/server/wm/WindowSurfacePlacer.java +1 −19 Original line number Diff line number Diff line Loading @@ -381,25 +381,7 @@ class WindowSurfacePlacer { } // Destroy the surface of any windows that are no longer visible. boolean wallpaperDestroyed = false; i = mService.mDestroySurface.size(); if (i > 0) { do { i--; WindowState win = mService.mDestroySurface.get(i); win.mDestroying = false; if (mService.mInputMethodWindow == win) { mService.mInputMethodWindow = null; } if (mWallpaperControllerLocked.isWallpaperTarget(win)) { wallpaperDestroyed = true; } if (!win.shouldSaveSurface()) { win.mWinAnimator.destroySurfaceLocked(); } } while (i > 0); mService.mDestroySurface.clear(); } final boolean wallpaperDestroyed = mService.destroySurfacesLocked(); // Time to remove any exiting tokens? for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) { Loading Loading
services/core/java/com/android/server/wm/WindowManagerService.java +36 −28 Original line number Diff line number Diff line Loading @@ -110,6 +110,7 @@ import android.util.Log; import android.util.Pair; import android.util.Slog; import android.util.SparseArray; import android.util.SparseBooleanArray; import android.util.SparseIntArray; import android.util.TimeUtils; import android.util.TypedValue; Loading Loading @@ -405,7 +406,7 @@ public class WindowManagerService extends IWindowManager.Stub /** * Windows whose surface should be destroyed. */ final ArrayList<WindowState> mDestroySurface = new ArrayList<>(); private final ArrayList<WindowState> mDestroySurface = new ArrayList<>(); /** * Windows with a preserved surface waiting to be destroyed. These windows Loading Loading @@ -442,11 +443,11 @@ public class WindowManagerService extends IWindowManager.Stub WindowState[] mRebuildTmp = new WindowState[20]; /** * Stores for each user whether screencapture is disabled * Stores for each user whether screencapture is disabled for all their windows. * This array is essentially a cache for all userId for * {@link android.app.admin.DevicePolicyManager#getScreenCaptureDisabled} */ SparseArray<Boolean> mScreenCaptureDisabled = new SparseArray<>(); private SparseBooleanArray mScreenCaptureDisabled = new SparseBooleanArray(); IInputMethodManager mInputMethodManager; Loading Loading @@ -2108,25 +2109,11 @@ public class WindowManagerService extends IWindowManager.Stub executeAppTransition(); } /** * Returns whether screen capture is disabled for all windows of a specific user. */ boolean isScreenCaptureDisabledLocked(int userId) { Boolean disabled = mScreenCaptureDisabled.get(userId); if (disabled == null) { return false; } return disabled; } boolean isSecureLocked(WindowState w) { if ((w.mAttrs.flags&WindowManager.LayoutParams.FLAG_SECURE) != 0) { if ((w.mAttrs.flags & FLAG_SECURE) != 0) { return true; } if (isScreenCaptureDisabledLocked(UserHandle.getUserId(w.mOwnerUid))) { return true; } return false; return mScreenCaptureDisabled.get(UserHandle.getUserId(w.mOwnerUid)); } /** Loading Loading @@ -2650,8 +2637,10 @@ public class WindowManagerService extends IWindowManager.Stub Slog.i(TAG, "Relayout " + win + ": oldVis=" + oldVisibility + " newVis=" + viewVisibility, stack); } if (viewVisibility == View.VISIBLE && (win.mAppToken == null || !win.mAppToken.clientHidden)) { final AppWindowToken appToken = win.mAppToken; final boolean visible = viewVisibility == View.VISIBLE && (appToken == null ? win.mPolicyVisibility : !appToken.clientHidden); if (visible) { result = relayoutVisibleWindow(outConfig, result, win, winAnimator, attrChanges, oldVisibility); try { Loading Loading @@ -2737,8 +2726,8 @@ public class WindowManagerService extends IWindowManager.Stub mWallpaperControllerLocked.updateWallpaperOffset( win, displayInfo.logicalWidth, displayInfo.logicalHeight, false); } if (win.mAppToken != null) { win.mAppToken.updateReportedVisibilityLocked(); if (appToken != null) { appToken.updateReportedVisibilityLocked(); } if (winAnimator.mReportSurfaceResized) { winAnimator.mReportSurfaceResized = false; Loading Loading @@ -10152,14 +10141,33 @@ public class WindowManagerService extends IWindowManager.Stub } } boolean isDockedStackResizingLocked() { return getDefaultDisplayContentLocked().getDockedDividerController().isResizing(); } static int dipToPixel(int dip, DisplayMetrics displayMetrics) { return (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dip, displayMetrics); } void scheduleSurfaceDestroy(WindowState win) { mDestroySurface.add(win); } boolean destroySurfacesLocked() { boolean wallpaperDestroyed = false; for (int i = mDestroySurface.size() - 1; i >= 0; i--) { WindowState win = mDestroySurface.get(i); win.mDestroying = false; if (mInputMethodWindow == win) { mInputMethodWindow = null; } if (mWallpaperControllerLocked.isWallpaperTarget(win)) { wallpaperDestroyed = true; } if (!win.shouldSaveSurface()) { win.mWinAnimator.destroySurfaceLocked(); } } mDestroySurface.clear(); return wallpaperDestroyed; } private final class LocalService extends WindowManagerInternal { @Override public void requestTraversalFromDisplayManager() { Loading
services/core/java/com/android/server/wm/WindowState.java +17 −6 Original line number Diff line number Diff line Loading @@ -411,6 +411,10 @@ final class WindowState implements WindowManagerPolicy.WindowState { final private Rect mTmpRect = new Rect(); // This window often remains added but hidden, so we want to destroy its surface when it's not // visible. private final boolean mDestroySurfaceWhenHidden; WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token, WindowState attachedWindow, int appOp, int seq, WindowManager.LayoutParams a, int viewVisibility, final DisplayContent displayContent) { Loading Loading @@ -458,6 +462,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { mSubLayer = 0; mInputWindowHandle = null; mWinAnimator = null; mDestroySurfaceWhenHidden = false; return; } mDeathRecipient = deathRecipient; Loading Loading @@ -556,6 +561,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { mInputWindowHandle = new InputWindowHandle( mAppToken != null ? mAppToken.mInputApplicationHandle : null, this, displayContent.getDisplayId()); mDestroySurfaceWhenHidden = mAttrs.type == TYPE_DOCK_DIVIDER; } void attach() { Loading Loading @@ -1313,6 +1319,10 @@ final class WindowState implements WindowManagerPolicy.WindowState { mHasSurface = hasSurface; } boolean shouldDestroySurfaceWhenAnimationFinishes() { return mExiting || (mDestroySurfaceWhenHidden && !mPolicyVisibilityAfterAnim); } private final class DeadWindowEventReceiver extends InputEventReceiver { DeadWindowEventReceiver(InputChannel inputChannel) { super(inputChannel, mService.mH.getLooper()); Loading Loading @@ -1589,6 +1599,10 @@ final class WindowState implements WindowManagerPolicy.WindowState { // Already showing. return false; } if (!mHasSurface) { mDestroying = false; mWinAnimator.createSurfaceLocked(); } if (DEBUG_VISIBILITY) Slog.v(TAG, "Policy visibility true: " + this); if (doAnimation) { if (DEBUG_VISIBILITY) Slog.v(TAG, "doAnimation: mPolicyVisibility=" Loading Loading @@ -1624,8 +1638,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { doAnimation = false; } } boolean current = doAnimation ? mPolicyVisibilityAfterAnim : mPolicyVisibility; final boolean current = doAnimation ? mPolicyVisibilityAfterAnim : mPolicyVisibility; if (!current) { // Already hiding. return false; Loading @@ -1636,11 +1649,9 @@ final class WindowState implements WindowManagerPolicy.WindowState { doAnimation = false; } } if (doAnimation) { mPolicyVisibilityAfterAnim = false; } else { if (!doAnimation) { if (DEBUG_VISIBILITY) Slog.v(TAG, "Policy visibility false: " + this); mPolicyVisibilityAfterAnim = false; mPolicyVisibility = false; // Window is no longer visible -- make sure if we were waiting // for it to be displayed before enabling the display, that Loading
services/core/java/com/android/server/wm/WindowStateAnimator.java +11 −10 Original line number Diff line number Diff line Loading @@ -446,7 +446,7 @@ class WindowStateAnimator { } } if (!mWin.mExiting) { if (!mWin.shouldDestroySurfaceWhenAnimationFinishes()) { return; } Loading @@ -454,12 +454,13 @@ class WindowStateAnimator { return; } if (WindowManagerService.localLOGV) Slog.v( TAG, "Exit animation finished in " + this + ": remove=" + mWin.mRemoveOnExit); if (localLOGV) Slog.v(TAG, "Exit animation finished in " + this + ": remove=" + mWin.mRemoveOnExit); if (mSurfaceController != null && mSurfaceController.hasSurface()) { mService.mDestroySurface.add(mWin); mService.scheduleSurfaceDestroy(mWin); if (mWin.mExiting) { mWin.mDestroying = true; } hide("finishExit"); } mWin.mExiting = false; Loading Loading @@ -645,7 +646,7 @@ class WindowStateAnimator { return null; } if (WindowManagerService.localLOGV) { if (localLOGV) { Slog.v(TAG, "Got surface: " + mSurfaceController + ", set left=" + w.mFrame.left + " top=" + w.mFrame.top + ", animLayer=" + mAnimLayer); Loading @@ -666,7 +667,7 @@ class WindowStateAnimator { mAnimLayer); mLastHidden = true; if (WindowManagerService.localLOGV) Slog.v( if (localLOGV) Slog.v( TAG, "Created surface " + this); } return mSurfaceController; Loading Loading @@ -973,7 +974,7 @@ class WindowStateAnimator { //Slog.i(TAG, "Not applying alpha transform"); } if ((DEBUG_SURFACE_TRACE || WindowManagerService.localLOGV) if ((DEBUG_SURFACE_TRACE || localLOGV) && (mShownAlpha == 1.0 || mShownAlpha == 0.0)) Slog.v( TAG, "computeShownFrameLocked: Animating " + this + " mAlpha=" + mAlpha + " self=" + (selfTransformation ? mTransformation.getAlpha() : "null") Loading @@ -994,7 +995,7 @@ class WindowStateAnimator { return; } if (WindowManagerService.localLOGV) Slog.v( if (localLOGV) Slog.v( TAG, "computeShownFrameLocked: " + this + " not attached, mAlpha=" + mAlpha); Loading
services/core/java/com/android/server/wm/WindowSurfaceController.java +2 −4 Original line number Diff line number Diff line Loading @@ -296,10 +296,8 @@ class WindowSurfaceController { } boolean showRobustlyInTransaction() { if (SHOW_TRANSACTIONS) logSurface( "SHOW (performLayout)", null); if (DEBUG_VISIBILITY) Slog.v(TAG, "Showing " + this + " during relayout"); if (SHOW_TRANSACTIONS) logSurface("SHOW (performLayout)", null); if (DEBUG_VISIBILITY) Slog.v(TAG, "Showing " + this + " during relayout"); if (mHiddenForCrop) { return false; Loading
services/core/java/com/android/server/wm/WindowSurfacePlacer.java +1 −19 Original line number Diff line number Diff line Loading @@ -381,25 +381,7 @@ class WindowSurfacePlacer { } // Destroy the surface of any windows that are no longer visible. boolean wallpaperDestroyed = false; i = mService.mDestroySurface.size(); if (i > 0) { do { i--; WindowState win = mService.mDestroySurface.get(i); win.mDestroying = false; if (mService.mInputMethodWindow == win) { mService.mInputMethodWindow = null; } if (mWallpaperControllerLocked.isWallpaperTarget(win)) { wallpaperDestroyed = true; } if (!win.shouldSaveSurface()) { win.mWinAnimator.destroySurfaceLocked(); } } while (i > 0); mService.mDestroySurface.clear(); } final boolean wallpaperDestroyed = mService.destroySurfacesLocked(); // Time to remove any exiting tokens? for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) { Loading