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

Commit 924065ec authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fixed booting logic on ActivityTaskSupervisor.activityIdleInternal()"...

Merge "Fixed booting logic on ActivityTaskSupervisor.activityIdleInternal()" into sc-v2-dev am: 5aeb77eb

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16067345

Change-Id: I690fbd4dec68ec461babe2c7ec5b4901421114bb
parents f735cc38 5aeb77eb
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -4833,6 +4833,8 @@ public class ActivityManagerService extends IActivityManager.Stub
    @Override
    public void bootAnimationComplete() {
        if (DEBUG_ALL) Slog.d(TAG, "bootAnimationComplete: Callers=" + Debug.getCallers(4));
        final boolean callFinishBooting;
        synchronized (this) {
            callFinishBooting = mCallFinishBooting;
@@ -7656,7 +7658,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        // On Automotive, at this point the system user has already been started and unlocked,
        // and some of the tasks we do here have already been done. So skip those in that case.
        // TODO(b/132262830): this workdound shouldn't be necessary once we move the
        // TODO(b/132262830, b/203885241): this workdound shouldn't be necessary once we move the
        // headless-user start logic to UserManager-land
        final boolean bootingSystemUser = currentUserId == UserHandle.USER_SYSTEM;
+7 −0
Original line number Diff line number Diff line
@@ -145,4 +145,11 @@ public final class UserState {
        proto.write(UserStateProto.SWITCHING, switching);
        proto.end(token);
    }

    @Override
    public String toString() {
        return "[UserState: id=" + mHandle.getIdentifier() + ", state=" + stateToString(state)
            + ", lastState=" + stateToString(lastState) + ", switching=" + switching
            + ", tokenProvided=" + tokenProvided + "]";
    }
}
+12 −5
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@ import com.android.internal.util.function.pooled.PooledLambda;
import com.android.server.LocalServices;
import com.android.server.am.ActivityManagerService;
import com.android.server.am.UserState;
import com.android.server.utils.Slogf;
import com.android.server.wm.ActivityMetricsLogger.LaunchingState;

import java.io.FileDescriptor;
@@ -1322,8 +1323,6 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
            // us, we can now deliver.
            r.idle = true;

            //Slog.i(TAG, "IDLE: mBooted=" + mBooted + ", fromTimeout=" + fromTimeout);

            // Check if able to finish booting when device is booting and all resumed activities
            // are idle.
            if ((mService.isBooting() && mRootWindowContainer.allResumedActivitiesIdle())
@@ -1356,14 +1355,21 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
        // Atomically retrieve all of the other things to do.
        processStoppingAndFinishingActivities(r, processPausingActivities, "idle");

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

        if (!mStartingUsers.isEmpty()) {
            final ArrayList<UserState> startingUsers = new ArrayList<>(mStartingUsers);
            mStartingUsers.clear();

            if (!booting) {
            // TODO(b/190854171): remove the isHeadlessSystemUserMode() check on master
            if (!booting || UserManager.isHeadlessSystemUserMode()) {
                // Complete user switch.
                for (int i = 0; i < startingUsers.size(); i++) {
                    mService.mAmInternal.finishUserSwitch(startingUsers.get(i));
                    UserState userState = startingUsers.get(i);
                    Slogf.i(TAG, "finishing switch of user %d", userState.mHandle.getIdentifier());
                    mService.mAmInternal.finishUserSwitch(userState);
                }
            }
        }
@@ -2012,6 +2018,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {

    final void scheduleIdle() {
        if (!mHandler.hasMessages(IDLE_NOW_MSG)) {
            if (DEBUG_IDLE) Slog.d(TAG_IDLE, "scheduleIdle: Callers=" + Debug.getCallers(4));
            mHandler.sendEmptyMessage(IDLE_NOW_MSG);
        }
    }