Loading services/core/java/com/android/server/am/ActiveServices.java +3 −3 Original line number Diff line number Diff line Loading @@ -839,7 +839,7 @@ public final class ActiveServices { boolean addToStarting = false; if (!callerFg && !fgRequired && r.app == null && mAm.mUserController.hasStartedUserState(r.userId)) { ProcessRecord proc = mAm.getProcessRecordLocked(r.processName, r.appInfo.uid, false); ProcessRecord proc = mAm.getProcessRecordLocked(r.processName, r.appInfo.uid); if (proc == null || proc.mState.getCurProcState() > PROCESS_STATE_RECEIVER) { // If this is not coming from a foreground caller, then we may want // to delay the start if there are already other background services Loading Loading @@ -3451,7 +3451,7 @@ public final class ActiveServices { ProcessRecord app; if (!isolated) { app = mAm.getProcessRecordLocked(procName, r.appInfo.uid, false); app = mAm.getProcessRecordLocked(procName, r.appInfo.uid); if (DEBUG_MU) Slog.v(TAG_MU, "bringUpServiceLocked: appInfo.uid=" + r.appInfo.uid + " app=" + app); if (app != null) { Loading Loading @@ -3499,7 +3499,7 @@ public final class ActiveServices { // TODO (chriswailes): Change the Zygote policy flags based on if the launch-for-service // was initiated from a notification tap or not. if ((app = mAm.startProcessLocked(procName, r.appInfo, true, intentFlags, hostingRecord, ZYGOTE_POLICY_FLAG_EMPTY, false, isolated, false)) == null) { hostingRecord, ZYGOTE_POLICY_FLAG_EMPTY, false, isolated)) == null) { String msg = "Unable to launch app " + r.appInfo.packageName + "/" + r.appInfo.uid + " for service " Loading services/core/java/com/android/server/am/ActivityManagerService.java +12 −14 Original line number Diff line number Diff line Loading @@ -2604,8 +2604,8 @@ public class ActivityManagerService extends IActivityManager.Stub } @GuardedBy("this") final ProcessRecord getProcessRecordLocked(String processName, int uid, boolean keepIfLarge) { return mProcessList.getProcessRecordLocked(processName, uid, keepIfLarge); final ProcessRecord getProcessRecordLocked(String processName, int uid) { return mProcessList.getProcessRecordLocked(processName, uid); } @GuardedBy(anyOf = {"this", "mProcLock"}) Loading Loading @@ -2639,8 +2639,7 @@ public class ActivityManagerService extends IActivityManager.Stub false /* knownToBeDead */, 0 /* intentFlags */, sNullHostingRecord /* hostingRecord */, ZYGOTE_POLICY_FLAG_EMPTY, true /* allowWhileBooting */, true /* isolated */, uid, true /* keepIfLarge */, abiOverride, entryPoint, entryPointArgs, crashHandler); uid, abiOverride, entryPoint, entryPointArgs, crashHandler); return proc != null; } } Loading @@ -2649,10 +2648,10 @@ public class ActivityManagerService extends IActivityManager.Stub final ProcessRecord startProcessLocked(String processName, ApplicationInfo info, boolean knownToBeDead, int intentFlags, HostingRecord hostingRecord, int zygotePolicyFlags, boolean allowWhileBooting, boolean isolated, boolean keepIfLarge) { boolean isolated) { return mProcessList.startProcessLocked(processName, info, knownToBeDead, intentFlags, hostingRecord, zygotePolicyFlags, allowWhileBooting, isolated, 0 /* isolatedUid */, keepIfLarge, null /* ABI override */, null /* entryPoint */, null /* ABI override */, null /* entryPoint */, null /* entryPointArgs */, null /* crashHandler */); } Loading Loading @@ -3905,7 +3904,7 @@ public class ActivityManagerService extends IActivityManager.Stub // Only the system server can kill an application if (callerUid == SYSTEM_UID) { synchronized (this) { ProcessRecord app = getProcessRecordLocked(processName, uid, true); ProcessRecord app = getProcessRecordLocked(processName, uid); IApplicationThread thread; if (app != null && (thread = app.getThread()) != null) { try { Loading Loading @@ -6101,7 +6100,7 @@ public class ActivityManagerService extends IActivityManager.Stub ProcessRecord app; if (!isolated) { app = getProcessRecordLocked(customProcess != null ? customProcess : info.processName, info.uid, true); info.uid); } else { app = null; } Loading Loading @@ -11933,7 +11932,7 @@ public class ActivityManagerService extends IActivityManager.Stub ProcessRecord proc = startProcessLocked(app.processName, app, false, 0, new HostingRecord("backup", hostingName), ZYGOTE_POLICY_FLAG_SYSTEM_PROCESS, false, false, false); ZYGOTE_POLICY_FLAG_SYSTEM_PROCESS, false, false); if (proc == null) { Slog.e(TAG, "Unable to start backup agent process " + r); return false; Loading Loading @@ -13643,7 +13642,7 @@ public class ActivityManagerService extends IActivityManager.Stub ProcessRecord app; synchronized (mProcLock) { if (noRestart) { app = getProcessRecordLocked(ai.processName, ai.uid, true); app = getProcessRecordLocked(ai.processName, ai.uid); } else { // Instrumentation can kill and relaunch even persistent processes forceStopPackageLocked(ii.targetPackage, -1, true, false, true, true, false, Loading Loading @@ -13686,7 +13685,7 @@ public class ActivityManagerService extends IActivityManager.Stub ApplicationInfo targetInfo) { ProcessRecord pr; synchronized (this) { pr = getProcessRecordLocked(targetInfo.processName, targetInfo.uid, true); pr = getProcessRecordLocked(targetInfo.processName, targetInfo.uid); } try { Loading Loading @@ -15433,8 +15432,7 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public void killProcess(String processName, int uid, String reason) { synchronized (ActivityManagerService.this) { final ProcessRecord proc = getProcessRecordLocked(processName, uid, true /* keepIfLarge */); final ProcessRecord proc = getProcessRecordLocked(processName, uid); if (proc != null) { mProcessList.removeProcessLocked(proc, false /* callerWillRestart */, true /* allowRestart */, ApplicationExitInfo.REASON_OTHER, reason); Loading Loading @@ -15841,7 +15839,7 @@ public class ActivityManagerService extends IActivityManager.Stub startProcessLocked(processName, info, knownToBeDead, 0 /* intentFlags */, new HostingRecord(hostingType, hostingName, isTop), ZYGOTE_POLICY_FLAG_LATENCY_SENSITIVE, false /* allowWhileBooting */, false /* isolated */, true /* keepIfLarge */); false /* isolated */); } } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); services/core/java/com/android/server/am/BroadcastQueue.java +2 −2 Original line number Diff line number Diff line Loading @@ -1544,7 +1544,7 @@ public final class BroadcastQueue { } String targetProcess = info.activityInfo.processName; ProcessRecord app = mService.getProcessRecordLocked(targetProcess, info.activityInfo.applicationInfo.uid, false); info.activityInfo.applicationInfo.uid); if (!skip) { final int allowed = mService.getAppStartModeLOSP( Loading Loading @@ -1678,7 +1678,7 @@ public final class BroadcastQueue { r.intent.getFlags() | Intent.FLAG_FROM_BACKGROUND, new HostingRecord("broadcast", r.curComponent), isActivityCapable ? ZYGOTE_POLICY_FLAG_LATENCY_SENSITIVE : ZYGOTE_POLICY_FLAG_EMPTY, (r.intent.getFlags() & Intent.FLAG_RECEIVER_BOOT_UPGRADE) != 0, false, false); (r.intent.getFlags() & Intent.FLAG_RECEIVER_BOOT_UPGRADE) != 0, false); if (r.curApp == null) { // Ah, this recipient is unavailable. Finish it if necessary, // and mark the broadcast record as ready for the next. Loading services/core/java/com/android/server/am/ContentProviderHelper.java +2 −2 Original line number Diff line number Diff line Loading @@ -436,7 +436,7 @@ public class ContentProviderHelper { // Use existing process if already started checkTime(startTime, "getContentProviderImpl: looking for process record"); ProcessRecord proc = mService.getProcessRecordLocked( cpi.processName, cpr.appInfo.uid, false); cpi.processName, cpr.appInfo.uid); IApplicationThread thread; if (proc != null && (thread = proc.getThread()) != null && !proc.isKilled()) { Loading @@ -459,7 +459,7 @@ public class ContentProviderHelper { new HostingRecord("content provider", new ComponentName( cpi.applicationInfo.packageName, cpi.name)), Process.ZYGOTE_POLICY_FLAG_EMPTY, false, false, false); Process.ZYGOTE_POLICY_FLAG_EMPTY, false, false); checkTime(startTime, "getContentProviderImpl: after start process"); if (proc == null) { Slog.w(TAG, "Unable to launch app " Loading services/core/java/com/android/server/am/ProcessList.java +6 −48 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_LRU; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_NETWORK; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_PROCESSES; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_PROCESS_OBSERVERS; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_PSS; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_UID_OBSERVERS; import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_PROCESS_OBSERVERS; import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; Loading @@ -54,7 +53,6 @@ import static com.android.server.am.ActivityManagerService.TAG_LRU; import static com.android.server.am.ActivityManagerService.TAG_NETWORK; import static com.android.server.am.ActivityManagerService.TAG_PROCESSES; import static com.android.server.am.ActivityManagerService.TAG_UID_OBSERVERS; import static com.android.server.am.AppProfiler.TAG_PSS; import android.annotation.NonNull; import android.app.ActivityManager; Loading Loading @@ -1501,8 +1499,7 @@ public final class ProcessList { } @GuardedBy("mService") final ProcessRecord getProcessRecordLocked(String processName, int uid, boolean keepIfLarge) { ProcessRecord getProcessRecordLocked(String processName, int uid) { if (uid == SYSTEM_UID) { // The system gets to run in any process. If there are multiple // processes with the same uid, just pick the first (this Loading @@ -1519,41 +1516,7 @@ public final class ProcessList { return procs.valueAt(i); } } ProcessRecord proc = mProcessNames.get(processName, uid); if (false && proc != null && !keepIfLarge && proc.mState.getSetProcState() >= ActivityManager.PROCESS_STATE_CACHED_EMPTY && proc.mProfile.getLastCachedPss() >= 4000) { // Turn this condition on to cause killing to happen regularly, for testing. synchronized (mService.mAppProfiler.mProfilerLock) { proc.mProfile.reportCachedKill(); } proc.killLocked(Long.toString(proc.mProfile.getLastCachedPss()) + "k from cached", ApplicationExitInfo.REASON_OTHER, ApplicationExitInfo.SUBREASON_LARGE_CACHED, true); } else if (proc != null && !keepIfLarge && !mService.mAppProfiler.isLastMemoryLevelNormal() && proc.mState.getSetProcState() >= ActivityManager.PROCESS_STATE_CACHED_EMPTY) { final long lastCachedPss; boolean doKilling = false; synchronized (mService.mAppProfiler.mProfilerLock) { lastCachedPss = proc.mProfile.getLastCachedPss(); if (lastCachedPss >= getCachedRestoreThresholdKb()) { proc.mProfile.reportCachedKill(); doKilling = true; } } if (DEBUG_PSS) { Slog.d(TAG_PSS, "May not keep " + proc + ": pss=" + lastCachedPss); } if (doKilling) { proc.killLocked(Long.toString(lastCachedPss) + "k from cached", ApplicationExitInfo.REASON_OTHER, ApplicationExitInfo.SUBREASON_LARGE_CACHED, true); } } return proc; return mProcessNames.get(processName, uid); } void getMemoryInfo(ActivityManager.MemoryInfo outInfo) { Loading Loading @@ -2408,12 +2371,11 @@ public final class ProcessList { ProcessRecord startProcessLocked(String processName, ApplicationInfo info, boolean knownToBeDead, int intentFlags, HostingRecord hostingRecord, int zygotePolicyFlags, boolean allowWhileBooting, boolean isolated, int isolatedUid, boolean keepIfLarge, String abiOverride, String entryPoint, String[] entryPointArgs, Runnable crashHandler) { String abiOverride, String entryPoint, String[] entryPointArgs, Runnable crashHandler) { long startTime = SystemClock.uptimeMillis(); ProcessRecord app; if (!isolated) { app = getProcessRecordLocked(processName, info.uid, keepIfLarge); app = getProcessRecordLocked(processName, info.uid); checkSlow(startTime, "startProcess: after getProcessRecord"); if ((intentFlags & Intent.FLAG_FROM_BACKGROUND) != 0) { Loading Loading @@ -2476,12 +2438,8 @@ public final class ProcessList { ProcessList.killProcessGroup(app.uid, app.getPid()); checkSlow(startTime, "startProcess: done killing old proc"); if (!app.isKilled() || mService.mAppProfiler.isLastMemoryLevelNormal() || app.mState.getSetProcState() < ActivityManager.PROCESS_STATE_CACHED_EMPTY || app.mProfile.getLastCachedPss() < getCachedRestoreThresholdKb()) { // Throw a wtf if it's not killed, or killed but not because the system was in // memory pressure + the app was in "cch-empty" and used large amount of memory if (!app.isKilled()) { // Throw a wtf if it's not killed Slog.wtf(TAG_PROCESSES, app.toString() + " is attached to a previous process"); } else { Slog.w(TAG_PROCESSES, app.toString() + " is attached to a previous process"); Loading Loading
services/core/java/com/android/server/am/ActiveServices.java +3 −3 Original line number Diff line number Diff line Loading @@ -839,7 +839,7 @@ public final class ActiveServices { boolean addToStarting = false; if (!callerFg && !fgRequired && r.app == null && mAm.mUserController.hasStartedUserState(r.userId)) { ProcessRecord proc = mAm.getProcessRecordLocked(r.processName, r.appInfo.uid, false); ProcessRecord proc = mAm.getProcessRecordLocked(r.processName, r.appInfo.uid); if (proc == null || proc.mState.getCurProcState() > PROCESS_STATE_RECEIVER) { // If this is not coming from a foreground caller, then we may want // to delay the start if there are already other background services Loading Loading @@ -3451,7 +3451,7 @@ public final class ActiveServices { ProcessRecord app; if (!isolated) { app = mAm.getProcessRecordLocked(procName, r.appInfo.uid, false); app = mAm.getProcessRecordLocked(procName, r.appInfo.uid); if (DEBUG_MU) Slog.v(TAG_MU, "bringUpServiceLocked: appInfo.uid=" + r.appInfo.uid + " app=" + app); if (app != null) { Loading Loading @@ -3499,7 +3499,7 @@ public final class ActiveServices { // TODO (chriswailes): Change the Zygote policy flags based on if the launch-for-service // was initiated from a notification tap or not. if ((app = mAm.startProcessLocked(procName, r.appInfo, true, intentFlags, hostingRecord, ZYGOTE_POLICY_FLAG_EMPTY, false, isolated, false)) == null) { hostingRecord, ZYGOTE_POLICY_FLAG_EMPTY, false, isolated)) == null) { String msg = "Unable to launch app " + r.appInfo.packageName + "/" + r.appInfo.uid + " for service " Loading
services/core/java/com/android/server/am/ActivityManagerService.java +12 −14 Original line number Diff line number Diff line Loading @@ -2604,8 +2604,8 @@ public class ActivityManagerService extends IActivityManager.Stub } @GuardedBy("this") final ProcessRecord getProcessRecordLocked(String processName, int uid, boolean keepIfLarge) { return mProcessList.getProcessRecordLocked(processName, uid, keepIfLarge); final ProcessRecord getProcessRecordLocked(String processName, int uid) { return mProcessList.getProcessRecordLocked(processName, uid); } @GuardedBy(anyOf = {"this", "mProcLock"}) Loading Loading @@ -2639,8 +2639,7 @@ public class ActivityManagerService extends IActivityManager.Stub false /* knownToBeDead */, 0 /* intentFlags */, sNullHostingRecord /* hostingRecord */, ZYGOTE_POLICY_FLAG_EMPTY, true /* allowWhileBooting */, true /* isolated */, uid, true /* keepIfLarge */, abiOverride, entryPoint, entryPointArgs, crashHandler); uid, abiOverride, entryPoint, entryPointArgs, crashHandler); return proc != null; } } Loading @@ -2649,10 +2648,10 @@ public class ActivityManagerService extends IActivityManager.Stub final ProcessRecord startProcessLocked(String processName, ApplicationInfo info, boolean knownToBeDead, int intentFlags, HostingRecord hostingRecord, int zygotePolicyFlags, boolean allowWhileBooting, boolean isolated, boolean keepIfLarge) { boolean isolated) { return mProcessList.startProcessLocked(processName, info, knownToBeDead, intentFlags, hostingRecord, zygotePolicyFlags, allowWhileBooting, isolated, 0 /* isolatedUid */, keepIfLarge, null /* ABI override */, null /* entryPoint */, null /* ABI override */, null /* entryPoint */, null /* entryPointArgs */, null /* crashHandler */); } Loading Loading @@ -3905,7 +3904,7 @@ public class ActivityManagerService extends IActivityManager.Stub // Only the system server can kill an application if (callerUid == SYSTEM_UID) { synchronized (this) { ProcessRecord app = getProcessRecordLocked(processName, uid, true); ProcessRecord app = getProcessRecordLocked(processName, uid); IApplicationThread thread; if (app != null && (thread = app.getThread()) != null) { try { Loading Loading @@ -6101,7 +6100,7 @@ public class ActivityManagerService extends IActivityManager.Stub ProcessRecord app; if (!isolated) { app = getProcessRecordLocked(customProcess != null ? customProcess : info.processName, info.uid, true); info.uid); } else { app = null; } Loading Loading @@ -11933,7 +11932,7 @@ public class ActivityManagerService extends IActivityManager.Stub ProcessRecord proc = startProcessLocked(app.processName, app, false, 0, new HostingRecord("backup", hostingName), ZYGOTE_POLICY_FLAG_SYSTEM_PROCESS, false, false, false); ZYGOTE_POLICY_FLAG_SYSTEM_PROCESS, false, false); if (proc == null) { Slog.e(TAG, "Unable to start backup agent process " + r); return false; Loading Loading @@ -13643,7 +13642,7 @@ public class ActivityManagerService extends IActivityManager.Stub ProcessRecord app; synchronized (mProcLock) { if (noRestart) { app = getProcessRecordLocked(ai.processName, ai.uid, true); app = getProcessRecordLocked(ai.processName, ai.uid); } else { // Instrumentation can kill and relaunch even persistent processes forceStopPackageLocked(ii.targetPackage, -1, true, false, true, true, false, Loading Loading @@ -13686,7 +13685,7 @@ public class ActivityManagerService extends IActivityManager.Stub ApplicationInfo targetInfo) { ProcessRecord pr; synchronized (this) { pr = getProcessRecordLocked(targetInfo.processName, targetInfo.uid, true); pr = getProcessRecordLocked(targetInfo.processName, targetInfo.uid); } try { Loading Loading @@ -15433,8 +15432,7 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public void killProcess(String processName, int uid, String reason) { synchronized (ActivityManagerService.this) { final ProcessRecord proc = getProcessRecordLocked(processName, uid, true /* keepIfLarge */); final ProcessRecord proc = getProcessRecordLocked(processName, uid); if (proc != null) { mProcessList.removeProcessLocked(proc, false /* callerWillRestart */, true /* allowRestart */, ApplicationExitInfo.REASON_OTHER, reason); Loading Loading @@ -15841,7 +15839,7 @@ public class ActivityManagerService extends IActivityManager.Stub startProcessLocked(processName, info, knownToBeDead, 0 /* intentFlags */, new HostingRecord(hostingType, hostingName, isTop), ZYGOTE_POLICY_FLAG_LATENCY_SENSITIVE, false /* allowWhileBooting */, false /* isolated */, true /* keepIfLarge */); false /* isolated */); } } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
services/core/java/com/android/server/am/BroadcastQueue.java +2 −2 Original line number Diff line number Diff line Loading @@ -1544,7 +1544,7 @@ public final class BroadcastQueue { } String targetProcess = info.activityInfo.processName; ProcessRecord app = mService.getProcessRecordLocked(targetProcess, info.activityInfo.applicationInfo.uid, false); info.activityInfo.applicationInfo.uid); if (!skip) { final int allowed = mService.getAppStartModeLOSP( Loading Loading @@ -1678,7 +1678,7 @@ public final class BroadcastQueue { r.intent.getFlags() | Intent.FLAG_FROM_BACKGROUND, new HostingRecord("broadcast", r.curComponent), isActivityCapable ? ZYGOTE_POLICY_FLAG_LATENCY_SENSITIVE : ZYGOTE_POLICY_FLAG_EMPTY, (r.intent.getFlags() & Intent.FLAG_RECEIVER_BOOT_UPGRADE) != 0, false, false); (r.intent.getFlags() & Intent.FLAG_RECEIVER_BOOT_UPGRADE) != 0, false); if (r.curApp == null) { // Ah, this recipient is unavailable. Finish it if necessary, // and mark the broadcast record as ready for the next. Loading
services/core/java/com/android/server/am/ContentProviderHelper.java +2 −2 Original line number Diff line number Diff line Loading @@ -436,7 +436,7 @@ public class ContentProviderHelper { // Use existing process if already started checkTime(startTime, "getContentProviderImpl: looking for process record"); ProcessRecord proc = mService.getProcessRecordLocked( cpi.processName, cpr.appInfo.uid, false); cpi.processName, cpr.appInfo.uid); IApplicationThread thread; if (proc != null && (thread = proc.getThread()) != null && !proc.isKilled()) { Loading @@ -459,7 +459,7 @@ public class ContentProviderHelper { new HostingRecord("content provider", new ComponentName( cpi.applicationInfo.packageName, cpi.name)), Process.ZYGOTE_POLICY_FLAG_EMPTY, false, false, false); Process.ZYGOTE_POLICY_FLAG_EMPTY, false, false); checkTime(startTime, "getContentProviderImpl: after start process"); if (proc == null) { Slog.w(TAG, "Unable to launch app " Loading
services/core/java/com/android/server/am/ProcessList.java +6 −48 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_LRU; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_NETWORK; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_PROCESSES; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_PROCESS_OBSERVERS; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_PSS; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_UID_OBSERVERS; import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_PROCESS_OBSERVERS; import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; Loading @@ -54,7 +53,6 @@ import static com.android.server.am.ActivityManagerService.TAG_LRU; import static com.android.server.am.ActivityManagerService.TAG_NETWORK; import static com.android.server.am.ActivityManagerService.TAG_PROCESSES; import static com.android.server.am.ActivityManagerService.TAG_UID_OBSERVERS; import static com.android.server.am.AppProfiler.TAG_PSS; import android.annotation.NonNull; import android.app.ActivityManager; Loading Loading @@ -1501,8 +1499,7 @@ public final class ProcessList { } @GuardedBy("mService") final ProcessRecord getProcessRecordLocked(String processName, int uid, boolean keepIfLarge) { ProcessRecord getProcessRecordLocked(String processName, int uid) { if (uid == SYSTEM_UID) { // The system gets to run in any process. If there are multiple // processes with the same uid, just pick the first (this Loading @@ -1519,41 +1516,7 @@ public final class ProcessList { return procs.valueAt(i); } } ProcessRecord proc = mProcessNames.get(processName, uid); if (false && proc != null && !keepIfLarge && proc.mState.getSetProcState() >= ActivityManager.PROCESS_STATE_CACHED_EMPTY && proc.mProfile.getLastCachedPss() >= 4000) { // Turn this condition on to cause killing to happen regularly, for testing. synchronized (mService.mAppProfiler.mProfilerLock) { proc.mProfile.reportCachedKill(); } proc.killLocked(Long.toString(proc.mProfile.getLastCachedPss()) + "k from cached", ApplicationExitInfo.REASON_OTHER, ApplicationExitInfo.SUBREASON_LARGE_CACHED, true); } else if (proc != null && !keepIfLarge && !mService.mAppProfiler.isLastMemoryLevelNormal() && proc.mState.getSetProcState() >= ActivityManager.PROCESS_STATE_CACHED_EMPTY) { final long lastCachedPss; boolean doKilling = false; synchronized (mService.mAppProfiler.mProfilerLock) { lastCachedPss = proc.mProfile.getLastCachedPss(); if (lastCachedPss >= getCachedRestoreThresholdKb()) { proc.mProfile.reportCachedKill(); doKilling = true; } } if (DEBUG_PSS) { Slog.d(TAG_PSS, "May not keep " + proc + ": pss=" + lastCachedPss); } if (doKilling) { proc.killLocked(Long.toString(lastCachedPss) + "k from cached", ApplicationExitInfo.REASON_OTHER, ApplicationExitInfo.SUBREASON_LARGE_CACHED, true); } } return proc; return mProcessNames.get(processName, uid); } void getMemoryInfo(ActivityManager.MemoryInfo outInfo) { Loading Loading @@ -2408,12 +2371,11 @@ public final class ProcessList { ProcessRecord startProcessLocked(String processName, ApplicationInfo info, boolean knownToBeDead, int intentFlags, HostingRecord hostingRecord, int zygotePolicyFlags, boolean allowWhileBooting, boolean isolated, int isolatedUid, boolean keepIfLarge, String abiOverride, String entryPoint, String[] entryPointArgs, Runnable crashHandler) { String abiOverride, String entryPoint, String[] entryPointArgs, Runnable crashHandler) { long startTime = SystemClock.uptimeMillis(); ProcessRecord app; if (!isolated) { app = getProcessRecordLocked(processName, info.uid, keepIfLarge); app = getProcessRecordLocked(processName, info.uid); checkSlow(startTime, "startProcess: after getProcessRecord"); if ((intentFlags & Intent.FLAG_FROM_BACKGROUND) != 0) { Loading Loading @@ -2476,12 +2438,8 @@ public final class ProcessList { ProcessList.killProcessGroup(app.uid, app.getPid()); checkSlow(startTime, "startProcess: done killing old proc"); if (!app.isKilled() || mService.mAppProfiler.isLastMemoryLevelNormal() || app.mState.getSetProcState() < ActivityManager.PROCESS_STATE_CACHED_EMPTY || app.mProfile.getLastCachedPss() < getCachedRestoreThresholdKb()) { // Throw a wtf if it's not killed, or killed but not because the system was in // memory pressure + the app was in "cch-empty" and used large amount of memory if (!app.isKilled()) { // Throw a wtf if it's not killed Slog.wtf(TAG_PROCESSES, app.toString() + " is attached to a previous process"); } else { Slog.w(TAG_PROCESSES, app.toString() + " is attached to a previous process"); Loading