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

Commit 2f13be7c authored by Marcelo Arteiro's avatar Marcelo Arteiro Committed by Android (Google) Code Review
Browse files

Merge "Fixing API names for home delay at boot" into main

parents 45a84c33 73a66539
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -5967,14 +5967,19 @@ public class ActivityManager {
    }

    /**
     * Used by {@link com.android.systemui.theme.ThemeOverlayController} to notify of color
     * palette readiness.
     * Used by ThemeOverlayController to notify when color
     * palette is ready.
     *
     * @param userId The ID of the user where ThemeOverlayController is ready.
     *
     * @throws RemoteException
     *
     * @hide
     */
    @RequiresPermission(Manifest.permission.SET_THEME_OVERLAY_CONTROLLER_READY)
    public void setThemeOverlayReady(boolean readiness) {
    public void setThemeOverlayReady(@UserIdInt int userId) {
        try {
            getService().setThemeOverlayReady(readiness);
            getService().setThemeOverlayReady(userId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+1 −1
Original line number Diff line number Diff line
@@ -1264,5 +1264,5 @@ public abstract class ActivityManagerInternal {
     * palette readiness.
     * @hide
     */
    public abstract boolean getThemeOverlayReadiness();
    public abstract boolean isThemeOverlayReady(int userId);
}
+6 −3
Original line number Diff line number Diff line
@@ -554,11 +554,14 @@ interface IActivityManager {
    void bootAnimationComplete();

    /**
     * Used by {@link com.android.systemui.theme.ThemeOverlayController} to notify of color
     * palette readiness.
     * Used by {@link com.android.systemui.theme.ThemeOverlayController} to notify when color
     * palette is ready.
     *
     * @param userId The ID of the user where ThemeOverlayController is ready.
     *
     * @throws RemoteException
     */
    void setThemeOverlayReady(boolean readiness);
    void setThemeOverlayReady(int userId);

    @UnsupportedAppUsage
    void registerTaskStackListener(in ITaskStackListener listener);
+1 −1
Original line number Diff line number Diff line
@@ -815,7 +815,7 @@ public class ThemeOverlayController implements CoreStartable, Dumpable {
                ? () -> {}
                : () -> {
                    Log.d(TAG, "ThemeHomeDelay: ThemeOverlayController ready");
                    mActivityManager.setThemeOverlayReady(true);
                    mActivityManager.setThemeOverlayReady(currentUser);
                };

        if (colorSchemeIsApplied(managedProfiles)) {
+26 −24
Original line number Diff line number Diff line
@@ -930,7 +930,7 @@ public class ActivityManagerService extends IActivityManager.Stub
     * Tracks all users with computed color resources by ThemeOverlaycvontroller
     */
    @GuardedBy("this")
    private final Set<Integer> mThemeOverlayReadiness = new HashSet<>();
    private final Set<Integer> mThemeOverlayReadyUsers = new HashSet<>();
    /**
     * Tracks association information for a particular package along with debuggability.
@@ -2351,7 +2351,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                mService.startBroadcastObservers();
            } else if (phase == PHASE_THIRD_PARTY_APPS_CAN_START) {
                mService.mPackageWatchdog.onPackagesReady();
                mService.setHomeTimeout();
                mService.scheduleHomeTimeout();
            }
        }
@@ -5327,40 +5327,43 @@ public class ActivityManagerService extends IActivityManager.Stub
    /**
     * Starts Home if there is no completion signal from ThemeOverlayController
     */
    private void setHomeTimeout() {
    private void scheduleHomeTimeout() {
        if (enableHomeDelay() && mHasHomeDelay.compareAndSet(false, true)) {
            int userId = mUserController.getCurrentUserId();
            mHandler.postDelayed(() -> {
                if (!getThemeOverlayReadiness()) {
                if (!isThemeOverlayReady(userId)) {
                    Slog.d(TAG,
                            "ThemeHomeDelay: ThemeOverlayController not responding, launching "
                                    + "Home after "
                                    + HOME_LAUNCH_TIMEOUT_MS + "ms");
                    setThemeOverlayReady(true);
                    setThemeOverlayReady(userId);
                }
            }, HOME_LAUNCH_TIMEOUT_MS);
        }
    }
    /**
     * Used by ThemeOverlayController to notify all listeners for
     * color palette readiness.
     * Used by ThemeOverlayController to notify when color
     * palette is ready.
     *
     * @param userId The ID of the user where ThemeOverlayController is ready.
     *
     * @throws RemoteException
     *
     * @hide
     */
    @Override
    public void setThemeOverlayReady(boolean readiness) {
    public void setThemeOverlayReady(@UserIdInt int userId) {
        enforceCallingPermission(Manifest.permission.SET_THEME_OVERLAY_CONTROLLER_READY,
                "setThemeOverlayReady");
        int currentUserId = mUserController.getCurrentUserId();
        boolean updateReadiness;
        synchronized (mThemeOverlayReadiness) {
            updateReadiness = readiness ? mThemeOverlayReadiness.add(currentUserId)
                    : mThemeOverlayReadiness.remove(currentUserId);
        boolean updateUser;
        synchronized (mThemeOverlayReadyUsers) {
            updateUser = mThemeOverlayReadyUsers.add(userId);
        }
        if (updateReadiness && readiness && enableHomeDelay()) {
            mAtmInternal.startHomeOnAllDisplays(currentUserId, "setThemeOverlayReady");
        if (updateUser && enableHomeDelay()) {
            mAtmInternal.startHomeOnAllDisplays(userId, "setThemeOverlayReady");
        }
    }
@@ -5370,10 +5373,9 @@ public class ActivityManagerService extends IActivityManager.Stub
     *
     * @hide
     */
    public boolean getThemeOverlayReadiness() {
        int uid = mUserController.getCurrentUserId();
        synchronized (mThemeOverlayReadiness) {
            return mThemeOverlayReadiness.contains(uid);
    public boolean isThemeOverlayReady(int userId) {
        synchronized (mThemeOverlayReadyUsers) {
            return mThemeOverlayReadyUsers.contains(userId);
        }
    }
@@ -18114,8 +18116,8 @@ public class ActivityManagerService extends IActivityManager.Stub
            // Clean up various services by removing the user
            mBatteryStatsService.onUserRemoved(userId);
            synchronized (mThemeOverlayReadiness) {
                mThemeOverlayReadiness.remove(userId);
            synchronized (mThemeOverlayReadyUsers) {
                mThemeOverlayReadyUsers.remove(userId);
            }
        }
@@ -19477,8 +19479,8 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
        @Override
        public boolean getThemeOverlayReadiness() {
            return ActivityManagerService.this.getThemeOverlayReadiness();
        public boolean isThemeOverlayReady(int userId) {
            return ActivityManagerService.this.isThemeOverlayReady(userId);
        }
    }
Loading