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

Commit fac26fef authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Prevents exceptions while putting stacks to sleep"

parents 44873ec7 c219bc39
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1519,6 +1519,13 @@ class RootActivityContainer extends ConfigurationContainer
        for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) {
            final ActivityDisplay display = mActivityDisplays.get(displayNdx);
            for (int stackNdx = display.getChildCount() - 1; stackNdx >= 0; --stackNdx) {
                // Stacks and activities could be removed while putting activities to sleep if
                // the app process was gone. This prevents us getting exception by accessing an
                // invalid stack index.
                if (stackNdx >= display.getChildCount()) {
                    continue;
                }

                final ActivityStack stack = display.getChildAt(stackNdx);
                if (allowDelay) {
                    allSleep &= stack.goToSleepIfPossible(shuttingDown);