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

Commit f04fc041 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Automerger Merge Worker
Browse files

Merge "Fix transfer splash screen view been called twice from onDraw" into...

Merge "Fix transfer splash screen view been called twice from onDraw" into sc-v2-dev am: 0c645014 am: 494706d9

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

Change-Id: I509b68c9fb28ec6a0611a87e3667210c0389f9fa
parents b01686d1 494706d9
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -4178,15 +4178,20 @@ public final class ActivityThread extends ClientTransactionHandler
        view.requestLayout();
        view.requestLayout();


        view.getViewTreeObserver().addOnDrawListener(new ViewTreeObserver.OnDrawListener() {
        view.getViewTreeObserver().addOnDrawListener(new ViewTreeObserver.OnDrawListener() {
            private boolean mHandled = false;
            @Override
            @Override
            public void onDraw() {
            public void onDraw() {
                if (mHandled) {
                    return;
                }
                mHandled = true;
                // Transfer the splash screen view from shell to client.
                // Transfer the splash screen view from shell to client.
                // Call syncTransferSplashscreenViewTransaction at the first onDraw so we can ensure
                // Call syncTransferSplashscreenViewTransaction at the first onDraw so we can ensure
                // the client view is ready to show and we can use applyTransactionOnDraw to make
                // the client view is ready to show and we can use applyTransactionOnDraw to make
                // all transitions happen at the same frame.
                // all transitions happen at the same frame.
                syncTransferSplashscreenViewTransaction(
                syncTransferSplashscreenViewTransaction(
                        view, r.token, decorView, startingWindowLeash);
                        view, r.token, decorView, startingWindowLeash);
                view.postOnAnimation(() -> view.getViewTreeObserver().removeOnDrawListener(this));
                view.post(() -> view.getViewTreeObserver().removeOnDrawListener(this));
            }
            }
        });
        });
    }
    }