diff options
8 files changed, 0 insertions, 351 deletions
diff --git a/packages/SystemUI/aconfig/systemui.aconfig b/packages/SystemUI/aconfig/systemui.aconfig index d8d1a74448c5..903c05526122 100644 --- a/packages/SystemUI/aconfig/systemui.aconfig +++ b/packages/SystemUI/aconfig/systemui.aconfig @@ -1846,13 +1846,6 @@ flag { } flag { - name: "glanceable_hub_shortcut_button" - namespace: "systemui" - description: "Adds a shortcut button to lockscreen to show glanceable hub." - bug: "378173531" -} - -flag { name: "spatial_model_launcher_pushback" namespace: "systemui" description: "Implement the depth push scaling effect on Launcher when users pull down shade." diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/GlanceableHubQuickAffordanceConfigTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/GlanceableHubQuickAffordanceConfigTest.kt deleted file mode 100644 index ac06a3b9293c..000000000000 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/GlanceableHubQuickAffordanceConfigTest.kt +++ /dev/null @@ -1,155 +0,0 @@ -/* - * 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.systemui.keyguard.data.quickaffordance - -import android.platform.test.annotations.DisableFlags -import android.platform.test.annotations.EnableFlags -import android.platform.test.flag.junit.FlagsParameterization -import androidx.test.filters.SmallTest -import com.android.systemui.Flags -import com.android.systemui.SysuiTestCase -import com.android.systemui.communal.data.repository.communalSceneRepository -import com.android.systemui.communal.domain.interactor.setCommunalV2Available -import com.android.systemui.communal.domain.interactor.setCommunalV2Enabled -import com.android.systemui.communal.shared.model.CommunalScenes -import com.android.systemui.flags.parameterizeSceneContainerFlag -import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository -import com.android.systemui.kosmos.Kosmos -import com.android.systemui.kosmos.collectLastValue -import com.android.systemui.kosmos.runCurrent -import com.android.systemui.kosmos.runTest -import com.android.systemui.scene.data.repository.sceneContainerRepository -import com.android.systemui.scene.shared.model.Scenes -import com.android.systemui.testKosmos -import com.google.common.truth.Truth.assertThat -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import platform.test.runner.parameterized.ParameterizedAndroidJunit4 -import platform.test.runner.parameterized.Parameters - -@SmallTest -@EnableFlags(Flags.FLAG_GLANCEABLE_HUB_V2) -@RunWith(ParameterizedAndroidJunit4::class) -class GlanceableHubQuickAffordanceConfigTest(flags: FlagsParameterization?) : SysuiTestCase() { - private val kosmos = testKosmos() - private val Kosmos.underTest by Kosmos.Fixture { glanceableHubQuickAffordanceConfig } - - init { - mSetFlagsRule.setFlagsParameterization(flags!!) - } - - @Before - fun setUp() { - MockitoAnnotations.initMocks(this) - - // Access the class immediately so that flows are instantiated. - // GlanceableHubQuickAffordanceConfig accesses StateFlow.value directly so we need the flows - // to start flowing before runCurrent is called in the tests. - kosmos.underTest - } - - @Test - fun lockscreenState_whenGlanceableHubEnabled_returnsVisible() = - kosmos.runTest { - kosmos.setCommunalV2Available(true) - runCurrent() - - val lockScreenState by collectLastValue(underTest.lockScreenState) - - assertThat(lockScreenState) - .isInstanceOf(KeyguardQuickAffordanceConfig.LockScreenState.Visible::class.java) - } - - @Test - fun lockscreenState_whenGlanceableHubDisabled_returnsHidden() = - kosmos.runTest { - setCommunalV2Enabled(false) - val lockScreenState by collectLastValue(underTest.lockScreenState) - runCurrent() - - assertThat(lockScreenState) - .isEqualTo(KeyguardQuickAffordanceConfig.LockScreenState.Hidden) - } - - @Test - fun lockscreenState_whenGlanceableHubNotAvailable_returnsHidden() = - kosmos.runTest { - // Hub is enabled, but not available. - setCommunalV2Enabled(true) - fakeKeyguardRepository.setKeyguardShowing(false) - val lockScreenState by collectLastValue(underTest.lockScreenState) - runCurrent() - - assertThat(lockScreenState) - .isEqualTo(KeyguardQuickAffordanceConfig.LockScreenState.Hidden) - } - - @Test - fun pickerScreenState_whenGlanceableHubEnabled_returnsDefault() = - kosmos.runTest { - setCommunalV2Enabled(true) - runCurrent() - - assertThat(underTest.getPickerScreenState()) - .isEqualTo(KeyguardQuickAffordanceConfig.PickerScreenState.Default()) - } - - @Test - fun pickerScreenState_whenGlanceableHubDisabled_returnsDisabled() = - kosmos.runTest { - setCommunalV2Enabled(false) - runCurrent() - - assertThat( - underTest.getPickerScreenState() - is KeyguardQuickAffordanceConfig.PickerScreenState.Disabled - ) - } - - @Test - @DisableFlags(Flags.FLAG_SCENE_CONTAINER) - fun onTriggered_changesSceneToCommunal() = - kosmos.runTest { - underTest.onTriggered(expandable = null) - runCurrent() - - assertThat(kosmos.communalSceneRepository.currentScene.value) - .isEqualTo(CommunalScenes.Communal) - } - - @Test - @EnableFlags(Flags.FLAG_SCENE_CONTAINER) - fun testTransitionToGlanceableHub_sceneContainer() = - kosmos.runTest { - underTest.onTriggered(expandable = null) - runCurrent() - - assertThat(kosmos.sceneContainerRepository.currentScene.value) - .isEqualTo(Scenes.Communal) - } - - companion object { - @JvmStatic - @Parameters(name = "{0}") - fun getParams(): List<FlagsParameterization> { - return parameterizeSceneContainerFlag() - } - } -} diff --git a/packages/SystemUI/res/drawable/ic_widgets.xml b/packages/SystemUI/res/drawable/ic_widgets.xml deleted file mode 100644 index 9e05809bfb33..000000000000 --- a/packages/SystemUI/res/drawable/ic_widgets.xml +++ /dev/null @@ -1,26 +0,0 @@ -<!-- - ~ 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. - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:tint="?attr/colorControlNormal" - android:viewportHeight="960" - android:viewportWidth="960"> - <path - android:fillColor="@android:color/black" - android:pathData="M666,520L440,294L666,68L892,294L666,520ZM120,440L120,120L440,120L440,440L120,440ZM520,840L520,520L840,520L840,840L520,840ZM120,840L120,520L440,520L440,840L120,840ZM200,360L360,360L360,200L200,200L200,360ZM667,408L780,295L667,182L554,295L667,408ZM600,760L760,760L760,600L600,600L600,760ZM200,760L360,760L360,600L200,600L200,760ZM360,360L360,360L360,360L360,360L360,360ZM554,295L554,295L554,295L554,295L554,295ZM360,600L360,600L360,600L360,600L360,600ZM600,600L600,600L600,600L600,600L600,600Z" /> -</vector> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 79fa41949b57..e5e205cab4d0 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -1351,12 +1351,6 @@ <string name="communal_widgets_disclaimer_text">To open an app using a widget, you\u2019ll need to verify it\u2019s you. Also, keep in mind that anyone can view them, even when your tablet\u2019s locked. Some widgets may not have been intended for your lock screen and may be unsafe to add here.</string> <!-- Button for user to verify they understand the information presented. [CHAR LIMIT=50] --> <string name="communal_widgets_disclaimer_button">Got it</string> - <!-- Label for a lock screen affordance to show widgets on the lock screen. [CHAR LIMIT=20] --> - <string name="glanceable_hub_lockscreen_affordance_label">Widgets</string> - <!-- Text explaining why the lock screen affordance to show widgets on the lockscreen is disabled and how to enable the affordance in settings. [CHAR LIMIT=NONE] --> - <string name="glanceable_hub_lockscreen_affordance_disabled_text">To add the \"Widgets\" shortcut, make sure \"Show widgets on lock screen\" is enabled in settings.</string> - <!-- Label for a button used to open Settings in order to enable showing widgets on the lock screen. [CHAR LIMIT=NONE] --> - <string name="glanceable_hub_lockscreen_affordance_action_button_label">Settings</string> <!-- Content description for a "show screensaver" button on glanceable hub. [CHAR LIMIT=NONE] --> <string name="accessibility_glanceable_hub_to_dream_button">Show screensaver button</string> diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/quickaffordance/BuiltInKeyguardQuickAffordanceKeys.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/quickaffordance/BuiltInKeyguardQuickAffordanceKeys.kt index a45204d41718..80675d373b8e 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/data/quickaffordance/BuiltInKeyguardQuickAffordanceKeys.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/quickaffordance/BuiltInKeyguardQuickAffordanceKeys.kt @@ -28,7 +28,6 @@ object BuiltInKeyguardQuickAffordanceKeys { const val CREATE_NOTE = "create_note" const val DO_NOT_DISTURB = "do_not_disturb" const val FLASHLIGHT = "flashlight" - const val GLANCEABLE_HUB = "glanceable_hub" const val HOME_CONTROLS = "home" const val MUTE = "mute" const val QR_CODE_SCANNER = "qr_code_scanner" diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/quickaffordance/GlanceableHubQuickAffordanceConfig.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/quickaffordance/GlanceableHubQuickAffordanceConfig.kt deleted file mode 100644 index 96b07cc84705..000000000000 --- a/packages/SystemUI/src/com/android/systemui/keyguard/data/quickaffordance/GlanceableHubQuickAffordanceConfig.kt +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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.systemui.keyguard.data.quickaffordance - -import android.content.Context -import android.content.Intent -import android.provider.Settings -import android.util.Log -import com.android.systemui.animation.Expandable -import com.android.systemui.common.shared.model.ContentDescription -import com.android.systemui.common.shared.model.Icon -import com.android.systemui.communal.data.repository.CommunalSceneRepository -import com.android.systemui.communal.domain.interactor.CommunalInteractor -import com.android.systemui.communal.domain.interactor.CommunalSettingsInteractor -import com.android.systemui.communal.shared.model.CommunalScenes -import com.android.systemui.communal.shared.model.CommunalTransitionKeys -import com.android.systemui.dagger.SysUISingleton -import com.android.systemui.dagger.qualifiers.Application -import com.android.systemui.res.R -import com.android.systemui.scene.domain.interactor.SceneInteractor -import com.android.systemui.scene.shared.flag.SceneContainerFlag -import com.android.systemui.scene.shared.model.Scenes -import javax.inject.Inject -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.map - -/** Lockscreen affordance that opens the glanceable hub. */ -@SysUISingleton -class GlanceableHubQuickAffordanceConfig -@Inject -constructor( - @Application private val context: Context, - private val communalSceneRepository: CommunalSceneRepository, - private val communalInteractor: CommunalInteractor, - private val communalSettingsInteractor: CommunalSettingsInteractor, - private val sceneInteractor: SceneInteractor, -) : KeyguardQuickAffordanceConfig { - - private val pickerNameResourceId = R.string.glanceable_hub_lockscreen_affordance_label - - override val key: String = BuiltInKeyguardQuickAffordanceKeys.GLANCEABLE_HUB - - override fun pickerName(): String = context.getString(pickerNameResourceId) - - override val pickerIconResourceId: Int - get() = R.drawable.ic_widgets - - override val lockScreenState: Flow<KeyguardQuickAffordanceConfig.LockScreenState> - get() = - communalInteractor.isCommunalAvailable.map { available -> - if (!communalSettingsInteractor.isV2FlagEnabled()) { - Log.i(TAG, "Button hidden on lockscreen: flag not enabled.") - KeyguardQuickAffordanceConfig.LockScreenState.Hidden - } else if (!available) { - Log.i(TAG, "Button hidden on lockscreen: hub not available.") - KeyguardQuickAffordanceConfig.LockScreenState.Hidden - } else { - KeyguardQuickAffordanceConfig.LockScreenState.Visible( - icon = - Icon.Resource( - pickerIconResourceId, - ContentDescription.Resource(pickerNameResourceId), - ) - ) - } - } - - override suspend fun getPickerScreenState(): KeyguardQuickAffordanceConfig.PickerScreenState { - return if (!communalSettingsInteractor.isV2FlagEnabled()) { - Log.i(TAG, "Button unavailable in picker: flag not enabled.") - KeyguardQuickAffordanceConfig.PickerScreenState.UnavailableOnDevice - } else if (!communalInteractor.isCommunalEnabled.value) { - Log.i(TAG, "Button disabled in picker: hub not enabled in settings.") - KeyguardQuickAffordanceConfig.PickerScreenState.Disabled( - explanation = - context.getString(R.string.glanceable_hub_lockscreen_affordance_disabled_text), - actionText = - context.getString( - R.string.glanceable_hub_lockscreen_affordance_action_button_label - ), - actionIntent = Intent(Settings.ACTION_LOCKSCREEN_SETTINGS), - ) - } else { - KeyguardQuickAffordanceConfig.PickerScreenState.Default() - } - } - - override fun onTriggered( - expandable: Expandable? - ): KeyguardQuickAffordanceConfig.OnTriggeredResult { - if (SceneContainerFlag.isEnabled) { - sceneInteractor.changeScene(Scenes.Communal, "lockscreen to communal from shortcut") - } else { - communalSceneRepository.changeScene( - CommunalScenes.Communal, - transitionKey = CommunalTransitionKeys.SimpleFade, - ) - } - return KeyguardQuickAffordanceConfig.OnTriggeredResult.Handled(true) - } - - companion object { - private const val TAG = "GlanceableHubQuickAffordanceConfig" - } -} diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardDataQuickAffordanceModule.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardDataQuickAffordanceModule.kt index 8c6fdb989daf..787a9837b860 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardDataQuickAffordanceModule.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardDataQuickAffordanceModule.kt @@ -36,7 +36,6 @@ interface KeyguardDataQuickAffordanceModule { camera: CameraQuickAffordanceConfig, doNotDisturb: DoNotDisturbQuickAffordanceConfig, flashlight: FlashlightQuickAffordanceConfig, - glanceableHub: GlanceableHubQuickAffordanceConfig, home: HomeControlsKeyguardQuickAffordanceConfig, mute: MuteQuickAffordanceConfig, quickAccessWallet: QuickAccessWalletKeyguardQuickAffordanceConfig, @@ -47,7 +46,6 @@ interface KeyguardDataQuickAffordanceModule { camera, doNotDisturb, flashlight, - glanceableHub, home, mute, quickAccessWallet, diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/quickaffordance/GlanceableHubQuickAffordanceConfigKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/quickaffordance/GlanceableHubQuickAffordanceConfigKosmos.kt deleted file mode 100644 index 568324832b33..000000000000 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/quickaffordance/GlanceableHubQuickAffordanceConfigKosmos.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.systemui.keyguard.data.quickaffordance - -import android.content.applicationContext -import com.android.systemui.communal.data.repository.communalSceneRepository -import com.android.systemui.communal.domain.interactor.communalInteractor -import com.android.systemui.communal.domain.interactor.communalSettingsInteractor -import com.android.systemui.kosmos.Kosmos -import com.android.systemui.scene.domain.interactor.sceneInteractor - -val Kosmos.glanceableHubQuickAffordanceConfig by - Kosmos.Fixture { - GlanceableHubQuickAffordanceConfig( - context = applicationContext, - communalInteractor = communalInteractor, - communalSceneRepository = communalSceneRepository, - communalSettingsInteractor = communalSettingsInteractor, - sceneInteractor = sceneInteractor, - ) - } |