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

Commit 9b10a3ff authored by Bryce Lee's avatar Bryce Lee
Browse files

Introduce low light clock dream flag.

This changelist introduces a new flag to enable low light dream on all
eligible devices.

Bug: 378174125
Test: manual - ensured component is returned with flag enabled.
Flag: com.android.systemui.low_light_clock_dream
Change-Id: I3a37b0a3d66877bb19f6acc424a3fb30d76eca63
parent b27643b9
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1214,6 +1214,13 @@ flag {
  bug: "378171351"
}

flag {
  name: "low_light_clock_dream"
  namespace: "systemui"
  description: "Enables low light clock dream experience on mobile phones"
  bug: "378174125"
}

flag {
  name: "communal_standalone_support"
  namespace: "systemui"
+17 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.content.res.Resources;

import com.android.dream.lowlight.dagger.LowLightDreamComponent;
import com.android.settingslib.dream.DreamBackend;
import com.android.systemui.Flags;
import com.android.systemui.ambient.touch.scrim.dagger.ScrimModule;
import com.android.systemui.complication.dagger.RegisteredComplicationsModule;
import com.android.systemui.dagger.SysUISingleton;
@@ -48,6 +49,7 @@ import com.android.systemui.res.R;
import com.android.systemui.touch.TouchInsetManager;

import dagger.Binds;
import dagger.BindsOptionalOf;
import dagger.Module;
import dagger.Provides;
import dagger.multibindings.ClassKey;
@@ -85,6 +87,8 @@ public interface DreamModule {
    String DREAM_TILE_SPEC = "dream";
    String LOW_LIGHT_DREAM_SERVICE = "low_light_dream_component";

    String LOW_LIGHT_CLOCK_DREAM = "low_light_clock_dream";

    /**
     * Provides the dream component
     */
@@ -226,13 +230,25 @@ public interface DreamModule {
        return Objects.requireNonNull(context.getSystemService(DreamManager.class));
    }

    /**
     * Binds a default (unset) clock dream.
     */
    @BindsOptionalOf
    @Named(LOW_LIGHT_CLOCK_DREAM)
    ComponentName bindsLowLightClockDream();

    /**
     * Provides the component name of the low light dream, or null if not configured.
     */
    @Provides
    @Nullable
    @Named(LOW_LIGHT_DREAM_SERVICE)
    static ComponentName providesLowLightDreamService(Context context) {
    static ComponentName providesLowLightDreamService(Context context,
            @Named(LOW_LIGHT_CLOCK_DREAM) Optional<ComponentName> clockDream) {
        if (Flags.lowLightClockDream() && clockDream.isPresent()) {
            return clockDream.get();
        }

        String lowLightDreamComponent = context.getResources().getString(
                R.string.config_lowLightDreamComponent
        );