Merge "Destroy and reinflate bouncer before showing" into tm-qpr-dev am: d3d710e837
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21337997 Change-Id: I8c0a6266dc4f689bc79febbc44078bbabc9dc1ea Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -202,8 +202,11 @@ public class KeyguardHostViewController extends ViewController<KeyguardHostView>
|
|||||||
mKeyguardSecurityContainerController.onPause();
|
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.
|
* 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
|
// 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.
|
// be small, let's wait on the predraw to do the animation in that case.
|
||||||
if (mView.getHeight() != 0 && mView.getHeight() != statusBarHeight) {
|
mView.getViewTreeObserver().addOnPreDrawListener(
|
||||||
mKeyguardSecurityContainerController.startAppearAnimation();
|
new ViewTreeObserver.OnPreDrawListener() {
|
||||||
} else {
|
@Override
|
||||||
mView.getViewTreeObserver().addOnPreDrawListener(
|
public boolean onPreDraw() {
|
||||||
new ViewTreeObserver.OnPreDrawListener() {
|
mView.getViewTreeObserver().removeOnPreDrawListener(this);
|
||||||
@Override
|
mKeyguardSecurityContainerController.startAppearAnimation();
|
||||||
public boolean onPreDraw() {
|
return true;
|
||||||
mView.getViewTreeObserver().removeOnPreDrawListener(this);
|
}
|
||||||
mKeyguardSecurityContainerController.startAppearAnimation();
|
});
|
||||||
return true;
|
mView.requestLayout();
|
||||||
}
|
|
||||||
});
|
|
||||||
mView.requestLayout();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -743,17 +743,20 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void reloadColors() {
|
private void reloadColors() {
|
||||||
resetViewFlipper();
|
reinflateViewFlipper();
|
||||||
mView.reloadColors();
|
mView.reloadColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Handles density or font scale changes. */
|
/** Handles density or font scale changes. */
|
||||||
private void onDensityOrFontScaleChanged() {
|
private void onDensityOrFontScaleChanged() {
|
||||||
resetViewFlipper();
|
reinflateViewFlipper();
|
||||||
mView.onDensityOrFontScaleChanged();
|
mView.onDensityOrFontScaleChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetViewFlipper() {
|
/**
|
||||||
|
* Reinflate the view flipper child view.
|
||||||
|
*/
|
||||||
|
public void reinflateViewFlipper() {
|
||||||
mSecurityViewFlipperController.clearViews();
|
mSecurityViewFlipperController.clearViews();
|
||||||
mSecurityViewFlipperController.getSecurityView(mCurrentSecurityMode,
|
mSecurityViewFlipperController.getSecurityView(mCurrentSecurityMode,
|
||||||
mKeyguardSecurityCallback);
|
mKeyguardSecurityCallback);
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import android.view.ViewGroup
|
|||||||
import android.window.OnBackAnimationCallback
|
import android.window.OnBackAnimationCallback
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.repeatOnLifecycle
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
import com.android.internal.policy.SystemBarUtils
|
|
||||||
import com.android.keyguard.KeyguardHostViewController
|
import com.android.keyguard.KeyguardHostViewController
|
||||||
import com.android.keyguard.KeyguardSecurityModel
|
import com.android.keyguard.KeyguardSecurityModel
|
||||||
import com.android.keyguard.KeyguardUpdateMonitor
|
import com.android.keyguard.KeyguardUpdateMonitor
|
||||||
@@ -98,14 +97,14 @@ object KeyguardBouncerViewBinder {
|
|||||||
viewModel.setBouncerViewDelegate(delegate)
|
viewModel.setBouncerViewDelegate(delegate)
|
||||||
launch {
|
launch {
|
||||||
viewModel.show.collect {
|
viewModel.show.collect {
|
||||||
|
// Reset Security Container entirely.
|
||||||
|
hostViewController.reinflateViewFlipper()
|
||||||
hostViewController.showPromptReason(it.promptReason)
|
hostViewController.showPromptReason(it.promptReason)
|
||||||
it.errorMessage?.let { errorMessage ->
|
it.errorMessage?.let { errorMessage ->
|
||||||
hostViewController.showErrorMessage(errorMessage)
|
hostViewController.showErrorMessage(errorMessage)
|
||||||
}
|
}
|
||||||
hostViewController.showPrimarySecurityScreen()
|
hostViewController.showPrimarySecurityScreen()
|
||||||
hostViewController.appear(
|
hostViewController.appear()
|
||||||
SystemBarUtils.getStatusBarHeight(view.context)
|
|
||||||
)
|
|
||||||
hostViewController.onResume()
|
hostViewController.onResume()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,7 +113,6 @@ object KeyguardBouncerViewBinder {
|
|||||||
viewModel.hide.collect {
|
viewModel.hide.collect {
|
||||||
hostViewController.cancelDismissAction()
|
hostViewController.cancelDismissAction()
|
||||||
hostViewController.cleanUp()
|
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 {
|
launch {
|
||||||
viewModel.keyguardPosition.collect { position ->
|
viewModel.keyguardPosition.collect { position ->
|
||||||
hostViewController.updateKeyguardPosition(position)
|
hostViewController.updateKeyguardPosition(position)
|
||||||
|
|||||||
@@ -600,6 +600,14 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
|
|||||||
any(KeyguardSecurityCallback.class));
|
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() {
|
private KeyguardSecurityContainer.SwipeListener getRegisteredSwipeListener() {
|
||||||
mKeyguardSecurityContainerController.onViewAttached();
|
mKeyguardSecurityContainerController.onViewAttached();
|
||||||
verify(mView).setSwipeListener(mSwipeListenerArgumentCaptor.capture());
|
verify(mView).setSwipeListener(mSwipeListenerArgumentCaptor.capture());
|
||||||
|
|||||||
Reference in New Issue
Block a user