Update ApplicationExitInfo per API Review
Bug: 148980719 Test: atest ApplicationExitInfoTest Test: atest CtsAppExitTestCases:ActivityManagerAppExitInfoTest Change-Id: I2982105f200fbe65c6b6bedfc23ed7b158298745
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -174,12 +174,12 @@ public class ApplicationExitInfoTest {
|
||||
final int app1ConnectiongGroup = 10;
|
||||
final int app1UidUser2 = 1010123;
|
||||
final int app1PidUser2 = 12347;
|
||||
final int app1Pss1 = 34567;
|
||||
final int app1Rss1 = 45678;
|
||||
final int app1Pss2 = 34568;
|
||||
final int app1Rss2 = 45679;
|
||||
final int app1Pss3 = 34569;
|
||||
final int app1Rss3 = 45680;
|
||||
final long app1Pss1 = 34567;
|
||||
final long app1Rss1 = 45678;
|
||||
final long app1Pss2 = 34568;
|
||||
final long app1Rss2 = 45679;
|
||||
final long app1Pss3 = 34569;
|
||||
final long app1Rss3 = 45680;
|
||||
final String app1ProcessName = "com.android.test.stub1:process";
|
||||
final String app1PackageName = "com.android.test.stub1";
|
||||
|
||||
@@ -344,8 +344,8 @@ public class ApplicationExitInfoTest {
|
||||
// Case 4: Create a process from another package with kill from lmkd
|
||||
final int app2UidUser2 = 1010234;
|
||||
final int app2PidUser2 = 12348;
|
||||
final int app2Pss1 = 54321;
|
||||
final int app2Rss1 = 65432;
|
||||
final long app2Pss1 = 54321;
|
||||
final long app2Rss1 = 65432;
|
||||
final String app2ProcessName = "com.android.test.stub2:process";
|
||||
final String app2PackageName = "com.android.test.stub2";
|
||||
|
||||
@@ -402,8 +402,8 @@ public class ApplicationExitInfoTest {
|
||||
final int app3UidUser2 = 1010345;
|
||||
final int app3PidUser2 = 12349;
|
||||
final int app3ConnectiongGroup = 4;
|
||||
final int app3Pss1 = 54320;
|
||||
final int app3Rss1 = 65430;
|
||||
final long app3Pss1 = 54320;
|
||||
final long app3Rss1 = 65430;
|
||||
final String app3ProcessName = "com.android.test.stub3:process";
|
||||
final String app3PackageName = "com.android.test.stub3";
|
||||
final String app3Description = "native crash";
|
||||
@@ -529,8 +529,8 @@ public class ApplicationExitInfoTest {
|
||||
final int app3Uid = 10345;
|
||||
final int app3IsolatedUid = 99001; // it's an isolated process
|
||||
final int app3Pid = 12350;
|
||||
final int app3Pss2 = 23232;
|
||||
final int app3Rss2 = 32323;
|
||||
final long app3Pss2 = 23232;
|
||||
final long app3Rss2 = 32323;
|
||||
final String app3Description2 = "force close";
|
||||
|
||||
sleep(1);
|
||||
@@ -618,8 +618,8 @@ public class ApplicationExitInfoTest {
|
||||
|
||||
sleep(1);
|
||||
final int app1IsolatedUidUser2 = 1099002; // isolated uid
|
||||
final int app1Pss4 = 34343;
|
||||
final int app1Rss4 = 43434;
|
||||
final long app1Pss4 = 34343;
|
||||
final long app1Rss4 = 43434;
|
||||
final long now8 = System.currentTimeMillis();
|
||||
sigNum = OsConstants.SIGKILL;
|
||||
doReturn(new Pair<Long, Object>(now8, makeSignalStatus(sigNum)))
|
||||
@@ -673,8 +673,8 @@ public class ApplicationExitInfoTest {
|
||||
sleep(1);
|
||||
final int app1Pid2User2 = 56565;
|
||||
final int app1IsolatedUid2User2 = 1099003; // isolated uid
|
||||
final int app1Pss5 = 34344;
|
||||
final int app1Rss5 = 43435;
|
||||
final long app1Pss5 = 34344;
|
||||
final long app1Rss5 = 43435;
|
||||
final long now9 = System.currentTimeMillis();
|
||||
sigNum = OsConstants.SIGKILL;
|
||||
doReturn(new Pair<Long, Object>(now9, makeSignalStatus(sigNum)))
|
||||
@@ -831,7 +831,7 @@ public class ApplicationExitInfoTest {
|
||||
}
|
||||
|
||||
private ProcessRecord makeProcessRecord(int pid, int uid, int packageUid, Integer definingUid,
|
||||
int connectionGroup, int procState, int pss, int rss,
|
||||
int connectionGroup, int procState, long pss, long rss,
|
||||
String processName, String packageName) {
|
||||
ApplicationInfo ai = new ApplicationInfo();
|
||||
ai.packageName = packageName;
|
||||
@@ -847,8 +847,8 @@ public class ApplicationExitInfoTest {
|
||||
app.connectionGroup = connectionGroup;
|
||||
app.setProcState = procState;
|
||||
app.lastMemInfo = spy(new Debug.MemoryInfo());
|
||||
doReturn(pss).when(app.lastMemInfo).getTotalPss();
|
||||
doReturn(rss).when(app.lastMemInfo).getTotalRss();
|
||||
doReturn((int) pss).when(app.lastMemInfo).getTotalPss();
|
||||
doReturn((int) rss).when(app.lastMemInfo).getTotalRss();
|
||||
return app;
|
||||
}
|
||||
|
||||
@@ -856,7 +856,7 @@ public class ApplicationExitInfoTest {
|
||||
Long timestamp, Integer pid, Integer uid, Integer packageUid,
|
||||
Integer definingUid, String processName, Integer connectionGroup,
|
||||
Integer reason, Integer subReason, Integer status,
|
||||
Integer pss, Integer rss, Integer importance, String description) {
|
||||
Long pss, Long rss, Integer importance, String description) {
|
||||
assertNotNull(info);
|
||||
|
||||
if (timestamp != null) {
|
||||
@@ -892,10 +892,10 @@ public class ApplicationExitInfoTest {
|
||||
assertEquals(status.intValue(), info.getStatus());
|
||||
}
|
||||
if (pss != null) {
|
||||
assertEquals(pss.intValue(), info.getPss());
|
||||
assertEquals(pss.longValue(), info.getPss());
|
||||
}
|
||||
if (rss != null) {
|
||||
assertEquals(rss.intValue(), info.getRss());
|
||||
assertEquals(rss.longValue(), info.getRss());
|
||||
}
|
||||
if (importance != null) {
|
||||
assertEquals(importance.intValue(), info.getImportance());
|
||||
|
||||
Reference in New Issue
Block a user