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

Commit f2f0688e authored by Bryce Lee's avatar Bryce Lee Committed by Android (Google) Code Review
Browse files

Merge changes from topic "378174125" into main

* changes:
  Introduce low light clock dream flag.
  Restructure low light dream dependencies.
parents 4d0ef116 9b10a3ff
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 {
+7 −0
Original line number Diff line number Diff line
@@ -1221,6 +1221,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"
+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>
Loading