Loading core/java/android/view/ViewRootImpl.java +6 −12 Original line number Diff line number Diff line Loading @@ -2643,18 +2643,12 @@ public final class ViewRootImpl implements ViewParent, || mForceNextWindowRelayout) { mForceNextWindowRelayout = false; if (isViewVisible) { // If this window is giving internal insets to the window // manager, and it is being added or changing its visibility, // then we want to first give the window manager "fake" // insets to cause it to effectively ignore the content of // the window during layout. This avoids it briefly causing // other windows to resize/move based on the raw frame of the // window, waiting until we can finish laying out this window // and get back to the window manager with the ultimately // computed insets. insetsPending = computesInternalInsets && (mFirst || viewVisibilityChanged); } // If this window is giving internal insets to the window manager, then we want to first // make the provided insets unchanged during layout. This avoids it briefly causing // other windows to resize/move based on the raw frame of the window, waiting until we // can finish laying out this window and get back to the window manager with the // ultimately computed insets. insetsPending = computesInternalInsets; if (mSurfaceHolder != null) { mSurfaceHolder.mSurfaceLock.lock(); Loading services/core/java/com/android/server/wm/InsetsSourceProvider.java +36 −9 Original line number Diff line number Diff line Loading @@ -151,6 +151,7 @@ class InsetsSourceProvider { // TODO: Ideally, we should wait for the animation to finish so previous window can // animate-out as new one animates-in. mWin.cancelAnimation(); mWin.mPendingPositionChanged = null; } ProtoLog.d(WM_DEBUG_IME, "InsetsSource setWin %s", win); mWin = win; Loading Loading @@ -181,7 +182,9 @@ class InsetsSourceProvider { * window gets laid out. */ void updateSourceFrame() { if (mWin == null) { if (mWin == null || mWin.mGivenInsetsPending) { // If the given insets are pending, they are not reliable for now. The source frame // should be updated after the new given insets are sent to window manager. return; } Loading Loading @@ -238,19 +241,45 @@ class InsetsSourceProvider { return; } setServerVisible(mWin.wouldBeVisibleIfPolicyIgnored() && mWin.isVisibleByPolicy() && !mWin.mGivenInsetsPending); setServerVisible(mWin.wouldBeVisibleIfPolicyIgnored() && mWin.isVisibleByPolicy()); updateSourceFrame(); if (mControl != null) { final Rect frame = mWin.getWindowFrames().mFrame; if (mControl.setSurfacePosition(frame.left, frame.top) && mControlTarget != null) { // The leash has been stale, we need to create a new one for the client. updateControlForTarget(mControlTarget, true /* force */); if (!mWin.getWindowFrames().didFrameSizeChange()) { updateLeashPosition(frame, -1 /* frameNumber */); } else if (mWin.mInRelayout) { updateLeashPosition(frame, mWin.getFrameNumber()); } else { mWin.mPendingPositionChanged = this; } mStateController.notifyControlChanged(mControlTarget); } } } void updateLeashPosition(Rect frame, long frameNumber) { if (mControl == null) { return; } final SurfaceControl leash = mControl.getLeash(); if (leash != null) { final Transaction t = mDisplayContent.getPendingTransaction(); Point position = new Point(); mWin.transformFrameToSurfacePosition(frame.left, frame.top, position); t.setPosition(leash, position.x, position.y); deferTransactionUntil(t, leash, frameNumber); } } private void deferTransactionUntil(Transaction t, SurfaceControl leash, long frameNumber) { if (frameNumber >= 0) { final SurfaceControl barrier = mWin.getClientViewRootSurface(); t.deferTransactionUntil(mWin.getSurfaceControl(), barrier, frameNumber); t.deferTransactionUntil(leash, barrier, frameNumber); } } /** * @see InsetsStateController#onControlFakeTargetChanged(int, InsetsControlTarget) */ Loading Loading @@ -305,14 +334,12 @@ class InsetsSourceProvider { final SurfaceControl leash = mAdapter.mCapturedLeash; final long frameNumber = mFinishSeamlessRotateFrameNumber; mFinishSeamlessRotateFrameNumber = -1; if (frameNumber >= 0 && mWin.mHasSurface && leash != null) { if (mWin.mHasSurface && leash != null) { // We just finished the seamless rotation. We don't want to change the position or the // window crop of the surface controls (including the leash) until the client finishes // drawing the new frame of the new orientation. Although we cannot defer the reparent // operation, it is fine, because reparent won't cause any visual effect. final SurfaceControl barrier = mWin.getClientViewRootSurface(); t.deferTransactionUntil(mWin.getSurfaceControl(), barrier, frameNumber); t.deferTransactionUntil(leash, barrier, frameNumber); deferTransactionUntil(t, leash, frameNumber); } mControlTarget = target; updateVisibility(); Loading services/core/java/com/android/server/wm/InsetsStateController.java +2 −0 Original line number Diff line number Diff line Loading @@ -193,6 +193,8 @@ class InsetsStateController { state.removeSource(ITYPE_STATUS_BAR); state.removeSource(ITYPE_CLIMATE_BAR); state.removeSource(ITYPE_CAPTION_BAR); state.removeSource(ITYPE_NAVIGATION_BAR); state.removeSource(ITYPE_EXTRA_NAVIGATION_BAR); } // Status bar doesn't get influenced by caption bar Loading services/core/java/com/android/server/wm/WindowFrames.java +1 −1 Original line number Diff line number Diff line Loading @@ -203,7 +203,7 @@ public class WindowFrames { /** * @return true if the width or height has changed since last reported to the client. */ private boolean didFrameSizeChange() { boolean didFrameSizeChange() { return (mLastFrame.width() != mFrame.width()) || (mLastFrame.height() != mFrame.height()); } Loading services/core/java/com/android/server/wm/WindowManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -2191,6 +2191,11 @@ public class WindowManagerService extends IWindowManager.Stub win.finishSeamlessRotation(false /* timeout */); } if (win.mPendingPositionChanged != null) { win.mPendingPositionChanged.updateLeashPosition(win.getFrame(), frameNumber); win.mPendingPositionChanged = null; } if (mUseBLASTSync && win.useBLASTSync()) { result |= RELAYOUT_RES_BLAST_SYNC; } Loading Loading
core/java/android/view/ViewRootImpl.java +6 −12 Original line number Diff line number Diff line Loading @@ -2643,18 +2643,12 @@ public final class ViewRootImpl implements ViewParent, || mForceNextWindowRelayout) { mForceNextWindowRelayout = false; if (isViewVisible) { // If this window is giving internal insets to the window // manager, and it is being added or changing its visibility, // then we want to first give the window manager "fake" // insets to cause it to effectively ignore the content of // the window during layout. This avoids it briefly causing // other windows to resize/move based on the raw frame of the // window, waiting until we can finish laying out this window // and get back to the window manager with the ultimately // computed insets. insetsPending = computesInternalInsets && (mFirst || viewVisibilityChanged); } // If this window is giving internal insets to the window manager, then we want to first // make the provided insets unchanged during layout. This avoids it briefly causing // other windows to resize/move based on the raw frame of the window, waiting until we // can finish laying out this window and get back to the window manager with the // ultimately computed insets. insetsPending = computesInternalInsets; if (mSurfaceHolder != null) { mSurfaceHolder.mSurfaceLock.lock(); Loading
services/core/java/com/android/server/wm/InsetsSourceProvider.java +36 −9 Original line number Diff line number Diff line Loading @@ -151,6 +151,7 @@ class InsetsSourceProvider { // TODO: Ideally, we should wait for the animation to finish so previous window can // animate-out as new one animates-in. mWin.cancelAnimation(); mWin.mPendingPositionChanged = null; } ProtoLog.d(WM_DEBUG_IME, "InsetsSource setWin %s", win); mWin = win; Loading Loading @@ -181,7 +182,9 @@ class InsetsSourceProvider { * window gets laid out. */ void updateSourceFrame() { if (mWin == null) { if (mWin == null || mWin.mGivenInsetsPending) { // If the given insets are pending, they are not reliable for now. The source frame // should be updated after the new given insets are sent to window manager. return; } Loading Loading @@ -238,19 +241,45 @@ class InsetsSourceProvider { return; } setServerVisible(mWin.wouldBeVisibleIfPolicyIgnored() && mWin.isVisibleByPolicy() && !mWin.mGivenInsetsPending); setServerVisible(mWin.wouldBeVisibleIfPolicyIgnored() && mWin.isVisibleByPolicy()); updateSourceFrame(); if (mControl != null) { final Rect frame = mWin.getWindowFrames().mFrame; if (mControl.setSurfacePosition(frame.left, frame.top) && mControlTarget != null) { // The leash has been stale, we need to create a new one for the client. updateControlForTarget(mControlTarget, true /* force */); if (!mWin.getWindowFrames().didFrameSizeChange()) { updateLeashPosition(frame, -1 /* frameNumber */); } else if (mWin.mInRelayout) { updateLeashPosition(frame, mWin.getFrameNumber()); } else { mWin.mPendingPositionChanged = this; } mStateController.notifyControlChanged(mControlTarget); } } } void updateLeashPosition(Rect frame, long frameNumber) { if (mControl == null) { return; } final SurfaceControl leash = mControl.getLeash(); if (leash != null) { final Transaction t = mDisplayContent.getPendingTransaction(); Point position = new Point(); mWin.transformFrameToSurfacePosition(frame.left, frame.top, position); t.setPosition(leash, position.x, position.y); deferTransactionUntil(t, leash, frameNumber); } } private void deferTransactionUntil(Transaction t, SurfaceControl leash, long frameNumber) { if (frameNumber >= 0) { final SurfaceControl barrier = mWin.getClientViewRootSurface(); t.deferTransactionUntil(mWin.getSurfaceControl(), barrier, frameNumber); t.deferTransactionUntil(leash, barrier, frameNumber); } } /** * @see InsetsStateController#onControlFakeTargetChanged(int, InsetsControlTarget) */ Loading Loading @@ -305,14 +334,12 @@ class InsetsSourceProvider { final SurfaceControl leash = mAdapter.mCapturedLeash; final long frameNumber = mFinishSeamlessRotateFrameNumber; mFinishSeamlessRotateFrameNumber = -1; if (frameNumber >= 0 && mWin.mHasSurface && leash != null) { if (mWin.mHasSurface && leash != null) { // We just finished the seamless rotation. We don't want to change the position or the // window crop of the surface controls (including the leash) until the client finishes // drawing the new frame of the new orientation. Although we cannot defer the reparent // operation, it is fine, because reparent won't cause any visual effect. final SurfaceControl barrier = mWin.getClientViewRootSurface(); t.deferTransactionUntil(mWin.getSurfaceControl(), barrier, frameNumber); t.deferTransactionUntil(leash, barrier, frameNumber); deferTransactionUntil(t, leash, frameNumber); } mControlTarget = target; updateVisibility(); Loading
services/core/java/com/android/server/wm/InsetsStateController.java +2 −0 Original line number Diff line number Diff line Loading @@ -193,6 +193,8 @@ class InsetsStateController { state.removeSource(ITYPE_STATUS_BAR); state.removeSource(ITYPE_CLIMATE_BAR); state.removeSource(ITYPE_CAPTION_BAR); state.removeSource(ITYPE_NAVIGATION_BAR); state.removeSource(ITYPE_EXTRA_NAVIGATION_BAR); } // Status bar doesn't get influenced by caption bar Loading
services/core/java/com/android/server/wm/WindowFrames.java +1 −1 Original line number Diff line number Diff line Loading @@ -203,7 +203,7 @@ public class WindowFrames { /** * @return true if the width or height has changed since last reported to the client. */ private boolean didFrameSizeChange() { boolean didFrameSizeChange() { return (mLastFrame.width() != mFrame.width()) || (mLastFrame.height() != mFrame.height()); } Loading
services/core/java/com/android/server/wm/WindowManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -2191,6 +2191,11 @@ public class WindowManagerService extends IWindowManager.Stub win.finishSeamlessRotation(false /* timeout */); } if (win.mPendingPositionChanged != null) { win.mPendingPositionChanged.updateLeashPosition(win.getFrame(), frameNumber); win.mPendingPositionChanged = null; } if (mUseBLASTSync && win.useBLASTSync()) { result |= RELAYOUT_RES_BLAST_SYNC; } Loading