Loading core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5329,6 +5329,7 @@ package android.app { method public int getStartType(); method public int getStartupState(); method @NonNull public java.util.Map<java.lang.Integer,java.lang.Long> getStartupTimestamps(); method @FlaggedApi("android.content.pm.stay_stopped") public boolean wasForceStopped(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.app.ApplicationStartInfo> CREATOR; field public static final int LAUNCH_MODE_SINGLE_INSTANCE = 2; // 0x2 core/java/android/app/ApplicationStartInfo.java +40 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SuppressLint; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.icu.text.SimpleDateFormat; import android.os.Parcel; import android.os.Parcelable; Loading Loading @@ -249,7 +250,7 @@ public final class ApplicationStartInfo implements Parcelable { private @StartType int mStartType; /** * @see #getStartIntent * @see #getIntent */ private Intent mStartIntent; Loading @@ -258,6 +259,11 @@ public final class ApplicationStartInfo implements Parcelable { */ private @LaunchMode int mLaunchMode; /** * @see #wasForceStopped() */ private boolean mWasForceStopped; /** * @hide * */ Loading Loading @@ -426,6 +432,15 @@ public final class ApplicationStartInfo implements Parcelable { mLaunchMode = launchMode; } /** * @see #wasForceStopped() * @param wasForceStopped whether the app had been force-stopped in the past * @hide */ public void setForceStopped(boolean wasForceStopped) { mWasForceStopped = wasForceStopped; } /** * Current state of startup. * Loading Loading @@ -578,6 +593,20 @@ public final class ApplicationStartInfo implements Parcelable { return mLaunchMode; } /** * Informs whether this is the first process launch for an app since it was * {@link ApplicationInfo#FLAG_STOPPED force-stopped} for some reason. * This allows the app to know if it should re-register for any alarms, jobs and other callbacks * that were cleared when the app was force-stopped. * * @return {@code true} if this is the first process launch of the app after having been * stopped, {@code false} otherwise. */ @FlaggedApi(android.content.pm.Flags.FLAG_STAY_STOPPED) public boolean wasForceStopped() { return mWasForceStopped; } @Override public int describeContents() { return 0; Loading @@ -603,6 +632,7 @@ public final class ApplicationStartInfo implements Parcelable { dest.writeInt(mStartType); dest.writeParcelable(mStartIntent, flags); dest.writeInt(mLaunchMode); dest.writeBoolean(mWasForceStopped); } /** @hide */ Loading @@ -622,6 +652,7 @@ public final class ApplicationStartInfo implements Parcelable { mStartType = other.mStartType; mStartIntent = other.mStartIntent; mLaunchMode = other.mLaunchMode; mWasForceStopped = other.mWasForceStopped; } private ApplicationStartInfo(@NonNull Parcel in) { Loading @@ -643,6 +674,7 @@ public final class ApplicationStartInfo implements Parcelable { mStartIntent = in.readParcelable(Intent.class.getClassLoader(), android.content.Intent.class); mLaunchMode = in.readInt(); mWasForceStopped = in.readBoolean(); } private static String intern(@Nullable String source) { Loading Loading @@ -720,6 +752,7 @@ public final class ApplicationStartInfo implements Parcelable { intentOut.close(); } proto.write(ApplicationStartInfoProto.LAUNCH_MODE, mLaunchMode); proto.write(ApplicationStartInfoProto.WAS_FORCE_STOPPED, mWasForceStopped); proto.end(token); } Loading Loading @@ -799,6 +832,10 @@ public final class ApplicationStartInfo implements Parcelable { case (int) ApplicationStartInfoProto.LAUNCH_MODE: mLaunchMode = proto.readInt(ApplicationStartInfoProto.LAUNCH_MODE); break; case (int) ApplicationStartInfoProto.WAS_FORCE_STOPPED: mWasForceStopped = proto.readBoolean( ApplicationStartInfoProto.WAS_FORCE_STOPPED); break; } } proto.end(token); Loading @@ -823,6 +860,7 @@ public final class ApplicationStartInfo implements Parcelable { .append(" reason=").append(reasonToString(mReason)) .append(" startType=").append(startTypeToString(mStartType)) .append(" launchMode=").append(mLaunchMode) .append(" wasForceStopped=").append(mWasForceStopped) .append('\n'); if (mStartIntent != null) { sb.append(" intent=").append(mStartIntent.toString()) Loading Loading @@ -878,7 +916,7 @@ public final class ApplicationStartInfo implements Parcelable { && mDefiningUid == o.mDefiningUid && mReason == o.mReason && mStartupState == o.mStartupState && mStartType == o.mStartType && mLaunchMode == o.mLaunchMode && TextUtils.equals(mProcessName, o.mProcessName) && timestampsEquals(o); && timestampsEquals(o) && mWasForceStopped == o.mWasForceStopped; } @Override Loading core/proto/android/app/appstartinfo.proto +1 −0 Original line number Diff line number Diff line Loading @@ -39,4 +39,5 @@ message ApplicationStartInfoProto { optional AppStartStartType start_type = 9; optional bytes start_intent = 10; optional AppStartLaunchMode launch_mode = 11; optional bool was_force_stopped = 12; } services/core/java/com/android/server/am/AppStartInfoTracker.java +5 −0 Original line number Diff line number Diff line Loading @@ -383,6 +383,11 @@ public final class AppStartInfoTracker { start.setDefiningUid(definingUid > 0 ? definingUid : app.info.uid); start.setProcessName(app.processName); start.setPackageName(app.info.packageName); if (android.content.pm.Flags.stayStopped()) { // TODO: Verify this is created at the right time to have the correct force-stopped // state in the ProcessRecord. Also use the WindowProcessRecord if activity. start.setForceStopped(app.wasForceStopped()); } } void reportApplicationOnCreateTimeNanos(ProcessRecord app, long timeNs) { Loading Loading
core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5329,6 +5329,7 @@ package android.app { method public int getStartType(); method public int getStartupState(); method @NonNull public java.util.Map<java.lang.Integer,java.lang.Long> getStartupTimestamps(); method @FlaggedApi("android.content.pm.stay_stopped") public boolean wasForceStopped(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.app.ApplicationStartInfo> CREATOR; field public static final int LAUNCH_MODE_SINGLE_INSTANCE = 2; // 0x2
core/java/android/app/ApplicationStartInfo.java +40 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SuppressLint; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.icu.text.SimpleDateFormat; import android.os.Parcel; import android.os.Parcelable; Loading Loading @@ -249,7 +250,7 @@ public final class ApplicationStartInfo implements Parcelable { private @StartType int mStartType; /** * @see #getStartIntent * @see #getIntent */ private Intent mStartIntent; Loading @@ -258,6 +259,11 @@ public final class ApplicationStartInfo implements Parcelable { */ private @LaunchMode int mLaunchMode; /** * @see #wasForceStopped() */ private boolean mWasForceStopped; /** * @hide * */ Loading Loading @@ -426,6 +432,15 @@ public final class ApplicationStartInfo implements Parcelable { mLaunchMode = launchMode; } /** * @see #wasForceStopped() * @param wasForceStopped whether the app had been force-stopped in the past * @hide */ public void setForceStopped(boolean wasForceStopped) { mWasForceStopped = wasForceStopped; } /** * Current state of startup. * Loading Loading @@ -578,6 +593,20 @@ public final class ApplicationStartInfo implements Parcelable { return mLaunchMode; } /** * Informs whether this is the first process launch for an app since it was * {@link ApplicationInfo#FLAG_STOPPED force-stopped} for some reason. * This allows the app to know if it should re-register for any alarms, jobs and other callbacks * that were cleared when the app was force-stopped. * * @return {@code true} if this is the first process launch of the app after having been * stopped, {@code false} otherwise. */ @FlaggedApi(android.content.pm.Flags.FLAG_STAY_STOPPED) public boolean wasForceStopped() { return mWasForceStopped; } @Override public int describeContents() { return 0; Loading @@ -603,6 +632,7 @@ public final class ApplicationStartInfo implements Parcelable { dest.writeInt(mStartType); dest.writeParcelable(mStartIntent, flags); dest.writeInt(mLaunchMode); dest.writeBoolean(mWasForceStopped); } /** @hide */ Loading @@ -622,6 +652,7 @@ public final class ApplicationStartInfo implements Parcelable { mStartType = other.mStartType; mStartIntent = other.mStartIntent; mLaunchMode = other.mLaunchMode; mWasForceStopped = other.mWasForceStopped; } private ApplicationStartInfo(@NonNull Parcel in) { Loading @@ -643,6 +674,7 @@ public final class ApplicationStartInfo implements Parcelable { mStartIntent = in.readParcelable(Intent.class.getClassLoader(), android.content.Intent.class); mLaunchMode = in.readInt(); mWasForceStopped = in.readBoolean(); } private static String intern(@Nullable String source) { Loading Loading @@ -720,6 +752,7 @@ public final class ApplicationStartInfo implements Parcelable { intentOut.close(); } proto.write(ApplicationStartInfoProto.LAUNCH_MODE, mLaunchMode); proto.write(ApplicationStartInfoProto.WAS_FORCE_STOPPED, mWasForceStopped); proto.end(token); } Loading Loading @@ -799,6 +832,10 @@ public final class ApplicationStartInfo implements Parcelable { case (int) ApplicationStartInfoProto.LAUNCH_MODE: mLaunchMode = proto.readInt(ApplicationStartInfoProto.LAUNCH_MODE); break; case (int) ApplicationStartInfoProto.WAS_FORCE_STOPPED: mWasForceStopped = proto.readBoolean( ApplicationStartInfoProto.WAS_FORCE_STOPPED); break; } } proto.end(token); Loading @@ -823,6 +860,7 @@ public final class ApplicationStartInfo implements Parcelable { .append(" reason=").append(reasonToString(mReason)) .append(" startType=").append(startTypeToString(mStartType)) .append(" launchMode=").append(mLaunchMode) .append(" wasForceStopped=").append(mWasForceStopped) .append('\n'); if (mStartIntent != null) { sb.append(" intent=").append(mStartIntent.toString()) Loading Loading @@ -878,7 +916,7 @@ public final class ApplicationStartInfo implements Parcelable { && mDefiningUid == o.mDefiningUid && mReason == o.mReason && mStartupState == o.mStartupState && mStartType == o.mStartType && mLaunchMode == o.mLaunchMode && TextUtils.equals(mProcessName, o.mProcessName) && timestampsEquals(o); && timestampsEquals(o) && mWasForceStopped == o.mWasForceStopped; } @Override Loading
core/proto/android/app/appstartinfo.proto +1 −0 Original line number Diff line number Diff line Loading @@ -39,4 +39,5 @@ message ApplicationStartInfoProto { optional AppStartStartType start_type = 9; optional bytes start_intent = 10; optional AppStartLaunchMode launch_mode = 11; optional bool was_force_stopped = 12; }
services/core/java/com/android/server/am/AppStartInfoTracker.java +5 −0 Original line number Diff line number Diff line Loading @@ -383,6 +383,11 @@ public final class AppStartInfoTracker { start.setDefiningUid(definingUid > 0 ? definingUid : app.info.uid); start.setProcessName(app.processName); start.setPackageName(app.info.packageName); if (android.content.pm.Flags.stayStopped()) { // TODO: Verify this is created at the right time to have the correct force-stopped // state in the ProcessRecord. Also use the WindowProcessRecord if activity. start.setForceStopped(app.wasForceStopped()); } } void reportApplicationOnCreateTimeNanos(ProcessRecord app, long timeNs) { Loading