From 886c5e2463af3eb87dfd1c9dededa32b6ccf126e Mon Sep 17 00:00:00 2001 From: Darrell Shi Date: Fri, 11 Aug 2023 23:03:26 +0000 Subject: 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 --- .../layout/blueprints/DefaultCommunalBlueprint.kt | 35 ++++++++++++++++++++++ .../layout/blueprints/KeyguardBlueprintModule.kt | 7 +++++ .../blueprints/DefaultCommunalBlueprintTest.kt | 29 ++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 packages/SystemUI/src/com/android/systemui/communal/ui/view/layout/blueprints/DefaultCommunalBlueprint.kt create mode 100644 packages/SystemUI/tests/src/com/android/systemui/communal/ui/view/layout/blueprints/DefaultCommunalBlueprintTest.kt diff --git a/packages/SystemUI/src/com/android/systemui/communal/ui/view/layout/blueprints/DefaultCommunalBlueprint.kt b/packages/SystemUI/src/com/android/systemui/communal/ui/view/layout/blueprints/DefaultCommunalBlueprint.kt new file mode 100644 index 000000000000..bf402749add7 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/communal/ui/view/layout/blueprints/DefaultCommunalBlueprint.kt @@ -0,0 +1,35 @@ +/* + * 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" + } +} diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/KeyguardBlueprintModule.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/KeyguardBlueprintModule.kt index fefe6792036f..07f316b487bf 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/KeyguardBlueprintModule.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/KeyguardBlueprintModule.kt @@ -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 } diff --git a/packages/SystemUI/tests/src/com/android/systemui/communal/ui/view/layout/blueprints/DefaultCommunalBlueprintTest.kt b/packages/SystemUI/tests/src/com/android/systemui/communal/ui/view/layout/blueprints/DefaultCommunalBlueprintTest.kt new file mode 100644 index 000000000000..783bb47bb9b0 --- /dev/null +++ b/packages/SystemUI/tests/src/com/android/systemui/communal/ui/view/layout/blueprints/DefaultCommunalBlueprintTest.kt @@ -0,0 +1,29 @@ +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 -- cgit v1.2.3-59-g8ed1b