From 9761c10a5c706b0921a16e55a51e1b853853e792 Mon Sep 17 00:00:00 2001 From: Brad Hinegardner Date: Fri, 4 Nov 2022 19:25:47 +0000 Subject: [PATCH] Revert "Now Playing is too low on the lock screen" Revert "Now Playing is too low on the lock screen" Revert submission 20274762-b230466568_move_now_playing Reason for revert: b/257493331 and others Reverted Changes: I6f92c92f6:Now Playing is too low on the lock screen I5c93f310e:Now Playing is too low on the lock screen Change-Id: I86d28733b581fc238fb4a0f73ae8c6915f49ef24 --- packages/SystemUI/res/values/dimens.xml | 2 +- .../com/android/keyguard/LockIconView.java | 4 --- .../keyguard/LockIconViewController.java | 4 --- .../data/repository/KeyguardRepository.kt | 19 +++------- .../KeyguardBottomAreaInteractor.kt | 5 --- .../ui/binder/KeyguardBottomAreaViewBinder.kt | 10 ------ .../viewmodel/KeyguardBottomAreaViewModel.kt | 6 ---- .../NotificationPanelViewController.java | 6 +--- .../statusbar/phone/KeyguardBottomAreaView.kt | 36 +------------------ .../repository/KeyguardRepositoryImplTest.kt | 22 +++--------- .../data/repository/FakeKeyguardRepository.kt | 6 ---- 11 files changed, 13 insertions(+), 107 deletions(-) diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 40d96eac131ae..93926ef9e7807 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -762,7 +762,7 @@ 20dp 32dp - 74dp + 110dp 71dp diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconView.java b/packages/SystemUI/src/com/android/keyguard/LockIconView.java index 34a5ef75f1769..0a82968ae4cb1 100644 --- a/packages/SystemUI/src/com/android/keyguard/LockIconView.java +++ b/packages/SystemUI/src/com/android/keyguard/LockIconView.java @@ -158,10 +158,6 @@ public class LockIconView extends FrameLayout implements Dumpable { return mLockIconCenter.y - mRadius; } - float getLocationBottom() { - return mLockIconCenter.y + mRadius; - } - /** * Updates the icon its default state where no visual is shown. */ diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java index c7cc05971513d..fe7c70ae4c7ed 100644 --- a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java @@ -280,10 +280,6 @@ public class LockIconViewController extends ViewController impleme return mView.getLocationTop(); } - public float getBottom() { - return mView.getLocationBottom(); - } - private void updateVisibility() { if (mCancelDelayedUpdateVisibilityRunnable != null) { mCancelDelayedUpdateVisibilityRunnable.run(); 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 ca25282ec2f0e..c867c6e9229b7 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 @@ -16,7 +16,6 @@ package com.android.systemui.keyguard.data.repository -import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.common.coroutine.ChannelExt.trySendWithFailureLogging import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow import com.android.systemui.common.shared.model.Position @@ -124,11 +123,6 @@ interface KeyguardRepository { * Sets the relative offset of the lock-screen clock from its natural position on the screen. */ fun setClockPosition(x: Int, y: Int) - - /** - * Returns whether the keyguard bottom area should be constrained to the top of the lock icon - */ - fun isUdfpsSupported(): Boolean } /** Encapsulates application state for the keyguard. */ @@ -136,12 +130,11 @@ interface KeyguardRepository { class KeyguardRepositoryImpl @Inject constructor( - statusBarStateController: StatusBarStateController, - dozeHost: DozeHost, - wakefulnessLifecycle: WakefulnessLifecycle, - biometricUnlockController: BiometricUnlockController, - private val keyguardStateController: KeyguardStateController, - private val keyguardUpdateMonitor: KeyguardUpdateMonitor, + statusBarStateController: StatusBarStateController, + private val keyguardStateController: KeyguardStateController, + dozeHost: DozeHost, + wakefulnessLifecycle: WakefulnessLifecycle, + biometricUnlockController: BiometricUnlockController, ) : KeyguardRepository { private val _animateBottomAreaDozingTransitions = MutableStateFlow(false) override val animateBottomAreaDozingTransitions = @@ -318,8 +311,6 @@ constructor( _clockPosition.value = Position(x, y) } - override fun isUdfpsSupported(): Boolean = keyguardUpdateMonitor.isUdfpsSupported - private fun statusBarStateIntToObject(value: Int): StatusBarState { return when (value) { 0 -> StatusBarState.SHADE 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 index d2a7486eed0bb..ede50b068de35 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardBottomAreaInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardBottomAreaInteractor.kt @@ -48,9 +48,4 @@ constructor( 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/KeyguardBottomAreaViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt index 3276b6dd9748e..2c99ca59ba6ba 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt @@ -27,8 +27,6 @@ import androidx.core.view.isVisible import androidx.core.view.updateLayoutParams import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle -import com.android.keyguard.KeyguardUpdateMonitor -import com.android.keyguard.LockIconViewController import com.android.settingslib.Utils import com.android.systemui.R import com.android.systemui.animation.Expandable @@ -71,11 +69,6 @@ object KeyguardBottomAreaViewBinder { /** 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 } /** Binds the view to the view-model, continuing to update the former based on the latter. */ @@ -215,9 +208,6 @@ object KeyguardBottomAreaViewBinder { override fun onConfigurationChanged() { configurationBasedDimensions.value = loadFromResources(view) } - - override fun shouldConstrainToTopOfLockIcon(): Boolean = - viewModel.shouldConstrainToTopOfLockIcon() } } 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 index 227796f43e350..b6b2304413976 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt @@ -90,12 +90,6 @@ constructor( .distinctUntilChanged() } - /** - * Returns whether the keyguard bottom area should be constrained to the top of the lock icon - */ - fun shouldConstrainToTopOfLockIcon(): Boolean = - bottomAreaInteractor.shouldConstrainToTopOfLockIcon() - private fun button( position: KeyguardQuickAffordancePosition ): Flow { diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 5924e14bf3bc5..92f5c851f2088 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -1309,11 +1309,7 @@ public final class NotificationPanelViewController { } private void initBottomArea() { - mKeyguardBottomArea.init( - mKeyguardBottomAreaViewModel, - mFalsingManager, - mLockIconViewController - ); + mKeyguardBottomArea.init(mKeyguardBottomAreaViewModel, mFalsingManager); } @VisibleForTesting 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 78b28d203629a..4897c529dd517 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.kt @@ -23,8 +23,6 @@ import android.view.ViewGroup import android.view.ViewPropertyAnimator import android.view.WindowInsets import android.widget.FrameLayout -import com.android.keyguard.KeyguardUpdateMonitor -import com.android.keyguard.LockIconViewController import com.android.systemui.R import com.android.systemui.keyguard.ui.binder.KeyguardBottomAreaViewBinder import com.android.systemui.keyguard.ui.binder.KeyguardBottomAreaViewBinder.bind @@ -53,20 +51,13 @@ constructor( private var ambientIndicationArea: View? = null private lateinit var binding: KeyguardBottomAreaViewBinder.Binding - private lateinit var lockIconViewController: LockIconViewController /** Initializes the view. */ fun init( viewModel: KeyguardBottomAreaViewModel, falsingManager: FalsingManager, - lockIconViewController: LockIconViewController, ) { - binding = bind( - this, - viewModel, - falsingManager, - ) - this.lockIconViewController = lockIconViewController + binding = bind(this, viewModel, falsingManager) } /** @@ -123,29 +114,4 @@ constructor( } return insets } - - override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) { - super.onLayout(changed, left, top, right, bottom) - findViewById(R.id.ambient_indication_container)?.let { - val (ambientLeft, ambientTop) = it.locationOnScreen - if (binding.shouldConstrainToTopOfLockIcon()) { - //make top of ambient indication view the bottom of the lock icon - it.layout( - ambientLeft, - lockIconViewController.bottom.toInt(), - right - ambientLeft, - ambientTop + it.measuredHeight - ) - } else { - //make bottom of ambient indication view the top of the lock icon - val lockLocationTop = lockIconViewController.top - it.layout( - ambientLeft, - lockLocationTop.toInt() - it.measuredHeight, - right - ambientLeft, - lockLocationTop.toInt() - ) - } - } - } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt index 7bc39c7447400..53d9b87b23465 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt @@ -17,7 +17,6 @@ package com.android.systemui.keyguard.data.repository import androidx.test.filters.SmallTest -import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.SysuiTestCase import com.android.systemui.common.shared.model.Position import com.android.systemui.doze.DozeHost @@ -49,7 +48,6 @@ class KeyguardRepositoryImplTest : SysuiTestCase() { @Mock private lateinit var dozeHost: DozeHost @Mock private lateinit var keyguardStateController: KeyguardStateController @Mock private lateinit var wakefulnessLifecycle: WakefulnessLifecycle - @Mock private lateinit var keyguardUpdateMonitor: KeyguardUpdateMonitor @Mock private lateinit var biometricUnlockController: BiometricUnlockController private lateinit var underTest: KeyguardRepositoryImpl @@ -60,12 +58,11 @@ class KeyguardRepositoryImplTest : SysuiTestCase() { underTest = KeyguardRepositoryImpl( - statusBarStateController, - dozeHost, - wakefulnessLifecycle, - biometricUnlockController, - keyguardStateController, - keyguardUpdateMonitor, + statusBarStateController, + keyguardStateController, + dozeHost, + wakefulnessLifecycle, + biometricUnlockController, ) } @@ -226,15 +223,6 @@ class KeyguardRepositoryImplTest : SysuiTestCase() { } @Test - fun isUdfpsSupported() = runBlockingTest { - whenever(keyguardUpdateMonitor.isUdfpsSupported).thenReturn(true) - assertThat(underTest.isUdfpsSupported()).isTrue() - - whenever(keyguardUpdateMonitor.isUdfpsSupported).thenReturn(false) - assertThat(underTest.isUdfpsSupported()).isFalse() - } - - @Test fun isBouncerShowing() = runBlockingTest { whenever(keyguardStateController.isBouncerShowing).thenReturn(false) var latest: Boolean? = null 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 6f70f0ee0f2b1..627bd096143e3 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 @@ -53,8 +53,6 @@ class FakeKeyguardRepository : KeyguardRepository { private val _wakefulnessState = MutableStateFlow(WakefulnessModel.ASLEEP) override val wakefulnessState: Flow = _wakefulnessState - private val _isUdfpsSupported = MutableStateFlow(false) - private val _isBouncerShowing = MutableStateFlow(false) override val isBouncerShowing: Flow = _isBouncerShowing @@ -88,8 +86,4 @@ class FakeKeyguardRepository : KeyguardRepository { fun setDozeAmount(dozeAmount: Float) { _dozeAmount.value = dozeAmount } - - override fun isUdfpsSupported(): Boolean { - return _isUdfpsSupported.value - } }