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

Commit b27643b9 authored by Bryce Lee's avatar Bryce Lee
Browse files

Restructure low light dream dependencies.

This changelist moves the dream manager and low light dream service
component dependencies into SystemUI.

Bug: 378174125
Test: atest LowLightClockDreamServiceTest
Flag: EXEMPT refactor
Change-Id: I8e600cc8358f2d7eb22fb0688a420f9580329fbf
parent 37b9d5c9
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -15,8 +15,6 @@
  ~ limitations under the License.
  -->
<resources>
    <!-- The dream component used when the device is low light environment. -->
    <string translatable="false" name="config_lowLightDreamComponent"/>
    <!-- The max number of milliseconds to wait for the low light transition before setting
    the system dream component -->
    <integer name="config_lowLightTransitionTimeoutMs">2000</integer>
+34 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.dream.lowlight.dagger

import android.app.DreamManager
import android.content.ComponentName
import dagger.BindsInstance
import dagger.Subcomponent
import javax.inject.Named

@Subcomponent(modules = [LowLightDreamModule::class])
interface LowLightDreamComponent {
    @Subcomponent.Factory
    interface Factory {
        fun create(@BindsInstance dreamManager: DreamManager,
                   @Named(LowLightDreamModule.LOW_LIGHT_DREAM_COMPONENT)
                   @BindsInstance lowLightDreamComponent: ComponentName?
        ): LowLightDreamComponent
    }
}
 No newline at end of file
+0 −26
Original line number Diff line number Diff line
@@ -15,8 +15,6 @@
 */
package com.android.dream.lowlight.dagger

import android.app.DreamManager
import android.content.ComponentName
import android.content.Context
import com.android.dream.lowlight.R
import com.android.dream.lowlight.dagger.qualifiers.Application
@@ -35,30 +33,6 @@ import javax.inject.Named
 */
@Module
object LowLightDreamModule {
    /**
     * Provides dream manager.
     */
    @Provides
    fun providesDreamManager(context: Context): DreamManager {
        return requireNotNull(context.getSystemService(DreamManager::class.java))
    }

    /**
     * Provides the component name of the low light dream, or null if not configured.
     */
    @Provides
    @Named(LOW_LIGHT_DREAM_COMPONENT)
    fun providesLowLightDreamComponent(context: Context): ComponentName? {
        val lowLightDreamComponent = context.resources.getString(
            R.string.config_lowLightDreamComponent
        )
        return if (lowLightDreamComponent.isEmpty()) {
            null
        } else {
            ComponentName.unflattenFromString(lowLightDreamComponent)
        }
    }

    @Provides
    @Named(LOW_LIGHT_TRANSITION_TIMEOUT_MS)
    fun providesLowLightTransitionTimeout(context: Context): Long {
+4 −0
Original line number Diff line number Diff line
@@ -1103,4 +1103,8 @@
    Whether the user switching can only happen by logging out and going through the system user (login screen).
    -->
    <bool name="config_userSwitchingMustGoThroughLoginScreen">false</bool>


    <!-- The dream component used when the device is low light environment. -->
    <string translatable="false" name="config_lowLightDreamComponent"/>
</resources>
+2 −2
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ import androidx.lifecycle.ViewModelStore;

import com.android.app.viewcapture.ViewCaptureAwareWindowManager;
import com.android.compose.animation.scene.SceneKey;
import com.android.dream.lowlight.dagger.LowLightDreamModule;
import com.android.internal.logging.UiEvent;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.policy.PhoneWindow;
@@ -66,6 +65,7 @@ import com.android.systemui.communal.shared.model.CommunalTransitionKeys;
import com.android.systemui.complication.dagger.ComplicationComponent;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dreams.complication.dagger.DreamComplicationComponent;
import com.android.systemui.dreams.dagger.DreamModule;
import com.android.systemui.dreams.dagger.DreamOverlayComponent;
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor;
import com.android.systemui.navigationbar.gestural.domain.GestureInteractor;
@@ -389,7 +389,7 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ
            SystemDialogsCloser systemDialogsCloser,
            UiEventLogger uiEventLogger,
            @Named(DREAM_TOUCH_INSET_MANAGER) TouchInsetManager touchInsetManager,
            @Nullable @Named(LowLightDreamModule.LOW_LIGHT_DREAM_COMPONENT)
            @Nullable @Named(DreamModule.LOW_LIGHT_DREAM_SERVICE)
            ComponentName lowLightDreamComponent,
            @Nullable @Named(HOME_CONTROL_PANEL_DREAM_COMPONENT)
            ComponentName homeControlPanelDreamComponent,
Loading