Loading core/java/android/view/InsetsController.java +13 −6 Original line number Diff line number Diff line Loading @@ -642,7 +642,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation updateState(state); applyLocalVisibilityOverride(); if (!mState.equals(lastState, true /* excludingCaptionInsets */, if (!mState.equals(lastState, false /* excludingCaptionInsets */, true /* excludeInvisibleIme */)) { if (DEBUG) Log.d(TAG, "onStateChanged, notifyInsetsChanged"); mHost.notifyInsetsChanged(); Loading Loading @@ -672,16 +672,14 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation getSourceConsumer(type).updateSource(source, animationType); } for (@InternalInsetsType int type = 0; type < InsetsState.SIZE; type++) { // Only update the server side insets here. if (type == ITYPE_CAPTION_BAR) continue; InsetsSource source = mState.peekSource(type); if (source == null) continue; if (newState.peekSource(type) == null) { mState.removeSource(type); } } if (mCaptionInsetsHeight != 0) { mState.getSource(ITYPE_CAPTION_BAR).setFrame(new Rect(mFrame.left, mFrame.top, mFrame.right, mFrame.top + mCaptionInsetsHeight)); } updateDisabledUserAnimationTypes(disabledUserAnimationTypes); Loading Loading @@ -1488,7 +1486,16 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation @Override public void setCaptionInsetsHeight(int height) { if (mCaptionInsetsHeight != height) { mCaptionInsetsHeight = height; if (mCaptionInsetsHeight != 0) { mState.getSource(ITYPE_CAPTION_BAR).setFrame(new Rect(mFrame.left, mFrame.top, mFrame.right, mFrame.top + mCaptionInsetsHeight)); } else { mState.removeSource(ITYPE_CAPTION_BAR); } mHost.notifyInsetsChanged(); } } @Override Loading core/java/com/android/internal/policy/DecorView.java +1 −0 Original line number Diff line number Diff line Loading @@ -2019,6 +2019,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind if (getForeground() != null) { drawableChanged(); } notifyCaptionHeightChanged(); } } Loading core/tests/coretests/src/android/view/InsetsControllerTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import static org.mockito.ArgumentMatchers.notNull; import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; Loading Loading @@ -680,6 +681,19 @@ public class InsetsControllerTest { }); } @Test public void testNotifyCaptionInsetsOnlyChange() { InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { final InsetsState state = new InsetsState(mController.getState(), true); reset(mTestHost); mController.setCaptionInsetsHeight(100); verify(mTestHost).notifyInsetsChanged(); reset(mTestHost); mController.setCaptionInsetsHeight(0); verify(mTestHost).notifyInsetsChanged(); }); } @Test public void testRequestedState() { InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { Loading Loading
core/java/android/view/InsetsController.java +13 −6 Original line number Diff line number Diff line Loading @@ -642,7 +642,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation updateState(state); applyLocalVisibilityOverride(); if (!mState.equals(lastState, true /* excludingCaptionInsets */, if (!mState.equals(lastState, false /* excludingCaptionInsets */, true /* excludeInvisibleIme */)) { if (DEBUG) Log.d(TAG, "onStateChanged, notifyInsetsChanged"); mHost.notifyInsetsChanged(); Loading Loading @@ -672,16 +672,14 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation getSourceConsumer(type).updateSource(source, animationType); } for (@InternalInsetsType int type = 0; type < InsetsState.SIZE; type++) { // Only update the server side insets here. if (type == ITYPE_CAPTION_BAR) continue; InsetsSource source = mState.peekSource(type); if (source == null) continue; if (newState.peekSource(type) == null) { mState.removeSource(type); } } if (mCaptionInsetsHeight != 0) { mState.getSource(ITYPE_CAPTION_BAR).setFrame(new Rect(mFrame.left, mFrame.top, mFrame.right, mFrame.top + mCaptionInsetsHeight)); } updateDisabledUserAnimationTypes(disabledUserAnimationTypes); Loading Loading @@ -1488,7 +1486,16 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation @Override public void setCaptionInsetsHeight(int height) { if (mCaptionInsetsHeight != height) { mCaptionInsetsHeight = height; if (mCaptionInsetsHeight != 0) { mState.getSource(ITYPE_CAPTION_BAR).setFrame(new Rect(mFrame.left, mFrame.top, mFrame.right, mFrame.top + mCaptionInsetsHeight)); } else { mState.removeSource(ITYPE_CAPTION_BAR); } mHost.notifyInsetsChanged(); } } @Override Loading
core/java/com/android/internal/policy/DecorView.java +1 −0 Original line number Diff line number Diff line Loading @@ -2019,6 +2019,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind if (getForeground() != null) { drawableChanged(); } notifyCaptionHeightChanged(); } } Loading
core/tests/coretests/src/android/view/InsetsControllerTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import static org.mockito.ArgumentMatchers.notNull; import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; Loading Loading @@ -680,6 +681,19 @@ public class InsetsControllerTest { }); } @Test public void testNotifyCaptionInsetsOnlyChange() { InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { final InsetsState state = new InsetsState(mController.getState(), true); reset(mTestHost); mController.setCaptionInsetsHeight(100); verify(mTestHost).notifyInsetsChanged(); reset(mTestHost); mController.setCaptionInsetsHeight(0); verify(mTestHost).notifyInsetsChanged(); }); } @Test public void testRequestedState() { InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { Loading