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

Commit a5aa3ecb authored by Andrii Kulian's avatar Andrii Kulian Committed by Android (Google) Code Review
Browse files

Merge "Fix onStop not called when activity is under translucent" into nyc-dev

parents 522a4377 f9949d55
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1008,13 +1008,14 @@ final class ActivityStack {
    void goToSleep() {
        ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS);

        // Make sure any stopped but visible activities are now sleeping.
        // Make sure any paused or stopped but visible activities are now sleeping.
        // This ensures that the activity's onStop() is called.
        for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
            final ArrayList<ActivityRecord> activities = mTaskHistory.get(taskNdx).mActivities;
            for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
                final ActivityRecord r = activities.get(activityNdx);
                if (r.state == ActivityState.STOPPING || r.state == ActivityState.STOPPED) {
                if (r.state == ActivityState.STOPPING || r.state == ActivityState.STOPPED
                        || r.state == ActivityState.PAUSED || r.state == ActivityState.PAUSING) {
                    r.setSleeping(true);
                }
            }