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

Commit ec5674a9 authored by Jing Ji's avatar Jing Ji
Browse files

Move the callbacks in app died/crash handling out of WM global lock

These callbacks would require the AM proc lock internally, result in
dead lock.

Bug: 186067587
Test: adb shell am monitor & crash app manually
Test: atest ActivityStarterTests
Test: presubmit
Change-Id: Ia1b95d7c4fca25cb6f21abf0c295aa51258b1e0c
parent 0cd1de22
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -5598,10 +5598,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                    mTaskSupervisor.endDeferResume();
                }

                if (wpc.isInstrumenting()) {
                    finishInstrumentationCallback.run();
                }

                if (!restarting && hasVisibleActivities) {
                    deferWindowLayout();
                    try {
@@ -5618,6 +5614,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                    }
                }
            }
            if (wpc.isInstrumenting()) {
                finishInstrumentationCallback.run();
            }
        }

        @Override
@@ -6117,6 +6116,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        public boolean handleAppCrashInActivityController(String processName, int pid,
                String shortMsg, String longMsg, long timeMillis, String stackTrace,
                Runnable killCrashingAppCallback) {
            Runnable targetRunnable = null;
            synchronized (mGlobalLock) {
                if (mController == null) {
                    return false;
@@ -6125,15 +6125,18 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                try {
                    if (!mController.appCrashed(processName, pid, shortMsg, longMsg, timeMillis,
                            stackTrace)) {
                        killCrashingAppCallback.run();
                        return true;
                        targetRunnable = killCrashingAppCallback;
                    }
                } catch (RemoteException e) {
                    mController = null;
                    Watchdog.getInstance().setActivityController(null);
                }
                return false;
            }
            if (targetRunnable != null) {
                targetRunnable.run();
                return true;
            }
            return false;
        }

        @Override