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

Commit 6dff0925 authored by Fengjiang Li's avatar Fengjiang Li
Browse files

If COLD startup occurs while launcher is backgrounded, do not wait until user...

If COLD startup occurs while launcher is backgrounded, do not wait until user goes to home to end startup session.

Fix: 305243183
Test: lock screen, force stop launcher, verify COLD startup is logged before user unlocks screen
Flag: N/A
Change-Id: I2d93dc3346e1aec82555162c9bb868cc4ddb621b
parent a96537fa
Loading
Loading
Loading
Loading
+14 −16
Original line number Diff line number Diff line
@@ -2631,18 +2631,12 @@ public class Launcher extends StatefulActivity<LauncherState>
            Trace.endAsyncSection(DISPLAY_WORKSPACE_TRACE_METHOD_NAME,
                    DISPLAY_WORKSPACE_TRACE_COOKIE);
        }
        MAIN_EXECUTOR.getHandler().postAtFrontOfQueue(() -> {
            mStartupLatencyLogger
                    .logCardinality(workspaceItemCount)
                    .logEnd(isBindSync
                            ? LAUNCHER_LATENCY_STARTUP_WORKSPACE_LOADER_SYNC
                        : LAUNCHER_LATENCY_STARTUP_WORKSPACE_LOADER_ASYNC);
        // In the first rootview's onDraw after onInitialBindComplete(), log end of startup latency.
        getRootView().getViewTreeObserver().addOnDrawListener(
                new ViewTreeObserver.OnDrawListener() {

                    @Override
                    public void onDraw() {
                        mStartupLatencyLogger
                            : LAUNCHER_LATENCY_STARTUP_WORKSPACE_LOADER_ASYNC)
                    .logEnd(LAUNCHER_LATENCY_STARTUP_TOTAL_DURATION)
                    .log()
                    .reset();
@@ -2650,7 +2644,11 @@ public class Launcher extends StatefulActivity<LauncherState>
                Trace.endAsyncSection(COLD_STARTUP_TRACE_METHOD_NAME,
                        COLD_STARTUP_TRACE_COOKIE);
            }

        });
        getRootView().getViewTreeObserver().addOnDrawListener(
                new ViewTreeObserver.OnDrawListener() {
                    @Override
                    public void onDraw() {
                        MAIN_EXECUTOR.getHandler().postAtFrontOfQueue(
                                () -> getRootView().getViewTreeObserver()
                                        .removeOnDrawListener(this));