diff options
46 files changed, 134 insertions, 2749 deletions
diff --git a/packages/SystemUI/aconfig/systemui.aconfig b/packages/SystemUI/aconfig/systemui.aconfig index ee229158decc..493d2aebd722 100644 --- a/packages/SystemUI/aconfig/systemui.aconfig +++ b/packages/SystemUI/aconfig/systemui.aconfig @@ -265,14 +265,6 @@ flag { } flag { - name: "keyguard_bottom_area_refactor" - namespace: "systemui" - description: "Bottom area of keyguard refactor move into KeyguardRootView. Includes " - "lock icon and others." - bug: "290652751" -} - -flag { name: "device_entry_udfps_refactor" namespace: "systemui" description: "Refactoring device entry UDFPS icon to use modern architecture and " diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt index 105e8dadfafb..7956d0293a1d 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt @@ -159,6 +159,7 @@ constructor( with(lockSection) { LockIcon() } // Aligned to bottom and constrained to below the lock icon. + // TODO("b/383588832") change this away from "keyguard_bottom_area" Column(modifier = Modifier.fillMaxWidth().sysuiResTag("keyguard_bottom_area")) { if (isUdfpsVisible && ambientIndicationSectionOptional.isPresent) { with(ambientIndicationSectionOptional.get()) { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt index 77f19795eaf7..6805a133459f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt @@ -123,27 +123,6 @@ class KeyguardRepositoryImplTest : SysuiTestCase() { } @Test - fun bottomAreaAlpha() = - testScope.runTest { - assertThat(underTest.bottomAreaAlpha.value).isEqualTo(1f) - - underTest.setBottomAreaAlpha(0.1f) - assertThat(underTest.bottomAreaAlpha.value).isEqualTo(0.1f) - - underTest.setBottomAreaAlpha(0.2f) - assertThat(underTest.bottomAreaAlpha.value).isEqualTo(0.2f) - - underTest.setBottomAreaAlpha(0.3f) - assertThat(underTest.bottomAreaAlpha.value).isEqualTo(0.3f) - - underTest.setBottomAreaAlpha(0.5f) - assertThat(underTest.bottomAreaAlpha.value).isEqualTo(0.5f) - - underTest.setBottomAreaAlpha(1.0f) - assertThat(underTest.bottomAreaAlpha.value).isEqualTo(1f) - } - - @Test fun panelAlpha() = testScope.runTest { assertThat(underTest.panelAlpha.value).isEqualTo(1f) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultIndicationAreaSectionTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultIndicationAreaSectionTest.kt index 10f7128af43c..9ceabd743618 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultIndicationAreaSectionTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultIndicationAreaSectionTest.kt @@ -56,21 +56,12 @@ class DefaultIndicationAreaSectionTest : SysuiTestCase() { @Test fun addViewsConditionally() { - mSetFlagsRule.enableFlags(AConfigFlags.FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR) val constraintLayout = ConstraintLayout(context, null) underTest.addViews(constraintLayout) assertThat(constraintLayout.childCount).isGreaterThan(0) } @Test - fun addViewsConditionally_migrateFlagOff() { - mSetFlagsRule.disableFlags(AConfigFlags.FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR) - val constraintLayout = ConstraintLayout(context, null) - underTest.addViews(constraintLayout) - assertThat(constraintLayout.childCount).isEqualTo(0) - } - - @Test fun applyConstraints() { val cs = ConstraintSet() underTest.applyConstraints(cs) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardIndicationAreaViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardIndicationAreaViewModelTest.kt index 6f74ed34c4e9..242ee3a783f2 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardIndicationAreaViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardIndicationAreaViewModelTest.kt @@ -20,7 +20,6 @@ import android.platform.test.annotations.DisableFlags import android.platform.test.flag.junit.FlagsParameterization import androidx.test.filters.SmallTest import com.android.compose.animation.scene.ObservableTransitionState -import com.android.systemui.Flags.FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR import com.android.systemui.Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT import com.android.systemui.SysuiTestCase import com.android.systemui.common.ui.domain.interactor.configurationInteractor @@ -31,7 +30,6 @@ import com.android.systemui.coroutines.collectLastValue import com.android.systemui.doze.util.BurnInHelperWrapper import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository import com.android.systemui.keyguard.domain.interactor.BurnInInteractor -import com.android.systemui.keyguard.domain.interactor.keyguardBottomAreaInteractor import com.android.systemui.keyguard.domain.interactor.keyguardInteractor import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor import com.android.systemui.keyguard.shared.model.BurnInModel @@ -61,8 +59,6 @@ import platform.test.runner.parameterized.Parameters class KeyguardIndicationAreaViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { private val kosmos = testKosmos() private val testScope = kosmos.testScope - - private val bottomAreaInteractor = kosmos.keyguardBottomAreaInteractor private lateinit var underTest: KeyguardIndicationAreaViewModel private val keyguardRepository = kosmos.fakeKeyguardRepository private val communalSceneRepository = kosmos.fakeCommunalSceneRepository @@ -87,12 +83,6 @@ class KeyguardIndicationAreaViewModelTest(flags: FlagsParameterization) : SysuiT @Before fun setUp() { - val bottomAreaViewModel = - mock<KeyguardBottomAreaViewModel> { - on { startButton } doReturn startButtonFlow - on { endButton } doReturn endButtonFlow - on { alpha } doReturn alphaFlow - } val burnInInteractor = mock<BurnInInteractor> { on { burnIn(anyInt(), anyInt()) } doReturn flowOf(BurnInModel()) @@ -109,8 +99,6 @@ class KeyguardIndicationAreaViewModelTest(flags: FlagsParameterization) : SysuiT underTest = KeyguardIndicationAreaViewModel( keyguardInteractor = kosmos.keyguardInteractor, - bottomAreaInteractor = bottomAreaInteractor, - keyguardBottomAreaViewModel = bottomAreaViewModel, burnInHelperWrapper = burnInHelperWrapper, burnInInteractor = burnInInteractor, shortcutsCombinedViewModel = shortcutsCombinedViewModel, @@ -123,23 +111,6 @@ class KeyguardIndicationAreaViewModelTest(flags: FlagsParameterization) : SysuiT } @Test - fun alpha() = - testScope.runTest { - val alpha by collectLastValue(underTest.alpha) - - assertThat(alpha).isEqualTo(1f) - alphaFlow.value = 0.1f - assertThat(alpha).isEqualTo(0.1f) - alphaFlow.value = 0.5f - assertThat(alpha).isEqualTo(0.5f) - alphaFlow.value = 0.2f - assertThat(alpha).isEqualTo(0.2f) - alphaFlow.value = 0f - assertThat(alpha).isEqualTo(0f) - } - - @Test - @DisableFlags(FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR) fun isIndicationAreaPadded() = testScope.runTest { keyguardRepository.setKeyguardShowing(true) @@ -157,23 +128,6 @@ class KeyguardIndicationAreaViewModelTest(flags: FlagsParameterization) : SysuiT } @Test - @DisableFlags(FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR) - fun indicationAreaTranslationX() = - testScope.runTest { - val translationX by collectLastValue(underTest.indicationAreaTranslationX) - - assertThat(translationX).isEqualTo(0f) - bottomAreaInteractor.setClockPosition(100, 100) - assertThat(translationX).isEqualTo(100f) - bottomAreaInteractor.setClockPosition(200, 100) - assertThat(translationX).isEqualTo(200f) - bottomAreaInteractor.setClockPosition(200, 200) - assertThat(translationX).isEqualTo(200f) - bottomAreaInteractor.setClockPosition(300, 100) - assertThat(translationX).isEqualTo(300f) - } - - @Test @DisableFlags(FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) fun indicationAreaTranslationY() = testScope.runTest { @@ -236,7 +190,6 @@ class KeyguardIndicationAreaViewModelTest(flags: FlagsParameterization) : SysuiT @Parameters(name = "{0}") fun getParams(): List<FlagsParameterization> { return FlagsParameterization.allCombinationsOf( - FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR, FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, ) } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt index b5e670c4bbcc..95ffc962797d 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt @@ -24,7 +24,6 @@ import android.platform.test.flag.junit.FlagsParameterization import android.view.View import androidx.test.filters.SmallTest import com.android.compose.animation.scene.ObservableTransitionState -import com.android.systemui.Flags.FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR import com.android.systemui.Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT import com.android.systemui.SysuiTestCase import com.android.systemui.communal.data.repository.communalSceneRepository @@ -74,7 +73,7 @@ import platform.test.runner.parameterized.Parameters @SmallTest @RunWith(ParameterizedAndroidJunit4::class) -@EnableFlags(FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR) +@EnableFlags(FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT) class KeyguardRootViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { private val kosmos = testKosmos() private val testScope = kosmos.testScope diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/shared/flag/SceneContainerFlagParameterizationTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/shared/flag/SceneContainerFlagParameterizationTest.kt index f86337ec63dc..396f531b7e1b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/shared/flag/SceneContainerFlagParameterizationTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/shared/flag/SceneContainerFlagParameterizationTest.kt @@ -20,7 +20,7 @@ import android.platform.test.flag.junit.FlagsParameterization import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.Flags.FLAG_EXAMPLE_FLAG -import com.android.systemui.Flags.FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR +import com.android.systemui.Flags.FLAG_NOTIFICATION_AVALANCHE_THROTTLE_HUN import com.android.systemui.Flags.FLAG_SCENE_CONTAINER import com.android.systemui.SysuiTestCase import com.android.systemui.flags.andSceneContainer @@ -66,7 +66,7 @@ internal class SceneContainerFlagParameterizationTest : SysuiTestCase() { @Test fun oneDependencyAndSceneContainer() { - val dependentFlag = FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR + val dependentFlag = FLAG_NOTIFICATION_AVALANCHE_THROTTLE_HUN val result = FlagsParameterization.allCombinationsOf(dependentFlag).andSceneContainer() Truth.assertThat(result).hasSize(3) Truth.assertThat(result[0].mOverrides[dependentFlag]).isFalse() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java index 0d8d57e52dbf..d3b58287e961 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java @@ -68,7 +68,6 @@ import com.android.internal.logging.UiEventLogger; import com.android.internal.logging.testing.UiEventLoggerFake; import com.android.internal.statusbar.IStatusBarService; import com.android.internal.util.LatencyTracker; -import com.android.keyguard.EmptyLockIconViewController; import com.android.keyguard.KeyguardClockSwitch; import com.android.keyguard.KeyguardClockSwitchController; import com.android.keyguard.KeyguardSliceViewController; @@ -99,7 +98,6 @@ import com.android.systemui.keyguard.KeyguardUnlockAnimationController; import com.android.systemui.keyguard.KeyguardViewConfigurator; import com.android.systemui.keyguard.data.repository.FakeKeyguardClockRepository; import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository; -import com.android.systemui.keyguard.domain.interactor.KeyguardBottomAreaInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractorFactory; @@ -108,7 +106,6 @@ import com.android.systemui.keyguard.domain.interactor.NaturalScrollingSettingOb import com.android.systemui.keyguard.ui.view.KeyguardRootView; import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel; import com.android.systemui.keyguard.ui.viewmodel.GoneToDreamingTransitionViewModel; -import com.android.systemui.keyguard.ui.viewmodel.KeyguardBottomAreaViewModel; import com.android.systemui.keyguard.ui.viewmodel.KeyguardTouchHandlingViewModel; import com.android.systemui.keyguard.ui.viewmodel.LockscreenToDreamingTransitionViewModel; import com.android.systemui.keyguard.ui.viewmodel.LockscreenToOccludedTransitionViewModel; @@ -167,8 +164,6 @@ import com.android.systemui.statusbar.phone.CentralSurfaces; import com.android.systemui.statusbar.phone.ConfigurationControllerImpl; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.HeadsUpAppearanceController; -import com.android.systemui.statusbar.phone.KeyguardBottomAreaView; -import com.android.systemui.statusbar.phone.KeyguardBottomAreaViewController; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.KeyguardClockPositionAlgorithm; import com.android.systemui.statusbar.phone.KeyguardStatusBarView; @@ -228,10 +223,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { @Mock protected CentralSurfaces mCentralSurfaces; @Mock protected NotificationStackScrollLayout mNotificationStackScrollLayout; - @Mock protected KeyguardBottomAreaView mKeyguardBottomArea; - @Mock protected KeyguardBottomAreaViewController mKeyguardBottomAreaViewController; @Mock protected ViewPropertyAnimator mViewPropertyAnimator; - @Mock protected KeyguardBottomAreaView mQsFrame; @Mock protected HeadsUpManager mHeadsUpManager; @Mock protected NotificationGutsManager mGutsManager; @Mock protected KeyguardStatusBarView mKeyguardStatusBar; @@ -270,7 +262,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { @Mock protected KeyguardUserSwitcherController mKeyguardUserSwitcherController; @Mock protected KeyguardStatusViewComponent mKeyguardStatusViewComponent; @Mock protected KeyguardStatusBarViewComponent.Factory mKeyguardStatusBarViewComponentFactory; - @Mock protected EmptyLockIconViewController mLockIconViewController; @Mock protected KeyguardStatusBarViewComponent mKeyguardStatusBarViewComponent; @Mock protected KeyguardClockSwitchController mKeyguardClockSwitchController; @Mock protected KeyguardStatusBarViewController mKeyguardStatusBarViewController; @@ -317,7 +308,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { @Mock protected ViewGroup mQsHeader; @Mock protected ViewParent mViewParent; @Mock protected ViewTreeObserver mViewTreeObserver; - @Mock protected KeyguardBottomAreaViewModel mKeyguardBottomAreaViewModel; @Mock protected DreamingToLockscreenTransitionViewModel mDreamingToLockscreenTransitionViewModel; @Mock protected OccludedToLockscreenTransitionViewModel @@ -352,7 +342,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { @Mock private StatusBarLongPressGestureDetector mStatusBarLongPressGestureDetector; protected final int mMaxUdfpsBurnInOffsetY = 5; protected FakeFeatureFlagsClassic mFeatureFlags = new FakeFeatureFlagsClassic(); - protected KeyguardBottomAreaInteractor mKeyguardBottomAreaInteractor; protected KeyguardClockInteractor mKeyguardClockInteractor; protected FakeKeyguardRepository mFakeKeyguardRepository; protected FakeKeyguardClockRepository mFakeKeyguardClockRepository; @@ -397,13 +386,10 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mFeatureFlags.set(Flags.LOCKSCREEN_ENABLE_LANDSCAPE, false); mFeatureFlags.set(Flags.QS_USER_DETAIL_SHORTCUT, false); - mSetFlagsRule.disableFlags(com.android.systemui.Flags.FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR); - mMainDispatcher = getMainDispatcher(); KeyguardInteractorFactory.WithDependencies keyguardInteractorDeps = KeyguardInteractorFactory.create(); mFakeKeyguardRepository = keyguardInteractorDeps.getRepository(); - mKeyguardBottomAreaInteractor = new KeyguardBottomAreaInteractor(mFakeKeyguardRepository); mFakeKeyguardClockRepository = new FakeKeyguardClockRepository(); mKeyguardClockInteractor = mKosmos.getKeyguardClockInteractor(); mKeyguardInteractor = keyguardInteractorDeps.getKeyguardInteractor(); @@ -500,9 +486,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { when(mNotificationStackScrollLayoutController.getHeight()).thenReturn(1000); when(mNotificationStackScrollLayoutController.getHeadsUpCallback()) .thenReturn(mHeadsUpCallback); - when(mKeyguardBottomAreaViewController.getView()).thenReturn(mKeyguardBottomArea); - when(mView.findViewById(R.id.keyguard_bottom_area)).thenReturn(mKeyguardBottomArea); - when(mKeyguardBottomArea.animate()).thenReturn(mViewPropertyAnimator); when(mView.animate()).thenReturn(mViewPropertyAnimator); when(mKeyguardStatusView.animate()).thenReturn(mViewPropertyAnimator); when(mViewPropertyAnimator.translationX(anyFloat())).thenReturn(mViewPropertyAnimator); @@ -513,7 +496,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { when(mViewPropertyAnimator.setListener(any())).thenReturn(mViewPropertyAnimator); when(mViewPropertyAnimator.setUpdateListener(any())).thenReturn(mViewPropertyAnimator); when(mViewPropertyAnimator.withEndAction(any())).thenReturn(mViewPropertyAnimator); - when(mView.findViewById(R.id.qs_frame)).thenReturn(mQsFrame); when(mView.findViewById(R.id.keyguard_status_view)) .thenReturn(mock(KeyguardStatusView.class)); ViewGroup rootView = mock(ViewGroup.class); @@ -647,8 +629,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { .thenReturn(keyguardStatusView); when(mLayoutInflater.inflate(eq(R.layout.keyguard_user_switcher), any(), anyBoolean())) .thenReturn(mUserSwitcherView); - when(mLayoutInflater.inflate(eq(R.layout.keyguard_bottom_area), any(), anyBoolean())) - .thenReturn(mKeyguardBottomArea); when(mNotificationRemoteInputManager.isRemoteInputActive()) .thenReturn(false); doAnswer(invocation -> { @@ -720,7 +700,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mMediaDataManager, mNotificationShadeDepthController, mAmbientState, - mLockIconViewController, mKeyguardMediaController, mTapAgainViewController, mNavigationModeController, @@ -736,15 +715,12 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mShadeRepository, mSysUIUnfoldComponent, mSysUiState, - () -> mKeyguardBottomAreaViewController, mKeyguardUnlockAnimationController, mKeyguardIndicationController, mNotificationListContainer, mNotificationStackSizeCalculator, mUnlockedScreenOffAnimationController, systemClock, - mKeyguardBottomAreaViewModel, - mKeyguardBottomAreaInteractor, mKeyguardClockInteractor, mAlternateBouncerInteractor, mDreamingToLockscreenTransitionViewModel, diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerWithCoroutinesTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerWithCoroutinesTest.kt index 97441f01bcf5..5289554e9e18 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerWithCoroutinesTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerWithCoroutinesTest.kt @@ -28,7 +28,6 @@ import androidx.test.filters.SmallTest import com.android.internal.util.CollectionUtils import com.android.keyguard.KeyguardClockSwitch.LARGE import com.android.systemui.Flags -import com.android.systemui.coroutines.collectLastValue import com.android.systemui.res.R import com.android.systemui.statusbar.StatusBarState.KEYGUARD import com.android.systemui.statusbar.StatusBarState.SHADE @@ -215,31 +214,4 @@ class NotificationPanelViewControllerWithCoroutinesTest : } advanceUntilIdle() } - - @Test - fun onLayoutChange_shadeCollapsed_bottomAreaAlphaIsZero() = runTest { - // GIVEN bottomAreaShadeAlpha was updated before - mNotificationPanelViewController.maybeAnimateBottomAreaAlpha() - - // WHEN a layout change is triggered with the shade being closed - triggerLayoutChange() - - // THEN the bottomAreaAlpha is zero - val bottomAreaAlpha by collectLastValue(mFakeKeyguardRepository.bottomAreaAlpha) - assertThat(bottomAreaAlpha).isEqualTo(0f) - } - - @Test - fun onShadeExpanded_bottomAreaAlphaIsFullyOpaque() = runTest { - // GIVEN bottomAreaShadeAlpha was updated before - mNotificationPanelViewController.maybeAnimateBottomAreaAlpha() - - // WHEN the shade expanded - val transitionDistance = mNotificationPanelViewController.maxPanelTransitionDistance - mNotificationPanelViewController.expandedHeight = transitionDistance.toFloat() - - // THEN the bottomAreaAlpha is fully opaque - val bottomAreaAlpha by collectLastValue(mFakeKeyguardRepository.bottomAreaAlpha) - assertThat(bottomAreaAlpha).isEqualTo(1f) - } } diff --git a/packages/SystemUI/res/values/ids.xml b/packages/SystemUI/res/values/ids.xml index 88ed4e353719..5822e015de5b 100644 --- a/packages/SystemUI/res/values/ids.xml +++ b/packages/SystemUI/res/values/ids.xml @@ -215,27 +215,30 @@ <item type="id" name="backlight_icon" /> <!-- IDs for use in the keyguard/lockscreen scene --> - <item type="id" name="keyguard_root_view" /> + <item type="id" name="accessibility_actions_view" /> + <item type="id" name="ambient_indication_container" /> + <item type="id" name="aod_notification_icon_container" /> + <item type="id" name="burn_in_layer" /> + <item type="id" name="burn_in_layer_empty_view" /> + <item type="id" name="communal_tutorial_indicator" /> + <item type="id" name="end_button" /> + <item type="id" name="lock_icon" /> + <item type="id" name="lock_icon_bg" /> <item type="id" name="keyguard_indication_area" /> <item type="id" name="keyguard_indication_text" /> <item type="id" name="keyguard_indication_text_bottom" /> + <item type="id" name="keyguard_root_view" /> + <item type="id" name="keyguard_settings_button" /> <item type="id" name="nssl_guideline" /> <item type="id" name="nssl_placeholder" /> - <item type="id" name="aod_notification_icon_container" /> - <item type="id" name="split_shade_guideline" /> - <item type="id" name="lock_icon" /> - <item type="id" name="lock_icon_bg" /> - <item type="id" name="burn_in_layer" /> - <item type="id" name="burn_in_layer_empty_view" /> - <item type="id" name="communal_tutorial_indicator" /> <item type="id" name="nssl_placeholder_barrier_bottom" /> - <item type="id" name="ambient_indication_container" /> - <item type="id" name="status_view_media_container" /> - <item type="id" name="smart_space_barrier_bottom" /> <item type="id" name="small_clock_guideline_top" /> + <item type="id" name="smart_space_barrier_bottom" /> + <item type="id" name="split_shade_guideline" /> + <item type="id" name="start_button" /> + <item type="id" name="status_view_media_container" /> <item type="id" name="weather_clock_date_and_icons_barrier_bottom" /> <item type="id" name="weather_clock_bc_smartspace_bottom" /> - <item type="id" name="accessibility_actions_view" /> <!-- Privacy dialog --> <item type="id" name="privacy_dialog_close_app_button" /> diff --git a/packages/SystemUI/src/com/android/keyguard/EmptyLockIconViewController.kt b/packages/SystemUI/src/com/android/keyguard/EmptyLockIconViewController.kt deleted file mode 100644 index 306d68217e50..000000000000 --- a/packages/SystemUI/src/com/android/keyguard/EmptyLockIconViewController.kt +++ /dev/null @@ -1,64 +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.keyguard - -import android.view.MotionEvent -import android.view.View -import com.android.systemui.dagger.SysUISingleton -import com.android.systemui.keyguard.ui.view.KeyguardRootView -import com.android.systemui.res.R -import dagger.Lazy -import javax.inject.Inject - -/** - * Lock icon view logic now lives in DeviceEntryIconViewBinder and ViewModels. Icon is positioned in - * [com.android.systemui.keyguard.ui.view.layout.sections.DefaultDeviceEntrySection]. - * - * This class is to bridge the gap between the logic when the DeviceEntryUdfpsRefactor is enabled - * and the KeyguardBottomAreaRefactor is NOT enabled. This class can and should be removed when both - * flags are enabled. - */ -@SysUISingleton -class EmptyLockIconViewController -@Inject -constructor(private val keyguardRootView: Lazy<KeyguardRootView>) : LockIconViewController { - private val deviceEntryIconViewId = R.id.device_entry_icon_view - - override fun setLockIconView(lockIconView: View) { - // no-op - } - - override fun getTop(): Float { - return keyguardRootView.get().getViewById(deviceEntryIconViewId)?.top?.toFloat() ?: 0f - } - - override fun getBottom(): Float { - return keyguardRootView.get().getViewById(deviceEntryIconViewId)?.bottom?.toFloat() ?: 0f - } - - override fun dozeTimeTick() { - // no-op - } - - override fun setAlpha(alpha: Float) { - // no-op - } - - override fun willHandleTouchWhileDozing(event: MotionEvent): Boolean { - return false - } -} diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.kt b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.kt deleted file mode 100644 index c5012b01dd3e..000000000000 --- a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.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.keyguard - -import android.view.MotionEvent -import android.view.View - -/** Controls the [LockIconView]. */ -interface LockIconViewController { - fun setLockIconView(lockIconView: View) - - fun getTop(): Float - - fun getBottom(): Float - - fun dozeTimeTick() - - fun setAlpha(alpha: Float) - - fun willHandleTouchWhileDozing(event: MotionEvent): Boolean -} diff --git a/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalTutorialIndicatorViewModel.kt b/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalTutorialIndicatorViewModel.kt index 63a497213255..ce3a2be9229e 100644 --- a/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalTutorialIndicatorViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/CommunalTutorialIndicatorViewModel.kt @@ -17,21 +17,17 @@ package com.android.systemui.communal.ui.viewmodel import com.android.systemui.communal.domain.interactor.CommunalTutorialInteractor -import com.android.systemui.keyguard.domain.interactor.KeyguardBottomAreaInteractor import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow -import kotlinx.coroutines.flow.distinctUntilChanged +import kotlinx.coroutines.flow.flowOf /** View model for communal tutorial indicator on keyguard */ class CommunalTutorialIndicatorViewModel @Inject -constructor( - private val communalTutorialInteractor: CommunalTutorialInteractor, - bottomAreaInteractor: KeyguardBottomAreaInteractor, -) { +constructor(private val communalTutorialInteractor: CommunalTutorialInteractor) { /** * An observable for whether the tutorial indicator view should be visible. * @@ -46,5 +42,6 @@ constructor( } /** An observable for the alpha level for the tutorial indicator. */ - val alpha: Flow<Float> = bottomAreaInteractor.alpha.distinctUntilChanged() + // TODO("b/383587536") find replacement for keyguardBottomAreaInteractor alpha + val alpha: Flow<Float> = flowOf(0f) } diff --git a/packages/SystemUI/src/com/android/systemui/deviceentry/DeviceEntryModule.kt b/packages/SystemUI/src/com/android/systemui/deviceentry/DeviceEntryModule.kt index 6c335e71cfde..0ab9661c0b4e 100644 --- a/packages/SystemUI/src/com/android/systemui/deviceentry/DeviceEntryModule.kt +++ b/packages/SystemUI/src/com/android/systemui/deviceentry/DeviceEntryModule.kt @@ -16,18 +16,13 @@ package com.android.systemui.deviceentry -import com.android.keyguard.EmptyLockIconViewController -import com.android.keyguard.LockIconViewController import com.android.systemui.CoreStartable -import com.android.systemui.dagger.SysUISingleton import com.android.systemui.deviceentry.data.repository.DeviceEntryRepositoryModule import com.android.systemui.deviceentry.data.repository.FaceWakeUpTriggersConfigModule import com.android.systemui.deviceentry.domain.interactor.DeviceUnlockedInteractor import com.android.systemui.keyguard.ui.transitions.DeviceEntryIconTransition import dagger.Binds -import dagger.Lazy import dagger.Module -import dagger.Provides import dagger.multibindings.ClassKey import dagger.multibindings.IntoMap import dagger.multibindings.Multibinds @@ -45,14 +40,4 @@ abstract class DeviceEntryModule { abstract fun deviceUnlockedInteractorActivator( activator: DeviceUnlockedInteractor.Activator ): CoreStartable - - companion object { - @Provides - @SysUISingleton - fun provideLockIconViewController( - emptyLockIconViewController: Lazy<EmptyLockIconViewController> - ): LockIconViewController { - return emptyLockIconViewController.get() - } - } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardBottomAreaRefactor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardBottomAreaRefactor.kt deleted file mode 100644 index 779b27b25375..000000000000 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardBottomAreaRefactor.kt +++ /dev/null @@ -1,53 +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 - -import com.android.systemui.Flags -import com.android.systemui.flags.FlagToken -import com.android.systemui.flags.RefactorFlagUtils - -/** Helper for reading or using the keyguard bottom area refactor flag. */ -@Suppress("NOTHING_TO_INLINE") -object KeyguardBottomAreaRefactor { - /** The aconfig flag name */ - const val FLAG_NAME = Flags.FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR - - /** A token used for dependency declaration */ - val token: FlagToken - get() = FlagToken(FLAG_NAME, isEnabled) - - /** Is the refactor enabled */ - @JvmStatic - inline val isEnabled - get() = Flags.keyguardBottomAreaRefactor() - - /** - * Called to ensure code is only run when the flag is enabled. This protects users from the - * unintended behaviors caused by accidentally running new logic, while also crashing on an eng - * build to ensure that the refactor author catches issues in testing. - */ - @JvmStatic - inline fun isUnexpectedlyInLegacyMode() = - RefactorFlagUtils.isUnexpectedlyInLegacyMode(isEnabled, FLAG_NAME) - - /** - * Called to ensure code is only run when the flag is disabled. This will throw an exception if - * the flag is enabled to ensure that the refactor author catches issues in testing. - */ - @JvmStatic - inline fun assertInLegacyMode() = RefactorFlagUtils.assertInLegacyMode(isEnabled, FLAG_NAME) -} diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndication.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndication.java index a0b25b930d15..984541bcc60b 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndication.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndication.java @@ -27,7 +27,7 @@ import android.view.View; * Data class containing display information (message, icon, styling) for indication to show at * the bottom of the keyguard. * - * See {@link com.android.systemui.statusbar.phone.KeyguardBottomAreaView}. + * See {@link com.android.systemui.keyguard.ui.view.KeyguardRootView}. */ public class KeyguardIndication { @Nullable diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt index 5ec6d37207b5..e8eb4976194a 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt @@ -41,7 +41,6 @@ import com.android.systemui.deviceentry.domain.interactor.DeviceEntryHapticsInte import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor import com.android.systemui.keyguard.shared.model.LockscreenSceneBlueprint import com.android.systemui.keyguard.ui.binder.KeyguardBlueprintViewBinder -import com.android.systemui.keyguard.ui.binder.KeyguardIndicationAreaBinder import com.android.systemui.keyguard.ui.binder.KeyguardRootViewBinder import com.android.systemui.keyguard.ui.binder.LightRevealScrimViewBinder import com.android.systemui.keyguard.ui.composable.LockscreenContent @@ -50,7 +49,6 @@ import com.android.systemui.keyguard.ui.view.KeyguardIndicationArea import com.android.systemui.keyguard.ui.view.KeyguardRootView import com.android.systemui.keyguard.ui.viewmodel.KeyguardBlueprintViewModel import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel -import com.android.systemui.keyguard.ui.viewmodel.KeyguardIndicationAreaViewModel import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel import com.android.systemui.keyguard.ui.viewmodel.KeyguardSmartspaceViewModel import com.android.systemui.keyguard.ui.viewmodel.LightRevealScrimViewModel @@ -59,7 +57,6 @@ import com.android.systemui.keyguard.ui.viewmodel.OccludingAppDeviceEntryMessage import com.android.systemui.plugins.FalsingManager import com.android.systemui.res.R import com.android.systemui.scene.shared.flag.SceneContainerFlag -import com.android.systemui.shade.NotificationShadeWindowView import com.android.systemui.shade.ShadeDisplayAware import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.statusbar.KeyguardIndicationController @@ -86,9 +83,6 @@ class KeyguardViewConfigurator constructor( private val keyguardRootView: KeyguardRootView, private val keyguardRootViewModel: KeyguardRootViewModel, - private val keyguardIndicationAreaViewModel: KeyguardIndicationAreaViewModel, - private val notificationShadeWindowView: NotificationShadeWindowView, - private val indicationController: KeyguardIndicationController, private val screenOffAnimationController: ScreenOffAnimationController, private val occludingAppDeviceEntryMessageViewModel: OccludingAppDeviceEntryMessageViewModel, private val chipbarCoordinator: ChipbarCoordinator, @@ -163,23 +157,6 @@ constructor( } } - fun bindIndicationArea() { - indicationAreaHandle?.dispose() - - if (!KeyguardBottomAreaRefactor.isEnabled) { - keyguardRootView.findViewById<View?>(R.id.keyguard_indication_area)?.let { - keyguardRootView.removeView(it) - } - } - - indicationAreaHandle = - KeyguardIndicationAreaBinder.bind( - notificationShadeWindowView.requireViewById(R.id.keyguard_indication_area), - keyguardIndicationAreaViewModel, - indicationController, - ) - } - /** Initialize views so that corresponding controllers have a view set. */ private fun initializeViews() { val indicationArea = KeyguardIndicationArea(context, null) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt index d3c17ccd2d18..ac04dd5a7ec1 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt @@ -75,12 +75,6 @@ interface KeyguardRepository { */ val animateBottomAreaDozingTransitions: StateFlow<Boolean> - /** - * Observable for the current amount of alpha that should be used for rendering the bottom area. - * UI. - */ - val bottomAreaAlpha: StateFlow<Float> - val keyguardAlpha: StateFlow<Float> val panelAlpha: MutableStateFlow<Float> @@ -283,9 +277,6 @@ interface KeyguardRepository { /** Sets whether the bottom area UI should animate the transition out of doze state. */ fun setAnimateDozingTransitions(animate: Boolean) - /** Sets the current amount of alpha that should be used for rendering the bottom area. */ - @Deprecated("Deprecated as part of b/278057014") fun setBottomAreaAlpha(alpha: Float) - /** Sets the current amount of alpha that should be used for rendering the keyguard. */ fun setKeyguardAlpha(alpha: Float) @@ -392,9 +383,6 @@ constructor( override val animateBottomAreaDozingTransitions = _animateBottomAreaDozingTransitions.asStateFlow() - private val _bottomAreaAlpha = MutableStateFlow(1f) - override val bottomAreaAlpha = _bottomAreaAlpha.asStateFlow() - private val _keyguardAlpha = MutableStateFlow(1f) override val keyguardAlpha = _keyguardAlpha.asStateFlow() @@ -675,10 +663,6 @@ constructor( _animateBottomAreaDozingTransitions.value = animate } - override fun setBottomAreaAlpha(alpha: Float) { - _bottomAreaAlpha.value = alpha - } - override fun setKeyguardAlpha(alpha: Float) { _keyguardAlpha.value = alpha } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardBottomAreaInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardBottomAreaInteractor.kt deleted file mode 100644 index 53f241684a62..000000000000 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardBottomAreaInteractor.kt +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2022 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.domain.interactor - -import com.android.systemui.common.shared.model.Position -import com.android.systemui.dagger.SysUISingleton -import com.android.systemui.keyguard.data.repository.KeyguardRepository -import javax.inject.Inject -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.asStateFlow - -/** Encapsulates business-logic specifically related to the keyguard bottom area. */ -@SysUISingleton -class KeyguardBottomAreaInteractor -@Inject -constructor( - private val repository: KeyguardRepository, -) { - /** Whether to animate the next doze mode transition. */ - val animateDozingTransitions: Flow<Boolean> = repository.animateBottomAreaDozingTransitions - /** The amount of alpha for the UI components of the bottom area. */ - val alpha: Flow<Float> = repository.bottomAreaAlpha - /** The position of the keyguard clock. */ - private val _clockPosition = MutableStateFlow(Position(0, 0)) - /** See [ClockSection] */ - @Deprecated("with MigrateClocksToBlueprint.isEnabled") - val clockPosition: Flow<Position> = _clockPosition.asStateFlow() - - fun setClockPosition(x: Int, y: Int) { - _clockPosition.value = Position(x, y) - } - - fun setAlpha(alpha: Float) { - repository.setBottomAreaAlpha(alpha) - } - - fun setAnimateDozingTransitions(animate: Boolean) { - repository.setAnimateDozingTransitions(animate) - } - - /** - * Returns whether the keyguard bottom area should be constrained to the top of the lock icon - */ - fun shouldConstrainToTopOfLockIcon(): Boolean = repository.isUdfpsSupported() -} diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBlueprintViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBlueprintViewBinder.kt index 5bad0168fe05..261c130d0d82 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBlueprintViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBlueprintViewBinder.kt @@ -24,7 +24,6 @@ import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.app.tracing.coroutines.launchTraced as launch import com.android.systemui.customization.R as customR -import com.android.systemui.keyguard.KeyguardBottomAreaRefactor import com.android.systemui.keyguard.shared.model.KeyguardBlueprint import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.BaseBlueprintTransition import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.IntraBlueprintTransition @@ -51,26 +50,11 @@ object KeyguardBlueprintViewBinder { (prevBlueprint, blueprint) -> val config = Config.DEFAULT val transition = - if ( - !KeyguardBottomAreaRefactor.isEnabled && - prevBlueprint != null && - prevBlueprint != blueprint - ) { - BaseBlueprintTransition(clockViewModel) - .addTransition( - IntraBlueprintTransition( - config, - clockViewModel, - smartspaceViewModel, - ) - ) - } else { - IntraBlueprintTransition( - config, - clockViewModel, - smartspaceViewModel, - ) - } + IntraBlueprintTransition( + config, + clockViewModel, + smartspaceViewModel, + ) viewModel.runTransition(constraintLayout, transition, config) { // Replace sections from the previous blueprint with the new ones diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt deleted file mode 100644 index c59fe5357ccb..000000000000 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt +++ /dev/null @@ -1,586 +0,0 @@ -/* - * Copyright (C) 2022 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.ui.binder - -import android.annotation.SuppressLint -import android.content.res.ColorStateList -import android.graphics.Rect -import android.graphics.drawable.Animatable2 -import android.util.Size -import android.view.View -import android.view.ViewGroup -import android.view.ViewGroup.MarginLayoutParams -import android.view.WindowInsets -import android.widget.ImageView -import androidx.core.animation.CycleInterpolator -import androidx.core.animation.ObjectAnimator -import androidx.core.view.isInvisible -import androidx.core.view.isVisible -import androidx.core.view.marginLeft -import androidx.core.view.marginRight -import androidx.core.view.marginTop -import androidx.core.view.updateLayoutParams -import androidx.lifecycle.Lifecycle -import androidx.lifecycle.repeatOnLifecycle -import com.android.app.animation.Interpolators -import com.android.app.tracing.coroutines.launchTraced as launch -import com.android.systemui.animation.ActivityTransitionAnimator -import com.android.systemui.animation.Expandable -import com.android.systemui.animation.view.LaunchableLinearLayout -import com.android.systemui.common.shared.model.Icon -import com.android.systemui.common.ui.binder.IconViewBinder -import com.android.systemui.common.ui.binder.TextViewBinder -import com.android.systemui.keyguard.ui.viewmodel.KeyguardBottomAreaViewModel -import com.android.systemui.keyguard.ui.viewmodel.KeyguardQuickAffordanceViewModel -import com.android.systemui.keyguard.util.WallpaperPickerIntentUtils -import com.android.systemui.keyguard.util.WallpaperPickerIntentUtils.LAUNCH_SOURCE_KEYGUARD -import com.android.systemui.lifecycle.repeatWhenAttached -import com.android.systemui.plugins.ActivityStarter -import com.android.systemui.plugins.FalsingManager -import com.android.systemui.res.R -import com.android.systemui.statusbar.VibratorHelper -import com.android.systemui.util.doOnEnd -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.combine -import kotlinx.coroutines.flow.distinctUntilChanged -import kotlinx.coroutines.flow.filter -import kotlinx.coroutines.flow.flatMapLatest -import kotlinx.coroutines.flow.map - -/** - * Binds a keyguard bottom area view to its view-model. - * - * To use this properly, users should maintain a one-to-one relationship between the [View] and the - * view-binding, binding each view only once. It is okay and expected for the same instance of the - * view-model to be reused for multiple view/view-binder bindings. - */ -@OptIn(ExperimentalCoroutinesApi::class) -@Deprecated("Deprecated as part of b/278057014") -object KeyguardBottomAreaViewBinder { - - private const val EXIT_DOZE_BUTTON_REVEAL_ANIMATION_DURATION_MS = 250L - private const val SCALE_SELECTED_BUTTON = 1.23f - private const val DIM_ALPHA = 0.3f - private const val TAG = "KeyguardBottomAreaViewBinder" - - /** - * Defines interface for an object that acts as the binding between the view and its view-model. - * - * Users of the [KeyguardBottomAreaViewBinder] class should use this to control the binder after - * it is bound. - */ - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] - @Deprecated("Deprecated as part of b/278057014") - interface Binding { - /** Notifies that device configuration has changed. */ - fun onConfigurationChanged() - - /** - * Returns whether the keyguard bottom area should be constrained to the top of the lock - * icon - */ - fun shouldConstrainToTopOfLockIcon(): Boolean - - /** Destroys this binding, releases resources, and cancels any coroutines. */ - fun destroy() - } - - /** Binds the view to the view-model, continuing to update the former based on the latter. */ - @Deprecated("Deprecated as part of b/278057014") - @SuppressLint("ClickableViewAccessibility") - @JvmStatic - fun bind( - view: ViewGroup, - viewModel: KeyguardBottomAreaViewModel, - falsingManager: FalsingManager?, - vibratorHelper: VibratorHelper?, - activityStarter: ActivityStarter?, - messageDisplayer: (Int) -> Unit, - ): Binding { - val ambientIndicationArea: View? = view.findViewById(R.id.ambient_indication_container) - val startButton: ImageView = view.requireViewById(R.id.start_button) - val endButton: ImageView = view.requireViewById(R.id.end_button) - val overlayContainer: View = view.requireViewById(R.id.overlay_container) - val settingsMenu: LaunchableLinearLayout = - view.requireViewById(R.id.keyguard_settings_button) - - startButton.setOnApplyWindowInsetsListener { inView, windowInsets -> - val bottomInset = windowInsets.displayCutout?.safeInsetBottom ?: 0 - val marginBottom = - inView.resources.getDimension(R.dimen.keyguard_affordance_vertical_offset).toInt() - inView.layoutParams = - (inView.layoutParams as MarginLayoutParams).apply { - setMargins( - inView.marginLeft, - inView.marginTop, - inView.marginRight, - marginBottom + bottomInset - ) - } - WindowInsets.CONSUMED - } - - endButton.setOnApplyWindowInsetsListener { inView, windowInsets -> - val bottomInset = windowInsets.displayCutout?.safeInsetBottom ?: 0 - val marginBottom = - inView.resources.getDimension(R.dimen.keyguard_affordance_vertical_offset).toInt() - inView.layoutParams = - (inView.layoutParams as MarginLayoutParams).apply { - setMargins( - inView.marginLeft, - inView.marginTop, - inView.marginRight, - marginBottom + bottomInset - ) - } - WindowInsets.CONSUMED - } - - view.clipChildren = false - view.clipToPadding = false - view.setOnTouchListener { _, event -> - if (settingsMenu.isVisible) { - val hitRect = Rect() - settingsMenu.getHitRect(hitRect) - if (!hitRect.contains(event.x.toInt(), event.y.toInt())) { - viewModel.onTouchedOutsideLockScreenSettingsMenu() - } - } - - false - } - - val configurationBasedDimensions = MutableStateFlow(loadFromResources(view)) - - val disposableHandle = - view.repeatWhenAttached { - repeatOnLifecycle(Lifecycle.State.STARTED) { - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] - launch("$TAG#viewModel.startButton") { - viewModel.startButton.collect { buttonModel -> - updateButton( - view = startButton, - viewModel = buttonModel, - falsingManager = falsingManager, - messageDisplayer = messageDisplayer, - vibratorHelper = vibratorHelper, - ) - } - } - - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] - launch("$TAG#viewModel.endButton") { - viewModel.endButton.collect { buttonModel -> - updateButton( - view = endButton, - viewModel = buttonModel, - falsingManager = falsingManager, - messageDisplayer = messageDisplayer, - vibratorHelper = vibratorHelper, - ) - } - } - - launch("$TAG#viewModel.isOverlayContainerVisible") { - viewModel.isOverlayContainerVisible.collect { isVisible -> - overlayContainer.visibility = - if (isVisible) { - View.VISIBLE - } else { - View.INVISIBLE - } - } - } - - launch("$TAG#viewModel.alpha") { - viewModel.alpha.collect { alpha -> - ambientIndicationArea?.apply { - this.importantForAccessibility = - if (alpha == 0f) { - View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS - } else { - View.IMPORTANT_FOR_ACCESSIBILITY_AUTO - } - this.alpha = alpha - } - } - } - - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] - launch("$TAG#updateButtonAlpha") { - updateButtonAlpha( - view = startButton, - viewModel = viewModel.startButton, - alphaFlow = viewModel.alpha, - ) - } - - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] - launch("$TAG#updateButtonAlpha") { - updateButtonAlpha( - view = endButton, - viewModel = viewModel.endButton, - alphaFlow = viewModel.alpha, - ) - } - - launch("$TAG#viewModel.indicationAreaTranslationX") { - viewModel.indicationAreaTranslationX.collect { translationX -> - ambientIndicationArea?.translationX = translationX - } - } - - launch("$TAG#viewModel.indicationAreaTranslationY") { - configurationBasedDimensions - .map { it.defaultBurnInPreventionYOffsetPx } - .flatMapLatest { defaultBurnInOffsetY -> - viewModel.indicationAreaTranslationY(defaultBurnInOffsetY) - } - .collect { translationY -> - ambientIndicationArea?.translationY = translationY - } - } - - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] - launch("$TAG#startButton.updateLayoutParams<ViewGroup") { - configurationBasedDimensions.collect { dimensions -> - startButton.updateLayoutParams<ViewGroup.LayoutParams> { - width = dimensions.buttonSizePx.width - height = dimensions.buttonSizePx.height - } - endButton.updateLayoutParams<ViewGroup.LayoutParams> { - width = dimensions.buttonSizePx.width - height = dimensions.buttonSizePx.height - } - } - } - - launch("$TAG#viewModel.settingsMenuViewModel") { - viewModel.settingsMenuViewModel.isVisible.distinctUntilChanged().collect { - isVisible -> - settingsMenu.animateVisibility(visible = isVisible) - if (isVisible) { - vibratorHelper?.vibrate(KeyguardBottomAreaVibrations.Activated) - settingsMenu.setOnTouchListener( - KeyguardSettingsButtonOnTouchListener( - viewModel = viewModel.settingsMenuViewModel, - ) - ) - IconViewBinder.bind( - icon = viewModel.settingsMenuViewModel.icon, - view = settingsMenu.requireViewById(R.id.icon), - ) - TextViewBinder.bind( - view = settingsMenu.requireViewById(R.id.text), - viewModel = viewModel.settingsMenuViewModel.text, - ) - } - } - } - - // activityStarter will only be null when rendering the preview that - // shows up in the Wallpaper Picker app. If we do that, then the - // settings menu should never be visible. - if (activityStarter != null) { - launch("$TAG#viewModel.settingsMenuViewModel") { - viewModel.settingsMenuViewModel.shouldOpenSettings - .filter { it } - .collect { - navigateToLockScreenSettings( - activityStarter = activityStarter, - view = settingsMenu, - ) - viewModel.settingsMenuViewModel.onSettingsShown() - } - } - } - } - } - - return object : Binding { - override fun onConfigurationChanged() { - configurationBasedDimensions.value = loadFromResources(view) - } - - override fun shouldConstrainToTopOfLockIcon(): Boolean = - viewModel.shouldConstrainToTopOfLockIcon() - - override fun destroy() { - disposableHandle.dispose() - } - } - } - - @Deprecated("Deprecated as part of b/278057014") - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] - @SuppressLint("ClickableViewAccessibility") - private fun updateButton( - view: ImageView, - viewModel: KeyguardQuickAffordanceViewModel, - falsingManager: FalsingManager?, - messageDisplayer: (Int) -> Unit, - vibratorHelper: VibratorHelper?, - ) { - if (!viewModel.isVisible) { - view.isInvisible = true - return - } - - if (!view.isVisible) { - view.isVisible = true - if (viewModel.animateReveal) { - view.alpha = 0f - view.translationY = view.height / 2f - view - .animate() - .alpha(1f) - .translationY(0f) - .setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN) - .setDuration(EXIT_DOZE_BUTTON_REVEAL_ANIMATION_DURATION_MS) - .start() - } - } - - IconViewBinder.bind(viewModel.icon, view) - - (view.drawable as? Animatable2)?.let { animatable -> - (viewModel.icon as? Icon.Resource)?.res?.let { iconResourceId -> - // Always start the animation (we do call stop() below, if we need to skip it). - animatable.start() - - if (view.tag != iconResourceId) { - // Here when we haven't run the animation on a previous update. - // - // Save the resource ID for next time, so we know not to re-animate the same - // animation again. - view.tag = iconResourceId - } else { - // Here when we've already done this animation on a previous update and want to - // skip directly to the final frame of the animation to avoid running it. - // - // By calling stop after start, we go to the final frame of the animation. - animatable.stop() - } - } - } - - view.isActivated = viewModel.isActivated - view.drawable.setTint( - view.context.getColor( - if (viewModel.isActivated) { - com.android.internal.R.color.materialColorOnPrimaryFixed - } else { - com.android.internal.R.color.materialColorOnSurface - } - ) - ) - - view.backgroundTintList = - if (!viewModel.isSelected) { - ColorStateList.valueOf( - view.context.getColor( - if (viewModel.isActivated) { - com.android.internal.R.color.materialColorPrimaryFixed - } else { - com.android.internal.R.color.materialColorSurfaceContainerHigh - } - ) - ) - } else { - null - } - view - .animate() - .scaleX(if (viewModel.isSelected) SCALE_SELECTED_BUTTON else 1f) - .scaleY(if (viewModel.isSelected) SCALE_SELECTED_BUTTON else 1f) - .start() - - view.isClickable = viewModel.isClickable - if (viewModel.isClickable) { - if (viewModel.useLongPress) { - val onTouchListener = - KeyguardQuickAffordanceOnTouchListener( - view, - viewModel, - messageDisplayer, - vibratorHelper, - falsingManager, - ) - view.setOnTouchListener(onTouchListener) - view.setOnClickListener { - messageDisplayer.invoke(R.string.keyguard_affordance_press_too_short) - val amplitude = - view.context.resources - .getDimensionPixelSize(R.dimen.keyguard_affordance_shake_amplitude) - .toFloat() - val shakeAnimator = - ObjectAnimator.ofFloat( - view, - "translationX", - -amplitude / 2, - amplitude / 2, - ) - shakeAnimator.duration = - KeyguardBottomAreaVibrations.ShakeAnimationDuration.inWholeMilliseconds - shakeAnimator.interpolator = - CycleInterpolator(KeyguardBottomAreaVibrations.ShakeAnimationCycles) - shakeAnimator.doOnEnd { view.translationX = 0f } - shakeAnimator.start() - - vibratorHelper?.vibrate(KeyguardBottomAreaVibrations.Shake) - } - view.onLongClickListener = - OnLongClickListener(falsingManager, viewModel, vibratorHelper, onTouchListener) - } else { - view.setOnClickListener(OnClickListener(viewModel, checkNotNull(falsingManager))) - } - } else { - view.onLongClickListener = null - view.setOnClickListener(null) - view.setOnTouchListener(null) - } - - view.isSelected = viewModel.isSelected - } - - @Deprecated("Deprecated as part of b/278057014") - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] - private suspend fun updateButtonAlpha( - view: View, - viewModel: Flow<KeyguardQuickAffordanceViewModel>, - alphaFlow: Flow<Float>, - ) { - combine(viewModel.map { it.isDimmed }, alphaFlow) { isDimmed, alpha -> - if (isDimmed) DIM_ALPHA else alpha - } - .collect { view.alpha = it } - } - - @Deprecated("Deprecated as part of b/278057014") - private fun View.animateVisibility(visible: Boolean) { - animate() - .withStartAction { - if (visible) { - alpha = 0f - isVisible = true - } - } - .alpha(if (visible) 1f else 0f) - .withEndAction { - if (!visible) { - isVisible = false - } - } - .start() - } - - @Deprecated("Deprecated as part of b/278057014") - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] - private class OnLongClickListener( - private val falsingManager: FalsingManager?, - private val viewModel: KeyguardQuickAffordanceViewModel, - private val vibratorHelper: VibratorHelper?, - private val onTouchListener: KeyguardQuickAffordanceOnTouchListener - ) : View.OnLongClickListener { - override fun onLongClick(view: View): Boolean { - if (falsingManager?.isFalseLongTap(FalsingManager.MODERATE_PENALTY) == true) { - return true - } - - if (viewModel.configKey != null) { - viewModel.onClicked( - KeyguardQuickAffordanceViewModel.OnClickedParameters( - configKey = viewModel.configKey, - expandable = Expandable.fromView(view), - slotId = viewModel.slotId, - ) - ) - vibratorHelper?.vibrate( - if (viewModel.isActivated) { - KeyguardBottomAreaVibrations.Activated - } else { - KeyguardBottomAreaVibrations.Deactivated - } - ) - } - - onTouchListener.cancel() - return true - } - - override fun onLongClickUseDefaultHapticFeedback(view: View) = false - } - - @Deprecated("Deprecated as part of b/278057014") - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] - private class OnClickListener( - private val viewModel: KeyguardQuickAffordanceViewModel, - private val falsingManager: FalsingManager, - ) : View.OnClickListener { - override fun onClick(view: View) { - if (falsingManager.isFalseTap(FalsingManager.LOW_PENALTY)) { - return - } - - if (viewModel.configKey != null) { - viewModel.onClicked( - KeyguardQuickAffordanceViewModel.OnClickedParameters( - configKey = viewModel.configKey, - expandable = Expandable.fromView(view), - slotId = viewModel.slotId, - ) - ) - } - } - } - - @Deprecated("Deprecated as part of b/278057014") - private fun loadFromResources(view: View): ConfigurationBasedDimensions { - return ConfigurationBasedDimensions( - defaultBurnInPreventionYOffsetPx = - view.resources.getDimensionPixelOffset(R.dimen.default_burn_in_prevention_offset), - buttonSizePx = - Size( - view.resources.getDimensionPixelSize(R.dimen.keyguard_affordance_fixed_width), - view.resources.getDimensionPixelSize(R.dimen.keyguard_affordance_fixed_height), - ), - ) - } - - @Deprecated("Deprecated as part of b/278057014") - /** Opens the wallpaper picker screen after the device is unlocked by the user. */ - private fun navigateToLockScreenSettings( - activityStarter: ActivityStarter, - view: View, - ) { - activityStarter.postStartActivityDismissingKeyguard( - WallpaperPickerIntentUtils.getIntent(view.context, LAUNCH_SOURCE_KEYGUARD), - /* delay= */ 0, - /* animationController= */ ActivityTransitionAnimator.Controller.fromView(view), - /* customMessage= */ view.context.getString(R.string.keyguard_unlock_to_customize_ls) - ) - } - - @Deprecated("Deprecated as part of b/278057014") - // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] - private data class ConfigurationBasedDimensions( - val defaultBurnInPreventionYOffsetPx: Int, - val buttonSizePx: Size, - ) -} diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardIndicationAreaBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardIndicationAreaBinder.kt index 8b947a3bcb1e..92b49ed6156c 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardIndicationAreaBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardIndicationAreaBinder.kt @@ -23,8 +23,6 @@ import android.widget.TextView import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.app.tracing.coroutines.launchTraced as launch -import com.android.systemui.keyguard.KeyguardBottomAreaRefactor -import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.ui.viewmodel.KeyguardIndicationAreaViewModel import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.res.R @@ -75,16 +73,6 @@ object KeyguardIndicationAreaBinder { disposables += view.repeatWhenAttached { repeatOnLifecycle(Lifecycle.State.STARTED) { - launch("$TAG#viewModel.alpha") { - // Do not independently apply alpha, as [KeyguardRootViewModel] should work - // for this and all its children - if ( - !(MigrateClocksToBlueprint.isEnabled || - KeyguardBottomAreaRefactor.isEnabled) - ) { - viewModel.alpha.collect { alpha -> view.alpha = alpha } - } - } launch("$TAG#viewModel.indicationAreaTranslationX") { viewModel.indicationAreaTranslationX.collect { translationX -> diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt index 5c8a234ec6c4..8725cdd273df 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardQuickAffordanceViewBinder.kt @@ -71,9 +71,6 @@ constructor( /** * Defines interface for an object that acts as the binding between the view and its view-model. - * - * Users of the [KeyguardBottomAreaViewBinder] class should use this to control the binder after - * it is bound. */ interface Binding { /** Notifies that device configuration has changed. */ diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt index f121aabe795a..db671aa4d1da 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt @@ -54,7 +54,6 @@ import com.android.systemui.common.ui.view.onLayoutChanged import com.android.systemui.common.ui.view.onTouchListener import com.android.systemui.customization.R as customR import com.android.systemui.deviceentry.domain.interactor.DeviceEntryHapticsInteractor -import com.android.systemui.keyguard.KeyguardBottomAreaRefactor import com.android.systemui.keyguard.KeyguardViewMediator import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor @@ -95,7 +94,6 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.update -import com.android.app.tracing.coroutines.launchTraced as launch /** Bind occludingAppDeviceEntryMessageViewModel to run whenever the keyguard view is attached. */ @OptIn(ExperimentalCoroutinesApi::class) @@ -125,35 +123,33 @@ object KeyguardRootViewBinder { val disposables = DisposableHandles() val childViews = mutableMapOf<Int, View>() - if (KeyguardBottomAreaRefactor.isEnabled) { - disposables += - view.onTouchListener { _, event -> - var consumed = false - if (falsingManager?.isFalseTap(FalsingManager.LOW_PENALTY) == false) { - // signifies a primary button click down has reached keyguardrootview - // we need to return true here otherwise an ACTION_UP will never arrive - if (Flags.nonTouchscreenDevicesBypassFalsing()) { - if ( - event.action == MotionEvent.ACTION_DOWN && - event.buttonState == MotionEvent.BUTTON_PRIMARY && - !event.isTouchscreenSource() - ) { - consumed = true - } else if ( - event.action == MotionEvent.ACTION_UP && - !event.isTouchscreenSource() - ) { - statusBarKeyguardViewManager?.showBouncer(true) - consumed = true - } + disposables += + view.onTouchListener { _, event -> + var consumed = false + if (falsingManager?.isFalseTap(FalsingManager.LOW_PENALTY) == false) { + // signifies a primary button click down has reached keyguardrootview + // we need to return true here otherwise an ACTION_UP will never arrive + if (Flags.nonTouchscreenDevicesBypassFalsing()) { + if ( + event.action == MotionEvent.ACTION_DOWN && + event.buttonState == MotionEvent.BUTTON_PRIMARY && + !event.isTouchscreenSource() + ) { + consumed = true + } else if ( + event.action == MotionEvent.ACTION_UP && + !event.isTouchscreenSource() + ) { + statusBarKeyguardViewManager?.showBouncer(true) + consumed = true } - viewModel.setRootViewLastTapPosition( - Point(event.x.toInt(), event.y.toInt()) - ) } - consumed + viewModel.setRootViewLastTapPosition( + Point(event.x.toInt(), event.y.toInt()) + ) } - } + consumed + } val burnInParams = MutableStateFlow(BurnInParameters()) val viewState = ViewStateAccessor(alpha = { view.alpha }) @@ -183,10 +179,8 @@ object KeyguardRootViewBinder { launch("$TAG#alpha") { viewModel.alpha(viewState).collect { alpha -> view.alpha = alpha - if (KeyguardBottomAreaRefactor.isEnabled) { - childViews[statusViewId]?.alpha = alpha - childViews[burnInLayerId]?.alpha = alpha - } + childViews[statusViewId]?.alpha = alpha + childViews[burnInLayerId]?.alpha = alpha } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt index 85725d24758d..090b65922d2d 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/preview/KeyguardPreviewRenderer.kt @@ -48,39 +48,28 @@ import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID import androidx.constraintlayout.widget.ConstraintSet.START import androidx.constraintlayout.widget.ConstraintSet.TOP import androidx.core.view.isInvisible -import com.android.app.tracing.coroutines.launchTraced as launch import com.android.internal.policy.SystemBarUtils import com.android.keyguard.ClockEventController import com.android.keyguard.KeyguardClockSwitch import com.android.systemui.animation.view.LaunchableImageView import com.android.systemui.biometrics.domain.interactor.UdfpsOverlayInteractor import com.android.systemui.broadcast.BroadcastDispatcher -import com.android.systemui.common.ui.ConfigurationState import com.android.systemui.communal.ui.binder.CommunalTutorialIndicatorViewBinder import com.android.systemui.communal.ui.viewmodel.CommunalTutorialIndicatorViewModel import com.android.systemui.coroutines.newTracingContext -import com.android.systemui.customization.R as customR import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dagger.qualifiers.Main -import com.android.systemui.keyguard.KeyguardBottomAreaRefactor import com.android.systemui.keyguard.MigrateClocksToBlueprint -import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor import com.android.systemui.keyguard.shared.model.ClockSizeSetting import com.android.systemui.keyguard.ui.binder.KeyguardPreviewClockViewBinder import com.android.systemui.keyguard.ui.binder.KeyguardPreviewSmartspaceViewBinder import com.android.systemui.keyguard.ui.binder.KeyguardQuickAffordanceViewBinder -import com.android.systemui.keyguard.ui.binder.KeyguardRootViewBinder import com.android.systemui.keyguard.ui.view.KeyguardRootView import com.android.systemui.keyguard.ui.view.layout.sections.DefaultShortcutsSection -import com.android.systemui.keyguard.ui.viewmodel.KeyguardBlueprintViewModel -import com.android.systemui.keyguard.ui.viewmodel.KeyguardBottomAreaViewModel -import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel import com.android.systemui.keyguard.ui.viewmodel.KeyguardPreviewClockViewModel import com.android.systemui.keyguard.ui.viewmodel.KeyguardPreviewSmartspaceViewModel import com.android.systemui.keyguard.ui.viewmodel.KeyguardQuickAffordancesCombinedViewModel -import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel -import com.android.systemui.keyguard.ui.viewmodel.OccludingAppDeviceEntryMessageViewModel import com.android.systemui.monet.ColorScheme import com.android.systemui.monet.Style import com.android.systemui.plugins.clocks.ClockController @@ -97,9 +86,6 @@ import com.android.systemui.shared.keyguard.shared.model.KeyguardQuickAffordance import com.android.systemui.shared.quickaffordance.shared.model.KeyguardPreviewConstants import com.android.systemui.statusbar.KeyguardIndicationController import com.android.systemui.statusbar.lockscreen.LockscreenSmartspaceController -import com.android.systemui.statusbar.phone.KeyguardBottomAreaView -import com.android.systemui.statusbar.phone.ScreenOffAnimationController -import com.android.systemui.temporarydisplay.chipbar.ChipbarCoordinator import com.android.systemui.util.kotlin.DisposableHandles import com.android.systemui.util.settings.SecureSettings import dagger.assisted.Assisted @@ -115,6 +101,8 @@ import kotlinx.coroutines.runBlocking import kotlinx.coroutines.withContext import org.json.JSONException import org.json.JSONObject +import com.android.app.tracing.coroutines.launchTraced as launch +import com.android.systemui.customization.R as customR /** Renders the preview of the lock screen. */ class KeyguardPreviewRenderer @@ -128,29 +116,20 @@ constructor( @Background private val backgroundDispatcher: CoroutineDispatcher, private val clockViewModel: KeyguardPreviewClockViewModel, private val smartspaceViewModel: KeyguardPreviewSmartspaceViewModel, - private val bottomAreaViewModel: KeyguardBottomAreaViewModel, private val quickAffordancesCombinedViewModel: KeyguardQuickAffordancesCombinedViewModel, displayManager: DisplayManager, private val windowManager: WindowManager, - private val configuration: ConfigurationState, private val clockController: ClockEventController, private val clockRegistry: ClockRegistry, private val broadcastDispatcher: BroadcastDispatcher, private val lockscreenSmartspaceController: LockscreenSmartspaceController, private val udfpsOverlayInteractor: UdfpsOverlayInteractor, private val indicationController: KeyguardIndicationController, - private val keyguardRootViewModel: KeyguardRootViewModel, - private val keyguardBlueprintViewModel: KeyguardBlueprintViewModel, @Assisted bundle: Bundle, - private val occludingAppDeviceEntryMessageViewModel: OccludingAppDeviceEntryMessageViewModel, - private val chipbarCoordinator: ChipbarCoordinator, - private val screenOffAnimationController: ScreenOffAnimationController, private val shadeInteractor: ShadeInteractor, private val secureSettings: SecureSettings, private val communalTutorialViewModel: CommunalTutorialIndicatorViewModel, private val defaultShortcutsSection: DefaultShortcutsSection, - private val keyguardClockInteractor: KeyguardClockInteractor, - private val keyguardClockViewModel: KeyguardClockViewModel, private val keyguardQuickAffordanceViewBinder: KeyguardQuickAffordanceViewBinder, ) { val hostToken: IBinder? = bundle.getBinder(KEY_HOST_TOKEN) @@ -201,20 +180,12 @@ constructor( disposables += DisposableHandle { coroutineScope.cancel() } clockController.setFallbackWeatherData(WeatherData.getPlaceholderWeatherData()) - if (KeyguardBottomAreaRefactor.isEnabled) { - quickAffordancesCombinedViewModel.enablePreviewMode( - initiallySelectedSlotId = - bundle.getString(KeyguardPreviewConstants.KEY_INITIALLY_SELECTED_SLOT_ID) - ?: KeyguardQuickAffordanceSlots.SLOT_ID_BOTTOM_START, - shouldHighlightSelectedAffordance = shouldHighlightSelectedAffordance, - ) - } else { - bottomAreaViewModel.enablePreviewMode( - initiallySelectedSlotId = - bundle.getString(KeyguardPreviewConstants.KEY_INITIALLY_SELECTED_SLOT_ID), - shouldHighlightSelectedAffordance = shouldHighlightSelectedAffordance, - ) - } + quickAffordancesCombinedViewModel.enablePreviewMode( + initiallySelectedSlotId = + bundle.getString(KeyguardPreviewConstants.KEY_INITIALLY_SELECTED_SLOT_ID) + ?: KeyguardQuickAffordanceSlots.SLOT_ID_BOTTOM_START, + shouldHighlightSelectedAffordance = shouldHighlightSelectedAffordance, + ) if (MigrateClocksToBlueprint.isEnabled) { clockViewModel.shouldHighlightSelectedAffordance = shouldHighlightSelectedAffordance } @@ -241,10 +212,6 @@ constructor( setupKeyguardRootView(previewContext, rootView) - if (!KeyguardBottomAreaRefactor.isEnabled) { - setUpBottomArea(rootView) - } - var displayInfo: DisplayInfo? = null display?.let { displayInfo = DisplayInfo() @@ -292,11 +259,7 @@ constructor( } fun onSlotSelected(slotId: String) { - if (KeyguardBottomAreaRefactor.isEnabled) { - quickAffordancesCombinedViewModel.onPreviewSlotSelected(slotId = slotId) - } else { - bottomAreaViewModel.onPreviewSlotSelected(slotId = slotId) - } + quickAffordancesCombinedViewModel.onPreviewSlotSelected(slotId = slotId) } fun onPreviewQuickAffordanceSelected(slotId: String, quickAffordanceId: String) { @@ -322,9 +285,7 @@ constructor( isDestroyed = true lockscreenSmartspaceController.disconnect() disposables.dispose() - if (KeyguardBottomAreaRefactor.isEnabled) { - shortcutsBindings.forEach { it.destroy() } - } + shortcutsBindings.forEach { it.destroy() } } /** @@ -387,47 +348,8 @@ constructor( smartSpaceView?.alpha = if (shouldHighlightSelectedAffordance) DIM_ALPHA else 1.0f } - @Deprecated("Deprecated as part of b/278057014") - private fun setUpBottomArea(parentView: ViewGroup) { - val bottomAreaView = - LayoutInflater.from(context).inflate(R.layout.keyguard_bottom_area, parentView, false) - as KeyguardBottomAreaView - bottomAreaView.init(viewModel = bottomAreaViewModel) - parentView.addView( - bottomAreaView, - FrameLayout.LayoutParams( - FrameLayout.LayoutParams.MATCH_PARENT, - FrameLayout.LayoutParams.MATCH_PARENT, - ), - ) - } - - @OptIn(ExperimentalCoroutinesApi::class) private fun setupKeyguardRootView(previewContext: Context, rootView: FrameLayout) { val keyguardRootView = KeyguardRootView(previewContext, null) - if (!KeyguardBottomAreaRefactor.isEnabled) { - disposables += - KeyguardRootViewBinder.bind( - keyguardRootView, - keyguardRootViewModel, - keyguardBlueprintViewModel, - configuration, - occludingAppDeviceEntryMessageViewModel, - chipbarCoordinator, - screenOffAnimationController, - shadeInteractor, - keyguardClockInteractor, - keyguardClockViewModel, - null, // jank monitor not required for preview mode - null, // device entry haptics not required preview mode - null, // device entry haptics not required for preview mode - null, // falsing manager not required for preview mode - null, // keyguard view mediator is not required for preview mode - null, // primary bouncer interactor is not required for preview mode - mainDispatcher, - null, - ) - } rootView.addView( keyguardRootView, FrameLayout.LayoutParams( @@ -441,9 +363,7 @@ constructor( if (MigrateClocksToBlueprint.isEnabled) keyguardRootView else rootView, ) - if (KeyguardBottomAreaRefactor.isEnabled) { - setupShortcuts(keyguardRootView) - } + setupShortcuts(keyguardRootView) if (!shouldHideClock) { setUpClock(previewContext, rootView) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySection.kt index aa7eb2933992..e8fce9ca4aa8 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySection.kt @@ -22,7 +22,6 @@ import android.graphics.Point import android.graphics.Rect import android.util.DisplayMetrics import android.util.Log -import android.view.View import android.view.WindowManager import androidx.annotation.VisibleForTesting import androidx.constraintlayout.widget.ConstraintLayout @@ -32,8 +31,6 @@ import com.android.systemui.customization.R as customR import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.Flags -import com.android.systemui.keyguard.KeyguardBottomAreaRefactor -import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.shared.model.KeyguardSection import com.android.systemui.keyguard.ui.binder.DeviceEntryIconViewBinder import com.android.systemui.keyguard.ui.view.DeviceEntryIconView @@ -76,10 +73,6 @@ constructor( private var disposableHandle: DisposableHandle? = null override fun addViews(constraintLayout: ConstraintLayout) { - if (!KeyguardBottomAreaRefactor.isEnabled && !MigrateClocksToBlueprint.isEnabled) { - return - } - val view = DeviceEntryIconView( context, @@ -194,38 +187,6 @@ constructor( sensorRect.left, ) } - - // This is only intended to be here until the KeyguardBottomAreaRefactor flag is enabled - // Without this logic, the lock icon location changes but the KeyguardBottomAreaView is not - // updated and visible ui layout jank occurs. This is due to AmbientIndicationContainer - // being in NPVC and laying out prior to the KeyguardRootView. - // Remove when KeyguardBottomAreaRefactor is enabled. - if (!KeyguardBottomAreaRefactor.isEnabled) { - with(notificationPanelView) { - val isUdfpsSupported = deviceEntryIconViewModel.get().isUdfpsSupported.value - val bottomAreaViewRight = findViewById<View>(R.id.keyguard_bottom_area)?.right ?: 0 - findViewById<View>(R.id.ambient_indication_container)?.let { - val (ambientLeft, ambientTop) = it.locationOnScreen - if (isUdfpsSupported) { - // make top of ambient indication view the bottom of the lock icon - it.layout( - ambientLeft, - sensorRect.bottom, - bottomAreaViewRight - ambientLeft, - ambientTop + it.measuredHeight, - ) - } else { - // make bottom of ambient indication view the top of the lock icon - it.layout( - ambientLeft, - sensorRect.top - it.measuredHeight, - bottomAreaViewRight - ambientLeft, - sensorRect.top, - ) - } - } - } - } } companion object { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultIndicationAreaSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultIndicationAreaSection.kt index 2d9dac41ba6e..5bf56e8de9a7 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultIndicationAreaSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultIndicationAreaSection.kt @@ -21,7 +21,6 @@ import android.content.Context import android.view.ViewGroup import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet -import com.android.systemui.keyguard.KeyguardBottomAreaRefactor import com.android.systemui.keyguard.shared.model.KeyguardSection import com.android.systemui.keyguard.ui.binder.KeyguardIndicationAreaBinder import com.android.systemui.keyguard.ui.view.KeyguardIndicationArea @@ -43,21 +42,17 @@ constructor( private var indicationAreaHandle: DisposableHandle? = null override fun addViews(constraintLayout: ConstraintLayout) { - if (KeyguardBottomAreaRefactor.isEnabled) { - val view = KeyguardIndicationArea(context, null) - constraintLayout.addView(view) - } + val view = KeyguardIndicationArea(context, null) + constraintLayout.addView(view) } override fun bindData(constraintLayout: ConstraintLayout) { - if (KeyguardBottomAreaRefactor.isEnabled) { - indicationAreaHandle = - KeyguardIndicationAreaBinder.bind( - constraintLayout.requireViewById(R.id.keyguard_indication_area), - keyguardIndicationAreaViewModel, - indicationController, - ) - } + indicationAreaHandle = + KeyguardIndicationAreaBinder.bind( + constraintLayout.requireViewById(R.id.keyguard_indication_area), + keyguardIndicationAreaViewModel, + indicationController, + ) } override fun applyConstraints(constraintSet: ConstraintSet) { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultSettingsPopupMenuSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultSettingsPopupMenuSection.kt index 5cd5172d1851..f973ced59dcf 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultSettingsPopupMenuSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultSettingsPopupMenuSection.kt @@ -31,7 +31,6 @@ import androidx.constraintlayout.widget.ConstraintSet.WRAP_CONTENT import androidx.core.view.isVisible import com.android.systemui.animation.view.LaunchableLinearLayout import com.android.systemui.dagger.qualifiers.Main -import com.android.systemui.keyguard.KeyguardBottomAreaRefactor import com.android.systemui.keyguard.shared.model.KeyguardSection import com.android.systemui.keyguard.ui.binder.KeyguardSettingsViewBinder import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel @@ -56,9 +55,6 @@ constructor( private var settingsPopupMenuHandle: DisposableHandle? = null override fun addViews(constraintLayout: ConstraintLayout) { - if (!KeyguardBottomAreaRefactor.isEnabled) { - return - } val view = LayoutInflater.from(constraintLayout.context) .inflate(R.layout.keyguard_settings_popup_menu, constraintLayout, false) @@ -71,17 +67,15 @@ constructor( } override fun bindData(constraintLayout: ConstraintLayout) { - if (KeyguardBottomAreaRefactor.isEnabled) { - settingsPopupMenuHandle = - KeyguardSettingsViewBinder.bind( - constraintLayout.requireViewById<View>(R.id.keyguard_settings_button), - keyguardSettingsMenuViewModel, - keyguardTouchHandlingViewModel, - keyguardRootViewModel, - vibratorHelper, - activityStarter, - ) - } + settingsPopupMenuHandle = + KeyguardSettingsViewBinder.bind( + constraintLayout.requireViewById<View>(R.id.keyguard_settings_button), + keyguardSettingsMenuViewModel, + keyguardTouchHandlingViewModel, + keyguardRootViewModel, + vibratorHelper, + activityStarter, + ) } override fun applyConstraints(constraintSet: ConstraintSet) { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultShortcutsSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultShortcutsSection.kt index d3895def28e0..82f142b03323 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultShortcutsSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultShortcutsSection.kt @@ -28,7 +28,6 @@ import androidx.constraintlayout.widget.ConstraintSet.RIGHT import androidx.constraintlayout.widget.ConstraintSet.VISIBILITY_MODE_IGNORE import com.android.systemui.animation.view.LaunchableImageView import com.android.systemui.dagger.qualifiers.Main -import com.android.systemui.keyguard.KeyguardBottomAreaRefactor import com.android.systemui.keyguard.domain.interactor.KeyguardBlueprintInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.keyguard.ui.binder.KeyguardQuickAffordanceViewBinder @@ -49,7 +48,6 @@ constructor( @Named(LOCKSCREEN_INSTANCE) private val keyguardQuickAffordancesCombinedViewModel: KeyguardQuickAffordancesCombinedViewModel, - private val keyguardRootViewModel: KeyguardRootViewModel, private val indicationController: KeyguardIndicationController, private val keyguardBlueprintInteractor: Lazy<KeyguardBlueprintInteractor>, private val keyguardQuickAffordanceViewBinder: KeyguardQuickAffordanceViewBinder, @@ -60,46 +58,42 @@ constructor( private var safeInsetBottom = 0 override fun addViews(constraintLayout: ConstraintLayout) { - if (KeyguardBottomAreaRefactor.isEnabled) { - addLeftShortcut(constraintLayout) - addRightShortcut(constraintLayout) + addLeftShortcut(constraintLayout) + addRightShortcut(constraintLayout) - constraintLayout - .requireViewById<LaunchableImageView>(R.id.start_button) - .setOnApplyWindowInsetsListener { _, windowInsets -> - val tempSafeInset = windowInsets?.displayCutout?.safeInsetBottom ?: 0 - if (safeInsetBottom != tempSafeInset) { - safeInsetBottom = tempSafeInset - keyguardBlueprintInteractor - .get() - .refreshBlueprint(IntraBlueprintTransition.Type.DefaultTransition) - } - WindowInsets.CONSUMED + constraintLayout + .requireViewById<LaunchableImageView>(R.id.start_button) + .setOnApplyWindowInsetsListener { _, windowInsets -> + val tempSafeInset = windowInsets?.displayCutout?.safeInsetBottom ?: 0 + if (safeInsetBottom != tempSafeInset) { + safeInsetBottom = tempSafeInset + keyguardBlueprintInteractor + .get() + .refreshBlueprint(IntraBlueprintTransition.Type.DefaultTransition) } - } + WindowInsets.CONSUMED + } } override fun bindData(constraintLayout: ConstraintLayout) { - if (KeyguardBottomAreaRefactor.isEnabled) { - leftShortcutHandle?.destroy() - leftShortcutHandle = - keyguardQuickAffordanceViewBinder.bind( - constraintLayout.requireViewById(R.id.start_button), - keyguardQuickAffordancesCombinedViewModel.startButton, - keyguardQuickAffordancesCombinedViewModel.transitionAlpha, - ) { - indicationController.showTransientIndication(it) - } - rightShortcutHandle?.destroy() - rightShortcutHandle = - keyguardQuickAffordanceViewBinder.bind( - constraintLayout.requireViewById(R.id.end_button), - keyguardQuickAffordancesCombinedViewModel.endButton, - keyguardQuickAffordancesCombinedViewModel.transitionAlpha, - ) { - indicationController.showTransientIndication(it) - } - } + leftShortcutHandle?.destroy() + leftShortcutHandle = + keyguardQuickAffordanceViewBinder.bind( + constraintLayout.requireViewById(R.id.start_button), + keyguardQuickAffordancesCombinedViewModel.startButton, + keyguardQuickAffordancesCombinedViewModel.transitionAlpha, + ) { + indicationController.showTransientIndication(it) + } + rightShortcutHandle?.destroy() + rightShortcutHandle = + keyguardQuickAffordanceViewBinder.bind( + constraintLayout.requireViewById(R.id.end_button), + keyguardQuickAffordancesCombinedViewModel.endButton, + keyguardQuickAffordancesCombinedViewModel.transitionAlpha, + ) { + indicationController.showTransientIndication(it) + } } override fun applyConstraints(constraintSet: ConstraintSet) { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultUdfpsAccessibilityOverlaySection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultUdfpsAccessibilityOverlaySection.kt index 0ae1400b1906..8186aa3746cf 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultUdfpsAccessibilityOverlaySection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultUdfpsAccessibilityOverlaySection.kt @@ -23,7 +23,6 @@ import androidx.constraintlayout.widget.ConstraintSet import com.android.systemui.deviceentry.ui.binder.UdfpsAccessibilityOverlayBinder import com.android.systemui.deviceentry.ui.view.UdfpsAccessibilityOverlay import com.android.systemui.deviceentry.ui.viewmodel.DeviceEntryUdfpsAccessibilityOverlayViewModel -import com.android.systemui.keyguard.KeyguardBottomAreaRefactor import com.android.systemui.keyguard.shared.model.KeyguardSection import com.android.systemui.res.R import com.android.systemui.shade.ShadeDisplayAware @@ -67,16 +66,12 @@ constructor( ConstraintSet.BOTTOM, ) - if (KeyguardBottomAreaRefactor.isEnabled) { - connect( - viewId, - ConstraintSet.BOTTOM, - R.id.keyguard_indication_area, - ConstraintSet.TOP, - ) - } else { - connect(viewId, ConstraintSet.BOTTOM, ConstraintSet.PARENT_ID, ConstraintSet.BOTTOM) - } + connect( + viewId, + ConstraintSet.BOTTOM, + R.id.keyguard_indication_area, + ConstraintSet.TOP, + ) } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt deleted file mode 100644 index 6fe51ae885be..000000000000 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (C) 2022 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.ui.viewmodel - -import androidx.annotation.VisibleForTesting -import com.android.systemui.doze.util.BurnInHelperWrapper -import com.android.systemui.keyguard.domain.interactor.KeyguardBottomAreaInteractor -import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor -import com.android.systemui.keyguard.domain.interactor.KeyguardQuickAffordanceInteractor -import com.android.systemui.keyguard.domain.model.KeyguardQuickAffordanceModel -import com.android.systemui.keyguard.shared.quickaffordance.ActivationState -import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancePosition -import com.android.systemui.shared.keyguard.shared.model.KeyguardQuickAffordanceSlots -import javax.inject.Inject -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.combine -import kotlinx.coroutines.flow.distinctUntilChanged -import kotlinx.coroutines.flow.flatMapLatest -import kotlinx.coroutines.flow.flowOf -import kotlinx.coroutines.flow.map - -/** View-model for the keyguard bottom area view */ -@OptIn(ExperimentalCoroutinesApi::class) -class KeyguardBottomAreaViewModel -@Inject -constructor( - private val keyguardInteractor: KeyguardInteractor, - private val quickAffordanceInteractor: KeyguardQuickAffordanceInteractor, - private val bottomAreaInteractor: KeyguardBottomAreaInteractor, - private val burnInHelperWrapper: BurnInHelperWrapper, - private val keyguardTouchHandlingViewModel: KeyguardTouchHandlingViewModel, - val settingsMenuViewModel: KeyguardSettingsMenuViewModel, -) { - data class PreviewMode( - val isInPreviewMode: Boolean = false, - val shouldHighlightSelectedAffordance: Boolean = false, - ) - - /** - * Whether this view-model instance is powering the preview experience that renders exclusively - * in the wallpaper picker application. This should _always_ be `false` for the real lock screen - * experience. - */ - val previewMode = MutableStateFlow(PreviewMode()) - - /** - * ID of the slot that's currently selected in the preview that renders exclusively in the - * wallpaper picker application. This is ignored for the actual, real lock screen experience. - */ - private val selectedPreviewSlotId = - MutableStateFlow(KeyguardQuickAffordanceSlots.SLOT_ID_BOTTOM_START) - - /** - * Whether quick affordances are "opaque enough" to be considered visible to and interactive by - * the user. If they are not interactive, user input should not be allowed on them. - * - * Note that there is a margin of error, where we allow very, very slightly transparent views to - * be considered "fully opaque" for the purpose of being interactive. This is to accommodate the - * error margin of floating point arithmetic. - * - * A view that is visible but with an alpha of less than our threshold either means it's not - * fully done fading in or is fading/faded out. Either way, it should not be - * interactive/clickable unless "fully opaque" to avoid issues like in b/241830987. - */ - private val areQuickAffordancesFullyOpaque: Flow<Boolean> = - bottomAreaInteractor.alpha - .map { alpha -> alpha >= AFFORDANCE_FULLY_OPAQUE_ALPHA_THRESHOLD } - .distinctUntilChanged() - - /** An observable for the view-model of the "start button" quick affordance. */ - val startButton: Flow<KeyguardQuickAffordanceViewModel> = - button(KeyguardQuickAffordancePosition.BOTTOM_START) - /** An observable for the view-model of the "end button" quick affordance. */ - val endButton: Flow<KeyguardQuickAffordanceViewModel> = - button(KeyguardQuickAffordancePosition.BOTTOM_END) - /** An observable for whether the overlay container should be visible. */ - val isOverlayContainerVisible: Flow<Boolean> = - keyguardInteractor.isDozing.map { !it }.distinctUntilChanged() - /** An observable for the alpha level for the entire bottom area. */ - val alpha: Flow<Float> = - previewMode.flatMapLatest { - if (it.isInPreviewMode) { - flowOf(1f) - } else { - bottomAreaInteractor.alpha.distinctUntilChanged() - } - } - /** An observable for the x-offset by which the indication area should be translated. */ - val indicationAreaTranslationX: Flow<Float> = - bottomAreaInteractor.clockPosition.map { it.x.toFloat() }.distinctUntilChanged() - - /** Returns an observable for the y-offset by which the indication area should be translated. */ - fun indicationAreaTranslationY(defaultBurnInOffset: Int): Flow<Float> { - return keyguardInteractor.dozeAmount - .map { dozeAmount -> - dozeAmount * - (burnInHelperWrapper.burnInOffset( - /* amplitude = */ defaultBurnInOffset * 2, - /* xAxis= */ false, - ) - defaultBurnInOffset) - } - .distinctUntilChanged() - } - - /** - * Returns whether the keyguard bottom area should be constrained to the top of the lock icon - */ - fun shouldConstrainToTopOfLockIcon(): Boolean = - bottomAreaInteractor.shouldConstrainToTopOfLockIcon() - - /** - * Puts this view-model in "preview mode", which means it's being used for UI that is rendering - * the lock screen preview in wallpaper picker / settings and not the real experience on the - * lock screen. - * - * @param initiallySelectedSlotId The ID of the initial slot to render as the selected one. - * @param shouldHighlightSelectedAffordance Whether the selected quick affordance should be - * highlighted (while all others are dimmed to make the selected one stand out). - */ - fun enablePreviewMode( - initiallySelectedSlotId: String?, - shouldHighlightSelectedAffordance: Boolean, - ) { - previewMode.value = - PreviewMode( - isInPreviewMode = true, - shouldHighlightSelectedAffordance = shouldHighlightSelectedAffordance, - ) - onPreviewSlotSelected( - initiallySelectedSlotId ?: KeyguardQuickAffordanceSlots.SLOT_ID_BOTTOM_START - ) - } - - /** - * Notifies that a slot with the given ID has been selected in the preview experience that is - * rendering in the wallpaper picker. This is ignored for the real lock screen experience. - * - * @see enablePreviewMode - */ - fun onPreviewSlotSelected(slotId: String) { - selectedPreviewSlotId.value = slotId - } - - /** - * Notifies that some input gesture has started somewhere in the bottom area that's outside of - * the lock screen settings menu item pop-up. - */ - fun onTouchedOutsideLockScreenSettingsMenu() { - keyguardTouchHandlingViewModel.onTouchedOutside() - } - - private fun button( - position: KeyguardQuickAffordancePosition - ): Flow<KeyguardQuickAffordanceViewModel> { - return previewMode.flatMapLatest { previewMode -> - combine( - if (previewMode.isInPreviewMode) { - quickAffordanceInteractor.quickAffordanceAlwaysVisible(position = position) - } else { - quickAffordanceInteractor.quickAffordance(position = position) - }, - bottomAreaInteractor.animateDozingTransitions.distinctUntilChanged(), - areQuickAffordancesFullyOpaque, - selectedPreviewSlotId, - quickAffordanceInteractor.useLongPress(), - ) { model, animateReveal, isFullyOpaque, selectedPreviewSlotId, useLongPress -> - val slotId = position.toSlotId() - val isSelected = selectedPreviewSlotId == slotId - model.toViewModel( - animateReveal = !previewMode.isInPreviewMode && animateReveal, - isClickable = isFullyOpaque && !previewMode.isInPreviewMode, - isSelected = - previewMode.isInPreviewMode && - previewMode.shouldHighlightSelectedAffordance && - isSelected, - isDimmed = - previewMode.isInPreviewMode && - previewMode.shouldHighlightSelectedAffordance && - !isSelected, - forceInactive = previewMode.isInPreviewMode, - slotId = slotId, - useLongPress = useLongPress, - ) - } - .distinctUntilChanged() - } - } - - private fun KeyguardQuickAffordanceModel.toViewModel( - animateReveal: Boolean, - isClickable: Boolean, - isSelected: Boolean, - isDimmed: Boolean, - forceInactive: Boolean, - slotId: String, - useLongPress: Boolean, - ): KeyguardQuickAffordanceViewModel { - return when (this) { - is KeyguardQuickAffordanceModel.Visible -> - KeyguardQuickAffordanceViewModel( - configKey = configKey, - isVisible = true, - animateReveal = animateReveal, - icon = icon, - onClicked = { parameters -> - quickAffordanceInteractor.onQuickAffordanceTriggered( - configKey = parameters.configKey, - expandable = parameters.expandable, - slotId = parameters.slotId, - ) - }, - isClickable = isClickable, - isActivated = !forceInactive && activationState is ActivationState.Active, - isSelected = isSelected, - useLongPress = useLongPress, - isDimmed = isDimmed, - slotId = slotId, - ) - is KeyguardQuickAffordanceModel.Hidden -> - KeyguardQuickAffordanceViewModel( - slotId = slotId, - ) - } - } - - companion object { - // We select a value that's less than 1.0 because we want floating point math precision to - // not be a factor in determining whether the affordance UI is fully opaque. The number we - // choose needs to be close enough 1.0 such that the user can't easily tell the difference - // between the UI with an alpha at the threshold and when the alpha is 1.0. At the same - // time, we don't want the number to be too close to 1.0 such that there is a chance that we - // never treat the affordance UI as "fully opaque" as that would risk making it forever not - // clickable. - @VisibleForTesting const val AFFORDANCE_FULLY_OPAQUE_ALPHA_THRESHOLD = 0.95f - } -} diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardIndicationAreaViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardIndicationAreaViewModel.kt index bc3ef02a0ec5..4663a2b3c20c 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardIndicationAreaViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardIndicationAreaViewModel.kt @@ -21,10 +21,8 @@ import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.doze.util.BurnInHelperWrapper -import com.android.systemui.keyguard.KeyguardBottomAreaRefactor import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.keyguard.domain.interactor.BurnInInteractor -import com.android.systemui.keyguard.domain.interactor.KeyguardBottomAreaInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor import com.android.systemui.keyguard.shared.model.BurnInModel @@ -48,8 +46,6 @@ class KeyguardIndicationAreaViewModel @Inject constructor( private val keyguardInteractor: KeyguardInteractor, - bottomAreaInteractor: KeyguardBottomAreaInteractor, - keyguardBottomAreaViewModel: KeyguardBottomAreaViewModel, private val burnInHelperWrapper: BurnInHelperWrapper, burnInInteractor: BurnInInteractor, @Named(KeyguardQuickAffordancesCombinedViewModelModule.Companion.LOCKSCREEN_INSTANCE) @@ -64,9 +60,6 @@ constructor( /** Notifies when a new configuration is set */ val configurationChange: Flow<Unit> = configurationInteractor.onAnyConfigurationChange - /** An observable for the alpha level for the entire bottom area. */ - val alpha: Flow<Float> = keyguardBottomAreaViewModel.alpha - /** An observable for the visibility value for the indication area view. */ val visible: Flow<Boolean> = anyOf( @@ -76,22 +69,12 @@ constructor( /** An observable for whether the indication area should be padded. */ val isIndicationAreaPadded: Flow<Boolean> = - if (KeyguardBottomAreaRefactor.isEnabled) { - combine(shortcutsCombinedViewModel.startButton, shortcutsCombinedViewModel.endButton) { - startButtonModel, - endButtonModel -> - startButtonModel.isVisible || endButtonModel.isVisible - } - .distinctUntilChanged() - } else { - combine( - keyguardBottomAreaViewModel.startButton, - keyguardBottomAreaViewModel.endButton, - ) { startButtonModel, endButtonModel -> - startButtonModel.isVisible || endButtonModel.isVisible - } - .distinctUntilChanged() + combine(shortcutsCombinedViewModel.startButton, shortcutsCombinedViewModel.endButton) { + startButtonModel, + endButtonModel -> + startButtonModel.isVisible || endButtonModel.isVisible } + .distinctUntilChanged() @OptIn(ExperimentalCoroutinesApi::class) private val burnIn: Flow<BurnInModel> = @@ -114,11 +97,7 @@ constructor( /** An observable for the x-offset by which the indication area should be translated. */ val indicationAreaTranslationX: Flow<Float> = - if (MigrateClocksToBlueprint.isEnabled || KeyguardBottomAreaRefactor.isEnabled) { - burnIn.map { it.translationX.toFloat() }.flowOn(mainDispatcher) - } else { - bottomAreaInteractor.clockPosition.map { it.x.toFloat() }.distinctUntilChanged() - } + burnIn.map { it.translationX.toFloat() }.flowOn(mainDispatcher) /** Returns an observable for the y-offset by which the indication area should be translated. */ fun indicationAreaTranslationY(defaultBurnInOffset: Int): Flow<Float> { diff --git a/packages/SystemUI/src/com/android/systemui/scene/shared/flag/SceneContainerFlag.kt b/packages/SystemUI/src/com/android/systemui/scene/shared/flag/SceneContainerFlag.kt index 6097ef53f8df..33bffc2e35ab 100644 --- a/packages/SystemUI/src/com/android/systemui/scene/shared/flag/SceneContainerFlag.kt +++ b/packages/SystemUI/src/com/android/systemui/scene/shared/flag/SceneContainerFlag.kt @@ -22,7 +22,6 @@ import com.android.systemui.Flags.FLAG_SCENE_CONTAINER import com.android.systemui.Flags.sceneContainer import com.android.systemui.flags.FlagToken import com.android.systemui.flags.RefactorFlagUtils -import com.android.systemui.keyguard.KeyguardBottomAreaRefactor import com.android.systemui.keyguard.KeyguardWmStateRefactor import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.statusbar.notification.shared.NotificationThrottleHun @@ -37,7 +36,6 @@ object SceneContainerFlag { inline val isEnabled get() = sceneContainer() && // mainAconfigFlag - KeyguardBottomAreaRefactor.isEnabled && KeyguardWmStateRefactor.isEnabled && MigrateClocksToBlueprint.isEnabled && NotificationThrottleHun.isEnabled && @@ -51,7 +49,6 @@ object SceneContainerFlag { /** The set of secondary flags which must be enabled for scene container to work properly */ inline fun getSecondaryFlags(): Sequence<FlagToken> = sequenceOf( - KeyguardBottomAreaRefactor.token, KeyguardWmStateRefactor.token, MigrateClocksToBlueprint.token, NotificationThrottleHun.token, diff --git a/packages/SystemUI/src/com/android/systemui/shade/DebugDrawable.java b/packages/SystemUI/src/com/android/systemui/shade/DebugDrawable.java index b24edd9beece..d78f4d8238b1 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/DebugDrawable.java +++ b/packages/SystemUI/src/com/android/systemui/shade/DebugDrawable.java @@ -24,7 +24,6 @@ import android.graphics.Paint; import android.graphics.PixelFormat; import android.graphics.drawable.Drawable; -import com.android.keyguard.LockIconViewController; import com.android.systemui.scene.shared.flag.SceneContainerFlag; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController; @@ -39,7 +38,6 @@ public class DebugDrawable extends Drawable { private final NotificationPanelViewController mNotificationPanelViewController; private final NotificationPanelView mView; private final NotificationStackScrollLayoutController mNotificationStackScrollLayoutController; - private final LockIconViewController mLockIconViewController; private final QuickSettingsController mQsController; private final Set<Integer> mDebugTextUsedYPositions; private final Paint mDebugPaint; @@ -48,13 +46,11 @@ public class DebugDrawable extends Drawable { NotificationPanelViewController notificationPanelViewController, NotificationPanelView notificationPanelView, NotificationStackScrollLayoutController notificationStackScrollLayoutController, - LockIconViewController lockIconViewController, QuickSettingsController quickSettingsController ) { mNotificationPanelViewController = notificationPanelViewController; mView = notificationPanelView; mNotificationStackScrollLayoutController = notificationStackScrollLayoutController; - mLockIconViewController = lockIconViewController; mQsController = quickSettingsController; mDebugTextUsedYPositions = new HashSet<>(); mDebugPaint = new Paint(); @@ -91,8 +87,6 @@ public class DebugDrawable extends Drawable { } drawDebugInfo(canvas, mNotificationPanelViewController.getClockPositionResult().clockY, Color.GRAY, "mClockPositionResult.clockY"); - drawDebugInfo(canvas, (int) mLockIconViewController.getTop(), Color.GRAY, - "mLockIconViewController.getTop()"); if (mNotificationPanelViewController.isKeyguardShowing()) { // Notifications have the space between those two lines. diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 3a6c250e55f1..79b9ae26e4e2 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -25,7 +25,6 @@ import static com.android.keyguard.KeyguardClockSwitch.LARGE; import static com.android.keyguard.KeyguardClockSwitch.SMALL; import static com.android.systemui.Flags.msdlFeedback; import static com.android.systemui.Flags.predictiveBackAnimateShade; -import static com.android.systemui.Flags.smartspaceRelocateToBottom; import static com.android.systemui.classifier.Classifier.BOUNCER_UNLOCK; import static com.android.systemui.classifier.Classifier.GENERIC; import static com.android.systemui.classifier.Classifier.QUICK_SETTINGS; @@ -105,7 +104,6 @@ import com.android.keyguard.KeyguardStatusView; import com.android.keyguard.KeyguardStatusViewController; import com.android.keyguard.KeyguardUnfoldTransition; import com.android.keyguard.KeyguardUpdateMonitor; -import com.android.keyguard.LockIconViewController; import com.android.keyguard.dagger.KeyguardQsUserSwitchComponent; import com.android.keyguard.dagger.KeyguardStatusBarViewComponent; import com.android.keyguard.dagger.KeyguardStatusViewComponent; @@ -128,11 +126,9 @@ import com.android.systemui.dump.DumpsysTableLogger; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.Flags; import com.android.systemui.fragments.FragmentService; -import com.android.systemui.keyguard.KeyguardBottomAreaRefactor; import com.android.systemui.keyguard.KeyguardUnlockAnimationController; import com.android.systemui.keyguard.KeyguardViewConfigurator; import com.android.systemui.keyguard.MigrateClocksToBlueprint; -import com.android.systemui.keyguard.domain.interactor.KeyguardBottomAreaInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; @@ -143,7 +139,6 @@ import com.android.systemui.keyguard.shared.model.TransitionStep; import com.android.systemui.keyguard.ui.binder.KeyguardLongPressViewBinder; import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel; import com.android.systemui.keyguard.ui.viewmodel.GoneToDreamingTransitionViewModel; -import com.android.systemui.keyguard.ui.viewmodel.KeyguardBottomAreaViewModel; import com.android.systemui.keyguard.ui.viewmodel.KeyguardTouchHandlingViewModel; import com.android.systemui.keyguard.ui.viewmodel.LockscreenToDreamingTransitionViewModel; import com.android.systemui.keyguard.ui.viewmodel.LockscreenToOccludedTransitionViewModel; @@ -211,8 +206,6 @@ import com.android.systemui.statusbar.phone.BounceInterpolator; import com.android.systemui.statusbar.phone.CentralSurfaces; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.HeadsUpAppearanceController; -import com.android.systemui.statusbar.phone.KeyguardBottomAreaView; -import com.android.systemui.statusbar.phone.KeyguardBottomAreaViewController; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.KeyguardClockPositionAlgorithm; import com.android.systemui.statusbar.phone.KeyguardStatusBarViewController; @@ -374,8 +367,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private float mExpandedHeight = 0; /** The current squish amount for the predictive back animation */ private float mCurrentBackProgress = 0.0f; - @Deprecated - private KeyguardBottomAreaView mKeyguardBottomArea; private boolean mExpanding; private boolean mSplitShadeEnabled; /** The bottom padding reserved for elements of the keyguard measuring notifications. */ @@ -391,11 +382,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private KeyguardUserSwitcherController mKeyguardUserSwitcherController; private KeyguardStatusBarViewController mKeyguardStatusBarViewController; private KeyguardStatusViewController mKeyguardStatusViewController; - private final LockIconViewController mLockIconViewController; private NotificationsQuickSettingsContainer mNotificationContainerParent; private final NotificationsQSContainerController mNotificationsQSContainerController; - private final Provider<KeyguardBottomAreaViewController> - mKeyguardBottomAreaViewControllerProvider; private boolean mAnimateNextPositionUpdate; private final ScreenOffAnimationController mScreenOffAnimationController; private final UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController; @@ -547,8 +535,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private final NotificationListContainer mNotificationListContainer; private final NotificationStackSizeCalculator mNotificationStackSizeCalculator; private final NPVCDownEventState.Buffer mLastDownEvents; - private final KeyguardBottomAreaViewModel mKeyguardBottomAreaViewModel; - private final KeyguardBottomAreaInteractor mKeyguardBottomAreaInteractor; private final KeyguardClockInteractor mKeyguardClockInteractor; private float mMinExpandHeight; private boolean mPanelUpdateWhenAnimatorEnds; @@ -624,8 +610,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private final SplitShadeStateController mSplitShadeStateController; private final Runnable mFlingCollapseRunnable = () -> fling(0, false /* expand */, mNextCollapseSpeedUpFactor, false /* expandBecauseOfFalsing */); - private final Runnable mAnimateKeyguardBottomAreaInvisibleEndRunnable = - () -> mKeyguardBottomArea.setVisibility(View.GONE); private final Runnable mHeadsUpExistenceChangedRunnable = () -> { setHeadsUpAnimatingAway(false); updateExpansionAndVisibility(); @@ -714,7 +698,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump MediaDataManager mediaDataManager, NotificationShadeDepthController notificationShadeDepthController, AmbientState ambientState, - LockIconViewController lockIconViewController, KeyguardMediaController keyguardMediaController, TapAgainViewController tapAgainViewController, NavigationModeController navigationModeController, @@ -730,15 +713,12 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump ShadeRepository shadeRepository, Optional<SysUIUnfoldComponent> unfoldComponent, SysUiState sysUiState, - Provider<KeyguardBottomAreaViewController> keyguardBottomAreaViewControllerProvider, KeyguardUnlockAnimationController keyguardUnlockAnimationController, KeyguardIndicationController keyguardIndicationController, NotificationListContainer notificationListContainer, NotificationStackSizeCalculator notificationStackSizeCalculator, UnlockedScreenOffAnimationController unlockedScreenOffAnimationController, SystemClock systemClock, - KeyguardBottomAreaViewModel keyguardBottomAreaViewModel, - KeyguardBottomAreaInteractor keyguardBottomAreaInteractor, KeyguardClockInteractor keyguardClockInteractor, AlternateBouncerInteractor alternateBouncerInteractor, DreamingToLockscreenTransitionViewModel dreamingToLockscreenTransitionViewModel, @@ -852,7 +832,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mNotificationListContainer = notificationListContainer; mNotificationStackSizeCalculator = notificationStackSizeCalculator; mNavigationBarController = navigationBarController; - mKeyguardBottomAreaViewControllerProvider = keyguardBottomAreaViewControllerProvider; mNotificationsQSContainerController.init(); mNotificationStackScrollLayoutController = notificationStackScrollLayoutController; mKeyguardStatusViewComponentFactory = keyguardStatusViewComponentFactory; @@ -908,7 +887,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mBottomAreaShadeAlphaAnimator.setInterpolator(Interpolators.ALPHA_OUT); mConversationNotificationManager = conversationNotificationManager; mAuthController = authController; - mLockIconViewController = lockIconViewController; mScreenOffAnimationController = screenOffAnimationController; mUnlockedScreenOffAnimationController = unlockedScreenOffAnimationController; mLastDownEvents = new NPVCDownEventState.Buffer(MAX_DOWN_EVENT_BUFFER_SIZE); @@ -930,16 +908,13 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump if (DEBUG_DRAWABLE) { mView.getOverlay().add(new DebugDrawable(this, mView, - mNotificationStackScrollLayoutController, mLockIconViewController, - mQsController)); + mNotificationStackScrollLayoutController, mQsController)); } mKeyguardUnfoldTransition = unfoldComponent.map( SysUIUnfoldComponent::getKeyguardUnfoldTransition); updateUserSwitcherFlags(); - mKeyguardBottomAreaViewModel = keyguardBottomAreaViewModel; - mKeyguardBottomAreaInteractor = keyguardBottomAreaInteractor; mKeyguardClockInteractor = keyguardClockInteractor; KeyguardLongPressViewBinder.bind( mView.requireViewById(R.id.keyguard_long_press), @@ -1062,12 +1037,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mQsController.init(); mShadeHeadsUpTracker.addTrackingHeadsUpListener( mNotificationStackScrollLayoutController::setTrackingHeadsUp); - if (!KeyguardBottomAreaRefactor.isEnabled()) { - setKeyguardBottomArea(mView.findViewById(R.id.keyguard_bottom_area)); - } - - initBottomArea(); - mWakeUpCoordinator.setStackScroller(mNotificationStackScrollLayoutController); mWakeUpCoordinator.addListener(new NotificationWakeUpCoordinator.WakeUpListener() { @Override @@ -1421,23 +1390,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump showKeyguardUserSwitcher /* enabled */); updateViewControllers(userAvatarView, keyguardUserSwitcherView); - - if (!KeyguardBottomAreaRefactor.isEnabled()) { - // Update keyguard bottom area - int index = mView.indexOfChild(mKeyguardBottomArea); - mView.removeView(mKeyguardBottomArea); - KeyguardBottomAreaView oldBottomArea = mKeyguardBottomArea; - KeyguardBottomAreaViewController keyguardBottomAreaViewController = - mKeyguardBottomAreaViewControllerProvider.get(); - if (smartspaceRelocateToBottom()) { - keyguardBottomAreaViewController.init(); - } - setKeyguardBottomArea(keyguardBottomAreaViewController.getView()); - mKeyguardBottomArea.initFrom(oldBottomArea); - mView.addView(mKeyguardBottomArea, index); - - initBottomArea(); - } mStatusBarStateListener.onDozeAmountChanged(mStatusBarStateController.getDozeAmount(), mStatusBarStateController.getInterpolatedDozeAmount()); @@ -1462,10 +1414,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump false, mBarState); } - - if (!KeyguardBottomAreaRefactor.isEnabled()) { - setKeyguardBottomAreaVisibility(mBarState, false); - } } private void attachSplitShadeMediaPlayerContainer(FrameLayout container) { @@ -1475,22 +1423,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mKeyguardMediaController.attachSplitShadeContainer(container); } - private void initBottomArea() { - if (!KeyguardBottomAreaRefactor.isEnabled()) { - mKeyguardBottomArea.init( - mKeyguardBottomAreaViewModel, - mFalsingManager, - mLockIconViewController, - stringResourceId -> - mKeyguardIndicationController.showTransientIndication(stringResourceId), - mVibratorHelper, - mActivityStarter); - - // Rebind (for now), as a new bottom area and indication area may have been created - mKeyguardViewConfigurator.bindIndicationArea(); - } - } - @VisibleForTesting void setMaxDisplayedNotifications(int maxAllowed) { mMaxAllowedKeyguardNotifications = maxAllowed; @@ -1528,11 +1460,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump return mUnlockedScreenOffAnimationController.isAnimationPlaying(); } - @Deprecated - private void setKeyguardBottomArea(KeyguardBottomAreaView keyguardBottomArea) { - mKeyguardBottomArea = keyguardBottomArea; - } - /** Sets a listener to be notified when the shade starts opening or finishes closing. */ public void setOpenCloseListener(OpenCloseListener openCloseListener) { SceneContainerFlag.assertInLegacyMode(); @@ -1660,10 +1587,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mKeyguardStatusViewController.setLockscreenClockY( mClockPositionAlgorithm.getExpandedPreferredClockY()); } - if (!(MigrateClocksToBlueprint.isEnabled() || KeyguardBottomAreaRefactor.isEnabled())) { - mKeyguardBottomAreaInteractor.setClockPosition( - mClockPositionResult.clockX, mClockPositionResult.clockY); - } boolean animate = !SceneContainerFlag.isEnabled() && mNotificationStackScrollLayoutController.isAddOrRemoveAnimationPending(); @@ -2382,25 +2305,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump } } - @Deprecated - private void setKeyguardBottomAreaVisibility(int statusBarState, boolean goingToFullShade) { - mKeyguardBottomArea.animate().cancel(); - if (goingToFullShade) { - mKeyguardBottomArea.animate().alpha(0f).setStartDelay( - mKeyguardStateController.getKeyguardFadingAwayDelay()).setDuration( - mKeyguardStateController.getShortenedFadingAwayDuration()).setInterpolator( - Interpolators.ALPHA_OUT).withEndAction( - mAnimateKeyguardBottomAreaInvisibleEndRunnable).start(); - } else if (statusBarState == KEYGUARD || statusBarState == StatusBarState.SHADE_LOCKED) { - mKeyguardBottomArea.setVisibility(View.VISIBLE); - if (!mIsOcclusionTransitionRunning) { - mKeyguardBottomArea.setAlpha(1f); - } - } else { - mKeyguardBottomArea.setVisibility(View.GONE); - } - } - /** * When the back gesture triggers a fully-expanded shade --> QQS shade collapse transition, * the expansionFraction goes down from 1.0 --> 0.0 (collapsing), so the current "squish" amount @@ -2755,12 +2659,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump float alpha = Math.min(expansionAlpha, 1 - mQsController.computeExpansionFraction()); alpha *= mBottomAreaShadeAlpha; - if (KeyguardBottomAreaRefactor.isEnabled()) { - mKeyguardInteractor.setAlpha(alpha); - } else { - mKeyguardBottomAreaInteractor.setAlpha(alpha); - } - mLockIconViewController.setAlpha(alpha); + mKeyguardInteractor.setAlpha(alpha); } private void onExpandingFinished() { @@ -2967,11 +2866,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump } private void updateDozingVisibilities(boolean animate) { - if (KeyguardBottomAreaRefactor.isEnabled()) { - mKeyguardInteractor.setAnimateDozingTransitions(animate); - } else { - mKeyguardBottomAreaInteractor.setAnimateDozingTransitions(animate); - } + mKeyguardInteractor.setAnimateDozingTransitions(animate); if (!mDozing && animate) { mKeyguardStatusBarViewController.animateKeyguardStatusBarIn(); } @@ -3212,11 +3107,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mDozing = dozing; // TODO (b/) make listeners for this mNotificationStackScrollLayoutController.setDozing(mDozing, animate); - if (KeyguardBottomAreaRefactor.isEnabled()) { - mKeyguardInteractor.setAnimateDozingTransitions(animate); - } else { - mKeyguardBottomAreaInteractor.setAnimateDozingTransitions(animate); - } + mKeyguardInteractor.setAnimateDozingTransitions(animate); mKeyguardStatusBarViewController.setDozing(mDozing); mQsController.setDozing(mDozing); @@ -3267,7 +3158,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump } public void dozeTimeTick() { - mLockIconViewController.dozeTimeTick(); if (!MigrateClocksToBlueprint.isEnabled()) { mKeyguardStatusViewController.dozeTimeTick(); } @@ -4544,10 +4434,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mBarState); } - if (!KeyguardBottomAreaRefactor.isEnabled()) { - setKeyguardBottomAreaVisibility(statusBarState, goingToFullShade); - } - // TODO: maybe add a listener for barstate mBarState = statusBarState; mQsController.setBarState(statusBarState); @@ -4813,12 +4699,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump stackScroller.setMaxAlphaForKeyguard(alpha, "NPVC.setTransitionAlpha()"); } - if (KeyguardBottomAreaRefactor.isEnabled()) { - mKeyguardInteractor.setAlpha(alpha); - } else { - mKeyguardBottomAreaInteractor.setAlpha(alpha); - } - mLockIconViewController.setAlpha(alpha); + mKeyguardInteractor.setAlpha(alpha); + //todo was this needed? if (mKeyguardQsUserSwitchController != null) { mKeyguardQsUserSwitchController.setAlpha(alpha); diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewProviderModule.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewProviderModule.kt index 8937ce33cd38..e19112047d2a 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewProviderModule.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewProviderModule.kt @@ -50,7 +50,6 @@ import com.android.systemui.statusbar.NotificationInsetsController import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout import com.android.systemui.statusbar.notification.stack.ui.view.NotificationScrollView import com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer -import com.android.systemui.statusbar.phone.KeyguardBottomAreaView import com.android.systemui.statusbar.phone.StatusBarLocation import com.android.systemui.statusbar.phone.StatusIconContainer import com.android.systemui.statusbar.phone.TapAgainView @@ -145,20 +144,6 @@ abstract class ShadeViewProviderModule { return notificationShadeWindowView.requireViewById(R.id.notification_panel) } - /** - * Constructs a new, unattached [KeyguardBottomAreaView]. - * - * Note that this is explicitly _not_ a singleton, as we want to be able to reinflate it - */ - @Provides - fun providesKeyguardBottomAreaView( - npv: NotificationPanelView, - @ShadeDisplayAware layoutInflater: LayoutInflater, - ): KeyguardBottomAreaView { - return layoutInflater.inflate(R.layout.keyguard_bottom_area, npv, false) - as KeyguardBottomAreaView - } - @Provides @SysUISingleton fun providesLightRevealScrim( diff --git a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeLockscreenInteractorImpl.kt b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeLockscreenInteractorImpl.kt index 50b5607f1955..2d7476c0433c 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeLockscreenInteractorImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeLockscreenInteractorImpl.kt @@ -16,7 +16,6 @@ package com.android.systemui.shade.domain.interactor -import com.android.keyguard.LockIconViewController import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.keyguard.shared.model.KeyguardState @@ -38,7 +37,6 @@ constructor( @Background private val backgroundScope: CoroutineScope, private val shadeInteractor: ShadeInteractor, private val sceneInteractor: SceneInteractor, - private val lockIconViewController: LockIconViewController, shadeRepository: ShadeRepository, ) : ShadeLockscreenInteractor { @@ -61,7 +59,7 @@ constructor( } override fun dozeTimeTick() { - lockIconViewController.dozeTimeTick() + // TODO("b/383591086") Implement replacement or delete } @Deprecated("Not supported by scenes") diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.kt index eadb7f5a1684..2368824311f8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.kt @@ -22,14 +22,7 @@ import android.view.View import android.view.ViewGroup import android.widget.FrameLayout import androidx.annotation.StringRes -import com.android.keyguard.LockIconViewController -import com.android.systemui.keyguard.ui.binder.KeyguardBottomAreaViewBinder -import com.android.systemui.keyguard.ui.binder.KeyguardBottomAreaViewBinder.bind -import com.android.systemui.keyguard.ui.viewmodel.KeyguardBottomAreaViewModel -import com.android.systemui.plugins.ActivityStarter -import com.android.systemui.plugins.FalsingManager import com.android.systemui.res.R -import com.android.systemui.statusbar.VibratorHelper /** * Renders the bottom area of the lock-screen. Concerned primarily with the quick affordance UI @@ -51,124 +44,7 @@ constructor( defStyleAttr, defStyleRes, ) { - - @Deprecated("Deprecated as part of b/278057014") - interface MessageDisplayer { - fun display(@StringRes stringResourceId: Int) - } - - private var ambientIndicationArea: View? = null - private var keyguardIndicationArea: View? = null - private var binding: KeyguardBottomAreaViewBinder.Binding? = null - private var lockIconViewController: LockIconViewController? = null - private var isLockscreenLandscapeEnabled: Boolean = false - - /** Initializes the view. */ - @Deprecated("Deprecated as part of b/278057014") - fun init( - viewModel: KeyguardBottomAreaViewModel, - falsingManager: FalsingManager? = null, - lockIconViewController: LockIconViewController? = null, - messageDisplayer: MessageDisplayer? = null, - vibratorHelper: VibratorHelper? = null, - activityStarter: ActivityStarter? = null, - ) { - binding?.destroy() - binding = - bind( - this, - viewModel, - falsingManager, - vibratorHelper, - activityStarter, - ) { - messageDisplayer?.display(it) - } - this.lockIconViewController = lockIconViewController - } - - /** - * Initializes this instance of [KeyguardBottomAreaView] based on the given instance of another - * [KeyguardBottomAreaView] - */ - @Deprecated("Deprecated as part of b/278057014") - fun initFrom(oldBottomArea: KeyguardBottomAreaView) { - // if it exists, continue to use the original ambient indication container - // instead of the newly inflated one - ambientIndicationArea?.let { nonNullAmbientIndicationArea -> - // remove old ambient indication from its parent - val originalAmbientIndicationView = - oldBottomArea.requireViewById<View>(R.id.ambient_indication_container) - (originalAmbientIndicationView.parent as ViewGroup).removeView( - originalAmbientIndicationView - ) - - // remove current ambient indication from its parent (discard) - val ambientIndicationParent = nonNullAmbientIndicationArea.parent as ViewGroup - val ambientIndicationIndex = - ambientIndicationParent.indexOfChild(nonNullAmbientIndicationArea) - ambientIndicationParent.removeView(nonNullAmbientIndicationArea) - - // add the old ambient indication to this view - ambientIndicationParent.addView(originalAmbientIndicationView, ambientIndicationIndex) - ambientIndicationArea = originalAmbientIndicationView - } - } - - fun setIsLockscreenLandscapeEnabled(isLockscreenLandscapeEnabled: Boolean) { - this.isLockscreenLandscapeEnabled = isLockscreenLandscapeEnabled - } - - override fun onFinishInflate() { - super.onFinishInflate() - ambientIndicationArea = findViewById(R.id.ambient_indication_container) - keyguardIndicationArea = findViewById(R.id.keyguard_indication_area) - } - - override fun onConfigurationChanged(newConfig: Configuration) { - super.onConfigurationChanged(newConfig) - binding?.onConfigurationChanged() - - if (isLockscreenLandscapeEnabled) { - updateIndicationAreaBottomMargin() - } - } - - private fun updateIndicationAreaBottomMargin() { - keyguardIndicationArea?.let { - val params = it.layoutParams as FrameLayout.LayoutParams - params.bottomMargin = - resources.getDimensionPixelSize(R.dimen.keyguard_indication_margin_bottom) - it.layoutParams = params - } - } - override fun hasOverlappingRendering(): Boolean { return false } - - override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) { - super.onLayout(changed, left, top, right, bottom) - findViewById<View>(R.id.ambient_indication_container)?.let { - val (ambientLeft, ambientTop) = it.locationOnScreen - if (binding?.shouldConstrainToTopOfLockIcon() == true) { - // make top of ambient indication view the bottom of the lock icon - it.layout( - ambientLeft, - lockIconViewController?.getBottom()?.toInt() ?: 0, - right - ambientLeft, - ambientTop + it.measuredHeight - ) - } else { - // make bottom of ambient indication view the top of the lock icon - val lockLocationTop = lockIconViewController?.getTop() ?: 0 - it.layout( - ambientLeft, - lockLocationTop.toInt() - it.measuredHeight, - right - ambientLeft, - lockLocationTop.toInt() - ) - } - } - } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaViewController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaViewController.kt deleted file mode 100644 index 4aece3d5cd6a..000000000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaViewController.kt +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2022 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.statusbar.phone - -import com.android.systemui.flags.FeatureFlagsClassic -import com.android.systemui.flags.Flags -import com.android.systemui.Flags.smartspaceRelocateToBottom -import android.view.View -import android.view.ViewGroup -import android.widget.LinearLayout -import com.android.systemui.res.R -import com.android.systemui.statusbar.lockscreen.LockscreenSmartspaceController -import com.android.systemui.util.ViewController -import javax.inject.Inject - -class KeyguardBottomAreaViewController - @Inject constructor( - view: KeyguardBottomAreaView, - private val smartspaceController: LockscreenSmartspaceController, - featureFlags: FeatureFlagsClassic -) : ViewController<KeyguardBottomAreaView> (view) { - - private var smartspaceView: View? = null - - init { - view.setIsLockscreenLandscapeEnabled( - featureFlags.isEnabled(Flags.LOCKSCREEN_ENABLE_LANDSCAPE)) - } - - override fun onViewAttached() { - if (!smartspaceRelocateToBottom() || !smartspaceController.isEnabled) { - return - } - - val ambientIndicationArea = mView.findViewById<View>(R.id.ambient_indication_container) - ambientIndicationArea?.visibility = View.GONE - - addSmartspaceView() - } - - override fun onViewDetached() { - } - - fun getView(): KeyguardBottomAreaView { - // TODO: remove this method. - return mView - } - - private fun addSmartspaceView() { - if (!smartspaceRelocateToBottom()) { - return - } - - val smartspaceContainer = mView.findViewById<View>(R.id.smartspace_container) - smartspaceContainer!!.visibility = View.VISIBLE - - smartspaceView = smartspaceController.buildAndConnectView(smartspaceContainer as ViewGroup) - val lp = LinearLayout.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) - (smartspaceContainer as ViewGroup).addView(smartspaceView, 0, lp) - val startPadding = context.resources.getDimensionPixelSize( - R.dimen.below_clock_padding_start) - val endPadding = context.resources.getDimensionPixelSize( - R.dimen.below_clock_padding_end) - smartspaceView?.setPaddingRelative(startPadding, 0, endPadding, 0) -// mKeyguardUnlockAnimationController.lockscreenSmartspace = smartspaceView - } -} diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySectionTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySectionTest.kt index cea51a89a378..222a7fe05778 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySectionTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySectionTest.kt @@ -23,7 +23,6 @@ import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest -import com.android.systemui.Flags as AConfigFlags import com.android.systemui.SysuiTestCase import com.android.systemui.biometrics.AuthController import com.android.systemui.flags.FakeFeatureFlags @@ -66,8 +65,6 @@ class DefaultDeviceEntrySectionTest : SysuiTestCase() { fun setup() { MockitoAnnotations.initMocks(this) - mSetFlagsRule.enableFlags(AConfigFlags.FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR) - featureFlags = FakeFeatureFlagsClassic().apply { set(Flags.LOCKSCREEN_ENABLE_LANDSCAPE, false) } underTest = @@ -88,16 +85,7 @@ class DefaultDeviceEntrySectionTest : SysuiTestCase() { } @Test - fun addViewsConditionally_migrateFlagOn() { - mSetFlagsRule.enableFlags(AConfigFlags.FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR) - val constraintLayout = ConstraintLayout(context, null) - underTest.addViews(constraintLayout) - assertThat(constraintLayout.childCount).isGreaterThan(0) - } - - @Test - fun addViewsConditionally_migrateAndRefactorFlagsOn() { - mSetFlagsRule.enableFlags(AConfigFlags.FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR) + fun addViewsConditionally() { val constraintLayout = ConstraintLayout(context, null) underTest.addViews(constraintLayout) assertThat(constraintLayout.childCount).isGreaterThan(0) diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModelTest.kt deleted file mode 100644 index 7e85dd5d3236..000000000000 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModelTest.kt +++ /dev/null @@ -1,771 +0,0 @@ -/* - * Copyright (C) 2022 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.ui.viewmodel - -import android.app.admin.DevicePolicyManager -import android.content.Intent -import android.os.UserHandle -import android.platform.test.flag.junit.FlagsParameterization -import androidx.test.filters.SmallTest -import com.android.internal.logging.testing.UiEventLoggerFake -import com.android.internal.widget.LockPatternUtils -import com.android.keyguard.logging.KeyguardQuickAffordancesLogger -import com.android.systemui.SysuiTestCase -import com.android.systemui.animation.DialogTransitionAnimator -import com.android.systemui.animation.Expandable -import com.android.systemui.broadcast.BroadcastDispatcher -import com.android.systemui.common.shared.model.Icon -import com.android.systemui.coroutines.collectLastValue -import com.android.systemui.deviceentry.domain.interactor.deviceEntryFaceAuthInteractor -import com.android.systemui.dock.DockManagerFake -import com.android.systemui.doze.util.BurnInHelperWrapper -import com.android.systemui.flags.FakeFeatureFlags -import com.android.systemui.flags.Flags -import com.android.systemui.flags.andSceneContainer -import com.android.systemui.keyguard.data.quickaffordance.BuiltInKeyguardQuickAffordanceKeys -import com.android.systemui.keyguard.data.quickaffordance.FakeKeyguardQuickAffordanceConfig -import com.android.systemui.keyguard.data.quickaffordance.FakeKeyguardQuickAffordanceProviderClientFactory -import com.android.systemui.keyguard.data.quickaffordance.KeyguardQuickAffordanceConfig -import com.android.systemui.keyguard.data.quickaffordance.KeyguardQuickAffordanceLegacySettingSyncer -import com.android.systemui.keyguard.data.quickaffordance.KeyguardQuickAffordanceLocalUserSelectionManager -import com.android.systemui.keyguard.data.quickaffordance.KeyguardQuickAffordanceRemoteUserSelectionManager -import com.android.systemui.keyguard.data.repository.FakeBiometricSettingsRepository -import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository -import com.android.systemui.keyguard.data.repository.KeyguardQuickAffordanceRepository -import com.android.systemui.keyguard.domain.interactor.KeyguardBottomAreaInteractor -import com.android.systemui.keyguard.domain.interactor.KeyguardInteractorFactory -import com.android.systemui.keyguard.domain.interactor.KeyguardQuickAffordanceInteractor -import com.android.systemui.keyguard.domain.interactor.KeyguardTouchHandlingInteractor -import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor -import com.android.systemui.keyguard.shared.quickaffordance.ActivationState -import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancePosition -import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancesMetricsLogger -import com.android.systemui.kosmos.testDispatcher -import com.android.systemui.kosmos.testScope -import com.android.systemui.plugins.ActivityStarter -import com.android.systemui.res.R -import com.android.systemui.scene.domain.interactor.sceneInteractor -import com.android.systemui.settings.UserFileManager -import com.android.systemui.settings.UserTracker -import com.android.systemui.shade.domain.interactor.shadeInteractor -import com.android.systemui.shade.pulsingGestureListener -import com.android.systemui.shared.keyguard.shared.model.KeyguardQuickAffordanceSlots -import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper -import com.android.systemui.statusbar.policy.KeyguardStateController -import com.android.systemui.testKosmos -import com.android.systemui.util.FakeSharedPreferences -import com.android.systemui.util.mockito.any -import com.android.systemui.util.mockito.mock -import com.android.systemui.util.mockito.whenever -import com.android.systemui.util.settings.fakeSettings -import com.google.common.truth.Truth.assertThat -import kotlin.math.max -import kotlin.math.min -import kotlinx.coroutines.flow.map -import kotlinx.coroutines.test.runTest -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.ArgumentMatchers.anyInt -import org.mockito.ArgumentMatchers.anyString -import org.mockito.Mock -import org.mockito.Mockito -import org.mockito.Mockito.verifyNoMoreInteractions -import org.mockito.MockitoAnnotations -import platform.test.runner.parameterized.ParameterizedAndroidJunit4 -import platform.test.runner.parameterized.Parameters - -@SmallTest -@RunWith(ParameterizedAndroidJunit4::class) -class KeyguardBottomAreaViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { - - private val kosmos = testKosmos() - private val testDispatcher = kosmos.testDispatcher - private val testScope = kosmos.testScope - private val settings = kosmos.fakeSettings - - @Mock private lateinit var expandable: Expandable - @Mock private lateinit var burnInHelperWrapper: BurnInHelperWrapper - @Mock private lateinit var lockPatternUtils: LockPatternUtils - @Mock private lateinit var keyguardStateController: KeyguardStateController - @Mock private lateinit var userTracker: UserTracker - @Mock private lateinit var activityStarter: ActivityStarter - @Mock private lateinit var launchAnimator: DialogTransitionAnimator - @Mock private lateinit var devicePolicyManager: DevicePolicyManager - @Mock private lateinit var logger: KeyguardQuickAffordancesLogger - @Mock private lateinit var metricsLogger: KeyguardQuickAffordancesMetricsLogger - @Mock private lateinit var broadcastDispatcher: BroadcastDispatcher - @Mock private lateinit var accessibilityManager: AccessibilityManagerWrapper - - private lateinit var underTest: KeyguardBottomAreaViewModel - - private lateinit var repository: FakeKeyguardRepository - private lateinit var homeControlsQuickAffordanceConfig: FakeKeyguardQuickAffordanceConfig - private lateinit var quickAccessWalletAffordanceConfig: FakeKeyguardQuickAffordanceConfig - private lateinit var qrCodeScannerAffordanceConfig: FakeKeyguardQuickAffordanceConfig - private lateinit var dockManager: DockManagerFake - private lateinit var biometricSettingsRepository: FakeBiometricSettingsRepository - - init { - mSetFlagsRule.setFlagsParameterization(flags) - } - - @Before - fun setUp() { - MockitoAnnotations.initMocks(this) - - overrideResource(R.bool.custom_lockscreen_shortcuts_enabled, true) - overrideResource( - R.array.config_keyguardQuickAffordanceDefaults, - arrayOf( - KeyguardQuickAffordanceSlots.SLOT_ID_BOTTOM_START + - ":" + - BuiltInKeyguardQuickAffordanceKeys.HOME_CONTROLS, - KeyguardQuickAffordanceSlots.SLOT_ID_BOTTOM_END + - ":" + - BuiltInKeyguardQuickAffordanceKeys.QUICK_ACCESS_WALLET - ) - ) - - whenever(burnInHelperWrapper.burnInOffset(anyInt(), any())) - .thenReturn(RETURNED_BURN_IN_OFFSET) - - homeControlsQuickAffordanceConfig = - FakeKeyguardQuickAffordanceConfig(BuiltInKeyguardQuickAffordanceKeys.HOME_CONTROLS) - quickAccessWalletAffordanceConfig = - FakeKeyguardQuickAffordanceConfig( - BuiltInKeyguardQuickAffordanceKeys.QUICK_ACCESS_WALLET - ) - qrCodeScannerAffordanceConfig = - FakeKeyguardQuickAffordanceConfig(BuiltInKeyguardQuickAffordanceKeys.QR_CODE_SCANNER) - dockManager = DockManagerFake() - biometricSettingsRepository = FakeBiometricSettingsRepository() - val featureFlags = - FakeFeatureFlags().apply { set(Flags.LOCK_SCREEN_LONG_PRESS_ENABLED, false) } - - val withDeps = KeyguardInteractorFactory.create(featureFlags = featureFlags) - val keyguardInteractor = withDeps.keyguardInteractor - repository = withDeps.repository - - whenever(userTracker.userHandle).thenReturn(mock()) - whenever(lockPatternUtils.getStrongAuthForUser(anyInt())) - .thenReturn(LockPatternUtils.StrongAuthTracker.STRONG_AUTH_NOT_REQUIRED) - val localUserSelectionManager = - KeyguardQuickAffordanceLocalUserSelectionManager( - context = context, - userFileManager = - mock<UserFileManager>().apply { - whenever( - getSharedPreferences( - anyString(), - anyInt(), - anyInt(), - ) - ) - .thenReturn(FakeSharedPreferences()) - }, - userTracker = userTracker, - broadcastDispatcher = fakeBroadcastDispatcher, - ) - val remoteUserSelectionManager = - KeyguardQuickAffordanceRemoteUserSelectionManager( - scope = testScope.backgroundScope, - userTracker = userTracker, - clientFactory = FakeKeyguardQuickAffordanceProviderClientFactory(userTracker), - userHandle = UserHandle.SYSTEM, - ) - val quickAffordanceRepository = - KeyguardQuickAffordanceRepository( - appContext = context, - scope = testScope.backgroundScope, - localUserSelectionManager = localUserSelectionManager, - remoteUserSelectionManager = remoteUserSelectionManager, - userTracker = userTracker, - legacySettingSyncer = - KeyguardQuickAffordanceLegacySettingSyncer( - scope = testScope.backgroundScope, - backgroundDispatcher = testDispatcher, - secureSettings = settings, - selectionsManager = localUserSelectionManager, - ), - configs = - setOf( - homeControlsQuickAffordanceConfig, - quickAccessWalletAffordanceConfig, - qrCodeScannerAffordanceConfig, - ), - dumpManager = mock(), - userHandle = UserHandle.SYSTEM, - ) - val keyguardTouchHandlingInteractor = - KeyguardTouchHandlingInteractor( - context = mContext, - scope = testScope.backgroundScope, - transitionInteractor = kosmos.keyguardTransitionInteractor, - repository = repository, - logger = UiEventLoggerFake(), - featureFlags = featureFlags, - broadcastDispatcher = broadcastDispatcher, - accessibilityManager = accessibilityManager, - pulsingGestureListener = kosmos.pulsingGestureListener, - faceAuthInteractor = kosmos.deviceEntryFaceAuthInteractor, - ) - underTest = - KeyguardBottomAreaViewModel( - keyguardInteractor = keyguardInteractor, - quickAffordanceInteractor = - KeyguardQuickAffordanceInteractor( - keyguardInteractor = keyguardInteractor, - shadeInteractor = kosmos.shadeInteractor, - lockPatternUtils = lockPatternUtils, - keyguardStateController = keyguardStateController, - userTracker = userTracker, - activityStarter = activityStarter, - featureFlags = featureFlags, - repository = { quickAffordanceRepository }, - launchAnimator = launchAnimator, - logger = logger, - metricsLogger = metricsLogger, - devicePolicyManager = devicePolicyManager, - dockManager = dockManager, - biometricSettingsRepository = biometricSettingsRepository, - backgroundDispatcher = testDispatcher, - appContext = mContext, - sceneInteractor = { kosmos.sceneInteractor }, - ), - bottomAreaInteractor = KeyguardBottomAreaInteractor(repository = repository), - burnInHelperWrapper = burnInHelperWrapper, - keyguardTouchHandlingViewModel = - KeyguardTouchHandlingViewModel( - interactor = keyguardTouchHandlingInteractor, - ), - settingsMenuViewModel = - KeyguardSettingsMenuViewModel( - interactor = keyguardTouchHandlingInteractor, - ), - ) - } - - @Test - fun startButton_present_visibleModel_startsActivityOnClick() = - testScope.runTest { - repository.setKeyguardShowing(true) - val latest = collectLastValue(underTest.startButton) - - val testConfig = - TestConfig( - isVisible = true, - isClickable = true, - isActivated = true, - icon = mock(), - canShowWhileLocked = false, - intent = Intent("action"), - slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(), - ) - val configKey = - setUpQuickAffordanceModel( - position = KeyguardQuickAffordancePosition.BOTTOM_START, - testConfig = testConfig, - ) - - assertQuickAffordanceViewModel( - viewModel = latest(), - testConfig = testConfig, - configKey = configKey, - ) - } - - @Test - fun startButton_hiddenWhenDevicePolicyDisablesAllKeyguardFeatures() = - testScope.runTest { - whenever(devicePolicyManager.getKeyguardDisabledFeatures(null, userTracker.userId)) - .thenReturn(DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_ALL) - repository.setKeyguardShowing(true) - val latest by collectLastValue(underTest.startButton) - - val testConfig = - TestConfig( - isVisible = true, - isClickable = true, - isActivated = true, - icon = mock(), - canShowWhileLocked = false, - intent = Intent("action"), - slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(), - ) - val configKey = - setUpQuickAffordanceModel( - position = KeyguardQuickAffordancePosition.BOTTOM_START, - testConfig = testConfig, - ) - - assertQuickAffordanceViewModel( - viewModel = latest, - testConfig = - TestConfig( - isVisible = false, - slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(), - ), - configKey = configKey, - ) - } - - @Test - fun startButton_inPreviewMode_visibleEvenWhenKeyguardNotShowing() = - testScope.runTest { - underTest.enablePreviewMode( - initiallySelectedSlotId = KeyguardQuickAffordanceSlots.SLOT_ID_BOTTOM_START, - shouldHighlightSelectedAffordance = true, - ) - repository.setKeyguardShowing(false) - val latest = collectLastValue(underTest.startButton) - - val icon: Icon = mock() - val configKey = - setUpQuickAffordanceModel( - position = KeyguardQuickAffordancePosition.BOTTOM_START, - testConfig = - TestConfig( - isVisible = true, - isClickable = true, - isActivated = true, - icon = icon, - canShowWhileLocked = false, - intent = Intent("action"), - slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(), - ), - ) - - assertQuickAffordanceViewModel( - viewModel = latest(), - testConfig = - TestConfig( - isVisible = true, - isClickable = false, - isActivated = false, - icon = icon, - canShowWhileLocked = false, - intent = Intent("action"), - isSelected = true, - slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(), - ), - configKey = configKey, - ) - assertThat(latest()?.isSelected).isTrue() - } - - @Test - fun endButton_inHiglightedPreviewMode_dimmedWhenOtherIsSelected() = - testScope.runTest { - underTest.enablePreviewMode( - initiallySelectedSlotId = KeyguardQuickAffordanceSlots.SLOT_ID_BOTTOM_START, - shouldHighlightSelectedAffordance = true, - ) - repository.setKeyguardShowing(false) - val startButton = collectLastValue(underTest.startButton) - val endButton = collectLastValue(underTest.endButton) - - val icon: Icon = mock() - setUpQuickAffordanceModel( - position = KeyguardQuickAffordancePosition.BOTTOM_START, - testConfig = - TestConfig( - isVisible = true, - isClickable = true, - isActivated = true, - icon = icon, - canShowWhileLocked = false, - intent = Intent("action"), - slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(), - ), - ) - val configKey = - setUpQuickAffordanceModel( - position = KeyguardQuickAffordancePosition.BOTTOM_END, - testConfig = - TestConfig( - isVisible = true, - isClickable = true, - isActivated = true, - icon = icon, - canShowWhileLocked = false, - intent = Intent("action"), - slotId = KeyguardQuickAffordancePosition.BOTTOM_END.toSlotId(), - ), - ) - - assertQuickAffordanceViewModel( - viewModel = endButton(), - testConfig = - TestConfig( - isVisible = true, - isClickable = false, - isActivated = false, - icon = icon, - canShowWhileLocked = false, - intent = Intent("action"), - isDimmed = true, - slotId = KeyguardQuickAffordancePosition.BOTTOM_END.toSlotId(), - ), - configKey = configKey, - ) - } - - @Test - fun endButton_present_visibleModel_doNothingOnClick() = - testScope.runTest { - repository.setKeyguardShowing(true) - val latest = collectLastValue(underTest.endButton) - - val config = - TestConfig( - isVisible = true, - isClickable = true, - icon = mock(), - canShowWhileLocked = false, - intent = - null, // This will cause it to tell the system that the click was handled. - slotId = KeyguardQuickAffordancePosition.BOTTOM_END.toSlotId(), - ) - val configKey = - setUpQuickAffordanceModel( - position = KeyguardQuickAffordancePosition.BOTTOM_END, - testConfig = config, - ) - - assertQuickAffordanceViewModel( - viewModel = latest(), - testConfig = config, - configKey = configKey, - ) - } - - @Test - fun startButton_notPresent_modelIsHidden() = - testScope.runTest { - val latest = collectLastValue(underTest.startButton) - - val config = - TestConfig( - isVisible = false, - slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(), - ) - val configKey = - setUpQuickAffordanceModel( - position = KeyguardQuickAffordancePosition.BOTTOM_START, - testConfig = config, - ) - - assertQuickAffordanceViewModel( - viewModel = latest(), - testConfig = config, - configKey = configKey, - ) - } - - @Test - fun animateButtonReveal() = - testScope.runTest { - repository.setKeyguardShowing(true) - val testConfig = - TestConfig( - isVisible = true, - isClickable = true, - icon = mock(), - canShowWhileLocked = false, - intent = Intent("action"), - slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(), - ) - - setUpQuickAffordanceModel( - position = KeyguardQuickAffordancePosition.BOTTOM_START, - testConfig = testConfig, - ) - - val value = collectLastValue(underTest.startButton.map { it.animateReveal }) - - assertThat(value()).isFalse() - repository.setAnimateDozingTransitions(true) - assertThat(value()).isTrue() - repository.setAnimateDozingTransitions(false) - assertThat(value()).isFalse() - } - - @Test - fun isOverlayContainerVisible() = - testScope.runTest { - val value = collectLastValue(underTest.isOverlayContainerVisible) - - assertThat(value()).isTrue() - repository.setIsDozing(true) - assertThat(value()).isFalse() - repository.setIsDozing(false) - assertThat(value()).isTrue() - } - - @Test - fun alpha() = - testScope.runTest { - val value = collectLastValue(underTest.alpha) - - assertThat(value()).isEqualTo(1f) - repository.setBottomAreaAlpha(0.1f) - assertThat(value()).isEqualTo(0.1f) - repository.setBottomAreaAlpha(0.5f) - assertThat(value()).isEqualTo(0.5f) - repository.setBottomAreaAlpha(0.2f) - assertThat(value()).isEqualTo(0.2f) - repository.setBottomAreaAlpha(0f) - assertThat(value()).isEqualTo(0f) - } - - @Test - fun alpha_inPreviewMode_doesNotChange() = - testScope.runTest { - underTest.enablePreviewMode( - initiallySelectedSlotId = null, - shouldHighlightSelectedAffordance = false, - ) - val value = collectLastValue(underTest.alpha) - - assertThat(value()).isEqualTo(1f) - repository.setBottomAreaAlpha(0.1f) - assertThat(value()).isEqualTo(1f) - repository.setBottomAreaAlpha(0.5f) - assertThat(value()).isEqualTo(1f) - repository.setBottomAreaAlpha(0.2f) - assertThat(value()).isEqualTo(1f) - repository.setBottomAreaAlpha(0f) - assertThat(value()).isEqualTo(1f) - } - - @Test - fun isClickable_trueWhenAlphaAtThreshold() = - testScope.runTest { - repository.setKeyguardShowing(true) - repository.setBottomAreaAlpha( - KeyguardBottomAreaViewModel.AFFORDANCE_FULLY_OPAQUE_ALPHA_THRESHOLD - ) - - val testConfig = - TestConfig( - isVisible = true, - isClickable = true, - icon = mock(), - canShowWhileLocked = false, - intent = Intent("action"), - slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(), - ) - val configKey = - setUpQuickAffordanceModel( - position = KeyguardQuickAffordancePosition.BOTTOM_START, - testConfig = testConfig, - ) - - val latest = collectLastValue(underTest.startButton) - - assertQuickAffordanceViewModel( - viewModel = latest(), - testConfig = testConfig, - configKey = configKey, - ) - } - - @Test - fun isClickable_trueWhenAlphaAboveThreshold() = - testScope.runTest { - repository.setKeyguardShowing(true) - val latest = collectLastValue(underTest.startButton) - repository.setBottomAreaAlpha( - min(1f, KeyguardBottomAreaViewModel.AFFORDANCE_FULLY_OPAQUE_ALPHA_THRESHOLD + 0.1f), - ) - - val testConfig = - TestConfig( - isVisible = true, - isClickable = true, - icon = mock(), - canShowWhileLocked = false, - intent = Intent("action"), - slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(), - ) - val configKey = - setUpQuickAffordanceModel( - position = KeyguardQuickAffordancePosition.BOTTOM_START, - testConfig = testConfig, - ) - - assertQuickAffordanceViewModel( - viewModel = latest(), - testConfig = testConfig, - configKey = configKey, - ) - } - - @Test - fun isClickable_falseWhenAlphaBelowThreshold() = - testScope.runTest { - repository.setKeyguardShowing(true) - val latest = collectLastValue(underTest.startButton) - repository.setBottomAreaAlpha( - max(0f, KeyguardBottomAreaViewModel.AFFORDANCE_FULLY_OPAQUE_ALPHA_THRESHOLD - 0.1f), - ) - - val testConfig = - TestConfig( - isVisible = true, - isClickable = false, - icon = mock(), - canShowWhileLocked = false, - intent = Intent("action"), - slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(), - ) - val configKey = - setUpQuickAffordanceModel( - position = KeyguardQuickAffordancePosition.BOTTOM_START, - testConfig = testConfig, - ) - - assertQuickAffordanceViewModel( - viewModel = latest(), - testConfig = testConfig, - configKey = configKey, - ) - } - - @Test - fun isClickable_falseWhenAlphaAtZero() = - testScope.runTest { - repository.setKeyguardShowing(true) - val latest = collectLastValue(underTest.startButton) - repository.setBottomAreaAlpha(0f) - - val testConfig = - TestConfig( - isVisible = true, - isClickable = false, - icon = mock(), - canShowWhileLocked = false, - intent = Intent("action"), - slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(), - ) - val configKey = - setUpQuickAffordanceModel( - position = KeyguardQuickAffordancePosition.BOTTOM_START, - testConfig = testConfig, - ) - - assertQuickAffordanceViewModel( - viewModel = latest(), - testConfig = testConfig, - configKey = configKey, - ) - } - - private suspend fun setUpQuickAffordanceModel( - position: KeyguardQuickAffordancePosition, - testConfig: TestConfig, - ): String { - val config = - when (position) { - KeyguardQuickAffordancePosition.BOTTOM_START -> homeControlsQuickAffordanceConfig - KeyguardQuickAffordancePosition.BOTTOM_END -> quickAccessWalletAffordanceConfig - } - - val lockScreenState = - if (testConfig.isVisible) { - if (testConfig.intent != null) { - config.onTriggeredResult = - KeyguardQuickAffordanceConfig.OnTriggeredResult.StartActivity( - intent = testConfig.intent, - canShowWhileLocked = testConfig.canShowWhileLocked, - ) - } - KeyguardQuickAffordanceConfig.LockScreenState.Visible( - icon = testConfig.icon ?: error("Icon is unexpectedly null!"), - activationState = - when (testConfig.isActivated) { - true -> ActivationState.Active - false -> ActivationState.Inactive - } - ) - } else { - KeyguardQuickAffordanceConfig.LockScreenState.Hidden - } - config.setState(lockScreenState) - - return "${position.toSlotId()}::${config.key}" - } - - private fun assertQuickAffordanceViewModel( - viewModel: KeyguardQuickAffordanceViewModel?, - testConfig: TestConfig, - configKey: String, - ) { - checkNotNull(viewModel) - assertThat(viewModel.isVisible).isEqualTo(testConfig.isVisible) - assertThat(viewModel.isClickable).isEqualTo(testConfig.isClickable) - assertThat(viewModel.isActivated).isEqualTo(testConfig.isActivated) - assertThat(viewModel.isSelected).isEqualTo(testConfig.isSelected) - assertThat(viewModel.isDimmed).isEqualTo(testConfig.isDimmed) - assertThat(viewModel.slotId).isEqualTo(testConfig.slotId) - if (testConfig.isVisible) { - assertThat(viewModel.icon).isEqualTo(testConfig.icon) - viewModel.onClicked.invoke( - KeyguardQuickAffordanceViewModel.OnClickedParameters( - configKey = configKey, - expandable = expandable, - slotId = viewModel.slotId, - ) - ) - if (testConfig.intent != null) { - assertThat(Mockito.mockingDetails(activityStarter).invocations).hasSize(1) - } else { - verifyNoMoreInteractions(activityStarter) - } - } else { - assertThat(viewModel.isVisible).isFalse() - } - } - - private data class TestConfig( - val isVisible: Boolean, - val isClickable: Boolean = false, - val isActivated: Boolean = false, - val icon: Icon? = null, - val canShowWhileLocked: Boolean = false, - val intent: Intent? = null, - val isSelected: Boolean = false, - val isDimmed: Boolean = false, - val slotId: String = "" - ) { - init { - check(!isVisible || icon != null) { "Must supply non-null icon if visible!" } - } - } - - companion object { - private const val DEFAULT_BURN_IN_OFFSET = 5 - private const val RETURNED_BURN_IN_OFFSET = 3 - - @JvmStatic - @Parameters(name = "{0}") - fun getParams(): List<FlagsParameterization> { - return FlagsParameterization.allCombinationsOf().andSceneContainer() - } - } -} diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardQuickAffordancesCombinedViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardQuickAffordancesCombinedViewModelTest.kt index cb2c8fc2c418..3364528f0b54 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardQuickAffordancesCombinedViewModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardQuickAffordancesCombinedViewModelTest.kt @@ -25,7 +25,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.internal.widget.LockPatternUtils import com.android.keyguard.logging.KeyguardQuickAffordancesLogger -import com.android.systemui.Flags as AConfigFlags import com.android.systemui.SysuiTestCase import com.android.systemui.animation.DialogTransitionAnimator import com.android.systemui.animation.Expandable @@ -191,8 +190,6 @@ class KeyguardQuickAffordancesCombinedViewModelTest : SysuiTestCase() { dockManager = DockManagerFake() biometricSettingsRepository = FakeBiometricSettingsRepository() - mSetFlagsRule.enableFlags(AConfigFlags.FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR) - val featureFlags = FakeFeatureFlags().apply { set(Flags.LOCK_SCREEN_LONG_PRESS_ENABLED, false) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/flags/EnableSceneContainer.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/flags/EnableSceneContainer.kt index 41402badf141..4513cc086513 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/flags/EnableSceneContainer.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/flags/EnableSceneContainer.kt @@ -17,7 +17,6 @@ package com.android.systemui.flags import android.platform.test.annotations.EnableFlags -import com.android.systemui.Flags.FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR import com.android.systemui.Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR import com.android.systemui.Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT import com.android.systemui.Flags.FLAG_NOTIFICATION_AVALANCHE_THROTTLE_HUN @@ -29,7 +28,6 @@ import com.android.systemui.Flags.FLAG_SCENE_CONTAINER * that feature. It is also picked up by [SceneContainerRule] to set non-aconfig prerequisites. */ @EnableFlags( - FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR, FLAG_KEYGUARD_WM_STATE_REFACTOR, FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT, FLAG_NOTIFICATION_AVALANCHE_THROTTLE_HUN, diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt index 693ec7954d70..1288d3151051 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt @@ -56,9 +56,6 @@ class FakeKeyguardRepository @Inject constructor() : KeyguardRepository { override val animateBottomAreaDozingTransitions: StateFlow<Boolean> = _animateBottomAreaDozingTransitions - private val _bottomAreaAlpha = MutableStateFlow(1f) - override val bottomAreaAlpha: StateFlow<Float> = _bottomAreaAlpha - private val _isKeyguardShowing = MutableStateFlow(false) override val isKeyguardShowing: StateFlow<Boolean> = _isKeyguardShowing @@ -159,11 +156,6 @@ class FakeKeyguardRepository @Inject constructor() : KeyguardRepository { _animateBottomAreaDozingTransitions.tryEmit(animate) } - @Deprecated("Deprecated as part of b/278057014") - override fun setBottomAreaAlpha(alpha: Float) { - _bottomAreaAlpha.value = alpha - } - fun setKeyguardShowing(isShowing: Boolean) { _isKeyguardShowing.value = isShowing } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardBottomAreaInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardBottomAreaInteractorKosmos.kt deleted file mode 100644 index a3955f7634eb..000000000000 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardBottomAreaInteractorKosmos.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.keyguard.domain.interactor - -import com.android.systemui.keyguard.data.repository.keyguardRepository -import com.android.systemui.kosmos.Kosmos -import com.android.systemui.kosmos.Kosmos.Fixture - -val Kosmos.keyguardBottomAreaInteractor by Fixture { - KeyguardBottomAreaInteractor( - repository = keyguardRepository, - ) -} diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeLockscreenInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeLockscreenInteractorKosmos.kt index 00b788fa4a41..c0d2621fae23 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeLockscreenInteractorKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeLockscreenInteractorKosmos.kt @@ -30,7 +30,6 @@ val Kosmos.shadeLockscreenInteractor by backgroundScope = applicationCoroutineScope, shadeInteractor = shadeInteractorImpl, sceneInteractor = sceneInteractor, - lockIconViewController = mock(), shadeRepository = shadeRepository, ) } |