Merge "Revert "Destroy and reinflate bouncer before showing"" into tm-qpr-dev
This commit is contained in:
@@ -202,11 +202,8 @@ public class KeyguardHostViewController extends ViewController<KeyguardHostView>
|
|||||||
mKeyguardSecurityContainerController.onPause();
|
mKeyguardSecurityContainerController.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void resetSecurityContainer() {
|
||||||
* Reinflate the view flipper child view.
|
mKeyguardSecurityContainerController.reset();
|
||||||
*/
|
|
||||||
public void reinflateViewFlipper() {
|
|
||||||
mKeyguardSecurityContainerController.reinflateViewFlipper();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -235,19 +232,23 @@ 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() {
|
public void appear(int statusBarHeight) {
|
||||||
// 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.
|
||||||
mView.getViewTreeObserver().addOnPreDrawListener(
|
if (mView.getHeight() != 0 && mView.getHeight() != statusBarHeight) {
|
||||||
new ViewTreeObserver.OnPreDrawListener() {
|
mKeyguardSecurityContainerController.startAppearAnimation();
|
||||||
@Override
|
} else {
|
||||||
public boolean onPreDraw() {
|
mView.getViewTreeObserver().addOnPreDrawListener(
|
||||||
mView.getViewTreeObserver().removeOnPreDrawListener(this);
|
new ViewTreeObserver.OnPreDrawListener() {
|
||||||
mKeyguardSecurityContainerController.startAppearAnimation();
|
@Override
|
||||||
return true;
|
public boolean onPreDraw() {
|
||||||
}
|
mView.getViewTreeObserver().removeOnPreDrawListener(this);
|
||||||
});
|
mKeyguardSecurityContainerController.startAppearAnimation();
|
||||||
mView.requestLayout();
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mView.requestLayout();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -743,20 +743,17 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void reloadColors() {
|
private void reloadColors() {
|
||||||
reinflateViewFlipper();
|
resetViewFlipper();
|
||||||
mView.reloadColors();
|
mView.reloadColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Handles density or font scale changes. */
|
/** Handles density or font scale changes. */
|
||||||
private void onDensityOrFontScaleChanged() {
|
private void onDensityOrFontScaleChanged() {
|
||||||
reinflateViewFlipper();
|
resetViewFlipper();
|
||||||
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,6 +22,7 @@ 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
|
||||||
@@ -97,14 +98,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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,6 +114,7 @@ object KeyguardBouncerViewBinder {
|
|||||||
viewModel.hide.collect {
|
viewModel.hide.collect {
|
||||||
hostViewController.cancelDismissAction()
|
hostViewController.cancelDismissAction()
|
||||||
hostViewController.cleanUp()
|
hostViewController.cleanUp()
|
||||||
|
hostViewController.resetSecurityContainer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,6 +159,15 @@ 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,14 +600,6 @@ 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