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

Commit 92a26b6f authored by Louis Chang's avatar Louis Chang
Browse files

Fix IndexOutOfBoundsException while handle app crash

The `mActivities` size could change while the the activity is
detached (r.detachFromProcess).

Bug: 274859740
Test: wm presubmit
Change-Id: I05d7b5a79d3f7cffca707a7ad7cce1b871f0c8ff
parent 709879dc
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -378,8 +378,9 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
    }

    void handleAppCrash() {
        for (int i = mActivities.size() - 1; i >= 0; --i) {
            final ActivityRecord r = mActivities.get(i);
        ArrayList<ActivityRecord> activities = new ArrayList<>(mActivities);
        for (int i = activities.size() - 1; i >= 0; --i) {
            final ActivityRecord r = activities.get(i);
            Slog.w(TAG, "  Force finishing activity "
                    + r.mActivityComponent.flattenToShortString());
            r.detachFromProcess();