Merge "Fix insets animations being skipped when the host view was invisible" into tm-dev
This commit is contained in:
@@ -1310,8 +1310,8 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void cancelAnimation(InsetsAnimationControlRunner control, boolean invokeCallback) {
|
private void cancelAnimation(InsetsAnimationControlRunner control, boolean invokeCallback) {
|
||||||
if (DEBUG) Log.d(TAG, String.format("cancelAnimation of types: %d, animType: %d",
|
if (DEBUG) Log.d(TAG, String.format("cancelAnimation of types: %d, animType: %d, host: %s",
|
||||||
control.getTypes(), control.getAnimationType()));
|
control.getTypes(), control.getAnimationType(), mHost.getRootViewTitle()));
|
||||||
if (invokeCallback) {
|
if (invokeCallback) {
|
||||||
control.cancel();
|
control.cancel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,10 +125,11 @@ public class ViewRootInsetsControllerHost implements InsetsController.Host {
|
|||||||
if (mApplier == null) {
|
if (mApplier == null) {
|
||||||
mApplier = new SyncRtSurfaceTransactionApplier(mViewRoot.mView);
|
mApplier = new SyncRtSurfaceTransactionApplier(mViewRoot.mView);
|
||||||
}
|
}
|
||||||
if (mViewRoot.mView.isHardwareAccelerated()) {
|
if (mViewRoot.mView.isHardwareAccelerated() && isVisibleToUser()) {
|
||||||
mApplier.scheduleApply(params);
|
mApplier.scheduleApply(params);
|
||||||
} else {
|
} 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
|
// TODO(b/149342281): use mViewRoot.mSurface.getNextFrameNumber() to sync on every
|
||||||
// frame instead.
|
// frame instead.
|
||||||
final SurfaceControl.Transaction t = new SurfaceControl.Transaction();
|
final SurfaceControl.Transaction t = new SurfaceControl.Transaction();
|
||||||
@@ -269,4 +270,8 @@ public class ViewRootInsetsControllerHost implements InsetsController.Host {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isVisibleToUser() {
|
||||||
|
return mViewRoot.getHostVisibility() == View.VISIBLE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user