Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a590e8e7 authored by Jing Ji's avatar Jing Ji
Browse files

Update ApplicationExitInfo per API Review

Bug: 148980719
Test: atest ApplicationExitInfoTest
Test: atest CtsAppExitTestCases:ActivityManagerAppExitInfoTest
Change-Id: I2982105f200fbe65c6b6bedfc23ed7b158298745
parent 374ba3fc
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -4002,7 +4002,7 @@ package android.app {
    method public android.util.Size getAppTaskThumbnailSize();
    method public java.util.List<android.app.ActivityManager.AppTask> getAppTasks();
    method public android.content.pm.ConfigurationInfo getDeviceConfigurationInfo();
    method @Nullable public java.util.List<android.app.ApplicationExitInfo> getHistoricalProcessExitReasons(@Nullable String, @IntRange(from=0) int, @IntRange(from=0) int);
    method @NonNull public java.util.List<android.app.ApplicationExitInfo> getHistoricalProcessExitReasons(@Nullable String, @IntRange(from=0) int, @IntRange(from=0) int);
    method public int getLargeMemoryClass();
    method public int getLauncherLargeIconDensity();
    method public int getLauncherLargeIconSize();
@@ -4542,12 +4542,13 @@ package android.app {
    method public int getPackageUid();
    method public int getPid();
    method @NonNull public String getProcessName();
    method public int getPss();
    method public long getPss();
    method public int getRealUid();
    method public int getReason();
    method public int getRss();
    method public long getRss();
    method public int getStatus();
    method public long getTimestamp();
    method @NonNull public android.os.UserHandle getUserHandle();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.ApplicationExitInfo> CREATOR;
    field public static final int REASON_ANR = 6; // 0x6
+0 −4
Original line number Diff line number Diff line
@@ -584,10 +584,6 @@ package android.app {
    field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.PackageOps> CREATOR;
  }
  public final class ApplicationExitInfo implements android.os.Parcelable {
    method @NonNull public android.os.UserHandle getUserHandle();
  }
  public class BroadcastOptions {
    method public static android.app.BroadcastOptions makeBasic();
    method @RequiresPermission("android.permission.START_ACTIVITIES_FROM_BACKGROUND") public void setBackgroundActivityStartsAllowed(boolean);
+3 −2
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;

@@ -3555,13 +3556,13 @@ public class ActivityManager {
     * @return a list of {@link ApplicationExitInfo} records matching the criteria, sorted in
     *         the order from most recent to least recent.
     */
    @Nullable
    @NonNull
    public List<ApplicationExitInfo> getHistoricalProcessExitReasons(@Nullable String packageName,
            @IntRange(from = 0) int pid, @IntRange(from = 0) int maxNum) {
        try {
            ParceledListSlice<ApplicationExitInfo> r = getService().getHistoricalProcessExitReasons(
                    packageName, pid, maxNum, mContext.getUserId());
            return r == null ? null : r.getList();
            return r == null ? Collections.emptyList() : r.getList();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+19 −19
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package android.app;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.app.ActivityManager.RunningAppProcessInfo.Importance;
import android.icu.text.SimpleDateFormat;
import android.os.Parcel;
@@ -245,12 +244,12 @@ public final class ApplicationExitInfo implements Parcelable {
    /**
     * @see {@link #getPss}
     */
    private int mPss;
    private long mPss;

    /**
     * @see {@link #getRss}
     */
    private int mRss;
    private long mRss;

    /**
     * @see {@link #getTimestamp}
@@ -385,7 +384,7 @@ public final class ApplicationExitInfo implements Parcelable {
     * it's NOT the exact memory information prior to its death; and it'll be zero
     * if the process died before system had a chance to take the sample. </p>
     */
    public int getPss() {
    public long getPss() {
        return mPss;
    }

@@ -396,12 +395,13 @@ public final class ApplicationExitInfo implements Parcelable {
     * it's NOT the exact memory information prior to its death; and it'll be zero
     * if the process died before system had a chance to take the sample. </p>
     */
    public int getRss() {
    public long getRss() {
        return mRss;
    }

    /**
     * The timestamp of the process's death, in milliseconds since the epoch.
     * The timestamp of the process's death, in milliseconds since the epoch,
     * as returned by {@link System#currentTimeMillis System.currentTimeMillis()}.
     */
    public long getTimestamp() {
        return mTimestamp;
@@ -409,6 +409,9 @@ public final class ApplicationExitInfo implements Parcelable {

    /**
     * The human readable description of the process's death, given by the system; could be null.
     *
     * <p class="note">Note: only intended to be human-readable and the system provides no
     * guarantees that the format is stable across devices or Android releases.</p>
     */
    public @Nullable String getDescription() {
        return mDescription;
@@ -416,10 +419,7 @@ public final class ApplicationExitInfo implements Parcelable {

    /**
     * Return the user id of the record on a multi-user system.
     *
     * @hide
     */
    @SystemApi
    public @NonNull UserHandle getUserHandle() {
        return UserHandle.of(UserHandle.getUserId(mRealUid));
    }
@@ -546,7 +546,7 @@ public final class ApplicationExitInfo implements Parcelable {
     *
     * @hide
     */
    public void setPss(final int pss) {
    public void setPss(final long pss) {
        mPss = pss;
    }

@@ -555,7 +555,7 @@ public final class ApplicationExitInfo implements Parcelable {
     *
     * @hide
     */
    public void setRss(final int rss) {
    public void setRss(final long rss) {
        mRss = rss;
    }

@@ -630,8 +630,8 @@ public final class ApplicationExitInfo implements Parcelable {
        dest.writeInt(mSubReason);
        dest.writeInt(mStatus);
        dest.writeInt(mImportance);
        dest.writeInt(mPss);
        dest.writeInt(mRss);
        dest.writeLong(mPss);
        dest.writeLong(mRss);
        dest.writeLong(mTimestamp);
        dest.writeString(mDescription);
    }
@@ -669,8 +669,8 @@ public final class ApplicationExitInfo implements Parcelable {
        mSubReason = in.readInt();
        mStatus = in.readInt();
        mImportance = in.readInt();
        mPss = in.readInt();
        mRss = in.readInt();
        mPss = in.readLong();
        mRss = in.readLong();
        mTimestamp = in.readLong();
        mDescription = in.readString();
    }
@@ -848,10 +848,10 @@ public final class ApplicationExitInfo implements Parcelable {
                    mImportance = proto.readInt(ApplicationExitInfoProto.IMPORTANCE);
                    break;
                case (int) ApplicationExitInfoProto.PSS:
                    mPss = proto.readInt(ApplicationExitInfoProto.PSS);
                    mPss = proto.readLong(ApplicationExitInfoProto.PSS);
                    break;
                case (int) ApplicationExitInfoProto.RSS:
                    mRss = proto.readInt(ApplicationExitInfoProto.RSS);
                    mRss = proto.readLong(ApplicationExitInfoProto.RSS);
                    break;
                case (int) ApplicationExitInfoProto.TIMESTAMP:
                    mTimestamp = proto.readLong(ApplicationExitInfoProto.TIMESTAMP);
@@ -891,8 +891,8 @@ public final class ApplicationExitInfo implements Parcelable {
        result = 31 * result + mSubReason;
        result = 31 * result + mImportance;
        result = 31 * result + mStatus;
        result = 31 * result + mPss;
        result = 31 * result + mRss;
        result = 31 * result + (int) mPss;
        result = 31 * result + (int) mRss;
        result = 31 * result + Long.hashCode(mTimestamp);
        result = 31 * result + Objects.hashCode(mProcessName);
        result = 31 * result + Objects.hashCode(mDescription);
+2 −2
Original line number Diff line number Diff line
@@ -178,8 +178,8 @@ message ApplicationExitInfoProto {
    }

    optional Importance importance = 10;
    optional int32 pss = 11;
    optional int32 rss = 12;
    optional int64 pss = 11;
    optional int64 rss = 12;
    optional int64 timestamp = 13;
    optional string description = 14;
}
Loading