From 4e303dbe8ab50676bb33b61d602a7e2bcbfca5d2 Mon Sep 17 00:00:00 2001 From: Will Leshner Date: Wed, 22 Jan 2025 10:39:28 -0800 Subject: Remove lock screen shortcut for opening glanceable hub. We are not going to ship with this feature. Bug: 391641179 Test: NA Flag: EXEMPT removing feature Change-Id: I603e649ff44d6ebb716e64f80cba7c09bbe4021c --- packages/SystemUI/aconfig/systemui.aconfig | 7 - .../GlanceableHubQuickAffordanceConfigTest.kt | 155 --------------------- packages/SystemUI/res/drawable/ic_widgets.xml | 26 ---- packages/SystemUI/res/values/strings.xml | 6 - .../BuiltInKeyguardQuickAffordanceKeys.kt | 1 - .../GlanceableHubQuickAffordanceConfig.kt | 119 ---------------- .../KeyguardDataQuickAffordanceModule.kt | 2 - .../GlanceableHubQuickAffordanceConfigKosmos.kt | 35 ----- 8 files changed, 351 deletions(-) delete mode 100644 packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/GlanceableHubQuickAffordanceConfigTest.kt delete mode 100644 packages/SystemUI/res/drawable/ic_widgets.xml delete mode 100644 packages/SystemUI/src/com/android/systemui/keyguard/data/quickaffordance/GlanceableHubQuickAffordanceConfig.kt delete mode 100644 packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/quickaffordance/GlanceableHubQuickAffordanceConfigKosmos.kt 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 @@ -1845,13 +1845,6 @@ flag { bug: "379364381" } -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" 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 { - 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 @@ - - - - - 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 @@ 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. Got it - - Widgets - - To add the \"Widgets\" shortcut, make sure \"Show widgets on lock screen\" is enabled in settings. - - Settings Show screensaver button 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 - 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, - ) - } -- cgit v1.2.3-59-g8ed1b