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

Commit a1dfee61 authored by Jing Ji's avatar Jing Ji Committed by Automerger Merge Worker
Browse files

Merge "Fix the processgroup creation failure due to race conditions" into...

Merge "Fix the processgroup creation failure due to race conditions" into udc-dev am: 9aad77c5 am: 9e830c96

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



Change-Id: Iba9310f31f1da5d32e3da17a502947660397e535
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 1851cbad 9e830c96
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3393,7 +3393,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                mProcessList.noteAppKill(app, ApplicationExitInfo.REASON_OTHER,
                        ApplicationExitInfo.SUBREASON_UNKNOWN, reason);
            }
            ProcessList.killProcessGroup(app.uid, pid);
            app.killProcessGroupIfNecessaryLocked(true);
            synchronized (mProcLock) {
                app.setKilled(true);
            }
+25 −20
Original line number Diff line number Diff line
@@ -1197,6 +1197,23 @@ class ProcessRecord implements WindowProcessListener {
                EventLog.writeEvent(EventLogTags.AM_KILL,
                        userId, mPid, processName, mState.getSetAdj(), reason);
                Process.killProcessQuiet(mPid);
                killProcessGroupIfNecessaryLocked(asyncKPG);
            } else {
                mPendingStart = false;
            }
            if (!mPersistent) {
                synchronized (mProcLock) {
                    mKilled = true;
                    mKilledByAm = true;
                    mKillTime = SystemClock.uptimeMillis();
                }
            }
            Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
        }
    }

    @GuardedBy("mService")
    void killProcessGroupIfNecessaryLocked(boolean async) {
        final boolean killProcessGroup;
        if (mHostingRecord != null
                && (mHostingRecord.usesWebviewZygote() || mHostingRecord.usesAppZygote())) {
@@ -1211,24 +1228,12 @@ class ProcessRecord implements WindowProcessListener {
            killProcessGroup = true;
        }
        if (killProcessGroup) {
                    if (asyncKPG) {
            if (async) {
                ProcessList.killProcessGroup(uid, mPid);
            } else {
                Process.sendSignalToProcessGroup(uid, mPid, OsConstants.SIGKILL);
            }
        }
            } else {
                mPendingStart = false;
            }
            if (!mPersistent) {
                synchronized (mProcLock) {
                    mKilled = true;
                    mKilledByAm = true;
                    mKillTime = SystemClock.uptimeMillis();
                }
            }
            Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
        }
    }

    @Override