Merge "Fix NPE in Snapshot#startAnimation" into sc-v2-dev

This commit is contained in:
Chris Li
2021-10-17 14:21:51 +00:00
committed by Android (Google) Code Review
10 changed files with 18 additions and 10 deletions

View File

@@ -16,6 +16,7 @@
package com.android.server.wm; package com.android.server.wm;
import android.annotation.NonNull;
import android.util.proto.ProtoOutputStream; import android.util.proto.ProtoOutputStream;
import android.view.SurfaceControl; import android.view.SurfaceControl;
import android.view.SurfaceControl.Transaction; import android.view.SurfaceControl.Transaction;
@@ -52,7 +53,7 @@ interface AnimationAdapter {
* @param finishCallback The callback to be invoked when the animation has finished. * @param finishCallback The callback to be invoked when the animation has finished.
*/ */
void startAnimation(SurfaceControl animationLeash, Transaction t, @AnimationType int type, void startAnimation(SurfaceControl animationLeash, Transaction t, @AnimationType int type,
OnAnimationFinishedCallback finishCallback); @NonNull OnAnimationFinishedCallback finishCallback);
/** /**
* Called when the animation that was started with {@link #startAnimation} was cancelled by the * Called when the animation that was started with {@link #startAnimation} was cancelled by the

View File

@@ -535,7 +535,7 @@ class InsetsSourceProvider {
@Override @Override
public void startAnimation(SurfaceControl animationLeash, Transaction t, public void startAnimation(SurfaceControl animationLeash, Transaction t,
@AnimationType int type, OnAnimationFinishedCallback finishCallback) { @AnimationType int type, @NonNull OnAnimationFinishedCallback finishCallback) {
// TODO(b/166736352): Check if we still need to control the IME visibility here. // TODO(b/166736352): Check if we still need to control the IME visibility here.
if (mSource.getType() == ITYPE_IME) { if (mSource.getType() == ITYPE_IME) {
// TODO: use 0 alpha and remove t.hide() once b/138459974 is fixed. // TODO: use 0 alpha and remove t.hide() once b/138459974 is fixed.

View File

@@ -19,6 +19,7 @@ package com.android.server.wm;
import static com.android.server.wm.AnimationAdapterProto.LOCAL; import static com.android.server.wm.AnimationAdapterProto.LOCAL;
import static com.android.server.wm.LocalAnimationAdapterProto.ANIMATION_SPEC; import static com.android.server.wm.LocalAnimationAdapterProto.ANIMATION_SPEC;
import android.annotation.NonNull;
import android.os.SystemClock; import android.os.SystemClock;
import android.util.proto.ProtoOutputStream; import android.util.proto.ProtoOutputStream;
import android.view.SurfaceControl; import android.view.SurfaceControl;
@@ -51,7 +52,7 @@ class LocalAnimationAdapter implements AnimationAdapter {
@Override @Override
public void startAnimation(SurfaceControl animationLeash, Transaction t, public void startAnimation(SurfaceControl animationLeash, Transaction t,
@AnimationType int type, OnAnimationFinishedCallback finishCallback) { @AnimationType int type, @NonNull OnAnimationFinishedCallback finishCallback) {
mAnimator.startAnimation(mSpec, animationLeash, t, mAnimator.startAnimation(mSpec, animationLeash, t,
() -> finishCallback.onAnimationFinished(type, this)); () -> finishCallback.onAnimationFinished(type, this));
} }

View File

@@ -18,6 +18,7 @@ package com.android.server.wm;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION;
import android.annotation.NonNull;
import android.view.SurfaceControl; import android.view.SurfaceControl;
import android.view.animation.AlphaAnimation; import android.view.animation.AlphaAnimation;
import android.view.animation.Animation; import android.view.animation.Animation;
@@ -144,7 +145,7 @@ public class NavBarFadeAnimationController extends FadeAnimationController{
@Override @Override
public void startAnimation(SurfaceControl animationLeash, SurfaceControl.Transaction t, public void startAnimation(SurfaceControl animationLeash, SurfaceControl.Transaction t,
int type, SurfaceAnimator.OnAnimationFinishedCallback finishCallback) { int type, @NonNull SurfaceAnimator.OnAnimationFinishedCallback finishCallback) {
super.startAnimation(animationLeash, t, type, finishCallback); super.startAnimation(animationLeash, t, type, finishCallback);
if (mParent != null && mParent.isValid()) { if (mParent != null && mParent.isValid()) {
t.reparent(animationLeash, mParent); t.reparent(animationLeash, mParent);

View File

@@ -27,6 +27,7 @@ import static com.android.server.wm.AnimationAdapterProto.REMOTE;
import static com.android.server.wm.RemoteAnimationAdapterWrapperProto.TARGET; import static com.android.server.wm.RemoteAnimationAdapterWrapperProto.TARGET;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_WINDOW_ANIMATION; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_WINDOW_ANIMATION;
import android.annotation.NonNull;
import android.graphics.Rect; import android.graphics.Rect;
import android.os.SystemClock; import android.os.SystemClock;
import android.util.proto.ProtoOutputStream; import android.util.proto.ProtoOutputStream;
@@ -145,7 +146,7 @@ class NonAppWindowAnimationAdapter implements AnimationAdapter {
@Override @Override
public void startAnimation(SurfaceControl animationLeash, SurfaceControl.Transaction t, public void startAnimation(SurfaceControl animationLeash, SurfaceControl.Transaction t,
int type, SurfaceAnimator.OnAnimationFinishedCallback finishCallback) { int type, @NonNull SurfaceAnimator.OnAnimationFinishedCallback finishCallback) {
ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "startAnimation"); ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "startAnimation");
mCapturedLeash = animationLeash; mCapturedLeash = animationLeash;
mCapturedLeashFinishCallback = finishCallback; mCapturedLeashFinishCallback = finishCallback;

View File

@@ -1320,7 +1320,7 @@ public class RecentsAnimationController implements DeathRecipient {
@Override @Override
public void startAnimation(SurfaceControl animationLeash, Transaction t, public void startAnimation(SurfaceControl animationLeash, Transaction t,
@AnimationType int type, OnAnimationFinishedCallback finishCallback) { @AnimationType int type, @NonNull OnAnimationFinishedCallback finishCallback) {
// Restore position and root task crop until client has a chance to modify it. // Restore position and root task crop until client has a chance to modify it.
t.setPosition(animationLeash, mLocalBounds.left, mLocalBounds.top); t.setPosition(animationLeash, mLocalBounds.left, mLocalBounds.top);
mTmpRect.set(mLocalBounds); mTmpRect.set(mLocalBounds);

View File

@@ -22,6 +22,7 @@ import static com.android.server.wm.RemoteAnimationAdapterWrapperProto.TARGET;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import android.annotation.NonNull;
import android.graphics.Point; import android.graphics.Point;
import android.graphics.Rect; import android.graphics.Rect;
import android.os.Binder; import android.os.Binder;
@@ -477,7 +478,7 @@ class RemoteAnimationController implements DeathRecipient {
@Override @Override
public void startAnimation(SurfaceControl animationLeash, Transaction t, public void startAnimation(SurfaceControl animationLeash, Transaction t,
@AnimationType int type, OnAnimationFinishedCallback finishCallback) { @AnimationType int type, @NonNull OnAnimationFinishedCallback finishCallback) {
ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "startAnimation"); ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "startAnimation");
if (mStartBounds.isEmpty()) { if (mStartBounds.isEmpty()) {

View File

@@ -229,7 +229,7 @@ class SurfaceFreezer {
cancelAnimation(t, false /* restarting */); cancelAnimation(t, false /* restarting */);
return; return;
} }
mAnimation.startAnimation(mSurfaceControl, t, type, null /* finishCallback */); mAnimation.startAnimation(mSurfaceControl, t, type, (typ, ani) -> { });
} }
/** /**

View File

@@ -22,6 +22,7 @@ import static com.android.server.wm.DisplayContent.IME_TARGET_LAYERING;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_STARTING_REVEAL; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_STARTING_REVEAL;
import static com.android.server.wm.WindowOrganizerController.configurationsAreEqualForOrganizer; import static com.android.server.wm.WindowOrganizerController.configurationsAreEqualForOrganizer;
import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.app.ActivityManager.RunningTaskInfo; import android.app.ActivityManager.RunningTaskInfo;
@@ -431,7 +432,7 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
@Override @Override
public void startAnimation(SurfaceControl animationLeash, SurfaceControl.Transaction t, public void startAnimation(SurfaceControl animationLeash, SurfaceControl.Transaction t,
int type, SurfaceAnimator.OnAnimationFinishedCallback finishCallback) { int type, @NonNull SurfaceAnimator.OnAnimationFinishedCallback finishCallback) {
mAnimationLeash = animationLeash; mAnimationLeash = animationLeash;
} }

View File

@@ -20,6 +20,7 @@ import static com.android.server.wm.AnimationAdapterProto.REMOTE;
import static com.android.server.wm.RemoteAnimationAdapterWrapperProto.TARGET; import static com.android.server.wm.RemoteAnimationAdapterWrapperProto.TARGET;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_WINDOW_ANIMATION; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_WINDOW_ANIMATION;
import android.annotation.NonNull;
import android.graphics.Point; import android.graphics.Point;
import android.os.SystemClock; import android.os.SystemClock;
import android.util.proto.ProtoOutputStream; import android.util.proto.ProtoOutputStream;
@@ -133,7 +134,8 @@ class WallpaperAnimationAdapter implements AnimationAdapter {
@Override @Override
public void startAnimation(SurfaceControl animationLeash, SurfaceControl.Transaction t, public void startAnimation(SurfaceControl animationLeash, SurfaceControl.Transaction t,
@AnimationType int type, SurfaceAnimator.OnAnimationFinishedCallback finishCallback) { @AnimationType int type,
@NonNull SurfaceAnimator.OnAnimationFinishedCallback finishCallback) {
ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "startAnimation"); ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "startAnimation");
// Restore z-layering until client has a chance to modify it. // Restore z-layering until client has a chance to modify it.