Merge "Now Playing is too low on the lock screen" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b82ce0fe96
@@ -762,7 +762,7 @@
|
|||||||
<dimen name="keyguard_lock_padding">20dp</dimen>
|
<dimen name="keyguard_lock_padding">20dp</dimen>
|
||||||
|
|
||||||
<dimen name="keyguard_indication_margin_bottom">32dp</dimen>
|
<dimen name="keyguard_indication_margin_bottom">32dp</dimen>
|
||||||
<dimen name="lock_icon_margin_bottom">110dp</dimen>
|
<dimen name="lock_icon_margin_bottom">74dp</dimen>
|
||||||
<dimen name="ambient_indication_margin_bottom">71dp</dimen>
|
<dimen name="ambient_indication_margin_bottom">71dp</dimen>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -158,6 +158,10 @@ public class LockIconView extends FrameLayout implements Dumpable {
|
|||||||
return mLockIconCenter.y - mRadius;
|
return mLockIconCenter.y - mRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float getLocationBottom() {
|
||||||
|
return mLockIconCenter.y + mRadius;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the icon its default state where no visual is shown.
|
* Updates the icon its default state where no visual is shown.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -280,6 +280,10 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
|||||||
return mView.getLocationTop();
|
return mView.getLocationTop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getBottom() {
|
||||||
|
return mView.getLocationBottom();
|
||||||
|
}
|
||||||
|
|
||||||
private void updateVisibility() {
|
private void updateVisibility() {
|
||||||
if (mCancelDelayedUpdateVisibilityRunnable != null) {
|
if (mCancelDelayedUpdateVisibilityRunnable != null) {
|
||||||
mCancelDelayedUpdateVisibilityRunnable.run();
|
mCancelDelayedUpdateVisibilityRunnable.run();
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.systemui.keyguard.data.repository
|
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.ChannelExt.trySendWithFailureLogging
|
||||||
import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow
|
import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow
|
||||||
import com.android.systemui.common.shared.model.Position
|
import com.android.systemui.common.shared.model.Position
|
||||||
@@ -123,6 +124,11 @@ interface KeyguardRepository {
|
|||||||
* Sets the relative offset of the lock-screen clock from its natural position on the screen.
|
* Sets the relative offset of the lock-screen clock from its natural position on the screen.
|
||||||
*/
|
*/
|
||||||
fun setClockPosition(x: Int, y: Int)
|
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. */
|
/** Encapsulates application state for the keyguard. */
|
||||||
@@ -130,11 +136,12 @@ interface KeyguardRepository {
|
|||||||
class KeyguardRepositoryImpl
|
class KeyguardRepositoryImpl
|
||||||
@Inject
|
@Inject
|
||||||
constructor(
|
constructor(
|
||||||
statusBarStateController: StatusBarStateController,
|
statusBarStateController: StatusBarStateController,
|
||||||
private val keyguardStateController: KeyguardStateController,
|
dozeHost: DozeHost,
|
||||||
dozeHost: DozeHost,
|
wakefulnessLifecycle: WakefulnessLifecycle,
|
||||||
wakefulnessLifecycle: WakefulnessLifecycle,
|
biometricUnlockController: BiometricUnlockController,
|
||||||
biometricUnlockController: BiometricUnlockController,
|
private val keyguardStateController: KeyguardStateController,
|
||||||
|
private val keyguardUpdateMonitor: KeyguardUpdateMonitor,
|
||||||
) : KeyguardRepository {
|
) : KeyguardRepository {
|
||||||
private val _animateBottomAreaDozingTransitions = MutableStateFlow(false)
|
private val _animateBottomAreaDozingTransitions = MutableStateFlow(false)
|
||||||
override val animateBottomAreaDozingTransitions =
|
override val animateBottomAreaDozingTransitions =
|
||||||
@@ -311,6 +318,8 @@ constructor(
|
|||||||
_clockPosition.value = Position(x, y)
|
_clockPosition.value = Position(x, y)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun isUdfpsSupported(): Boolean = keyguardUpdateMonitor.isUdfpsSupported
|
||||||
|
|
||||||
private fun statusBarStateIntToObject(value: Int): StatusBarState {
|
private fun statusBarStateIntToObject(value: Int): StatusBarState {
|
||||||
return when (value) {
|
return when (value) {
|
||||||
0 -> StatusBarState.SHADE
|
0 -> StatusBarState.SHADE
|
||||||
|
|||||||
@@ -48,4 +48,9 @@ constructor(
|
|||||||
fun setAnimateDozingTransitions(animate: Boolean) {
|
fun setAnimateDozingTransitions(animate: Boolean) {
|
||||||
repository.setAnimateDozingTransitions(animate)
|
repository.setAnimateDozingTransitions(animate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the keyguard bottom area should be constrained to the top of the lock icon
|
||||||
|
*/
|
||||||
|
fun shouldConstrainToTopOfLockIcon(): Boolean = repository.isUdfpsSupported()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import androidx.core.view.isVisible
|
|||||||
import androidx.core.view.updateLayoutParams
|
import androidx.core.view.updateLayoutParams
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.repeatOnLifecycle
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
|
import com.android.keyguard.KeyguardUpdateMonitor
|
||||||
|
import com.android.keyguard.LockIconViewController
|
||||||
import com.android.settingslib.Utils
|
import com.android.settingslib.Utils
|
||||||
import com.android.systemui.R
|
import com.android.systemui.R
|
||||||
import com.android.systemui.animation.Expandable
|
import com.android.systemui.animation.Expandable
|
||||||
@@ -69,6 +71,11 @@ object KeyguardBottomAreaViewBinder {
|
|||||||
|
|
||||||
/** Notifies that device configuration has changed. */
|
/** Notifies that device configuration has changed. */
|
||||||
fun onConfigurationChanged()
|
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. */
|
/** Binds the view to the view-model, continuing to update the former based on the latter. */
|
||||||
@@ -208,6 +215,9 @@ object KeyguardBottomAreaViewBinder {
|
|||||||
override fun onConfigurationChanged() {
|
override fun onConfigurationChanged() {
|
||||||
configurationBasedDimensions.value = loadFromResources(view)
|
configurationBasedDimensions.value = loadFromResources(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun shouldConstrainToTopOfLockIcon(): Boolean =
|
||||||
|
viewModel.shouldConstrainToTopOfLockIcon()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,12 @@ constructor(
|
|||||||
.distinctUntilChanged()
|
.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(
|
private fun button(
|
||||||
position: KeyguardQuickAffordancePosition
|
position: KeyguardQuickAffordancePosition
|
||||||
): Flow<KeyguardQuickAffordanceViewModel> {
|
): Flow<KeyguardQuickAffordanceViewModel> {
|
||||||
|
|||||||
@@ -1309,7 +1309,11 @@ public final class NotificationPanelViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initBottomArea() {
|
private void initBottomArea() {
|
||||||
mKeyguardBottomArea.init(mKeyguardBottomAreaViewModel, mFalsingManager);
|
mKeyguardBottomArea.init(
|
||||||
|
mKeyguardBottomAreaViewModel,
|
||||||
|
mFalsingManager,
|
||||||
|
mLockIconViewController
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import android.view.ViewGroup
|
|||||||
import android.view.ViewPropertyAnimator
|
import android.view.ViewPropertyAnimator
|
||||||
import android.view.WindowInsets
|
import android.view.WindowInsets
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
|
import com.android.keyguard.KeyguardUpdateMonitor
|
||||||
|
import com.android.keyguard.LockIconViewController
|
||||||
import com.android.systemui.R
|
import com.android.systemui.R
|
||||||
import com.android.systemui.keyguard.ui.binder.KeyguardBottomAreaViewBinder
|
import com.android.systemui.keyguard.ui.binder.KeyguardBottomAreaViewBinder
|
||||||
import com.android.systemui.keyguard.ui.binder.KeyguardBottomAreaViewBinder.bind
|
import com.android.systemui.keyguard.ui.binder.KeyguardBottomAreaViewBinder.bind
|
||||||
@@ -51,13 +53,20 @@ constructor(
|
|||||||
|
|
||||||
private var ambientIndicationArea: View? = null
|
private var ambientIndicationArea: View? = null
|
||||||
private lateinit var binding: KeyguardBottomAreaViewBinder.Binding
|
private lateinit var binding: KeyguardBottomAreaViewBinder.Binding
|
||||||
|
private lateinit var lockIconViewController: LockIconViewController
|
||||||
|
|
||||||
/** Initializes the view. */
|
/** Initializes the view. */
|
||||||
fun init(
|
fun init(
|
||||||
viewModel: KeyguardBottomAreaViewModel,
|
viewModel: KeyguardBottomAreaViewModel,
|
||||||
falsingManager: FalsingManager,
|
falsingManager: FalsingManager,
|
||||||
|
lockIconViewController: LockIconViewController,
|
||||||
) {
|
) {
|
||||||
binding = bind(this, viewModel, falsingManager)
|
binding = bind(
|
||||||
|
this,
|
||||||
|
viewModel,
|
||||||
|
falsingManager,
|
||||||
|
)
|
||||||
|
this.lockIconViewController = lockIconViewController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,4 +123,29 @@ constructor(
|
|||||||
}
|
}
|
||||||
return insets
|
return insets
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()) {
|
||||||
|
//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()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package com.android.systemui.keyguard.data.repository
|
package com.android.systemui.keyguard.data.repository
|
||||||
|
|
||||||
import androidx.test.filters.SmallTest
|
import androidx.test.filters.SmallTest
|
||||||
|
import com.android.keyguard.KeyguardUpdateMonitor
|
||||||
import com.android.systemui.SysuiTestCase
|
import com.android.systemui.SysuiTestCase
|
||||||
import com.android.systemui.common.shared.model.Position
|
import com.android.systemui.common.shared.model.Position
|
||||||
import com.android.systemui.doze.DozeHost
|
import com.android.systemui.doze.DozeHost
|
||||||
@@ -48,6 +49,7 @@ class KeyguardRepositoryImplTest : SysuiTestCase() {
|
|||||||
@Mock private lateinit var dozeHost: DozeHost
|
@Mock private lateinit var dozeHost: DozeHost
|
||||||
@Mock private lateinit var keyguardStateController: KeyguardStateController
|
@Mock private lateinit var keyguardStateController: KeyguardStateController
|
||||||
@Mock private lateinit var wakefulnessLifecycle: WakefulnessLifecycle
|
@Mock private lateinit var wakefulnessLifecycle: WakefulnessLifecycle
|
||||||
|
@Mock private lateinit var keyguardUpdateMonitor: KeyguardUpdateMonitor
|
||||||
@Mock private lateinit var biometricUnlockController: BiometricUnlockController
|
@Mock private lateinit var biometricUnlockController: BiometricUnlockController
|
||||||
|
|
||||||
private lateinit var underTest: KeyguardRepositoryImpl
|
private lateinit var underTest: KeyguardRepositoryImpl
|
||||||
@@ -58,11 +60,12 @@ class KeyguardRepositoryImplTest : SysuiTestCase() {
|
|||||||
|
|
||||||
underTest =
|
underTest =
|
||||||
KeyguardRepositoryImpl(
|
KeyguardRepositoryImpl(
|
||||||
statusBarStateController,
|
statusBarStateController,
|
||||||
keyguardStateController,
|
dozeHost,
|
||||||
dozeHost,
|
wakefulnessLifecycle,
|
||||||
wakefulnessLifecycle,
|
biometricUnlockController,
|
||||||
biometricUnlockController,
|
keyguardStateController,
|
||||||
|
keyguardUpdateMonitor,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,6 +225,15 @@ class KeyguardRepositoryImplTest : SysuiTestCase() {
|
|||||||
verify(wakefulnessLifecycle).removeObserver(captor.value)
|
verify(wakefulnessLifecycle).removeObserver(captor.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun isUdfpsSupported() = runBlockingTest {
|
||||||
|
whenever(keyguardUpdateMonitor.isUdfpsSupported).thenReturn(true)
|
||||||
|
assertThat(underTest.isUdfpsSupported()).isTrue()
|
||||||
|
|
||||||
|
whenever(keyguardUpdateMonitor.isUdfpsSupported).thenReturn(false)
|
||||||
|
assertThat(underTest.isUdfpsSupported()).isFalse()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun isBouncerShowing() = runBlockingTest {
|
fun isBouncerShowing() = runBlockingTest {
|
||||||
whenever(keyguardStateController.isBouncerShowing).thenReturn(false)
|
whenever(keyguardStateController.isBouncerShowing).thenReturn(false)
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ class FakeKeyguardRepository : KeyguardRepository {
|
|||||||
private val _wakefulnessState = MutableStateFlow(WakefulnessModel.ASLEEP)
|
private val _wakefulnessState = MutableStateFlow(WakefulnessModel.ASLEEP)
|
||||||
override val wakefulnessState: Flow<WakefulnessModel> = _wakefulnessState
|
override val wakefulnessState: Flow<WakefulnessModel> = _wakefulnessState
|
||||||
|
|
||||||
|
private val _isUdfpsSupported = MutableStateFlow(false)
|
||||||
|
|
||||||
private val _isBouncerShowing = MutableStateFlow(false)
|
private val _isBouncerShowing = MutableStateFlow(false)
|
||||||
override val isBouncerShowing: Flow<Boolean> = _isBouncerShowing
|
override val isBouncerShowing: Flow<Boolean> = _isBouncerShowing
|
||||||
|
|
||||||
@@ -86,4 +88,8 @@ class FakeKeyguardRepository : KeyguardRepository {
|
|||||||
fun setDozeAmount(dozeAmount: Float) {
|
fun setDozeAmount(dozeAmount: Float) {
|
||||||
_dozeAmount.value = dozeAmount
|
_dozeAmount.value = dozeAmount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun isUdfpsSupported(): Boolean {
|
||||||
|
return _isUdfpsSupported.value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user