Loading core/java/android/view/IWindow.aidl +9 −2 Original line number Diff line number Diff line Loading @@ -65,13 +65,20 @@ oneway interface IWindow { /** * Called when the window insets configuration has changed. * * @param willMove The window frame will be moved soon. * @param willResize The window frame will be resized soon. */ void insetsChanged(in InsetsState insetsState); void insetsChanged(in InsetsState insetsState, in boolean willMove, in boolean willResize); /** * Called when this window retrieved control over a specified set of insets sources. * * @param willMove The window frame will be moved soon. * @param willResize The window frame will be resized soon. */ void insetsControlChanged(in InsetsState insetsState, in InsetsSourceControl[] activeControls); void insetsControlChanged(in InsetsState insetsState, in InsetsSourceControl[] activeControls, in boolean willMove, in boolean willResize); /** * Called when a set of insets source window should be shown by policy. Loading core/java/android/view/ViewRootImpl.java +39 −10 Original line number Diff line number Diff line Loading @@ -585,6 +585,10 @@ public final class ViewRootImpl implements ViewParent, final Rect mWinFrame; // frame given by window manager. final Rect mPendingBackDropFrame = new Rect(); private boolean mWillMove; private boolean mWillResize; boolean mPendingAlwaysConsumeSystemBars; private final InsetsState mTempInsets = new InsetsState(); private final InsetsSourceControl[] mTempControls = new InsetsSourceControl[SIZE]; Loading Loading @@ -1708,6 +1712,10 @@ public final class ViewRootImpl implements ViewParent, void notifyInsetsChanged() { mApplyInsetsRequested = true; if (mWillMove || mWillResize) { // The window frame will be changed soon. The following logic will be executed then. return; } requestLayout(); // See comment for View.sForceLayoutWhenInsetsChanged Loading Loading @@ -2665,7 +2673,7 @@ public final class ViewRootImpl implements ViewParent, } } if (mApplyInsetsRequested) { if (mApplyInsetsRequested && !(mWillMove || mWillResize)) { dispatchApplyInsets(host); if (mLayoutRequested) { // Short-circuit catching a new layout request here, so Loading Loading @@ -5235,16 +5243,25 @@ public final class ViewRootImpl implements ViewParent, break; case MSG_RESIZED: case MSG_RESIZED_REPORT: { mWillMove = false; mWillResize = false; final SomeArgs args = (SomeArgs) msg.obj; handleResized(msg.what, args); args.recycle(); break; } case MSG_INSETS_CHANGED: mInsetsController.onStateChanged((InsetsState) msg.obj); case MSG_INSETS_CHANGED: { SomeArgs args = (SomeArgs) msg.obj; mWillMove = args.argi1 == 1; mWillResize = args.argi2 == 1; mInsetsController.onStateChanged((InsetsState) args.arg1); args.recycle(); break; } case MSG_INSETS_CONTROL_CHANGED: { SomeArgs args = (SomeArgs) msg.obj; mWillMove = args.argi1 == 1; mWillResize = args.argi2 == 1; // Deliver state change before control change, such that: // a) When gaining control, controller can compare with server state to evaluate Loading @@ -5253,6 +5270,7 @@ public final class ViewRootImpl implements ViewParent, // dispatched state as truth. mInsetsController.onStateChanged((InsetsState) args.arg1); mInsetsController.onControlsChanged((InsetsSourceControl[]) args.arg2); args.recycle(); break; } case MSG_SHOW_INSETS: { Loading @@ -5270,6 +5288,7 @@ public final class ViewRootImpl implements ViewParent, break; } case MSG_WINDOW_MOVED: mWillMove = false; if (mAdded) { final int w = mWinFrame.width(); final int h = mWinFrame.height(); Loading Loading @@ -7744,6 +7763,8 @@ public final class ViewRootImpl implements ViewParent, mTranslator.translateSourceControlsInScreenToAppWindow(mTempControls); } setFrame(mTmpFrames.frame); mWillMove = false; mWillResize = false; mInsetsController.onStateChanged(mTempInsets); mInsetsController.onControlsChanged(mTempControls); return relayoutResult; Loading Loading @@ -8179,7 +8200,8 @@ public final class ViewRootImpl implements ViewParent, mHandler.sendMessage(msg); } private void dispatchInsetsChanged(InsetsState insetsState) { private void dispatchInsetsChanged(InsetsState insetsState, boolean willMove, boolean willResize) { if (Binder.getCallingPid() == android.os.Process.myPid()) { insetsState = new InsetsState(insetsState, true /* copySource */); } Loading @@ -8190,11 +8212,15 @@ public final class ViewRootImpl implements ViewParent, ImeTracing.getInstance().triggerClientDump("ViewRootImpl#dispatchInsetsChanged", getInsetsController().getHost().getInputMethodManager(), null /* icProto */); } mHandler.obtainMessage(MSG_INSETS_CHANGED, insetsState).sendToTarget(); SomeArgs args = SomeArgs.obtain(); args.arg1 = insetsState; args.argi1 = willMove ? 1 : 0; args.argi2 = willResize ? 1 : 0; mHandler.obtainMessage(MSG_INSETS_CHANGED, args).sendToTarget(); } private void dispatchInsetsControlChanged(InsetsState insetsState, InsetsSourceControl[] activeControls) { InsetsSourceControl[] activeControls, boolean willMove, boolean willResize) { if (Binder.getCallingPid() == android.os.Process.myPid()) { insetsState = new InsetsState(insetsState, true /* copySource */); if (activeControls != null) { Loading @@ -8214,6 +8240,8 @@ public final class ViewRootImpl implements ViewParent, SomeArgs args = SomeArgs.obtain(); args.arg1 = insetsState; args.arg2 = activeControls; args.argi1 = willMove ? 1 : 0; args.argi2 = willResize ? 1 : 0; mHandler.obtainMessage(MSG_INSETS_CONTROL_CHANGED, args).sendToTarget(); } Loading Loading @@ -9560,19 +9588,20 @@ public final class ViewRootImpl implements ViewParent, } @Override public void insetsChanged(InsetsState insetsState) { public void insetsChanged(InsetsState insetsState, boolean willMove, boolean willResize) { final ViewRootImpl viewAncestor = mViewAncestor.get(); if (viewAncestor != null) { viewAncestor.dispatchInsetsChanged(insetsState); viewAncestor.dispatchInsetsChanged(insetsState, willMove, willResize); } } @Override public void insetsControlChanged(InsetsState insetsState, InsetsSourceControl[] activeControls) { InsetsSourceControl[] activeControls, boolean willMove, boolean willResize) { final ViewRootImpl viewAncestor = mViewAncestor.get(); if (viewAncestor != null) { viewAncestor.dispatchInsetsControlChanged(insetsState, activeControls); viewAncestor.dispatchInsetsControlChanged( insetsState, activeControls, willMove, willResize); } } Loading core/java/com/android/internal/view/BaseIWindow.java +2 −2 Original line number Diff line number Diff line Loading @@ -66,12 +66,12 @@ public class BaseIWindow extends IWindow.Stub { } @Override public void insetsChanged(InsetsState insetsState) { public void insetsChanged(InsetsState insetsState, boolean willMove, boolean willResize) { } @Override public void insetsControlChanged(InsetsState insetsState, InsetsSourceControl[] activeControls) { InsetsSourceControl[] activeControls, boolean willMove, boolean willResize) { } @Override Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java +2 −2 Original line number Diff line number Diff line Loading @@ -317,11 +317,11 @@ public class SystemWindows { public void locationInParentDisplayChanged(Point offset) {} @Override public void insetsChanged(InsetsState insetsState) {} public void insetsChanged(InsetsState insetsState, boolean willMove, boolean willResize) {} @Override public void insetsControlChanged(InsetsState insetsState, InsetsSourceControl[] activeControls) {} InsetsSourceControl[] activeControls, boolean willMove, boolean willResize) {} @Override public void showInsets(int types, boolean fromIme) {} Loading services/core/java/com/android/server/wm/WindowState.java +6 −2 Original line number Diff line number Diff line Loading @@ -3928,7 +3928,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP void notifyInsetsChanged() { ProtoLog.d(WM_DEBUG_IME, "notifyInsetsChanged for %s ", this); try { mClient.insetsChanged(getCompatInsetsState()); mClient.insetsChanged(getCompatInsetsState(), hasMoved(), mWindowFrames.isFrameSizeChangeReported()); } catch (RemoteException e) { Slog.w(TAG, "Failed to deliver inset state change w=" + this, e); } Loading @@ -3944,7 +3946,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP getDisplayContent().getInsetsStateController(); try { mClient.insetsControlChanged(getCompatInsetsState(), stateController.getControlsForDispatch(this)); stateController.getControlsForDispatch(this), hasMoved(), mWindowFrames.isFrameSizeChangeReported()); } catch (RemoteException e) { Slog.w(TAG, "Failed to deliver inset state change to w=" + this, e); } Loading Loading
core/java/android/view/IWindow.aidl +9 −2 Original line number Diff line number Diff line Loading @@ -65,13 +65,20 @@ oneway interface IWindow { /** * Called when the window insets configuration has changed. * * @param willMove The window frame will be moved soon. * @param willResize The window frame will be resized soon. */ void insetsChanged(in InsetsState insetsState); void insetsChanged(in InsetsState insetsState, in boolean willMove, in boolean willResize); /** * Called when this window retrieved control over a specified set of insets sources. * * @param willMove The window frame will be moved soon. * @param willResize The window frame will be resized soon. */ void insetsControlChanged(in InsetsState insetsState, in InsetsSourceControl[] activeControls); void insetsControlChanged(in InsetsState insetsState, in InsetsSourceControl[] activeControls, in boolean willMove, in boolean willResize); /** * Called when a set of insets source window should be shown by policy. Loading
core/java/android/view/ViewRootImpl.java +39 −10 Original line number Diff line number Diff line Loading @@ -585,6 +585,10 @@ public final class ViewRootImpl implements ViewParent, final Rect mWinFrame; // frame given by window manager. final Rect mPendingBackDropFrame = new Rect(); private boolean mWillMove; private boolean mWillResize; boolean mPendingAlwaysConsumeSystemBars; private final InsetsState mTempInsets = new InsetsState(); private final InsetsSourceControl[] mTempControls = new InsetsSourceControl[SIZE]; Loading Loading @@ -1708,6 +1712,10 @@ public final class ViewRootImpl implements ViewParent, void notifyInsetsChanged() { mApplyInsetsRequested = true; if (mWillMove || mWillResize) { // The window frame will be changed soon. The following logic will be executed then. return; } requestLayout(); // See comment for View.sForceLayoutWhenInsetsChanged Loading Loading @@ -2665,7 +2673,7 @@ public final class ViewRootImpl implements ViewParent, } } if (mApplyInsetsRequested) { if (mApplyInsetsRequested && !(mWillMove || mWillResize)) { dispatchApplyInsets(host); if (mLayoutRequested) { // Short-circuit catching a new layout request here, so Loading Loading @@ -5235,16 +5243,25 @@ public final class ViewRootImpl implements ViewParent, break; case MSG_RESIZED: case MSG_RESIZED_REPORT: { mWillMove = false; mWillResize = false; final SomeArgs args = (SomeArgs) msg.obj; handleResized(msg.what, args); args.recycle(); break; } case MSG_INSETS_CHANGED: mInsetsController.onStateChanged((InsetsState) msg.obj); case MSG_INSETS_CHANGED: { SomeArgs args = (SomeArgs) msg.obj; mWillMove = args.argi1 == 1; mWillResize = args.argi2 == 1; mInsetsController.onStateChanged((InsetsState) args.arg1); args.recycle(); break; } case MSG_INSETS_CONTROL_CHANGED: { SomeArgs args = (SomeArgs) msg.obj; mWillMove = args.argi1 == 1; mWillResize = args.argi2 == 1; // Deliver state change before control change, such that: // a) When gaining control, controller can compare with server state to evaluate Loading @@ -5253,6 +5270,7 @@ public final class ViewRootImpl implements ViewParent, // dispatched state as truth. mInsetsController.onStateChanged((InsetsState) args.arg1); mInsetsController.onControlsChanged((InsetsSourceControl[]) args.arg2); args.recycle(); break; } case MSG_SHOW_INSETS: { Loading @@ -5270,6 +5288,7 @@ public final class ViewRootImpl implements ViewParent, break; } case MSG_WINDOW_MOVED: mWillMove = false; if (mAdded) { final int w = mWinFrame.width(); final int h = mWinFrame.height(); Loading Loading @@ -7744,6 +7763,8 @@ public final class ViewRootImpl implements ViewParent, mTranslator.translateSourceControlsInScreenToAppWindow(mTempControls); } setFrame(mTmpFrames.frame); mWillMove = false; mWillResize = false; mInsetsController.onStateChanged(mTempInsets); mInsetsController.onControlsChanged(mTempControls); return relayoutResult; Loading Loading @@ -8179,7 +8200,8 @@ public final class ViewRootImpl implements ViewParent, mHandler.sendMessage(msg); } private void dispatchInsetsChanged(InsetsState insetsState) { private void dispatchInsetsChanged(InsetsState insetsState, boolean willMove, boolean willResize) { if (Binder.getCallingPid() == android.os.Process.myPid()) { insetsState = new InsetsState(insetsState, true /* copySource */); } Loading @@ -8190,11 +8212,15 @@ public final class ViewRootImpl implements ViewParent, ImeTracing.getInstance().triggerClientDump("ViewRootImpl#dispatchInsetsChanged", getInsetsController().getHost().getInputMethodManager(), null /* icProto */); } mHandler.obtainMessage(MSG_INSETS_CHANGED, insetsState).sendToTarget(); SomeArgs args = SomeArgs.obtain(); args.arg1 = insetsState; args.argi1 = willMove ? 1 : 0; args.argi2 = willResize ? 1 : 0; mHandler.obtainMessage(MSG_INSETS_CHANGED, args).sendToTarget(); } private void dispatchInsetsControlChanged(InsetsState insetsState, InsetsSourceControl[] activeControls) { InsetsSourceControl[] activeControls, boolean willMove, boolean willResize) { if (Binder.getCallingPid() == android.os.Process.myPid()) { insetsState = new InsetsState(insetsState, true /* copySource */); if (activeControls != null) { Loading @@ -8214,6 +8240,8 @@ public final class ViewRootImpl implements ViewParent, SomeArgs args = SomeArgs.obtain(); args.arg1 = insetsState; args.arg2 = activeControls; args.argi1 = willMove ? 1 : 0; args.argi2 = willResize ? 1 : 0; mHandler.obtainMessage(MSG_INSETS_CONTROL_CHANGED, args).sendToTarget(); } Loading Loading @@ -9560,19 +9588,20 @@ public final class ViewRootImpl implements ViewParent, } @Override public void insetsChanged(InsetsState insetsState) { public void insetsChanged(InsetsState insetsState, boolean willMove, boolean willResize) { final ViewRootImpl viewAncestor = mViewAncestor.get(); if (viewAncestor != null) { viewAncestor.dispatchInsetsChanged(insetsState); viewAncestor.dispatchInsetsChanged(insetsState, willMove, willResize); } } @Override public void insetsControlChanged(InsetsState insetsState, InsetsSourceControl[] activeControls) { InsetsSourceControl[] activeControls, boolean willMove, boolean willResize) { final ViewRootImpl viewAncestor = mViewAncestor.get(); if (viewAncestor != null) { viewAncestor.dispatchInsetsControlChanged(insetsState, activeControls); viewAncestor.dispatchInsetsControlChanged( insetsState, activeControls, willMove, willResize); } } Loading
core/java/com/android/internal/view/BaseIWindow.java +2 −2 Original line number Diff line number Diff line Loading @@ -66,12 +66,12 @@ public class BaseIWindow extends IWindow.Stub { } @Override public void insetsChanged(InsetsState insetsState) { public void insetsChanged(InsetsState insetsState, boolean willMove, boolean willResize) { } @Override public void insetsControlChanged(InsetsState insetsState, InsetsSourceControl[] activeControls) { InsetsSourceControl[] activeControls, boolean willMove, boolean willResize) { } @Override Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java +2 −2 Original line number Diff line number Diff line Loading @@ -317,11 +317,11 @@ public class SystemWindows { public void locationInParentDisplayChanged(Point offset) {} @Override public void insetsChanged(InsetsState insetsState) {} public void insetsChanged(InsetsState insetsState, boolean willMove, boolean willResize) {} @Override public void insetsControlChanged(InsetsState insetsState, InsetsSourceControl[] activeControls) {} InsetsSourceControl[] activeControls, boolean willMove, boolean willResize) {} @Override public void showInsets(int types, boolean fromIme) {} Loading
services/core/java/com/android/server/wm/WindowState.java +6 −2 Original line number Diff line number Diff line Loading @@ -3928,7 +3928,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP void notifyInsetsChanged() { ProtoLog.d(WM_DEBUG_IME, "notifyInsetsChanged for %s ", this); try { mClient.insetsChanged(getCompatInsetsState()); mClient.insetsChanged(getCompatInsetsState(), hasMoved(), mWindowFrames.isFrameSizeChangeReported()); } catch (RemoteException e) { Slog.w(TAG, "Failed to deliver inset state change w=" + this, e); } Loading @@ -3944,7 +3946,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP getDisplayContent().getInsetsStateController(); try { mClient.insetsControlChanged(getCompatInsetsState(), stateController.getControlsForDispatch(this)); stateController.getControlsForDispatch(this), hasMoved(), mWindowFrames.isFrameSizeChangeReported()); } catch (RemoteException e) { Slog.w(TAG, "Failed to deliver inset state change to w=" + this, e); } Loading