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

Commit 443c290e authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Use the last sample of the PSS/RSS in ApplicationExitInfo" into rvc-dev...

Merge "Use the last sample of the PSS/RSS in ApplicationExitInfo" into rvc-dev am: 005898dd am: 5da231cd

Change-Id: Id82cc2f5b2d712ee43d726a92512c740b912fb4b
parents 6f5ebe4b 5da231cd
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);
+14 −5
Original line number Diff line number Diff line
@@ -505,9 +505,13 @@ public final class AppExitInfoTracker {
    @VisibleForTesting
    void onPackageRemoved(String packageName, int uid, boolean allUsers) {
        if (packageName != null) {
            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;
+3 −0
Original line number Diff line number Diff line
@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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;
    }