Loading services/core/java/com/android/server/am/AppStartInfoTracker.java +28 −7 Original line number Diff line number Diff line Loading @@ -294,11 +294,13 @@ public final class AppStartInfoTracker { mInProgRecords.removeAt(index); return; } info.setStartupState(ApplicationStartInfo.STARTUP_STATE_FIRST_FRAME_DRAWN); info.setLaunchMode(launchMode); if (!android.app.Flags.appStartInfoTimestamps()) { info.setStartupState(ApplicationStartInfo.STARTUP_STATE_FIRST_FRAME_DRAWN); checkCompletenessAndCallback(info); } } } void onReportFullyDrawn(long id, long timestampNanos) { synchronized (mLock) { Loading Loading @@ -539,9 +541,9 @@ public final class AppStartInfoTracker { } /** * Called whenever data is added to a {@link ApplicationStartInfo} object. Checks for * completeness and triggers callback if a callback has been registered and the object * is complete. * Called whenever a potentially final piece of data is added to a {@link ApplicationStartInfo} * object. Checks for completeness and triggers callback if a callback has been registered and * the object is complete. */ private void checkCompletenessAndCallback(ApplicationStartInfo startInfo) { synchronized (mLock) { Loading Loading @@ -1124,10 +1126,23 @@ public final class AppStartInfoTracker { Long.compare(getStartTimestamp(b), getStartTimestamp(a))); } /** * Add the provided key/timestamp to the most recent start record, if it is currently * accepting new timestamps. * * Will also update the start records startup state and trigger the completion listener when * appropriate. */ @GuardedBy("mLock") void addTimestampToStartLocked(int key, long timestampNs) { if (mInfos.isEmpty()) { if (DEBUG) Slog.d(TAG, "No records to add to."); return; } // Records are sorted newest to oldest, grab record at index 0. int startupState = mInfos.get(0).getStartupState(); ApplicationStartInfo startInfo = mInfos.get(0); int startupState = startInfo.getStartupState(); // If startup state is error then don't accept any further timestamps. if (startupState == ApplicationStartInfo.STARTUP_STATE_ERROR) { Loading @@ -1145,7 +1160,13 @@ public final class AppStartInfoTracker { return; } mInfos.get(0).addStartupTimestamp(key, timestampNs); startInfo.addStartupTimestamp(key, timestampNs); if (key == ApplicationStartInfo.START_TIMESTAMP_FIRST_FRAME && android.app.Flags.appStartInfoTimestamps()) { startInfo.setStartupState(ApplicationStartInfo.STARTUP_STATE_FIRST_FRAME_DRAWN); checkCompletenessAndCallback(startInfo); } } @GuardedBy("mLock") Loading Loading
services/core/java/com/android/server/am/AppStartInfoTracker.java +28 −7 Original line number Diff line number Diff line Loading @@ -294,11 +294,13 @@ public final class AppStartInfoTracker { mInProgRecords.removeAt(index); return; } info.setStartupState(ApplicationStartInfo.STARTUP_STATE_FIRST_FRAME_DRAWN); info.setLaunchMode(launchMode); if (!android.app.Flags.appStartInfoTimestamps()) { info.setStartupState(ApplicationStartInfo.STARTUP_STATE_FIRST_FRAME_DRAWN); checkCompletenessAndCallback(info); } } } void onReportFullyDrawn(long id, long timestampNanos) { synchronized (mLock) { Loading Loading @@ -539,9 +541,9 @@ public final class AppStartInfoTracker { } /** * Called whenever data is added to a {@link ApplicationStartInfo} object. Checks for * completeness and triggers callback if a callback has been registered and the object * is complete. * Called whenever a potentially final piece of data is added to a {@link ApplicationStartInfo} * object. Checks for completeness and triggers callback if a callback has been registered and * the object is complete. */ private void checkCompletenessAndCallback(ApplicationStartInfo startInfo) { synchronized (mLock) { Loading Loading @@ -1124,10 +1126,23 @@ public final class AppStartInfoTracker { Long.compare(getStartTimestamp(b), getStartTimestamp(a))); } /** * Add the provided key/timestamp to the most recent start record, if it is currently * accepting new timestamps. * * Will also update the start records startup state and trigger the completion listener when * appropriate. */ @GuardedBy("mLock") void addTimestampToStartLocked(int key, long timestampNs) { if (mInfos.isEmpty()) { if (DEBUG) Slog.d(TAG, "No records to add to."); return; } // Records are sorted newest to oldest, grab record at index 0. int startupState = mInfos.get(0).getStartupState(); ApplicationStartInfo startInfo = mInfos.get(0); int startupState = startInfo.getStartupState(); // If startup state is error then don't accept any further timestamps. if (startupState == ApplicationStartInfo.STARTUP_STATE_ERROR) { Loading @@ -1145,7 +1160,13 @@ public final class AppStartInfoTracker { return; } mInfos.get(0).addStartupTimestamp(key, timestampNs); startInfo.addStartupTimestamp(key, timestampNs); if (key == ApplicationStartInfo.START_TIMESTAMP_FIRST_FRAME && android.app.Flags.appStartInfoTimestamps()) { startInfo.setStartupState(ApplicationStartInfo.STARTUP_STATE_FIRST_FRAME_DRAWN); checkCompletenessAndCallback(startInfo); } } @GuardedBy("mLock") Loading