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
This commit is contained in:
@@ -2631,26 +2631,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));
|
||||
|
||||
Reference in New Issue
Block a user