Merge "[Bouncer] Update bouncer view with display size." into tm-qpr-dev am: a40e956a6a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20413391 Change-Id: Iaffc0dc924f923191c0a988fe599055f77f77a8b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -727,6 +727,11 @@ public class KeyguardSecurityContainer extends ConstraintLayout {
|
|||||||
mViewMode.reloadColors();
|
mViewMode.reloadColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Handles density or font scale changes. */
|
||||||
|
void onDensityOrFontScaleChanged() {
|
||||||
|
mViewMode.onDensityOrFontScaleChanged();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enscapsulates the differences between bouncer modes for the container.
|
* Enscapsulates the differences between bouncer modes for the container.
|
||||||
*/
|
*/
|
||||||
@@ -752,6 +757,9 @@ public class KeyguardSecurityContainer extends ConstraintLayout {
|
|||||||
/** Refresh colors */
|
/** Refresh colors */
|
||||||
default void reloadColors() {};
|
default void reloadColors() {};
|
||||||
|
|
||||||
|
/** Handles density or font scale changes. */
|
||||||
|
default void onDensityOrFontScaleChanged() {}
|
||||||
|
|
||||||
/** On a successful auth, optionally handle how the view disappears */
|
/** On a successful auth, optionally handle how the view disappears */
|
||||||
default void startDisappearAnimation(SecurityMode securityMode) {};
|
default void startDisappearAnimation(SecurityMode securityMode) {};
|
||||||
|
|
||||||
@@ -899,14 +907,9 @@ public class KeyguardSecurityContainer extends ConstraintLayout {
|
|||||||
mFalsingA11yDelegate = falsingA11yDelegate;
|
mFalsingA11yDelegate = falsingA11yDelegate;
|
||||||
|
|
||||||
if (mUserSwitcherViewGroup == null) {
|
if (mUserSwitcherViewGroup == null) {
|
||||||
LayoutInflater.from(v.getContext()).inflate(
|
inflateUserSwitcher();
|
||||||
R.layout.keyguard_bouncer_user_switcher,
|
|
||||||
mView,
|
|
||||||
true);
|
|
||||||
mUserSwitcherViewGroup = mView.findViewById(R.id.keyguard_bouncer_user_switcher);
|
|
||||||
}
|
}
|
||||||
updateSecurityViewLocation();
|
updateSecurityViewLocation();
|
||||||
mUserSwitcher = mView.findViewById(R.id.user_switcher_header);
|
|
||||||
setupUserSwitcher();
|
setupUserSwitcher();
|
||||||
mUserSwitcherController.addUserSwitchCallback(mUserSwitchCallback);
|
mUserSwitcherController.addUserSwitchCallback(mUserSwitchCallback);
|
||||||
}
|
}
|
||||||
@@ -936,6 +939,12 @@ public class KeyguardSecurityContainer extends ConstraintLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDensityOrFontScaleChanged() {
|
||||||
|
mView.removeView(mUserSwitcherViewGroup);
|
||||||
|
inflateUserSwitcher();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
mUserSwitcherController.removeUserSwitchCallback(mUserSwitchCallback);
|
mUserSwitcherController.removeUserSwitchCallback(mUserSwitchCallback);
|
||||||
@@ -1145,6 +1154,15 @@ public class KeyguardSecurityContainer extends ConstraintLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void inflateUserSwitcher() {
|
||||||
|
LayoutInflater.from(mView.getContext()).inflate(
|
||||||
|
R.layout.keyguard_bouncer_user_switcher,
|
||||||
|
mView,
|
||||||
|
true);
|
||||||
|
mUserSwitcherViewGroup = mView.findViewById(R.id.keyguard_bouncer_user_switcher);
|
||||||
|
mUserSwitcher = mView.findViewById(R.id.user_switcher_header);
|
||||||
|
}
|
||||||
|
|
||||||
interface UserSwitcherCallback {
|
interface UserSwitcherCallback {
|
||||||
void showUnlockToContinueMessage();
|
void showUnlockToContinueMessage();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,6 +251,11 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
|
|||||||
public void onUiModeChanged() {
|
public void onUiModeChanged() {
|
||||||
reloadColors();
|
reloadColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDensityOrFontScaleChanged() {
|
||||||
|
KeyguardSecurityContainerController.this.onDensityOrFontScaleChanged();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
private boolean mBouncerVisible = false;
|
private boolean mBouncerVisible = false;
|
||||||
private final KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback =
|
private final KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback =
|
||||||
@@ -727,6 +732,14 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
|
|||||||
mView.reloadColors();
|
mView.reloadColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Handles density or font scale changes. */
|
||||||
|
private void onDensityOrFontScaleChanged() {
|
||||||
|
mSecurityViewFlipperController.onDensityOrFontScaleChanged();
|
||||||
|
mSecurityViewFlipperController.getSecurityView(mCurrentSecurityMode,
|
||||||
|
mKeyguardSecurityCallback);
|
||||||
|
mView.onDensityOrFontScaleChanged();
|
||||||
|
}
|
||||||
|
|
||||||
static class Factory {
|
static class Factory {
|
||||||
|
|
||||||
private final KeyguardSecurityContainer mView;
|
private final KeyguardSecurityContainer mView;
|
||||||
|
|||||||
@@ -83,6 +83,13 @@ public class KeyguardSecurityViewFlipperController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Handles density or font scale changes. */
|
||||||
|
public void onDensityOrFontScaleChanged() {
|
||||||
|
mView.removeAllViews();
|
||||||
|
mChildren.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
KeyguardInputViewController<KeyguardInputView> getSecurityView(SecurityMode securityMode,
|
KeyguardInputViewController<KeyguardInputView> getSecurityView(SecurityMode securityMode,
|
||||||
KeyguardSecurityCallback keyguardSecurityCallback) {
|
KeyguardSecurityCallback keyguardSecurityCallback) {
|
||||||
|
|||||||
@@ -548,6 +548,22 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
|
|||||||
verify(mKeyguardPasswordViewControllerMock, never()).showMessage(null, null);
|
verify(mKeyguardPasswordViewControllerMock, never()).showMessage(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onDensityorFontScaleChanged() {
|
||||||
|
ArgumentCaptor<ConfigurationController.ConfigurationListener>
|
||||||
|
configurationListenerArgumentCaptor = ArgumentCaptor.forClass(
|
||||||
|
ConfigurationController.ConfigurationListener.class);
|
||||||
|
mKeyguardSecurityContainerController.onViewAttached();
|
||||||
|
verify(mConfigurationController).addCallback(configurationListenerArgumentCaptor.capture());
|
||||||
|
configurationListenerArgumentCaptor.getValue().onDensityOrFontScaleChanged();
|
||||||
|
|
||||||
|
verify(mView).onDensityOrFontScaleChanged();
|
||||||
|
verify(mKeyguardSecurityViewFlipperController).onDensityOrFontScaleChanged();
|
||||||
|
verify(mKeyguardSecurityViewFlipperController).getSecurityView(any(SecurityMode.class),
|
||||||
|
any(KeyguardSecurityCallback.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private KeyguardSecurityContainer.SwipeListener getRegisteredSwipeListener() {
|
private KeyguardSecurityContainer.SwipeListener getRegisteredSwipeListener() {
|
||||||
mKeyguardSecurityContainerController.onViewAttached();
|
mKeyguardSecurityContainerController.onViewAttached();
|
||||||
verify(mView).setSwipeListener(mSwipeListenerArgumentCaptor.capture());
|
verify(mView).setSwipeListener(mSwipeListenerArgumentCaptor.capture());
|
||||||
|
|||||||
@@ -310,6 +310,17 @@ public class KeyguardSecurityContainerTest extends SysuiTestCase {
|
|||||||
assertThat(anchor.isClickable()).isTrue();
|
assertThat(anchor.isClickable()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testOnDensityOrFontScaleChanged() {
|
||||||
|
setupUserSwitcher();
|
||||||
|
View oldUserSwitcher = mKeyguardSecurityContainer.findViewById(
|
||||||
|
R.id.keyguard_bouncer_user_switcher);
|
||||||
|
mKeyguardSecurityContainer.onDensityOrFontScaleChanged();
|
||||||
|
View newUserSwitcher = mKeyguardSecurityContainer.findViewById(
|
||||||
|
R.id.keyguard_bouncer_user_switcher);
|
||||||
|
assertThat(oldUserSwitcher).isNotEqualTo(newUserSwitcher);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTouchesAreRecognizedAsBeingOnTheOtherSideOfSecurity() {
|
public void testTouchesAreRecognizedAsBeingOnTheOtherSideOfSecurity() {
|
||||||
setupUserSwitcher();
|
setupUserSwitcher();
|
||||||
|
|||||||
@@ -106,4 +106,10 @@ public class KeyguardSecurityViewFlipperControllerTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onDensityOrFontScaleChanged() {
|
||||||
|
mKeyguardSecurityViewFlipperController.onDensityOrFontScaleChanged();
|
||||||
|
verify(mView).removeAllViews();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user