Merge changes If7fb2450,I36614c86,Ic8bd2d0e,I4062f1f4 into tm-qpr-dev
* changes: Do not pass in anon callback. Dismiss user dialog when keyguard is going away. Bouncer pin appear flashes the message area Add more top margin for bouncer user switcher
This commit is contained in:
@@ -27,6 +27,4 @@
|
||||
<integer name="scaled_password_text_size">26</integer>
|
||||
|
||||
<dimen name="bouncer_user_switcher_y_trans">@dimen/status_bar_height</dimen>
|
||||
<dimen name="bouncer_user_switcher_view_mode_user_switcher_bottom_margin">0dp</dimen>
|
||||
<dimen name="bouncer_user_switcher_view_mode_view_flipper_bottom_margin">0dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -123,9 +123,7 @@
|
||||
<dimen name="bouncer_user_switcher_item_padding_vertical">10dp</dimen>
|
||||
<dimen name="bouncer_user_switcher_item_padding_horizontal">12dp</dimen>
|
||||
<dimen name="bouncer_user_switcher_header_padding_end">44dp</dimen>
|
||||
<dimen name="bouncer_user_switcher_y_trans">0dp</dimen>
|
||||
<dimen name="bouncer_user_switcher_view_mode_user_switcher_bottom_margin">0dp</dimen>
|
||||
<dimen name="bouncer_user_switcher_view_mode_view_flipper_bottom_margin">0dp</dimen>
|
||||
<dimen name="bouncer_user_switcher_y_trans">80dp</dimen>
|
||||
|
||||
<!-- 2 * the margin + size should equal the plus_margin -->
|
||||
<dimen name="user_switcher_icon_large_margin">16dp</dimen>
|
||||
|
||||
@@ -66,4 +66,8 @@
|
||||
|
||||
<dimen name="controls_header_horizontal_padding">12dp</dimen>
|
||||
<dimen name="controls_content_margin_horizontal">16dp</dimen>
|
||||
|
||||
<!-- Bouncer user switcher margins -->
|
||||
<dimen name="bouncer_user_switcher_view_mode_user_switcher_bottom_margin">0dp</dimen>
|
||||
<dimen name="bouncer_user_switcher_view_mode_view_flipper_bottom_margin">0dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -21,6 +21,6 @@
|
||||
<!-- Space between status view and notification shelf -->
|
||||
<dimen name="keyguard_status_view_bottom_margin">70dp</dimen>
|
||||
<dimen name="keyguard_clock_top_margin">80dp</dimen>
|
||||
<dimen name="bouncer_user_switcher_view_mode_user_switcher_bottom_margin">186dp</dimen>
|
||||
<dimen name="bouncer_user_switcher_view_mode_view_flipper_bottom_margin">110dp</dimen>
|
||||
<dimen name="bouncer_user_switcher_view_mode_user_switcher_bottom_margin">155dp</dimen>
|
||||
<dimen name="bouncer_user_switcher_view_mode_view_flipper_bottom_margin">85dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -1701,4 +1701,9 @@
|
||||
it is long-pressed.
|
||||
-->
|
||||
<dimen name="keyguard_long_press_settings_popup_vertical_offset">96dp</dimen>
|
||||
|
||||
|
||||
<!-- Bouncer user switcher margins -->
|
||||
<dimen name="bouncer_user_switcher_view_mode_user_switcher_bottom_margin">0dp</dimen>
|
||||
<dimen name="bouncer_user_switcher_view_mode_view_flipper_bottom_margin">0dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -217,9 +217,11 @@ public class KeyguardPINView extends KeyguardPinBasedInputView {
|
||||
private void animate(float progress) {
|
||||
Interpolator standardDecelerate = Interpolators.STANDARD_DECELERATE;
|
||||
Interpolator legacyDecelerate = Interpolators.LEGACY_DECELERATE;
|
||||
float standardProgress = standardDecelerate.getInterpolation(progress);
|
||||
|
||||
mBouncerMessageView.setTranslationY(
|
||||
mYTrans - mYTrans * standardDecelerate.getInterpolation(progress));
|
||||
mYTrans - mYTrans * standardProgress);
|
||||
mBouncerMessageView.setAlpha(standardProgress);
|
||||
|
||||
for (int i = 0; i < mViews.length; i++) {
|
||||
View[] row = mViews[i];
|
||||
@@ -236,7 +238,7 @@ public class KeyguardPINView extends KeyguardPinBasedInputView {
|
||||
view.setAlpha(scaledProgress);
|
||||
int yDistance = mYTrans + mYTransOffset * i;
|
||||
view.setTranslationY(
|
||||
yDistance - (yDistance * standardDecelerate.getInterpolation(progress)));
|
||||
yDistance - (yDistance * standardProgress));
|
||||
if (view instanceof NumPadAnimationListener) {
|
||||
((NumPadAnimationListener) view).setProgress(scaledProgress);
|
||||
}
|
||||
|
||||
@@ -1220,8 +1220,7 @@ public class KeyguardSecurityContainer extends ConstraintLayout {
|
||||
constraintSet.connect(rightElement, LEFT, leftElement, RIGHT);
|
||||
constraintSet.connect(rightElement, RIGHT, PARENT_ID, RIGHT);
|
||||
constraintSet.connect(mUserSwitcherViewGroup.getId(), TOP, PARENT_ID, TOP);
|
||||
constraintSet.connect(mUserSwitcherViewGroup.getId(), BOTTOM, PARENT_ID, BOTTOM,
|
||||
yTrans);
|
||||
constraintSet.connect(mUserSwitcherViewGroup.getId(), BOTTOM, PARENT_ID, BOTTOM);
|
||||
constraintSet.connect(mViewFlipper.getId(), TOP, PARENT_ID, TOP);
|
||||
constraintSet.connect(mViewFlipper.getId(), BOTTOM, PARENT_ID, BOTTOM);
|
||||
constraintSet.setHorizontalChainStyle(mUserSwitcherViewGroup.getId(), CHAIN_SPREAD);
|
||||
|
||||
@@ -708,6 +708,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
if (mKeyguardGoingAway) {
|
||||
updateFaceListeningState(BIOMETRIC_ACTION_STOP,
|
||||
FACE_AUTH_STOPPED_KEYGUARD_GOING_AWAY);
|
||||
for (int i = 0; i < mCallbacks.size(); i++) {
|
||||
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
|
||||
if (cb != null) {
|
||||
cb.onKeyguardGoingAway();
|
||||
}
|
||||
}
|
||||
}
|
||||
updateFingerprintListeningState(BIOMETRIC_ACTION_UPDATE);
|
||||
}
|
||||
@@ -3644,7 +3650,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
* Register to receive notifications about general keyguard information
|
||||
* (see {@link KeyguardUpdateMonitorCallback}.
|
||||
*
|
||||
* @param callback The callback to register
|
||||
* @param callback The callback to register. Stay away from passing anonymous instances
|
||||
* as they will likely be dereferenced. Ensure that the callback is a class
|
||||
* field to persist it.
|
||||
*/
|
||||
public void registerCallback(KeyguardUpdateMonitorCallback callback) {
|
||||
Assert.isMainThread();
|
||||
|
||||
@@ -317,4 +317,9 @@ public class KeyguardUpdateMonitorCallback {
|
||||
* Called when the non-strong biometric state changed.
|
||||
*/
|
||||
public void onNonStrongBiometricAllowedChanged(int userId) { }
|
||||
|
||||
/**
|
||||
* Called when keyguard is going away or not going away.
|
||||
*/
|
||||
public void onKeyguardGoingAway() { }
|
||||
}
|
||||
|
||||
@@ -122,21 +122,24 @@ constructor(
|
||||
val isInteractable: Flow<Boolean> = bouncerExpansion.map { it > 0.9 }
|
||||
val sideFpsShowing: Flow<Boolean> = repository.sideFpsShowing
|
||||
|
||||
init {
|
||||
keyguardUpdateMonitor.registerCallback(
|
||||
object : KeyguardUpdateMonitorCallback() {
|
||||
override fun onBiometricRunningStateChanged(
|
||||
running: Boolean,
|
||||
biometricSourceType: BiometricSourceType?
|
||||
) {
|
||||
updateSideFpsVisibility()
|
||||
}
|
||||
/**
|
||||
* This callback needs to be a class field so it does not get garbage collected.
|
||||
*/
|
||||
val keyguardUpdateMonitorCallback = object : KeyguardUpdateMonitorCallback() {
|
||||
override fun onBiometricRunningStateChanged(
|
||||
running: Boolean,
|
||||
biometricSourceType: BiometricSourceType?
|
||||
) {
|
||||
updateSideFpsVisibility()
|
||||
}
|
||||
|
||||
override fun onStrongAuthStateChanged(userId: Int) {
|
||||
updateSideFpsVisibility()
|
||||
}
|
||||
}
|
||||
)
|
||||
override fun onStrongAuthStateChanged(userId: Int) {
|
||||
updateSideFpsVisibility()
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
keyguardUpdateMonitor.registerCallback(keyguardUpdateMonitorCallback)
|
||||
}
|
||||
|
||||
// TODO(b/243685699): Move isScrimmed logic to data layer.
|
||||
|
||||
@@ -32,6 +32,8 @@ import android.os.UserManager
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import com.android.internal.util.UserIcons
|
||||
import com.android.keyguard.KeyguardUpdateMonitor
|
||||
import com.android.keyguard.KeyguardUpdateMonitorCallback
|
||||
import com.android.systemui.R
|
||||
import com.android.systemui.SystemUISecondaryUserService
|
||||
import com.android.systemui.animation.Expandable
|
||||
@@ -90,6 +92,7 @@ constructor(
|
||||
@Application private val applicationScope: CoroutineScope,
|
||||
telephonyInteractor: TelephonyInteractor,
|
||||
broadcastDispatcher: BroadcastDispatcher,
|
||||
keyguardUpdateMonitor: KeyguardUpdateMonitor,
|
||||
@Background private val backgroundDispatcher: CoroutineDispatcher,
|
||||
private val activityManager: ActivityManager,
|
||||
private val refreshUsersScheduler: RefreshUsersScheduler,
|
||||
@@ -286,6 +289,12 @@ constructor(
|
||||
|
||||
val isSimpleUserSwitcher: Boolean
|
||||
get() = repository.isSimpleUserSwitcher()
|
||||
val keyguardUpdateMonitorCallback =
|
||||
object : KeyguardUpdateMonitorCallback() {
|
||||
override fun onKeyguardGoingAway() {
|
||||
dismissDialog()
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
refreshUsersScheduler.refreshIfNotPaused()
|
||||
@@ -316,6 +325,7 @@ constructor(
|
||||
onBroadcastReceived(intent, previousSelectedUser)
|
||||
}
|
||||
.launchIn(applicationScope)
|
||||
keyguardUpdateMonitor.registerCallback(keyguardUpdateMonitorCallback)
|
||||
}
|
||||
|
||||
fun addCallback(callback: UserCallback) {
|
||||
|
||||
@@ -263,9 +263,6 @@ public class KeyguardSecurityContainerTest extends SysuiTestCase {
|
||||
assertThat(viewFlipperConstraint.layout.bottomToBottom).isEqualTo(PARENT_ID);
|
||||
assertThat(userSwitcherConstraint.layout.topToTop).isEqualTo(PARENT_ID);
|
||||
assertThat(userSwitcherConstraint.layout.bottomToBottom).isEqualTo(PARENT_ID);
|
||||
assertThat(userSwitcherConstraint.layout.bottomMargin).isEqualTo(
|
||||
getContext().getResources().getDimensionPixelSize(
|
||||
R.dimen.bouncer_user_switcher_y_trans));
|
||||
assertThat(viewFlipperConstraint.layout.horizontalChainStyle).isEqualTo(CHAIN_SPREAD);
|
||||
assertThat(userSwitcherConstraint.layout.horizontalChainStyle).isEqualTo(CHAIN_SPREAD);
|
||||
assertThat(viewFlipperConstraint.layout.mHeight).isEqualTo(MATCH_CONSTRAINT);
|
||||
|
||||
@@ -29,6 +29,8 @@ import android.os.UserManager
|
||||
import android.provider.Settings
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.internal.logging.UiEventLogger
|
||||
import com.android.keyguard.KeyguardUpdateMonitor
|
||||
import com.android.keyguard.KeyguardUpdateMonitorCallback
|
||||
import com.android.systemui.GuestResetOrExitSessionReceiver
|
||||
import com.android.systemui.GuestResumeSessionReceiver
|
||||
import com.android.systemui.R
|
||||
@@ -62,6 +64,7 @@ import com.android.systemui.util.mockito.mock
|
||||
import com.android.systemui.util.mockito.nullable
|
||||
import com.android.systemui.util.mockito.whenever
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import junit.framework.Assert.assertNotNull
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.test.StandardTestDispatcher
|
||||
@@ -72,6 +75,7 @@ import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.JUnit4
|
||||
import org.mockito.ArgumentCaptor
|
||||
import org.mockito.ArgumentMatchers.anyBoolean
|
||||
import org.mockito.ArgumentMatchers.anyInt
|
||||
import org.mockito.Mock
|
||||
@@ -96,6 +100,7 @@ class UserInteractorTest : SysuiTestCase() {
|
||||
@Mock private lateinit var resumeSessionReceiver: GuestResumeSessionReceiver
|
||||
@Mock private lateinit var resetOrExitSessionReceiver: GuestResetOrExitSessionReceiver
|
||||
@Mock private lateinit var commandQueue: CommandQueue
|
||||
@Mock private lateinit var keyguardUpdateMonitor: KeyguardUpdateMonitor
|
||||
|
||||
private lateinit var underTest: UserInteractor
|
||||
|
||||
@@ -154,6 +159,7 @@ class UserInteractorTest : SysuiTestCase() {
|
||||
repository = telephonyRepository,
|
||||
),
|
||||
broadcastDispatcher = fakeBroadcastDispatcher,
|
||||
keyguardUpdateMonitor = keyguardUpdateMonitor,
|
||||
backgroundDispatcher = testDispatcher,
|
||||
activityManager = activityManager,
|
||||
refreshUsersScheduler = refreshUsersScheduler,
|
||||
@@ -176,6 +182,18 @@ class UserInteractorTest : SysuiTestCase() {
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `testKeyguardUpdateMonitor_onKeyguardGoingAway`() =
|
||||
testScope.runTest {
|
||||
val argumentCaptor = ArgumentCaptor.forClass(KeyguardUpdateMonitorCallback::class.java)
|
||||
verify(keyguardUpdateMonitor).registerCallback(argumentCaptor.capture())
|
||||
|
||||
argumentCaptor.value.onKeyguardGoingAway()
|
||||
|
||||
val lastValue = collectLastValue(underTest.dialogDismissRequests)
|
||||
assertNotNull(lastValue)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `onRecordSelected - user`() =
|
||||
testScope.runTest {
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.graphics.drawable.BitmapDrawable
|
||||
import android.os.UserManager
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.internal.logging.UiEventLogger
|
||||
import com.android.keyguard.KeyguardUpdateMonitor
|
||||
import com.android.systemui.GuestResetOrExitSessionReceiver
|
||||
import com.android.systemui.GuestResumeSessionReceiver
|
||||
import com.android.systemui.SysuiTestCase
|
||||
@@ -80,6 +81,7 @@ class StatusBarUserChipViewModelTest : SysuiTestCase() {
|
||||
@Mock private lateinit var resumeSessionReceiver: GuestResumeSessionReceiver
|
||||
@Mock private lateinit var resetOrExitSessionReceiver: GuestResetOrExitSessionReceiver
|
||||
@Mock private lateinit var commandQueue: CommandQueue
|
||||
@Mock private lateinit var keyguardUpdateMonitor: KeyguardUpdateMonitor
|
||||
|
||||
private lateinit var underTest: StatusBarUserChipViewModel
|
||||
|
||||
@@ -263,6 +265,7 @@ class StatusBarUserChipViewModelTest : SysuiTestCase() {
|
||||
repository = FakeTelephonyRepository(),
|
||||
),
|
||||
broadcastDispatcher = fakeBroadcastDispatcher,
|
||||
keyguardUpdateMonitor = keyguardUpdateMonitor,
|
||||
backgroundDispatcher = testDispatcher,
|
||||
activityManager = activityManager,
|
||||
refreshUsersScheduler = refreshUsersScheduler,
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.content.pm.UserInfo
|
||||
import android.os.UserManager
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.internal.logging.UiEventLogger
|
||||
import com.android.keyguard.KeyguardUpdateMonitor
|
||||
import com.android.systemui.GuestResetOrExitSessionReceiver
|
||||
import com.android.systemui.GuestResumeSessionReceiver
|
||||
import com.android.systemui.SysuiTestCase
|
||||
@@ -81,6 +82,7 @@ class UserSwitcherViewModelTest : SysuiTestCase() {
|
||||
@Mock private lateinit var resumeSessionReceiver: GuestResumeSessionReceiver
|
||||
@Mock private lateinit var resetOrExitSessionReceiver: GuestResetOrExitSessionReceiver
|
||||
@Mock private lateinit var commandQueue: CommandQueue
|
||||
@Mock private lateinit var keyguardUpdateMonitor: KeyguardUpdateMonitor
|
||||
|
||||
private lateinit var underTest: UserSwitcherViewModel
|
||||
|
||||
@@ -165,6 +167,7 @@ class UserSwitcherViewModelTest : SysuiTestCase() {
|
||||
repository = FakeTelephonyRepository(),
|
||||
),
|
||||
broadcastDispatcher = fakeBroadcastDispatcher,
|
||||
keyguardUpdateMonitor = keyguardUpdateMonitor,
|
||||
backgroundDispatcher = testDispatcher,
|
||||
activityManager = activityManager,
|
||||
refreshUsersScheduler = refreshUsersScheduler,
|
||||
|
||||
Reference in New Issue
Block a user