summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/view/InsetsController.java17
-rw-r--r--core/java/android/view/ViewRootImpl.java6
-rw-r--r--core/java/android/view/ViewRootInsetsControllerHost.java7
-rw-r--r--services/core/java/com/android/server/wm/InsetsPolicy.java7
4 files changed, 37 insertions, 0 deletions
diff --git a/core/java/android/view/InsetsController.java b/core/java/android/view/InsetsController.java
index 90663c7ad38e..147c15bea076 100644
--- a/core/java/android/view/InsetsController.java
+++ b/core/java/android/view/InsetsController.java
@@ -216,6 +216,14 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
default CompatibilityInfo.Translator getTranslator() {
return null;
}
+
+ /**
+ * Notifies when the state of running animation is changed. The state is either "running" or
+ * "idle".
+ *
+ * @param running {@code true} if there is any animation running; {@code false} otherwise.
+ */
+ default void notifyAnimationRunningStateChanged(boolean running) {}
}
private static final String TAG = "InsetsController";
@@ -749,6 +757,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
final InsetsAnimationControlRunner runner = new InsetsResizeAnimationRunner(
mFrame, state1, mToState, RESIZE_INTERPOLATOR,
ANIMATION_DURATION_RESIZE, mTypes, InsetsController.this);
+ if (mRunningAnimations.isEmpty()) {
+ mHost.notifyAnimationRunningStateChanged(true);
+ }
mRunningAnimations.add(new RunningAnimation(runner, runner.getAnimationType()));
}
};
@@ -1382,6 +1393,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
}
}
ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_CLIENT_ANIMATION_RUNNING);
+ if (mRunningAnimations.isEmpty()) {
+ mHost.notifyAnimationRunningStateChanged(true);
+ }
mRunningAnimations.add(new RunningAnimation(runner, animationType));
if (DEBUG) Log.d(TAG, "Animation added to runner. useInsetsAnimationThread: "
+ useInsetsAnimationThread);
@@ -1588,6 +1602,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
break;
}
}
+ if (mRunningAnimations.isEmpty()) {
+ mHost.notifyAnimationRunningStateChanged(false);
+ }
onAnimationStateChanged(removedTypes, false /* running */);
}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 7a6c2929c706..b1076277ee2d 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -816,6 +816,8 @@ public final class ViewRootImpl implements ViewParent,
private long mFpsPrevTime = -1;
private int mFpsNumFrames;
+ private boolean mInsetsAnimationRunning;
+
/**
* The resolved pointer icon type requested by this window.
* A null value indicates the resolved pointer icon has not yet been calculated.
@@ -2179,6 +2181,10 @@ public final class ViewRootImpl implements ViewParent,
}
}
+ void notifyInsetsAnimationRunningStateChanged(boolean running) {
+ mInsetsAnimationRunning = running;
+ }
+
@Override
public void requestLayout() {
if (!mHandlingLayoutInLayoutRequest) {
diff --git a/core/java/android/view/ViewRootInsetsControllerHost.java b/core/java/android/view/ViewRootInsetsControllerHost.java
index a2708eead171..40730e8de849 100644
--- a/core/java/android/view/ViewRootInsetsControllerHost.java
+++ b/core/java/android/view/ViewRootInsetsControllerHost.java
@@ -279,6 +279,13 @@ public class ViewRootInsetsControllerHost implements InsetsController.Host {
return null;
}
+ @Override
+ public void notifyAnimationRunningStateChanged(boolean running) {
+ if (mViewRoot != null) {
+ mViewRoot.notifyInsetsAnimationRunningStateChanged(running);
+ }
+ }
+
private boolean isVisibleToUser() {
return mViewRoot.getHostVisibility() == View.VISIBLE;
}
diff --git a/services/core/java/com/android/server/wm/InsetsPolicy.java b/services/core/java/com/android/server/wm/InsetsPolicy.java
index e6bbd52807bd..c089d107d07d 100644
--- a/services/core/java/com/android/server/wm/InsetsPolicy.java
+++ b/services/core/java/com/android/server/wm/InsetsPolicy.java
@@ -740,6 +740,8 @@ class InsetsPolicy {
private final Handler mHandler;
private final String mName;
+ private boolean mInsetsAnimationRunning;
+
Host(Handler handler, String name) {
mHandler = handler;
mName = name;
@@ -841,5 +843,10 @@ class InsetsPolicy {
public IBinder getWindowToken() {
return null;
}
+
+ @Override
+ public void notifyAnimationRunningStateChanged(boolean running) {
+ mInsetsAnimationRunning = running;
+ }
}
}