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

Commit fe713aa2 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Ensure splash screen removed after it's view is shown in render thread." into main

parents 9a6302eb 5e787acf
Loading
Loading
Loading
Loading
+26 −3
Original line number Diff line number Diff line
@@ -4734,6 +4734,7 @@ public final class ActivityThread extends ClientTransactionHandler
    }

    private void reportSplashscreenViewShown(IBinder token, SplashScreenView view) {
        Trace.instant(Trace.TRACE_TAG_VIEW, "reportSplashscreenViewShown");
        ActivityClient.getInstance().reportSplashScreenAttached(token);
        synchronized (this) {
            if (mSplashScreenGlobal != null) {
@@ -4751,11 +4752,33 @@ public final class ActivityThread extends ClientTransactionHandler
        final SurfaceControl.Transaction transaction = new SurfaceControl.Transaction();
        transaction.hide(startingWindowLeash);

        decorView.getViewRootImpl().applyTransactionOnDraw(transaction);
        view.syncTransferSurfaceOnDraw();
        // Tell server we can remove the starting window

        if (com.android.window.flags.Flags.useRtFrameCallbackForSplashScreenTransfer()
                && decorView.isHardwareAccelerated()) {
            decorView.getViewRootImpl().registerRtFrameCallback(
                    new HardwareRenderer.FrameDrawingCallback() {
                        @Override
                        public void onFrameDraw(long frame) { }
                        @Override
                        public HardwareRenderer.FrameCommitCallback onFrameDraw(
                                int syncResult, long frame) {
                            return didProduceBuffer -> {
                                Trace.instant(Trace.TRACE_TAG_VIEW, "transferSplashscreenView");
                                transaction.apply();
                                // Tell server we can remove the starting window after frame commit.
                                decorView.postOnAnimation(() ->
                                        reportSplashscreenViewShown(token, view));
                            };
                        }
                    });
        } else {
            Trace.instant(Trace.TRACE_TAG_VIEW, "transferSplashscreenView_software");
            decorView.getViewRootImpl().applyTransactionOnDraw(transaction);
            // Tell server we can remove the starting window after frame commit.
            decorView.postOnAnimation(() -> reportSplashscreenViewShown(token, view));
        }
    }

    /**
     * Cycle activity through onPause and onUserLeaveHint so that PIP is entered if supported, then
+11 −0
Original line number Diff line number Diff line
@@ -425,6 +425,17 @@ flag {
    }
}

flag {
    name: "use_rt_frame_callback_for_splash_screen_transfer"
    namespace: "windowing_frontend"
    description: "report SplashscreenView shown after RtFrame commit"
    is_fixed_read_only: true
    bug: "387231234"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "port_window_size_animation"
    namespace: "windowing_frontend"