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

Commit 40b62087 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Avoid NPE in AM.getMyMemoryState()

Test: atest cts/tests/app/src/android/app/cts/ActivityManagerTest.java#testGetMyMemoryState
Change-Id: I974719b80d11b789e8793fdd66ca920281284a8e
Fixes: 79586975
parent ab38e73a
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -15952,7 +15952,10 @@ public class ActivityManagerService extends IActivityManager.Stub
    }
    }
    @Override
    @Override
    public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo) {
    public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outState) {
        if (outState == null) {
            throw new IllegalArgumentException("outState is null");
        }
        enforceNotIsolatedCaller("getMyMemoryState");
        enforceNotIsolatedCaller("getMyMemoryState");
        final int callingUid = Binder.getCallingUid();
        final int callingUid = Binder.getCallingUid();
@@ -15963,7 +15966,9 @@ public class ActivityManagerService extends IActivityManager.Stub
            synchronized (mPidsSelfLocked) {
            synchronized (mPidsSelfLocked) {
                proc = mPidsSelfLocked.get(Binder.getCallingPid());
                proc = mPidsSelfLocked.get(Binder.getCallingPid());
            }
            }
            fillInProcMemInfo(proc, outInfo, clientTargetSdk);
            if (proc != null) {
                fillInProcMemInfo(proc, outState, clientTargetSdk);
            }
        }
        }
    }
    }