Loading core/java/android/app/ActivityManagerInternal.java +7 −3 Original line number Diff line number Diff line Loading @@ -1253,10 +1253,14 @@ public abstract class ActivityManagerInternal { public abstract boolean clearApplicationUserData(String packageName, boolean keepState, boolean isRestore, IPackageDataObserver observer, int userId); /** * Returns current state of {@link com.android.systemui.theme.ThemeOverlayController} color * palette readiness. * Method that checks if system is Headless (don't delay launch) case in which it * should also check if ThemeOverlayController is ready (don't delay) or not (delay). * * @param userId * @return Boolean indicating if Home launch should wait for ThemeOverlayController signal * @hide */ public abstract boolean isThemeOverlayReady(int userId); public abstract boolean shouldDelayHomeLaunch(int userId); } packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayApplier.java +1 −2 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ */ package com.android.systemui.theme; import static com.android.systemui.shared.Flags.enableHomeDelay; import android.annotation.AnyThread; import android.content.om.FabricatedOverlay; Loading Loading @@ -251,7 +250,7 @@ public class ThemeOverlayApplier implements Dumpable { try { mOverlayManager.commit(transaction.build()); if (enableHomeDelay() && onComplete != null) { if (onComplete != null) { Log.d(TAG, "Executing onComplete runnable"); mMainExecutor.execute(onComplete); } Loading packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java +5 −7 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.util.TypedValue.TYPE_INT_COLOR_ARGB8; import static com.android.systemui.Flags.themeOverlayControllerWakefulnessDeprecation; import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_ASLEEP; import static com.android.systemui.shared.Flags.enableHomeDelay; import static com.android.systemui.theme.ThemeOverlayApplier.COLOR_SOURCE_HOME; import static com.android.systemui.theme.ThemeOverlayApplier.COLOR_SOURCE_LOCK; import static com.android.systemui.theme.ThemeOverlayApplier.COLOR_SOURCE_PRESET; Loading Loading @@ -775,10 +774,9 @@ public class ThemeOverlayController implements CoreStartable, Dumpable { } } final Runnable onCompleteCallback = !enableHomeDelay() ? () -> {} : () -> { Log.d(TAG, "ThemeHomeDelay: ThemeOverlayController ready"); final Runnable onCompleteCallback = () -> { Log.d(TAG, "ThemeHomeDelay: ThemeOverlayController ready with user " + currentUser); mActivityManager.setThemeOverlayReady(currentUser); }; Loading services/core/java/com/android/server/am/ActivityManagerService.java +48 −20 Original line number Diff line number Diff line Loading @@ -5283,18 +5283,24 @@ public class ActivityManagerService extends IActivityManager.Stub * Starts Home if there is no completion signal from ThemeOverlayController */ private void scheduleHomeTimeout() { if (enableHomeDelay() && mHasHomeDelay.compareAndSet(false, true)) { int userId = mUserController.getCurrentUserId(); if (!isHomeLaunchDelayable()) { Slog.d(TAG, "ThemeHomeDelay: Home launch is not delayable, skipping timeout creation"); return; } if (!mHasHomeDelay.compareAndSet(false, true)) return; mHandler.postDelayed(() -> { int userId = mUserController.getCurrentUserId(); if (!isThemeOverlayReady(userId)) { Slog.d(TAG, "ThemeHomeDelay: ThemeOverlayController not responding, launching " + "Home after " + HOME_LAUNCH_TIMEOUT_MS + "ms"); + "Home after " + HOME_LAUNCH_TIMEOUT_MS + "ms" + " with user " + userId); setThemeOverlayReady(userId); } }, HOME_LAUNCH_TIMEOUT_MS); } } /** Loading @@ -5302,22 +5308,28 @@ public class ActivityManagerService extends IActivityManager.Stub * palette is ready. * * @param userId The ID of the user where ThemeOverlayController is ready. * * @throws RemoteException * * @hide */ @Override public void setThemeOverlayReady(@UserIdInt int userId) { if (!isHomeLaunchDelayable()) { Slog.d(TAG, "ThemeHomeDelay: Home launch is not delayable, " + "ignoring setThemeOverlayReady() call"); return; } enforceCallingPermission(Manifest.permission.SET_THEME_OVERLAY_CONTROLLER_READY, "setThemeOverlayReady"); Slog.d(TAG, "ThemeHomeDelay: userId " + userId + " notified ThemeOverlayController completeness"); boolean updateUser; synchronized (mThemeOverlayReadyUsers) { updateUser = mThemeOverlayReadyUsers.add(userId); Slog.d(TAG, "ThemeHomeDelay: updateUser " + userId + " isUpdatable: " + updateUser); } if (updateUser && enableHomeDelay()) { if (updateUser) { Slog.d(TAG, "ThemeHomeDelay: updating user " + userId); mAtmInternal.startHomeOnAllDisplays(userId, "setThemeOverlayReady"); } } Loading @@ -5334,6 +5346,16 @@ public class ActivityManagerService extends IActivityManager.Stub } } /** * Checks if feature flag is enabled and if system is Headless (HSUM), case in which * home delay should be skipped. * * @hide */ public boolean isHomeLaunchDelayable() { return !UserManager.isHeadlessSystemUserMode() && enableHomeDelay(); } final void ensureBootCompleted() { boolean booting; boolean enableScreen; Loading Loading @@ -18142,10 +18164,12 @@ public class ActivityManagerService extends IActivityManager.Stub // Clean up various services by removing the user mBatteryStatsService.onUserRemoved(userId); if (isHomeLaunchDelayable()) { synchronized (mThemeOverlayReadyUsers) { mThemeOverlayReadyUsers.remove(userId); } } } @Override public void killForegroundAppsForUser(@UserIdInt int userId) { Loading Loading @@ -19496,8 +19520,12 @@ public class ActivityManagerService extends IActivityManager.Stub } @Override public boolean isThemeOverlayReady(int userId) { return ActivityManagerService.this.isThemeOverlayReady(userId); public boolean shouldDelayHomeLaunch(int userId) { if (!isHomeLaunchDelayable()) return false; synchronized (mThemeOverlayReadyUsers) { return !ActivityManagerService.this.mThemeOverlayReadyUsers.contains(userId); } } } services/core/java/com/android/server/wm/RootWindowContainer.java +2 −3 Original line number Diff line number Diff line Loading @@ -83,7 +83,6 @@ import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE import static com.android.server.wm.WindowManagerService.WINDOWS_FREEZING_SCREENS_NONE; import static com.android.server.wm.WindowSurfacePlacer.SET_UPDATE_ROTATION; import static com.android.server.wm.WindowSurfacePlacer.SET_WALLPAPER_ACTION_PENDING; import static com.android.systemui.shared.Flags.enableHomeDelay; import static java.lang.Integer.MAX_VALUE; Loading Loading @@ -1452,8 +1451,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent> return false; } if (enableHomeDelay() && !mService.mAmInternal.isThemeOverlayReady(userId)) { Slog.d(TAG, "ThemeHomeDelay: Home launch was deferred."); if (mService.mAmInternal.shouldDelayHomeLaunch(userId)) { Slog.d(TAG, "ThemeHomeDelay: Home launch was deferred with user " + userId); return false; } Loading Loading
core/java/android/app/ActivityManagerInternal.java +7 −3 Original line number Diff line number Diff line Loading @@ -1253,10 +1253,14 @@ public abstract class ActivityManagerInternal { public abstract boolean clearApplicationUserData(String packageName, boolean keepState, boolean isRestore, IPackageDataObserver observer, int userId); /** * Returns current state of {@link com.android.systemui.theme.ThemeOverlayController} color * palette readiness. * Method that checks if system is Headless (don't delay launch) case in which it * should also check if ThemeOverlayController is ready (don't delay) or not (delay). * * @param userId * @return Boolean indicating if Home launch should wait for ThemeOverlayController signal * @hide */ public abstract boolean isThemeOverlayReady(int userId); public abstract boolean shouldDelayHomeLaunch(int userId); }
packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayApplier.java +1 −2 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ */ package com.android.systemui.theme; import static com.android.systemui.shared.Flags.enableHomeDelay; import android.annotation.AnyThread; import android.content.om.FabricatedOverlay; Loading Loading @@ -251,7 +250,7 @@ public class ThemeOverlayApplier implements Dumpable { try { mOverlayManager.commit(transaction.build()); if (enableHomeDelay() && onComplete != null) { if (onComplete != null) { Log.d(TAG, "Executing onComplete runnable"); mMainExecutor.execute(onComplete); } Loading
packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java +5 −7 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.util.TypedValue.TYPE_INT_COLOR_ARGB8; import static com.android.systemui.Flags.themeOverlayControllerWakefulnessDeprecation; import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_ASLEEP; import static com.android.systemui.shared.Flags.enableHomeDelay; import static com.android.systemui.theme.ThemeOverlayApplier.COLOR_SOURCE_HOME; import static com.android.systemui.theme.ThemeOverlayApplier.COLOR_SOURCE_LOCK; import static com.android.systemui.theme.ThemeOverlayApplier.COLOR_SOURCE_PRESET; Loading Loading @@ -775,10 +774,9 @@ public class ThemeOverlayController implements CoreStartable, Dumpable { } } final Runnable onCompleteCallback = !enableHomeDelay() ? () -> {} : () -> { Log.d(TAG, "ThemeHomeDelay: ThemeOverlayController ready"); final Runnable onCompleteCallback = () -> { Log.d(TAG, "ThemeHomeDelay: ThemeOverlayController ready with user " + currentUser); mActivityManager.setThemeOverlayReady(currentUser); }; Loading
services/core/java/com/android/server/am/ActivityManagerService.java +48 −20 Original line number Diff line number Diff line Loading @@ -5283,18 +5283,24 @@ public class ActivityManagerService extends IActivityManager.Stub * Starts Home if there is no completion signal from ThemeOverlayController */ private void scheduleHomeTimeout() { if (enableHomeDelay() && mHasHomeDelay.compareAndSet(false, true)) { int userId = mUserController.getCurrentUserId(); if (!isHomeLaunchDelayable()) { Slog.d(TAG, "ThemeHomeDelay: Home launch is not delayable, skipping timeout creation"); return; } if (!mHasHomeDelay.compareAndSet(false, true)) return; mHandler.postDelayed(() -> { int userId = mUserController.getCurrentUserId(); if (!isThemeOverlayReady(userId)) { Slog.d(TAG, "ThemeHomeDelay: ThemeOverlayController not responding, launching " + "Home after " + HOME_LAUNCH_TIMEOUT_MS + "ms"); + "Home after " + HOME_LAUNCH_TIMEOUT_MS + "ms" + " with user " + userId); setThemeOverlayReady(userId); } }, HOME_LAUNCH_TIMEOUT_MS); } } /** Loading @@ -5302,22 +5308,28 @@ public class ActivityManagerService extends IActivityManager.Stub * palette is ready. * * @param userId The ID of the user where ThemeOverlayController is ready. * * @throws RemoteException * * @hide */ @Override public void setThemeOverlayReady(@UserIdInt int userId) { if (!isHomeLaunchDelayable()) { Slog.d(TAG, "ThemeHomeDelay: Home launch is not delayable, " + "ignoring setThemeOverlayReady() call"); return; } enforceCallingPermission(Manifest.permission.SET_THEME_OVERLAY_CONTROLLER_READY, "setThemeOverlayReady"); Slog.d(TAG, "ThemeHomeDelay: userId " + userId + " notified ThemeOverlayController completeness"); boolean updateUser; synchronized (mThemeOverlayReadyUsers) { updateUser = mThemeOverlayReadyUsers.add(userId); Slog.d(TAG, "ThemeHomeDelay: updateUser " + userId + " isUpdatable: " + updateUser); } if (updateUser && enableHomeDelay()) { if (updateUser) { Slog.d(TAG, "ThemeHomeDelay: updating user " + userId); mAtmInternal.startHomeOnAllDisplays(userId, "setThemeOverlayReady"); } } Loading @@ -5334,6 +5346,16 @@ public class ActivityManagerService extends IActivityManager.Stub } } /** * Checks if feature flag is enabled and if system is Headless (HSUM), case in which * home delay should be skipped. * * @hide */ public boolean isHomeLaunchDelayable() { return !UserManager.isHeadlessSystemUserMode() && enableHomeDelay(); } final void ensureBootCompleted() { boolean booting; boolean enableScreen; Loading Loading @@ -18142,10 +18164,12 @@ public class ActivityManagerService extends IActivityManager.Stub // Clean up various services by removing the user mBatteryStatsService.onUserRemoved(userId); if (isHomeLaunchDelayable()) { synchronized (mThemeOverlayReadyUsers) { mThemeOverlayReadyUsers.remove(userId); } } } @Override public void killForegroundAppsForUser(@UserIdInt int userId) { Loading Loading @@ -19496,8 +19520,12 @@ public class ActivityManagerService extends IActivityManager.Stub } @Override public boolean isThemeOverlayReady(int userId) { return ActivityManagerService.this.isThemeOverlayReady(userId); public boolean shouldDelayHomeLaunch(int userId) { if (!isHomeLaunchDelayable()) return false; synchronized (mThemeOverlayReadyUsers) { return !ActivityManagerService.this.mThemeOverlayReadyUsers.contains(userId); } } }
services/core/java/com/android/server/wm/RootWindowContainer.java +2 −3 Original line number Diff line number Diff line Loading @@ -83,7 +83,6 @@ import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE import static com.android.server.wm.WindowManagerService.WINDOWS_FREEZING_SCREENS_NONE; import static com.android.server.wm.WindowSurfacePlacer.SET_UPDATE_ROTATION; import static com.android.server.wm.WindowSurfacePlacer.SET_WALLPAPER_ACTION_PENDING; import static com.android.systemui.shared.Flags.enableHomeDelay; import static java.lang.Integer.MAX_VALUE; Loading Loading @@ -1452,8 +1451,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent> return false; } if (enableHomeDelay() && !mService.mAmInternal.isThemeOverlayReady(userId)) { Slog.d(TAG, "ThemeHomeDelay: Home launch was deferred."); if (mService.mAmInternal.shouldDelayHomeLaunch(userId)) { Slog.d(TAG, "ThemeHomeDelay: Home launch was deferred with user " + userId); return false; } Loading