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

Commit efea9d76 authored by Marcelo Arteiro's avatar Marcelo Arteiro
Browse files

Flagging ThemeOverlayController and ThemeManagerService

ThemeOverlayController is being replaced by ThemeManagerService so not it is under a flag provided by ThemeModule.java. The new ThemeManagerService is now being initialized under the flag in SystemServer

This CL also updates ActivityManagerService to make sure it does not wait for ThemeOverlayController initialization when ThemeManagerService is active.

Bug: 333694176
Test: atest FrameworksServicesTests_theme
Flag: android.server.enable_theme_service
Change-Id: Iaeb0f458b5bb17afdbb94d87ef1ba06b7402e02c
parent 6019ad9b
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -56,7 +56,6 @@ import com.android.systemui.statusbar.notification.InstantAppNotifier
import com.android.systemui.statusbar.notification.headsup.StatusBarHeadsUpChangeListener
import com.android.systemui.stylus.StylusUsiPowerStartable
import com.android.systemui.temporarydisplay.chipbar.ChipbarCoordinator
import com.android.systemui.theme.ThemeOverlayController
import com.android.systemui.usb.StorageNotification
import com.android.systemui.util.NotificationChannels
import com.android.systemui.wmshell.WMShell
@@ -185,12 +184,6 @@ abstract class SystemUICoreStartableModule {
    @ClassKey(StorageNotification::class)
    abstract fun bindStorageNotification(sysui: StorageNotification): CoreStartable

    /** Inject into ThemeOverlayController. */
    @Binds
    @IntoMap
    @ClassKey(ThemeOverlayController::class)
    abstract fun bindThemeOverlayController(sysui: ThemeOverlayController): CoreStartable

    /** Inject into MediaOutputSwitcherDialogUI. */
    @Binds
    @IntoMap
+24 −1
Original line number Diff line number Diff line
@@ -16,16 +16,23 @@

package com.android.systemui.theme;

import static android.server.Flags.enableThemeService;

import android.content.res.Resources;

import com.android.systemui.CoreStartable;
import com.android.systemui.NoOpCoreStartable;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.res.R;
import com.android.systemui.util.concurrency.SysUIConcurrencyModule;

import dagger.Module;
import dagger.Provides;
import dagger.multibindings.ClassKey;
import dagger.multibindings.IntoMap;

import javax.inject.Named;
import javax.inject.Provider;

/** */
@Module(includes = {SysUIConcurrencyModule.class})
@@ -46,4 +53,20 @@ public class ThemeModule {
    static String provideThemePickerPackage(@Main Resources resources) {
        return resources.getString(R.string.themepicker_overlayable_package);
    }

    /**
     * Injects a {@link CoreStartable} that is responsible for applying theme and color overlays.
     * <p>This will be a {@link ThemeOverlayController} unless the {@code enableThemeService} flag
     * is enabled, in which case it will be a {@link NoOpCoreStartable}.
     */
    @Provides
    @IntoMap
    @ClassKey(ThemeOverlayController.class)
    public CoreStartable provideThemeOverlayController(
            Provider<ThemeOverlayController> themeOverlayControllerProvider) {
        if (enableThemeService()) {
            return new NoOpCoreStartable();
        }
        return themeOverlayControllerProvider.get();
    }
}
 No newline at end of file
+8 −0
Original line number Diff line number Diff line
@@ -133,6 +133,7 @@ import static android.security.Flags.preventIntentRedirect;
import static android.security.Flags.preventIntentRedirectCollectNestedKeysOnServerIfNotCollected;
import static android.security.Flags.preventIntentRedirectShowToastIfNestedKeysNotCollectedRW;
import static android.security.Flags.preventIntentRedirectThrowExceptionIfNestedKeysNotCollected;
import static android.server.Flags.enableThemeService;
import static android.util.FeatureFlagUtils.SETTINGS_ENABLE_MONITOR_PHANTOM_PROCS;
import static android.view.Display.INVALID_DISPLAY;
@@ -5501,6 +5502,13 @@ public class ActivityManagerService extends IActivityManager.Stub
    /** Checks whether the home launch delay feature is enabled. */
    private boolean isHomeLaunchDelayable() {
        // ThemeManagerService is the long term solution to avoid Boot delays or regressions.
        // It replaces ThemeOverlayController and calculates themes early in the server,
        // not waiting for SystemUi
        if (enableThemeService()) {
            return false;
        }
        // This feature is disabled on Auto since it seems to add an unacceptably long boot delay
        // without even solving the underlying issue (it merely hits the timeout).
        // This feature is disabled on TV since the ThemeOverlayController is currently not present
+5 −3
Original line number Diff line number Diff line
@@ -2395,9 +2395,11 @@ public final class SystemServer implements Dumpable {
                Slog.i(TAG, "Wallpaper service disabled by config");
            }

            if (android.server.Flags.enableThemeService()) {
                t.traceBegin("StartThemeService");
                mSystemServiceManager.startService(ThemeManagerService.class);
                t.traceEnd();
            }

            // WallpaperEffectsGeneration manager service
            if (deviceHasConfigString(context,