Loading core/java/android/view/ViewRootImpl.java +20 −2 Original line number Diff line number Diff line Loading @@ -191,6 +191,10 @@ public final class ViewRootImpl implements ViewParent, Rect mDirty; boolean mIsAnimating; private boolean mDragResizing; private int mCanvasOffsetX; private int mCanvasOffsetY; CompatibilityInfo.Translator mTranslator; final View.AttachInfo mAttachInfo; Loading Loading @@ -1506,6 +1510,7 @@ public final class ViewRootImpl implements ViewParent, frame.width() < desiredWindowWidth && frame.width() != mWidth) || (lp.height == ViewGroup.LayoutParams.WRAP_CONTENT && frame.height() < desiredWindowHeight && frame.height() != mHeight)); windowShouldResize |= mDragResizing; // Determine whether to compute insets. // If there are no inset listeners remaining then we may still need to compute Loading Loading @@ -1681,6 +1686,19 @@ public final class ViewRootImpl implements ViewParent, return; } } final boolean dragResizing = (relayoutResult & WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING) != 0; if (mDragResizing != dragResizing) { mDragResizing = dragResizing; mFullRedrawNeeded = true; } if (dragResizing) { mCanvasOffsetX = mWinFrame.left; mCanvasOffsetY = mWinFrame.top; } else { mCanvasOffsetX = mCanvasOffsetY = 0; } } catch (RemoteException e) { } Loading Loading @@ -2463,8 +2481,8 @@ public final class ViewRootImpl implements ViewParent, mAttachInfo.mTreeObserver.dispatchOnDraw(); int xOffset = 0; int yOffset = curScrollY; int xOffset = -mCanvasOffsetX; int yOffset = -mCanvasOffsetY + curScrollY; final WindowManager.LayoutParams params = mWindowAttributes; final Rect surfaceInsets = params != null ? params.surfaceInsets : null; if (surfaceInsets != null) { Loading core/java/android/view/WindowManagerGlobal.java +7 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,13 @@ public final class WindowManagerGlobal { */ public static final int RELAYOUT_RES_SURFACE_CHANGED = 0x4; /** * The window is being resized by dragging one of the window corners, * in this case the surface would be fullsreen-sized. The client should * render to the actual frame location (instead of (0,curScrollY)). */ public static final int RELAYOUT_RES_DRAG_RESIZING = 0x8; /** * Flag for relayout: the client will be later giving * internal insets; as a result, the window will not impact other window Loading services/core/java/com/android/server/wm/WindowManagerService.java +27 −9 Original line number Diff line number Diff line Loading @@ -2439,6 +2439,7 @@ public class WindowManagerService extends IWindowManager.Stub boolean inTouchMode; boolean configChanged; boolean surfaceChanged = false; boolean dragResizing = false; boolean animating; boolean hasStatusBarPermission = mContext.checkCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR) Loading Loading @@ -2587,6 +2588,18 @@ public class WindowManagerService extends IWindowManager.Stub surfaceChanged = true; } } dragResizing = win.isDragResizing(); if (win.mDragResizing != dragResizing) { win.mDragResizing = dragResizing; if (win.mHasSurface) { winAnimator.mDestroyPendingSurfaceUponRedraw = true; winAnimator.mSurfaceDestroyDeferred = true; winAnimator.destroySurfaceLocked(); startFreezingDisplayLocked(false, 0, 0); toBeDisplayed = true; } } try { if (!win.mHasSurface) { surfaceChanged = true; Loading Loading @@ -2753,7 +2766,8 @@ public class WindowManagerService extends IWindowManager.Stub return (inTouchMode ? WindowManagerGlobal.RELAYOUT_RES_IN_TOUCH_MODE : 0) | (toBeDisplayed ? WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME : 0) | (surfaceChanged ? WindowManagerGlobal.RELAYOUT_RES_SURFACE_CHANGED : 0); | (surfaceChanged ? WindowManagerGlobal.RELAYOUT_RES_SURFACE_CHANGED : 0) | (dragResizing ? WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING : 0); } public void performDeferredDestroyWindow(Session session, IWindow client) { Loading Loading @@ -8466,15 +8480,18 @@ public class WindowManagerService extends IWindowManager.Stub Slog.v(TAG, "Win " + w + " config changed: " + mCurConfiguration); } final boolean dragResizingChanged = w.mDragResizing != w.isDragResizing(); if (localLOGV) Slog.v(TAG, "Resizing " + w + ": configChanged=" + configChanged + " dragResizingChanged=" + dragResizingChanged + " last=" + w.mLastFrame + " frame=" + w.mFrame); w.mLastFrame.set(w.mFrame); if (w.mContentInsetsChanged || w.mVisibleInsetsChanged || winAnimator.mSurfaceResized || w.mOutsetsChanged || configChanged) { || configChanged || dragResizingChanged) { if (DEBUG_RESIZE || DEBUG_ORIENTATION) { Slog.v(TAG, "Resize reasons for w=" + w + ": " + " contentInsetsChanged=" + w.mContentInsetsChanged Loading @@ -8486,7 +8503,8 @@ public class WindowManagerService extends IWindowManager.Stub + " outsetsChanged=" + w.mOutsetsChanged + " " + w.mOutsets.toShortString() + " surfaceResized=" + winAnimator.mSurfaceResized + " configChanged=" + configChanged); + " configChanged=" + configChanged + " dragResizingChanged=" + dragResizingChanged); } w.mLastOverscanInsets.set(w.mOverscanInsets); Loading @@ -8495,12 +8513,12 @@ public class WindowManagerService extends IWindowManager.Stub w.mLastStableInsets.set(w.mStableInsets); w.mLastOutsets.set(w.mOutsets); makeWindowFreezingScreenIfNeededLocked(w); // If the orientation is changing, then we need to // hold off on unfreezing the display until this // window has been redrawn; to do that, we need // to go through the process of getting informed // by the application when it has finished drawing. if (w.mOrientationChanging) { // If the orientation is changing, or we're starting or ending // a drag resizing action, then we need to hold off on unfreezing // the display until this window has been redrawn; to do that, // we need to go through the process of getting informed by the // application when it has finished drawing. if (w.mOrientationChanging || dragResizingChanged) { if (DEBUG_SURFACE_TRACE || DEBUG_ANIM || DEBUG_ORIENTATION) Slog.v(TAG, "Orientation start waiting for draw mDrawState=DRAW_PENDING in " + w + ", surface " + winAnimator.mSurfaceControl); Loading services/core/java/com/android/server/wm/WindowState.java +1 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { boolean mAppFreezing; boolean mAttachedHidden; // is our parent window hidden? boolean mWallpaperVisible; // for wallpaper, what was last vis report? boolean mDragResizing; RemoteCallbackList<IWindowFocusObserver> mFocusCallbacks; Loading services/core/java/com/android/server/wm/WindowStateAnimator.java +21 −10 Original line number Diff line number Diff line Loading @@ -107,6 +107,7 @@ class WindowStateAnimator { */ boolean mSurfaceDestroyDeferred; boolean mDestroyPendingSurfaceUponRedraw; float mShownAlpha = 0; float mAlpha = 0; float mLastAlpha = 0; Loading Loading @@ -546,9 +547,15 @@ class WindowStateAnimator { Slog.i(TAG, "commitFinishDrawingLocked: mDrawState=READY_TO_SHOW " + mSurfaceControl); } mDrawState = READY_TO_SHOW; boolean result = false; final AppWindowToken atoken = mWin.mAppToken; if (atoken == null || atoken.allDrawn || mWin.mAttrs.type == TYPE_APPLICATION_STARTING) { return performShowLocked(); result = performShowLocked(); } if (mDestroyPendingSurfaceUponRedraw) { mDestroyPendingSurfaceUponRedraw = false; destroyDeferredSurfaceLocked(); mService.stopFreezingDisplayLocked(); } return false; } Loading Loading @@ -796,6 +803,9 @@ class WindowStateAnimator { flags |= SurfaceControl.SECURE; } float left = w.mFrame.left + w.mXOffset; float top = w.mFrame.top + w.mYOffset; int width; int height; if ((attrs.flags & LayoutParams.FLAG_SCALED) != 0) { Loading @@ -808,7 +818,9 @@ class WindowStateAnimator { // so that we don't need to reallocate during the process. This also prevents // buffer drops due to size mismatch. final DisplayInfo displayInfo = w.getDisplayInfo(); if (displayInfo != null && w.isDragResizing()) { if (displayInfo != null && w.mDragResizing) { left = 0; top = 0; width = displayInfo.logicalWidth; height = displayInfo.logicalHeight; } else { Loading @@ -826,9 +838,6 @@ class WindowStateAnimator { height = 1; } float left = w.mFrame.left + w.mXOffset; float top = w.mFrame.top + w.mYOffset; // Adjust for surface insets. width += attrs.surfaceInsets.left + attrs.surfaceInsets.right; height += attrs.surfaceInsets.top + attrs.surfaceInsets.bottom; Loading Loading @@ -1324,7 +1333,7 @@ class WindowStateAnimator { final boolean fullscreen = w.isFullscreen(displayInfo.appWidth, displayInfo.appHeight); final Rect clipRect = mTmpClipRect; if (w.isDragResizing()) { if (w.mDragResizing) { // When we're doing a drag-resizing, the surface is set up to cover full screen. // Set the clip rect to be the same size so that we don't get any scaling. clipRect.set(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight); Loading Loading @@ -1399,6 +1408,9 @@ class WindowStateAnimator { void setSurfaceBoundariesLocked(final boolean recoveringMemory) { final WindowState w = mWin; float left = w.mShownFrame.left; float top = w.mShownFrame.top; int width; int height; if ((w.mAttrs.flags & LayoutParams.FLAG_SCALED) != 0) { Loading @@ -1411,7 +1423,9 @@ class WindowStateAnimator { // so that we don't need to reallocate during the process. This also prevents // buffer drops due to size mismatch. final DisplayInfo displayInfo = w.getDisplayInfo(); if (displayInfo != null && w.isDragResizing()) { if (displayInfo != null && w.mDragResizing) { left = 0; top = 0; width = displayInfo.logicalWidth; height = displayInfo.logicalHeight; } else { Loading @@ -1429,9 +1443,6 @@ class WindowStateAnimator { height = 1; } float left = w.mShownFrame.left; float top = w.mShownFrame.top; // Adjust for surface insets. final LayoutParams attrs = w.getAttrs(); final int displayId = w.getDisplayId(); Loading Loading
core/java/android/view/ViewRootImpl.java +20 −2 Original line number Diff line number Diff line Loading @@ -191,6 +191,10 @@ public final class ViewRootImpl implements ViewParent, Rect mDirty; boolean mIsAnimating; private boolean mDragResizing; private int mCanvasOffsetX; private int mCanvasOffsetY; CompatibilityInfo.Translator mTranslator; final View.AttachInfo mAttachInfo; Loading Loading @@ -1506,6 +1510,7 @@ public final class ViewRootImpl implements ViewParent, frame.width() < desiredWindowWidth && frame.width() != mWidth) || (lp.height == ViewGroup.LayoutParams.WRAP_CONTENT && frame.height() < desiredWindowHeight && frame.height() != mHeight)); windowShouldResize |= mDragResizing; // Determine whether to compute insets. // If there are no inset listeners remaining then we may still need to compute Loading Loading @@ -1681,6 +1686,19 @@ public final class ViewRootImpl implements ViewParent, return; } } final boolean dragResizing = (relayoutResult & WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING) != 0; if (mDragResizing != dragResizing) { mDragResizing = dragResizing; mFullRedrawNeeded = true; } if (dragResizing) { mCanvasOffsetX = mWinFrame.left; mCanvasOffsetY = mWinFrame.top; } else { mCanvasOffsetX = mCanvasOffsetY = 0; } } catch (RemoteException e) { } Loading Loading @@ -2463,8 +2481,8 @@ public final class ViewRootImpl implements ViewParent, mAttachInfo.mTreeObserver.dispatchOnDraw(); int xOffset = 0; int yOffset = curScrollY; int xOffset = -mCanvasOffsetX; int yOffset = -mCanvasOffsetY + curScrollY; final WindowManager.LayoutParams params = mWindowAttributes; final Rect surfaceInsets = params != null ? params.surfaceInsets : null; if (surfaceInsets != null) { Loading
core/java/android/view/WindowManagerGlobal.java +7 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,13 @@ public final class WindowManagerGlobal { */ public static final int RELAYOUT_RES_SURFACE_CHANGED = 0x4; /** * The window is being resized by dragging one of the window corners, * in this case the surface would be fullsreen-sized. The client should * render to the actual frame location (instead of (0,curScrollY)). */ public static final int RELAYOUT_RES_DRAG_RESIZING = 0x8; /** * Flag for relayout: the client will be later giving * internal insets; as a result, the window will not impact other window Loading
services/core/java/com/android/server/wm/WindowManagerService.java +27 −9 Original line number Diff line number Diff line Loading @@ -2439,6 +2439,7 @@ public class WindowManagerService extends IWindowManager.Stub boolean inTouchMode; boolean configChanged; boolean surfaceChanged = false; boolean dragResizing = false; boolean animating; boolean hasStatusBarPermission = mContext.checkCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR) Loading Loading @@ -2587,6 +2588,18 @@ public class WindowManagerService extends IWindowManager.Stub surfaceChanged = true; } } dragResizing = win.isDragResizing(); if (win.mDragResizing != dragResizing) { win.mDragResizing = dragResizing; if (win.mHasSurface) { winAnimator.mDestroyPendingSurfaceUponRedraw = true; winAnimator.mSurfaceDestroyDeferred = true; winAnimator.destroySurfaceLocked(); startFreezingDisplayLocked(false, 0, 0); toBeDisplayed = true; } } try { if (!win.mHasSurface) { surfaceChanged = true; Loading Loading @@ -2753,7 +2766,8 @@ public class WindowManagerService extends IWindowManager.Stub return (inTouchMode ? WindowManagerGlobal.RELAYOUT_RES_IN_TOUCH_MODE : 0) | (toBeDisplayed ? WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME : 0) | (surfaceChanged ? WindowManagerGlobal.RELAYOUT_RES_SURFACE_CHANGED : 0); | (surfaceChanged ? WindowManagerGlobal.RELAYOUT_RES_SURFACE_CHANGED : 0) | (dragResizing ? WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING : 0); } public void performDeferredDestroyWindow(Session session, IWindow client) { Loading Loading @@ -8466,15 +8480,18 @@ public class WindowManagerService extends IWindowManager.Stub Slog.v(TAG, "Win " + w + " config changed: " + mCurConfiguration); } final boolean dragResizingChanged = w.mDragResizing != w.isDragResizing(); if (localLOGV) Slog.v(TAG, "Resizing " + w + ": configChanged=" + configChanged + " dragResizingChanged=" + dragResizingChanged + " last=" + w.mLastFrame + " frame=" + w.mFrame); w.mLastFrame.set(w.mFrame); if (w.mContentInsetsChanged || w.mVisibleInsetsChanged || winAnimator.mSurfaceResized || w.mOutsetsChanged || configChanged) { || configChanged || dragResizingChanged) { if (DEBUG_RESIZE || DEBUG_ORIENTATION) { Slog.v(TAG, "Resize reasons for w=" + w + ": " + " contentInsetsChanged=" + w.mContentInsetsChanged Loading @@ -8486,7 +8503,8 @@ public class WindowManagerService extends IWindowManager.Stub + " outsetsChanged=" + w.mOutsetsChanged + " " + w.mOutsets.toShortString() + " surfaceResized=" + winAnimator.mSurfaceResized + " configChanged=" + configChanged); + " configChanged=" + configChanged + " dragResizingChanged=" + dragResizingChanged); } w.mLastOverscanInsets.set(w.mOverscanInsets); Loading @@ -8495,12 +8513,12 @@ public class WindowManagerService extends IWindowManager.Stub w.mLastStableInsets.set(w.mStableInsets); w.mLastOutsets.set(w.mOutsets); makeWindowFreezingScreenIfNeededLocked(w); // If the orientation is changing, then we need to // hold off on unfreezing the display until this // window has been redrawn; to do that, we need // to go through the process of getting informed // by the application when it has finished drawing. if (w.mOrientationChanging) { // If the orientation is changing, or we're starting or ending // a drag resizing action, then we need to hold off on unfreezing // the display until this window has been redrawn; to do that, // we need to go through the process of getting informed by the // application when it has finished drawing. if (w.mOrientationChanging || dragResizingChanged) { if (DEBUG_SURFACE_TRACE || DEBUG_ANIM || DEBUG_ORIENTATION) Slog.v(TAG, "Orientation start waiting for draw mDrawState=DRAW_PENDING in " + w + ", surface " + winAnimator.mSurfaceControl); Loading
services/core/java/com/android/server/wm/WindowState.java +1 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { boolean mAppFreezing; boolean mAttachedHidden; // is our parent window hidden? boolean mWallpaperVisible; // for wallpaper, what was last vis report? boolean mDragResizing; RemoteCallbackList<IWindowFocusObserver> mFocusCallbacks; Loading
services/core/java/com/android/server/wm/WindowStateAnimator.java +21 −10 Original line number Diff line number Diff line Loading @@ -107,6 +107,7 @@ class WindowStateAnimator { */ boolean mSurfaceDestroyDeferred; boolean mDestroyPendingSurfaceUponRedraw; float mShownAlpha = 0; float mAlpha = 0; float mLastAlpha = 0; Loading Loading @@ -546,9 +547,15 @@ class WindowStateAnimator { Slog.i(TAG, "commitFinishDrawingLocked: mDrawState=READY_TO_SHOW " + mSurfaceControl); } mDrawState = READY_TO_SHOW; boolean result = false; final AppWindowToken atoken = mWin.mAppToken; if (atoken == null || atoken.allDrawn || mWin.mAttrs.type == TYPE_APPLICATION_STARTING) { return performShowLocked(); result = performShowLocked(); } if (mDestroyPendingSurfaceUponRedraw) { mDestroyPendingSurfaceUponRedraw = false; destroyDeferredSurfaceLocked(); mService.stopFreezingDisplayLocked(); } return false; } Loading Loading @@ -796,6 +803,9 @@ class WindowStateAnimator { flags |= SurfaceControl.SECURE; } float left = w.mFrame.left + w.mXOffset; float top = w.mFrame.top + w.mYOffset; int width; int height; if ((attrs.flags & LayoutParams.FLAG_SCALED) != 0) { Loading @@ -808,7 +818,9 @@ class WindowStateAnimator { // so that we don't need to reallocate during the process. This also prevents // buffer drops due to size mismatch. final DisplayInfo displayInfo = w.getDisplayInfo(); if (displayInfo != null && w.isDragResizing()) { if (displayInfo != null && w.mDragResizing) { left = 0; top = 0; width = displayInfo.logicalWidth; height = displayInfo.logicalHeight; } else { Loading @@ -826,9 +838,6 @@ class WindowStateAnimator { height = 1; } float left = w.mFrame.left + w.mXOffset; float top = w.mFrame.top + w.mYOffset; // Adjust for surface insets. width += attrs.surfaceInsets.left + attrs.surfaceInsets.right; height += attrs.surfaceInsets.top + attrs.surfaceInsets.bottom; Loading Loading @@ -1324,7 +1333,7 @@ class WindowStateAnimator { final boolean fullscreen = w.isFullscreen(displayInfo.appWidth, displayInfo.appHeight); final Rect clipRect = mTmpClipRect; if (w.isDragResizing()) { if (w.mDragResizing) { // When we're doing a drag-resizing, the surface is set up to cover full screen. // Set the clip rect to be the same size so that we don't get any scaling. clipRect.set(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight); Loading Loading @@ -1399,6 +1408,9 @@ class WindowStateAnimator { void setSurfaceBoundariesLocked(final boolean recoveringMemory) { final WindowState w = mWin; float left = w.mShownFrame.left; float top = w.mShownFrame.top; int width; int height; if ((w.mAttrs.flags & LayoutParams.FLAG_SCALED) != 0) { Loading @@ -1411,7 +1423,9 @@ class WindowStateAnimator { // so that we don't need to reallocate during the process. This also prevents // buffer drops due to size mismatch. final DisplayInfo displayInfo = w.getDisplayInfo(); if (displayInfo != null && w.isDragResizing()) { if (displayInfo != null && w.mDragResizing) { left = 0; top = 0; width = displayInfo.logicalWidth; height = displayInfo.logicalHeight; } else { Loading @@ -1429,9 +1443,6 @@ class WindowStateAnimator { height = 1; } float left = w.mShownFrame.left; float top = w.mShownFrame.top; // Adjust for surface insets. final LayoutParams attrs = w.getAttrs(); final int displayId = w.getDisplayId(); Loading