diff options
| author | 2024-06-14 14:37:48 +0000 | |
|---|---|---|
| committer | 2024-06-14 18:43:42 +0000 | |
| commit | b3661bcfa20b4850d25099bf0bd6bd86bb4073b7 (patch) | |
| tree | 27d8c4ad366d943d9088930d99284cc6f0a66c79 | |
| parent | cc2d5f26af05866b8c2775798165d4adfa57d3d3 (diff) | |
Update AppStartInfo APIs javadoc
Update for increased clarity around when and how these apis can be used.
Test: presubmit
Bug: n/a
Flagging: EXEMPT - javadoc
Change-Id: Ie5fdc1dce2825c4e39b826a8e4ed60aea0e15ac0
| -rw-r--r-- | core/java/android/app/ActivityManager.java | 29 | ||||
| -rw-r--r-- | core/java/android/app/ApplicationStartInfo.java | 10 |
2 files changed, 29 insertions, 10 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index fa8fe3bf5458..74e95839b2f5 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -4222,6 +4222,10 @@ public class ActivityManager { * Return a list of {@link ApplicationStartInfo} records containing the information about the * most recent app startups. * + * Records accessed using this path might include "incomplete" records such as in-progress app + * starts. Accessing in-progress starts using this method lets you access start information + * early to better optimize your startup path. + * * <p class="note"> Note: System stores this historical information in a ring buffer and only * the most recent records will be returned. </p> * @@ -4249,6 +4253,9 @@ public class ActivityManager { * Return a list of {@link ApplicationStartInfo} records containing the information about the * most recent app startups. * + * Records accessed using this path might include "incomplete" records such as in-progress app + * starts. + * * <p class="note"> Note: System stores this historical information in a ring buffer and only * the most recent records will be returned. </p> * @@ -4294,17 +4301,19 @@ public class ActivityManager { } /** - * Adds a callback to be notified when the {@link ApplicationStartInfo} records of this startup - * are complete. + * Adds a callback that is notified when the {@link ApplicationStartInfo} record of this startup + * is complete. The startup is considered complete when the first frame is drawn. * - * <p class="note"> Note: callback will be removed automatically after being triggered.</p> + * The callback doesn't wait for {@link Activity#reportFullyDrawn} to occur. Retrieve a copy + * of {@link ApplicationStartInfo} after {@link Activity#reportFullyDrawn} is called (using this + * callback or {@link getHistoricalProcessStartReasons}) if you need the + * {@link ApplicationStartInfo.START_TIMESTAMP_FULLY_DRAWN} timestamp. * - * <p class="note"> Note: callback will not wait for {@link Activity#reportFullyDrawn} to occur. - * Timestamp for fully drawn may be added after callback occurs. Set callback after invoking - * {@link Activity#reportFullyDrawn} if timestamp for fully drawn is required.</p> + * If the current start record has already been completed (that is, the process is not currently + * starting), the callback will be invoked immediately on the specified executor with the + * previously completed {@link ApplicationStartInfo} record. * - * <p class="note"> Note: if start records have already been retrieved, the callback will be - * invoked immediately on the specified executor with the previously resolved AppStartInfo.</p> + * Callback will be called at most once and removed automatically after being triggered. * * <p class="note"> Note: callback is asynchronous and should be made from a background thread. * </p> @@ -4394,8 +4403,8 @@ public class ActivityManager { * Adds an optional developer supplied timestamp to the calling apps most recent * {@link ApplicationStartInfo}. This is in addition to system recorded timestamps. * - * <p class="note"> Note: timestamps added after {@link Activity#reportFullyDrawn} is called - * will be discarded.</p> + * <p class="note"> Note: any timestamps added after {@link Activity#reportFullyDrawn} is called + * are discarded.</p> * * <p class="note"> Note: will overwrite existing timestamp if called with same key.</p> * diff --git a/core/java/android/app/ApplicationStartInfo.java b/core/java/android/app/ApplicationStartInfo.java index f77c50a271be..0ff55149bf6e 100644 --- a/core/java/android/app/ApplicationStartInfo.java +++ b/core/java/android/app/ApplicationStartInfo.java @@ -60,6 +60,16 @@ import java.util.Objects; * start times, throttling, and other useful diagnostic data can be obtained from * {@link ApplicationStartInfo} records. * </p> + * + * <p> +* ApplicationStartInfo objects can be retrieved via: +* - {@link ActivityManager#getHistoricalProcessStartReasons}, which can be called during or after + * a application's startup. Using this method, an app can retrieve information about an + * in-progress app start. +* - {@link ActivityManager#addApplicationStartInfoCompletionListener}, which returns an + * ApplicationStartInfo object via a callback when the startup is complete, or immediately + * if requested after the startup is complete. + * </p> */ @FlaggedApi(Flags.FLAG_APP_START_INFO) public final class ApplicationStartInfo implements Parcelable { |