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

This commit is contained in:
Fengjiang Li
2023-10-19 19:51:46 +00:00
committed by Android (Google) Code Review

View File

@@ -2595,26 +2595,24 @@ public class Launcher extends StatefulActivity<LauncherState>
Trace.endAsyncSection(DISPLAY_WORKSPACE_TRACE_METHOD_NAME,
DISPLAY_WORKSPACE_TRACE_COOKIE);
}
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.
MAIN_EXECUTOR.getHandler().postAtFrontOfQueue(() -> {
mStartupLatencyLogger
.logCardinality(workspaceItemCount)
.logEnd(isBindSync
? LAUNCHER_LATENCY_STARTUP_WORKSPACE_LOADER_SYNC
: LAUNCHER_LATENCY_STARTUP_WORKSPACE_LOADER_ASYNC)
.logEnd(LAUNCHER_LATENCY_STARTUP_TOTAL_DURATION)
.log()
.reset();
if (mIsColdStartupAfterReboot) {
Trace.endAsyncSection(COLD_STARTUP_TRACE_METHOD_NAME,
COLD_STARTUP_TRACE_COOKIE);
}
});
getRootView().getViewTreeObserver().addOnDrawListener(
new ViewTreeObserver.OnDrawListener() {
@Override
public void onDraw() {
mStartupLatencyLogger
.logEnd(LAUNCHER_LATENCY_STARTUP_TOTAL_DURATION)
.log()
.reset();
if (mIsColdStartupAfterReboot) {
Trace.endAsyncSection(COLD_STARTUP_TRACE_METHOD_NAME,
COLD_STARTUP_TRACE_COOKIE);
}
MAIN_EXECUTOR.getHandler().postAtFrontOfQueue(
() -> getRootView().getViewTreeObserver()
.removeOnDrawListener(this));