Update requested state after applying pending frames am: dfc8abb1ff
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12526908 Change-Id: If9b91d721621cf567426c9dd9899968498513a57
This commit is contained in:
@@ -1134,15 +1134,14 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
|
||||
if (invokeCallback) {
|
||||
control.cancel();
|
||||
}
|
||||
boolean stateChanged = false;
|
||||
for (int i = mRunningAnimations.size() - 1; i >= 0; i--) {
|
||||
RunningAnimation runningAnimation = mRunningAnimations.get(i);
|
||||
if (runningAnimation.runner == control) {
|
||||
mRunningAnimations.remove(i);
|
||||
ArraySet<Integer> types = toInternalType(control.getTypes());
|
||||
for (int j = types.size() - 1; j >= 0; j--) {
|
||||
if (getSourceConsumer(types.valueAt(j)).notifyAnimationFinished()) {
|
||||
mHost.notifyInsetsChanged();
|
||||
}
|
||||
stateChanged |= getSourceConsumer(types.valueAt(j)).notifyAnimationFinished();
|
||||
}
|
||||
if (invokeCallback && runningAnimation.startDispatched) {
|
||||
dispatchAnimationEnd(runningAnimation.runner.getAnimation());
|
||||
@@ -1150,6 +1149,10 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (stateChanged) {
|
||||
mHost.notifyInsetsChanged();
|
||||
updateRequestedState();
|
||||
}
|
||||
}
|
||||
|
||||
private void applyLocalVisibilityOverride() {
|
||||
|
||||
@@ -27,6 +27,7 @@ import static android.view.InsetsState.ITYPE_NAVIGATION_BAR;
|
||||
import static android.view.InsetsState.ITYPE_STATUS_BAR;
|
||||
import static android.view.ViewRootImpl.NEW_INSETS_MODE_FULL;
|
||||
import static android.view.WindowInsets.Type.ime;
|
||||
import static android.view.WindowInsets.Type.navigationBars;
|
||||
import static android.view.WindowInsets.Type.statusBars;
|
||||
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
|
||||
|
||||
@@ -742,6 +743,20 @@ public class InsetsControllerTest {
|
||||
mController.onControlsChanged(createSingletonControl(ITYPE_IME));
|
||||
assertEquals(newState.getSource(ITYPE_IME),
|
||||
mTestHost.getModifiedState().peekSource(ITYPE_IME));
|
||||
|
||||
// The modified frames cannot be updated if there is an animation.
|
||||
mController.onControlsChanged(createSingletonControl(ITYPE_NAVIGATION_BAR));
|
||||
mController.hide(navigationBars());
|
||||
newState = new InsetsState(mController.getState(), true /* copySource */);
|
||||
newState.getSource(ITYPE_NAVIGATION_BAR).getFrame().top--;
|
||||
mController.onStateChanged(newState);
|
||||
assertNotEquals(newState.getSource(ITYPE_NAVIGATION_BAR),
|
||||
mTestHost.getModifiedState().peekSource(ITYPE_NAVIGATION_BAR));
|
||||
|
||||
// The modified frames can be updated while the animation is done.
|
||||
mController.cancelExistingAnimations();
|
||||
assertEquals(newState.getSource(ITYPE_NAVIGATION_BAR),
|
||||
mTestHost.getModifiedState().peekSource(ITYPE_NAVIGATION_BAR));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user