Loading services/core/java/com/android/server/wm/InsetsSourceProvider.java +14 −28 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import static com.android.server.wm.InsetsSourceProviderProto.CONTROLLABLE; import static com.android.server.wm.InsetsSourceProviderProto.CONTROL_TARGET; import static com.android.server.wm.InsetsSourceProviderProto.FAKE_CONTROL; import static com.android.server.wm.InsetsSourceProviderProto.FAKE_CONTROL_TARGET; import static com.android.server.wm.InsetsSourceProviderProto.FINISH_SEAMLESS_ROTATE_FRAME_NUMBER; import static com.android.server.wm.InsetsSourceProviderProto.FRAME; import static com.android.server.wm.InsetsSourceProviderProto.IME_OVERRIDDEN_FRAME; import static com.android.server.wm.InsetsSourceProviderProto.IS_LEASH_READY_FOR_DISPATCHING; Loading Loading @@ -59,6 +58,7 @@ import com.android.server.wm.SurfaceAnimator.AnimationType; import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback; import java.io.PrintWriter; import java.util.function.Consumer; /** * Controller for a specific inset source on the server. It's called provider as it provides the Loading @@ -84,6 +84,16 @@ class InsetsSourceProvider { private final Rect mImeOverrideFrame = new Rect(); private boolean mIsLeashReadyForDispatching; private final Consumer<Transaction> mSetLeashPositionConsumer = t -> { if (mControl != null) { final SurfaceControl leash = mControl.getLeash(); if (leash != null) { final Point position = mControl.getSurfacePosition(); t.setPosition(leash, position.x, position.y); } } }; /** The visibility override from the current controlling window. */ private boolean mClientVisible; Loading Loading @@ -149,7 +159,6 @@ 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; mWin.mProvidedInsetsSources.remove(mSource.getType()); } ProtoLog.d(WM_DEBUG_IME, "InsetsSource setWin %s", win); Loading Loading @@ -248,31 +257,16 @@ class InsetsSourceProvider { if (mControl != null) { final Point position = getWindowFrameSurfacePosition(); if (mControl.setSurfacePosition(position.x, position.y) && mControlTarget != null) { if (!mWin.getWindowFrames().didFrameSizeChange()) { updateLeashPosition(-1 /* frameNumber */); } else if (mWin.mInRelayout) { updateLeashPosition(mWin.getFrameNumber()); if (mWin.getWindowFrames().didFrameSizeChange()) { mWin.applyWithNextDraw(mSetLeashPositionConsumer); } else { mWin.mPendingPositionChanged = this; mSetLeashPositionConsumer.accept(mWin.getPendingTransaction()); } mStateController.notifyControlChanged(mControlTarget); } } } void updateLeashPosition(long frameNumber) { if (mControl == null) { return; } final SurfaceControl leash = mControl.getLeash(); if (leash != null) { final Transaction t = mDisplayContent.getPendingTransaction(); final Point position = mControl.getSurfacePosition(); t.setPosition(leash, position.x, position.y); deferTransactionUntil(t, leash, frameNumber); } } private Point getWindowFrameSurfacePosition() { final Rect frame = mWin.getFrame(); final Point position = new Point(); Loading @@ -280,14 +274,6 @@ class InsetsSourceProvider { return position; } 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 services/core/java/com/android/server/wm/WindowFrames.java +8 −1 Original line number Diff line number Diff line Loading @@ -113,7 +113,7 @@ public class WindowFrames { } /** * @return true if the width or height has changed since last reported to the client. * @return true if the width or height has changed since last updating resizing window. */ boolean didFrameSizeChange() { return (mLastFrame.width() != mFrame.width()) || (mLastFrame.height() != mFrame.height()); Loading @@ -134,6 +134,13 @@ public class WindowFrames { return mLastForceReportingResized || mFrameSizeChanged; } /** * @return true if the width or height has changed since last reported to the client. */ boolean isFrameSizeChangeReported() { return mFrameSizeChanged || didFrameSizeChange(); } /** * Resets the size changed flags so they're all set to false again. This should be called * after the frames are reported to client. Loading services/core/java/com/android/server/wm/WindowManagerService.java +0 −5 Original line number Diff line number Diff line Loading @@ -2234,11 +2234,6 @@ public class WindowManagerService extends IWindowManager.Stub final DisplayContent dc = win.getDisplayContent(); if (win.mPendingPositionChanged != null) { win.mPendingPositionChanged.updateLeashPosition(frameNumber); win.mPendingPositionChanged = null; } if (mUseBLASTSync && win.useBLASTSync() && viewVisibility != View.GONE) { win.prepareDrawHandlers(); result |= RELAYOUT_RES_BLAST_SYNC; Loading services/core/java/com/android/server/wm/WindowState.java +17 −7 Original line number Diff line number Diff line Loading @@ -726,8 +726,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP */ private InsetsState mFrozenInsetsState; @Nullable InsetsSourceProvider mPendingPositionChanged; private static final float DEFAULT_DIM_AMOUNT_DEAD_WINDOW = 0.5f; private KeyInterceptionInfo mKeyInterceptionInfo; Loading Loading @@ -774,6 +772,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP updateSurfacePosition(t); }; private final Consumer<SurfaceControl.Transaction> mSetSurfacePositionConsumer = t -> { if (mSurfaceControl != null && mSurfaceControl.isValid()) { t.setPosition(mSurfaceControl, mSurfacePosition.x, mSurfacePosition.y); } }; /** * Returns the visibility of the given {@link InternalInsetsType type} requested by the client. * Loading Loading @@ -2124,6 +2128,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP : getTask().getWindowConfiguration().hasMovementAnimations(); if (mToken.okToAnimate() && (mAttrs.privateFlags & PRIVATE_FLAG_NO_MOVE_ANIMATION) == 0 && !mWindowFrames.didFrameSizeChange() && !surfaceInsetsChanging() && !isDragResizing() && hasMovementAnimation && !mWinAnimator.mLastHidden Loading Loading @@ -5313,13 +5319,17 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // prior to the rotation. if (!mSurfaceAnimator.hasLeash() && mPendingSeamlessRotate == null && !mLastSurfacePosition.equals(mSurfacePosition)) { t.setPosition(mSurfaceControl, mSurfacePosition.x, mSurfacePosition.y); final boolean frameSizeChanged = mWindowFrames.isFrameSizeChangeReported(); final boolean surfaceInsetsChanged = surfaceInsetsChanging(); final boolean surfaceSizeChanged = frameSizeChanged || surfaceInsetsChanged; mLastSurfacePosition.set(mSurfacePosition.x, mSurfacePosition.y); if (surfaceInsetsChanging() && mWinAnimator.hasSurface()) { if (surfaceInsetsChanged) { mLastSurfaceInsets.set(mAttrs.surfaceInsets); t.deferTransactionUntil(mSurfaceControl, mWinAnimator.mSurfaceController.mSurfaceControl, getFrameNumber()); } if (surfaceSizeChanged) { applyWithNextDraw(mSetSurfacePositionConsumer); } else { mSetSurfacePositionConsumer.accept(t); } } } Loading Loading
services/core/java/com/android/server/wm/InsetsSourceProvider.java +14 −28 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import static com.android.server.wm.InsetsSourceProviderProto.CONTROLLABLE; import static com.android.server.wm.InsetsSourceProviderProto.CONTROL_TARGET; import static com.android.server.wm.InsetsSourceProviderProto.FAKE_CONTROL; import static com.android.server.wm.InsetsSourceProviderProto.FAKE_CONTROL_TARGET; import static com.android.server.wm.InsetsSourceProviderProto.FINISH_SEAMLESS_ROTATE_FRAME_NUMBER; import static com.android.server.wm.InsetsSourceProviderProto.FRAME; import static com.android.server.wm.InsetsSourceProviderProto.IME_OVERRIDDEN_FRAME; import static com.android.server.wm.InsetsSourceProviderProto.IS_LEASH_READY_FOR_DISPATCHING; Loading Loading @@ -59,6 +58,7 @@ import com.android.server.wm.SurfaceAnimator.AnimationType; import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback; import java.io.PrintWriter; import java.util.function.Consumer; /** * Controller for a specific inset source on the server. It's called provider as it provides the Loading @@ -84,6 +84,16 @@ class InsetsSourceProvider { private final Rect mImeOverrideFrame = new Rect(); private boolean mIsLeashReadyForDispatching; private final Consumer<Transaction> mSetLeashPositionConsumer = t -> { if (mControl != null) { final SurfaceControl leash = mControl.getLeash(); if (leash != null) { final Point position = mControl.getSurfacePosition(); t.setPosition(leash, position.x, position.y); } } }; /** The visibility override from the current controlling window. */ private boolean mClientVisible; Loading Loading @@ -149,7 +159,6 @@ 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; mWin.mProvidedInsetsSources.remove(mSource.getType()); } ProtoLog.d(WM_DEBUG_IME, "InsetsSource setWin %s", win); Loading Loading @@ -248,31 +257,16 @@ class InsetsSourceProvider { if (mControl != null) { final Point position = getWindowFrameSurfacePosition(); if (mControl.setSurfacePosition(position.x, position.y) && mControlTarget != null) { if (!mWin.getWindowFrames().didFrameSizeChange()) { updateLeashPosition(-1 /* frameNumber */); } else if (mWin.mInRelayout) { updateLeashPosition(mWin.getFrameNumber()); if (mWin.getWindowFrames().didFrameSizeChange()) { mWin.applyWithNextDraw(mSetLeashPositionConsumer); } else { mWin.mPendingPositionChanged = this; mSetLeashPositionConsumer.accept(mWin.getPendingTransaction()); } mStateController.notifyControlChanged(mControlTarget); } } } void updateLeashPosition(long frameNumber) { if (mControl == null) { return; } final SurfaceControl leash = mControl.getLeash(); if (leash != null) { final Transaction t = mDisplayContent.getPendingTransaction(); final Point position = mControl.getSurfacePosition(); t.setPosition(leash, position.x, position.y); deferTransactionUntil(t, leash, frameNumber); } } private Point getWindowFrameSurfacePosition() { final Rect frame = mWin.getFrame(); final Point position = new Point(); Loading @@ -280,14 +274,6 @@ class InsetsSourceProvider { return position; } 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
services/core/java/com/android/server/wm/WindowFrames.java +8 −1 Original line number Diff line number Diff line Loading @@ -113,7 +113,7 @@ public class WindowFrames { } /** * @return true if the width or height has changed since last reported to the client. * @return true if the width or height has changed since last updating resizing window. */ boolean didFrameSizeChange() { return (mLastFrame.width() != mFrame.width()) || (mLastFrame.height() != mFrame.height()); Loading @@ -134,6 +134,13 @@ public class WindowFrames { return mLastForceReportingResized || mFrameSizeChanged; } /** * @return true if the width or height has changed since last reported to the client. */ boolean isFrameSizeChangeReported() { return mFrameSizeChanged || didFrameSizeChange(); } /** * Resets the size changed flags so they're all set to false again. This should be called * after the frames are reported to client. Loading
services/core/java/com/android/server/wm/WindowManagerService.java +0 −5 Original line number Diff line number Diff line Loading @@ -2234,11 +2234,6 @@ public class WindowManagerService extends IWindowManager.Stub final DisplayContent dc = win.getDisplayContent(); if (win.mPendingPositionChanged != null) { win.mPendingPositionChanged.updateLeashPosition(frameNumber); win.mPendingPositionChanged = null; } if (mUseBLASTSync && win.useBLASTSync() && viewVisibility != View.GONE) { win.prepareDrawHandlers(); result |= RELAYOUT_RES_BLAST_SYNC; Loading
services/core/java/com/android/server/wm/WindowState.java +17 −7 Original line number Diff line number Diff line Loading @@ -726,8 +726,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP */ private InsetsState mFrozenInsetsState; @Nullable InsetsSourceProvider mPendingPositionChanged; private static final float DEFAULT_DIM_AMOUNT_DEAD_WINDOW = 0.5f; private KeyInterceptionInfo mKeyInterceptionInfo; Loading Loading @@ -774,6 +772,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP updateSurfacePosition(t); }; private final Consumer<SurfaceControl.Transaction> mSetSurfacePositionConsumer = t -> { if (mSurfaceControl != null && mSurfaceControl.isValid()) { t.setPosition(mSurfaceControl, mSurfacePosition.x, mSurfacePosition.y); } }; /** * Returns the visibility of the given {@link InternalInsetsType type} requested by the client. * Loading Loading @@ -2124,6 +2128,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP : getTask().getWindowConfiguration().hasMovementAnimations(); if (mToken.okToAnimate() && (mAttrs.privateFlags & PRIVATE_FLAG_NO_MOVE_ANIMATION) == 0 && !mWindowFrames.didFrameSizeChange() && !surfaceInsetsChanging() && !isDragResizing() && hasMovementAnimation && !mWinAnimator.mLastHidden Loading Loading @@ -5313,13 +5319,17 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // prior to the rotation. if (!mSurfaceAnimator.hasLeash() && mPendingSeamlessRotate == null && !mLastSurfacePosition.equals(mSurfacePosition)) { t.setPosition(mSurfaceControl, mSurfacePosition.x, mSurfacePosition.y); final boolean frameSizeChanged = mWindowFrames.isFrameSizeChangeReported(); final boolean surfaceInsetsChanged = surfaceInsetsChanging(); final boolean surfaceSizeChanged = frameSizeChanged || surfaceInsetsChanged; mLastSurfacePosition.set(mSurfacePosition.x, mSurfacePosition.y); if (surfaceInsetsChanging() && mWinAnimator.hasSurface()) { if (surfaceInsetsChanged) { mLastSurfaceInsets.set(mAttrs.surfaceInsets); t.deferTransactionUntil(mSurfaceControl, mWinAnimator.mSurfaceController.mSurfaceControl, getFrameNumber()); } if (surfaceSizeChanged) { applyWithNextDraw(mSetSurfacePositionConsumer); } else { mSetSurfacePositionConsumer.accept(t); } } } Loading