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

Commit 2a3296da authored by Felipe Leme's avatar Felipe Leme Committed by Android (Google) Code Review
Browse files

Merge "Removed headless system user check from activityIdleInternal()"

parents 9bd51514 d083aeea
Loading
Loading
Loading
Loading
+8 −16
Original line number Original line Diff line number Diff line
@@ -1278,10 +1278,9 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {


    /**
    /**
     * Called when all resumed tasks/root-tasks are idle.
     * Called when all resumed tasks/root-tasks are idle.
     * @return the state of mService.mAm.mBooting before this was called.
     */
     */
    @GuardedBy("mService")
    @GuardedBy("mService")
    private boolean checkFinishBootingLocked() {
    private void checkFinishBootingLocked() {
        final boolean booting = mService.isBooting();
        final boolean booting = mService.isBooting();
        boolean enableScreen = false;
        boolean enableScreen = false;
        mService.setBooting(false);
        mService.setBooting(false);
@@ -1292,15 +1291,12 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
        if (booting || enableScreen) {
        if (booting || enableScreen) {
            mService.postFinishBooting(booting, enableScreen);
            mService.postFinishBooting(booting, enableScreen);
        }
        }
        return booting;
    }
    }


    void activityIdleInternal(ActivityRecord r, boolean fromTimeout,
    void activityIdleInternal(ActivityRecord r, boolean fromTimeout,
            boolean processPausingActivities, Configuration config) {
            boolean processPausingActivities, Configuration config) {
        if (DEBUG_ALL) Slog.v(TAG, "Activity idle: " + r);
        if (DEBUG_ALL) Slog.v(TAG, "Activity idle: " + r);


        boolean booting = false;

        if (r != null) {
        if (r != null) {
            if (DEBUG_IDLE) Slog.d(TAG_IDLE, "activityIdleInternal: Callers="
            if (DEBUG_IDLE) Slog.d(TAG_IDLE, "activityIdleInternal: Callers="
                    + Debug.getCallers(4));
                    + Debug.getCallers(4));
@@ -1327,7 +1323,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
            // are idle.
            // are idle.
            if ((mService.isBooting() && mRootWindowContainer.allResumedActivitiesIdle())
            if ((mService.isBooting() && mRootWindowContainer.allResumedActivitiesIdle())
                    || fromTimeout) {
                    || fromTimeout) {
                booting = checkFinishBootingLocked();
                checkFinishBootingLocked();
            }
            }


            // When activity is idle, we consider the relaunch must be successful, so let's clear
            // When activity is idle, we consider the relaunch must be successful, so let's clear
@@ -1356,15 +1352,12 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
        processStoppingAndFinishingActivities(r, processPausingActivities, "idle");
        processStoppingAndFinishingActivities(r, processPausingActivities, "idle");


        if (DEBUG_IDLE) {
        if (DEBUG_IDLE) {
            Slogf.i(TAG, "activityIdleInternal(): r=%s, booting=%b, mStartingUsers=%s", r, booting,
            Slogf.i(TAG, "activityIdleInternal(): r=%s, mStartingUsers=%s", r, mStartingUsers);
                    mStartingUsers);
        }
        }


        if (!mStartingUsers.isEmpty()) {
        if (!mStartingUsers.isEmpty()) {
            final ArrayList<UserState> startingUsers = new ArrayList<>(mStartingUsers);
            final ArrayList<UserState> startingUsers = new ArrayList<>(mStartingUsers);
            mStartingUsers.clear();
            mStartingUsers.clear();
            // TODO(b/190854171): remove the isHeadlessSystemUserMode() check on master
            if (!booting || UserManager.isHeadlessSystemUserMode()) {
            // Complete user switch.
            // Complete user switch.
            for (int i = 0; i < startingUsers.size(); i++) {
            for (int i = 0; i < startingUsers.size(); i++) {
                UserState userState = startingUsers.get(i);
                UserState userState = startingUsers.get(i);
@@ -1372,7 +1365,6 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
                mService.mAmInternal.finishUserSwitch(userState);
                mService.mAmInternal.finishUserSwitch(userState);
            }
            }
        }
        }
        }


        mService.mH.post(() -> mService.mAmInternal.trimApplications());
        mService.mH.post(() -> mService.mAmInternal.trimApplications());
    }
    }