summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorMing-Shin Lu <lumark@google.com>2022-04-01 16:02:52 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2022-04-01 16:02:52 +0000
commitdf8e2a51319ce5eb30934eaca07a999b30f2fe0d (patch)
tree4fb46823980afb611779f0feac12f2af0c0c0d7d /core/java
parenta28e989921fda29e4a3902d85c1a6978d571a34d (diff)
parent63a95a2795ed35be7e92314730caa9ce1b8a998c (diff)
Merge "Fix insets animations being skipped when the host view was invisible" into tm-dev
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/view/InsetsController.java4
-rw-r--r--core/java/android/view/ViewRootInsetsControllerHost.java9
2 files changed, 9 insertions, 4 deletions
diff --git a/core/java/android/view/InsetsController.java b/core/java/android/view/InsetsController.java
index a4841f6f0d95..7b6a0d64f980 100644
--- a/core/java/android/view/InsetsController.java
+++ b/core/java/android/view/InsetsController.java
@@ -1310,8 +1310,8 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
}
private void cancelAnimation(InsetsAnimationControlRunner control, boolean invokeCallback) {
- if (DEBUG) Log.d(TAG, String.format("cancelAnimation of types: %d, animType: %d",
- control.getTypes(), control.getAnimationType()));
+ if (DEBUG) Log.d(TAG, String.format("cancelAnimation of types: %d, animType: %d, host: %s",
+ control.getTypes(), control.getAnimationType(), mHost.getRootViewTitle()));
if (invokeCallback) {
control.cancel();
}
diff --git a/core/java/android/view/ViewRootInsetsControllerHost.java b/core/java/android/view/ViewRootInsetsControllerHost.java
index 4387701f7a24..d960ba1489ca 100644
--- a/core/java/android/view/ViewRootInsetsControllerHost.java
+++ b/core/java/android/view/ViewRootInsetsControllerHost.java
@@ -125,10 +125,11 @@ public class ViewRootInsetsControllerHost implements InsetsController.Host {
if (mApplier == null) {
mApplier = new SyncRtSurfaceTransactionApplier(mViewRoot.mView);
}
- if (mViewRoot.mView.isHardwareAccelerated()) {
+ if (mViewRoot.mView.isHardwareAccelerated() && isVisibleToUser()) {
mApplier.scheduleApply(params);
} else {
- // Window doesn't support hardware acceleration, no synchronization for now.
+ // Synchronization requires hardware acceleration for now.
+ // If the window isn't visible, drawing is paused and the applier won't run.
// TODO(b/149342281): use mViewRoot.mSurface.getNextFrameNumber() to sync on every
// frame instead.
final SurfaceControl.Transaction t = new SurfaceControl.Transaction();
@@ -269,4 +270,8 @@ public class ViewRootInsetsControllerHost implements InsetsController.Host {
}
return null;
}
+
+ private boolean isVisibleToUser() {
+ return mViewRoot.getHostVisibility() == View.VISIBLE;
+ }
}