Merge "Recheck the condition before really killing" am: f24ac73825 am: c2cbdc7065

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2121361

Change-Id: Ie6d2d6958b27e59b3ccb9ca8f16d2e680758a8d5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jing Ji
2022-06-21 03:59:44 +00:00
committed by Automerger Merge Worker

View File

@@ -15246,6 +15246,10 @@ public class ActivityManagerService extends IActivityManager.Stub
app.processName, app.toShortString(), cpuLimit, app)) { app.processName, app.toShortString(), cpuLimit, app)) {
mHandler.post(() -> { mHandler.post(() -> {
synchronized (ActivityManagerService.this) { synchronized (ActivityManagerService.this) {
if (app.getThread() == null
|| app.mState.getSetProcState() < ActivityManager.PROCESS_STATE_HOME) {
return;
}
app.killLocked("excessive cpu " + cpuTimeUsed + " during " app.killLocked("excessive cpu " + cpuTimeUsed + " during "
+ uptimeSince + " dur=" + checkDur + " limit=" + cpuLimit, + uptimeSince + " dur=" + checkDur + " limit=" + cpuLimit,
ApplicationExitInfo.REASON_EXCESSIVE_RESOURCE_USAGE, ApplicationExitInfo.REASON_EXCESSIVE_RESOURCE_USAGE,
@@ -15271,6 +15275,10 @@ public class ActivityManagerService extends IActivityManager.Stub
app.processName, r.toString(), cpuLimit, app)) { app.processName, r.toString(), cpuLimit, app)) {
mHandler.post(() -> { mHandler.post(() -> {
synchronized (ActivityManagerService.this) { synchronized (ActivityManagerService.this) {
if (app.getThread() == null
|| app.mState.getSetProcState() < ActivityManager.PROCESS_STATE_HOME) {
return;
}
mPhantomProcessList.killPhantomProcessGroupLocked(app, r, mPhantomProcessList.killPhantomProcessGroupLocked(app, r,
ApplicationExitInfo.REASON_EXCESSIVE_RESOURCE_USAGE, ApplicationExitInfo.REASON_EXCESSIVE_RESOURCE_USAGE,
ApplicationExitInfo.SUBREASON_EXCESSIVE_CPU, ApplicationExitInfo.SUBREASON_EXCESSIVE_CPU,