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

Commit 886c5e24 authored by Darrell Shi's avatar Darrell Shi
Browse files

Add communal blueprint

This change introduces a new keyguard blueprint for communal mode.

Bug: 288275889
Test: adb shell cmd statusbar blueprint communal
Test: atest DefaultCommunalBlueprintTest
Change-Id: I89b349c264cfdaf394c569f3296823865206b80a
parent c06b8fbb
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.systemui.communal.ui.view.layout.blueprints

import androidx.constraintlayout.widget.ConstraintSet
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.data.repository.KeyguardBlueprint
import javax.inject.Inject

/** Blueprint for communal mode. */
@SysUISingleton
@JvmSuppressWildcards
class DefaultCommunalBlueprint @Inject constructor() : KeyguardBlueprint {
    override val id: String = COMMUNAL

    override fun apply(constraintSet: ConstraintSet) {}

    companion object {
        const val COMMUNAL = "communal"
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@

package com.android.systemui.keyguard.ui.view.layout.blueprints

import com.android.systemui.communal.ui.view.layout.blueprints.DefaultCommunalBlueprint
import com.android.systemui.keyguard.data.repository.KeyguardBlueprint
import dagger.Binds
import dagger.Module
@@ -35,4 +36,10 @@ abstract class KeyguardBlueprintModule {
    abstract fun bindShortcutsBesideUdfpsLockscreenBlueprint(
        shortcutsBesideUdfpsLockscreenBlueprint: ShortcutsBesideUdfpsKeyguardBlueprint
    ): KeyguardBlueprint

    @Binds
    @IntoSet
    abstract fun bindDefaultCommunalBlueprint(
        defaultCommunalBlueprint: DefaultCommunalBlueprint
    ): KeyguardBlueprint
}
+29 −0
Original line number Diff line number Diff line
package com.android.systemui.communal.ui.view.layout.blueprints

import android.testing.AndroidTestingRunner
import android.testing.TestableLooper
import androidx.constraintlayout.widget.ConstraintSet
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidTestingRunner::class)
@TestableLooper.RunWithLooper(setAsMainLooper = true)
@SmallTest
class DefaultCommunalBlueprintTest : SysuiTestCase() {
    private lateinit var blueprint: DefaultCommunalBlueprint

    @Before
    fun setup() {
        blueprint = DefaultCommunalBlueprint()
    }

    @Test
    fun apply_doesNothing() {
        val cs = ConstraintSet()
        blueprint.apply(cs)
        // Nothing happens yet.
    }
}
 No newline at end of file