Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4afc4954 authored by Matt Pietal's avatar Matt Pietal Committed by Automerger Merge Worker
Browse files

Merge "Don't run remote animations before sysui is ready" into udc-dev am:...

Merge "Don't run remote animations before sysui is ready" into udc-dev am: 06b3270f am: 62813cb7 am: 44f3f08c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23515976



Change-Id: I97c25f472dc80d50b56159755735f55efababf50
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents a9838922 44f3f08c
Loading
Loading
Loading
Loading
+31 −4
Original line number Diff line number Diff line
@@ -1924,19 +1924,19 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
    }

    public IRemoteAnimationRunner getExitAnimationRunner() {
        return mExitAnimationRunner;
        return validatingRemoteAnimationRunner(mExitAnimationRunner);
    }

    public IRemoteAnimationRunner getOccludeAnimationRunner() {
        return mOccludeAnimationRunner;
        return validatingRemoteAnimationRunner(mOccludeAnimationRunner);
    }

    public IRemoteAnimationRunner getOccludeByDreamAnimationRunner() {
        return mOccludeByDreamAnimationRunner;
        return validatingRemoteAnimationRunner(mOccludeByDreamAnimationRunner);
    }

    public IRemoteAnimationRunner getUnoccludeAnimationRunner() {
        return mUnoccludeAnimationRunner;
        return validatingRemoteAnimationRunner(mUnoccludeAnimationRunner);
    }

    public boolean isHiding() {
@@ -3448,6 +3448,10 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
        Trace.traceCounter(Trace.TRACE_TAG_APP, "pendingLock", mPendingLock ? 1 : 0);
    }

    private boolean isViewRootReady() {
        return mKeyguardViewControllerLazy.get().getViewRootImpl() != null;
    }

    public void addStateMonitorCallback(IKeyguardStateCallback callback) {
        synchronized (this) {
            mKeyguardStateCallbacks.add(callback);
@@ -3550,4 +3554,27 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
            mInteractionJankMonitor.cancel(CUJ_LOCKSCREEN_OCCLUSION);
        }
    }

    private IRemoteAnimationRunner validatingRemoteAnimationRunner(IRemoteAnimationRunner wrapped) {
        return new IRemoteAnimationRunner.Stub() {
            @Override
            public void onAnimationCancelled() throws RemoteException {
                wrapped.onAnimationCancelled();
            }

            @Override
            public void onAnimationStart(int transit, RemoteAnimationTarget[] apps,
                                         RemoteAnimationTarget[] wallpapers,
                                         RemoteAnimationTarget[] nonApps,
                                         IRemoteAnimationFinishedCallback finishedCallback)
                    throws RemoteException {
                if (!isViewRootReady()) {
                    Log.w(TAG, "Skipping remote animation - view root not ready");
                    return;
                }

                wrapped.onAnimationStart(transit, apps, wallpapers, nonApps, finishedCallback);
            }
        };
    }
}