summaryrefslogtreecommitdiff
path: root/core/java/android/view/ViewRootImpl.java
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2020-01-30 00:16:18 +0100
committerJorim Jaggi <jjaggi@google.com>2020-02-01 13:04:59 +0100
commit3182ef14882d5a1ffd2d7df8470a11d23df2cf9a (patch)
treeed3777c8281269daa4b6b7d3bd57d612cd454179 /core/java/android/view/ViewRootImpl.java
parentb29730fc9b687605d4e3cadd3d27bc98d529867c (diff)
Keep track of requestedVisibility when control unavailable
When control is unavailable, but the client still wants to hide or show something, we keep track of it and execute the animation as soon as we get control. Also fix an issue with a crash where control was lost before animation was started. Test: InsetsControllerTest, InsetsSourceConsumerTest Change-Id: I31c5177d9281161b8a607b24ddf094dbba640da3
Diffstat (limited to 'core/java/android/view/ViewRootImpl.java')
-rw-r--r--core/java/android/view/ViewRootImpl.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 51ea30b41741..2b4b71f01aa5 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -4887,8 +4887,14 @@ public final class ViewRootImpl implements ViewParent,
break;
case MSG_INSETS_CONTROL_CHANGED: {
SomeArgs args = (SomeArgs) msg.obj;
- mInsetsController.onControlsChanged((InsetsSourceControl[]) args.arg2);
+
+ // Deliver state change before control change, such that:
+ // a) When gaining control, controller can compare with server state to evaluate
+ // whether it needs to run animation.
+ // b) When loosing control, controller can restore server state by taking last
+ // dispatched state as truth.
mInsetsController.onStateChanged((InsetsState) args.arg1);
+ mInsetsController.onControlsChanged((InsetsSourceControl[]) args.arg2);
break;
}
case MSG_SHOW_INSETS: {