Destroy and reinflate bouncer before showing
Due to various bugs and settingns changes, it makes sense to entirely refresh the bouncer view before showing. This should significantly reduce the number of incoming bugs where bouncer is not showing or is not responding to settings changes. Fixes: 260958175 Fixes: 266840428 Fixes: 268226007 Fixes: 267363062 Test: open sim pin, sim puk, password, pattern, pin. Test: change pattern visible to see changes reflected on screen. Test: change show password characters to see changes reflected on screen. Change-Id: I8d7a906866888ad292bd8f813cdba99920a56884
This commit is contained in:
@@ -202,8 +202,11 @@ public class KeyguardHostViewController extends ViewController<KeyguardHostView>
|
||||
mKeyguardSecurityContainerController.onPause();
|
||||
}
|
||||
|
||||
public void resetSecurityContainer() {
|
||||
mKeyguardSecurityContainerController.reset();
|
||||
/**
|
||||
* Reinflate the view flipper child view.
|
||||
*/
|
||||
public void reinflateViewFlipper() {
|
||||
mKeyguardSecurityContainerController.reinflateViewFlipper();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,23 +235,19 @@ public class KeyguardHostViewController extends ViewController<KeyguardHostView>
|
||||
/**
|
||||
* Starts the animation when the Keyguard gets shown.
|
||||
*/
|
||||
public void appear(int statusBarHeight) {
|
||||
public void appear() {
|
||||
// We might still be collapsed and the view didn't have time to layout yet or still
|
||||
// be small, let's wait on the predraw to do the animation in that case.
|
||||
if (mView.getHeight() != 0 && mView.getHeight() != statusBarHeight) {
|
||||
mKeyguardSecurityContainerController.startAppearAnimation();
|
||||
} else {
|
||||
mView.getViewTreeObserver().addOnPreDrawListener(
|
||||
new ViewTreeObserver.OnPreDrawListener() {
|
||||
@Override
|
||||
public boolean onPreDraw() {
|
||||
mView.getViewTreeObserver().removeOnPreDrawListener(this);
|
||||
mKeyguardSecurityContainerController.startAppearAnimation();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
mView.requestLayout();
|
||||
}
|
||||
mView.getViewTreeObserver().addOnPreDrawListener(
|
||||
new ViewTreeObserver.OnPreDrawListener() {
|
||||
@Override
|
||||
public boolean onPreDraw() {
|
||||
mView.getViewTreeObserver().removeOnPreDrawListener(this);
|
||||
mKeyguardSecurityContainerController.startAppearAnimation();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
mView.requestLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -743,17 +743,20 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
|
||||
}
|
||||
|
||||
private void reloadColors() {
|
||||
resetViewFlipper();
|
||||
reinflateViewFlipper();
|
||||
mView.reloadColors();
|
||||
}
|
||||
|
||||
/** Handles density or font scale changes. */
|
||||
private void onDensityOrFontScaleChanged() {
|
||||
resetViewFlipper();
|
||||
reinflateViewFlipper();
|
||||
mView.onDensityOrFontScaleChanged();
|
||||
}
|
||||
|
||||
private void resetViewFlipper() {
|
||||
/**
|
||||
* Reinflate the view flipper child view.
|
||||
*/
|
||||
public void reinflateViewFlipper() {
|
||||
mSecurityViewFlipperController.clearViews();
|
||||
mSecurityViewFlipperController.getSecurityView(mCurrentSecurityMode,
|
||||
mKeyguardSecurityCallback);
|
||||
|
||||
@@ -22,7 +22,6 @@ import android.view.ViewGroup
|
||||
import android.window.OnBackAnimationCallback
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import com.android.internal.policy.SystemBarUtils
|
||||
import com.android.keyguard.KeyguardHostViewController
|
||||
import com.android.keyguard.KeyguardSecurityModel
|
||||
import com.android.keyguard.KeyguardUpdateMonitor
|
||||
@@ -98,14 +97,14 @@ object KeyguardBouncerViewBinder {
|
||||
viewModel.setBouncerViewDelegate(delegate)
|
||||
launch {
|
||||
viewModel.show.collect {
|
||||
// Reset Security Container entirely.
|
||||
hostViewController.reinflateViewFlipper()
|
||||
hostViewController.showPromptReason(it.promptReason)
|
||||
it.errorMessage?.let { errorMessage ->
|
||||
hostViewController.showErrorMessage(errorMessage)
|
||||
}
|
||||
hostViewController.showPrimarySecurityScreen()
|
||||
hostViewController.appear(
|
||||
SystemBarUtils.getStatusBarHeight(view.context)
|
||||
)
|
||||
hostViewController.appear()
|
||||
hostViewController.onResume()
|
||||
}
|
||||
}
|
||||
@@ -114,7 +113,6 @@ object KeyguardBouncerViewBinder {
|
||||
viewModel.hide.collect {
|
||||
hostViewController.cancelDismissAction()
|
||||
hostViewController.cleanUp()
|
||||
hostViewController.resetSecurityContainer()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,15 +157,6 @@ object KeyguardBouncerViewBinder {
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
viewModel.isBouncerVisible
|
||||
.filter { !it }
|
||||
.collect {
|
||||
// Remove existing input for security reasons.
|
||||
hostViewController.resetSecurityContainer()
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
viewModel.keyguardPosition.collect { position ->
|
||||
hostViewController.updateKeyguardPosition(position)
|
||||
|
||||
@@ -600,6 +600,14 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
|
||||
any(KeyguardSecurityCallback.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReinflateViewFlipper() {
|
||||
mKeyguardSecurityContainerController.reinflateViewFlipper();
|
||||
verify(mKeyguardSecurityViewFlipperController).clearViews();
|
||||
verify(mKeyguardSecurityViewFlipperController).getSecurityView(any(SecurityMode.class),
|
||||
any(KeyguardSecurityCallback.class));
|
||||
}
|
||||
|
||||
private KeyguardSecurityContainer.SwipeListener getRegisteredSwipeListener() {
|
||||
mKeyguardSecurityContainerController.onViewAttached();
|
||||
verify(mView).setSwipeListener(mSwipeListenerArgumentCaptor.capture());
|
||||
|
||||
Reference in New Issue
Block a user