Merge "Use the last sample of the PSS/RSS in ApplicationExitInfo" into rvc-dev
This commit is contained in:
@@ -4766,7 +4766,8 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
packageName == null ? ApplicationExitInfo.REASON_USER_STOPPED
|
||||
: ApplicationExitInfo.REASON_USER_REQUESTED,
|
||||
ApplicationExitInfo.SUBREASON_UNKNOWN,
|
||||
packageName == null ? ("stop user " + userId) : ("stop " + packageName));
|
||||
(packageName == null ? ("stop user " + userId) : ("stop " + packageName))
|
||||
+ " due to " + reason);
|
||||
|
||||
didSomething |=
|
||||
mAtmInternal.onForceStopPackage(packageName, doit, evenPersistent, userId);
|
||||
@@ -17066,6 +17067,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
proc.lastCachedPss = pss;
|
||||
proc.lastCachedSwapPss = swapPss;
|
||||
}
|
||||
proc.mLastRss = rss;
|
||||
|
||||
final SparseArray<Pair<Long, String>> watchUids
|
||||
= mMemWatchProcesses.getMap().get(proc.processName);
|
||||
|
||||
@@ -505,9 +505,13 @@ public final class AppExitInfoTracker {
|
||||
@VisibleForTesting
|
||||
void onPackageRemoved(String packageName, int uid, boolean allUsers) {
|
||||
if (packageName != null) {
|
||||
mAppExitInfoSourceZygote.removeByUid(uid, allUsers);
|
||||
mAppExitInfoSourceLmkd.removeByUid(uid, allUsers);
|
||||
mIsolatedUidRecords.removeAppUid(uid, allUsers);
|
||||
final boolean removeUid = TextUtils.isEmpty(
|
||||
mService.mPackageManagerInt.getNameForUid(uid));
|
||||
if (removeUid) {
|
||||
mAppExitInfoSourceZygote.removeByUid(uid, allUsers);
|
||||
mAppExitInfoSourceLmkd.removeByUid(uid, allUsers);
|
||||
mIsolatedUidRecords.removeAppUid(uid, allUsers);
|
||||
}
|
||||
removePackage(packageName, allUsers ? UserHandle.USER_ALL : UserHandle.getUserId(uid));
|
||||
schedulePersistProcessExitInfo(true);
|
||||
}
|
||||
@@ -533,6 +537,11 @@ public final class AppExitInfoTracker {
|
||||
mService.mContext.registerReceiverForAllUsers(new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
boolean replacing = intent.getBooleanExtra(
|
||||
Intent.EXTRA_REPLACING, false);
|
||||
if (replacing) {
|
||||
return;
|
||||
}
|
||||
int uid = intent.getIntExtra(Intent.EXTRA_UID, UserHandle.USER_NULL);
|
||||
boolean allUsers = intent.getBooleanExtra(
|
||||
Intent.EXTRA_REMOVED_FOR_ALL_USERS, false);
|
||||
@@ -835,8 +844,8 @@ public final class AppExitInfoTracker {
|
||||
info.setReason(ApplicationExitInfo.REASON_UNKNOWN);
|
||||
info.setStatus(0);
|
||||
info.setImportance(procStateToImportance(app.setProcState));
|
||||
info.setPss(app.lastMemInfo == null ? 0 : app.lastMemInfo.getTotalPss());
|
||||
info.setRss(app.lastMemInfo == null ? 0 : app.lastMemInfo.getTotalRss());
|
||||
info.setPss(app.lastPss);
|
||||
info.setRss(app.mLastRss);
|
||||
info.setTimestamp(System.currentTimeMillis());
|
||||
|
||||
return info;
|
||||
|
||||
@@ -323,6 +323,8 @@ class ProcessRecord implements WindowProcessListener {
|
||||
// set of disabled compat changes for the process (all others are enabled)
|
||||
long[] mDisabledCompatChanges;
|
||||
|
||||
long mLastRss; // Last computed memory rss.
|
||||
|
||||
// The precede instance of the process, which would exist when the previous process is killed
|
||||
// but not fully dead yet; in this case, the new instance of the process should be held until
|
||||
// this precede instance is fully dead.
|
||||
@@ -431,6 +433,7 @@ class ProcessRecord implements WindowProcessListener {
|
||||
pw.print(" lastSwapPss="); DebugUtils.printSizeValue(pw, lastSwapPss*1024);
|
||||
pw.print(" lastCachedPss="); DebugUtils.printSizeValue(pw, lastCachedPss*1024);
|
||||
pw.print(" lastCachedSwapPss="); DebugUtils.printSizeValue(pw, lastCachedSwapPss*1024);
|
||||
pw.print(" lastRss="); DebugUtils.printSizeValue(pw, mLastRss * 1024);
|
||||
pw.println();
|
||||
pw.print(prefix); pw.print("procStateMemTracker: ");
|
||||
procStateMemTracker.dumpLine(pw);
|
||||
|
||||
@@ -847,8 +847,8 @@ public class ApplicationExitInfoTest {
|
||||
app.connectionGroup = connectionGroup;
|
||||
app.setProcState = procState;
|
||||
app.lastMemInfo = spy(new Debug.MemoryInfo());
|
||||
doReturn((int) pss).when(app.lastMemInfo).getTotalPss();
|
||||
doReturn((int) rss).when(app.lastMemInfo).getTotalRss();
|
||||
app.lastPss = pss;
|
||||
app.mLastRss = rss;
|
||||
return app;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user