Fix jank when pin/pattern is shown
- Only update layout params of status bar window when needed - Do not update security method all the time, only when needed (only when reset gets called) - Check for actual used security method when updating states for bouncer Bug: 18505838 Change-Id: Ib3d0021c0cc364fa5598e06e0a2bae059ae79cbe
This commit is contained in:
@@ -399,8 +399,6 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
|
|||||||
showPrimarySecurityScreen(false);
|
showPrimarySecurityScreen(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
showPrimarySecurityScreen(false);
|
|
||||||
}
|
}
|
||||||
if (finish) {
|
if (finish) {
|
||||||
mSecurityCallback.finish();
|
mSecurityCallback.finish();
|
||||||
@@ -556,6 +554,10 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
|
|||||||
return mSecurityModel.getSecurityMode();
|
return mSecurityModel.getSecurityMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SecurityMode getCurrentSecurityMode() {
|
||||||
|
return mCurrentSecuritySelection;
|
||||||
|
}
|
||||||
|
|
||||||
public void verifyUnlock() {
|
public void verifyUnlock() {
|
||||||
mIsVerifyUnlockOnly = true;
|
mIsVerifyUnlockOnly = true;
|
||||||
showSecurityScreen(getSecurityMode());
|
showSecurityScreen(getSecurityMode());
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa
|
|||||||
/**
|
/**
|
||||||
* Called when the view needs to be shown.
|
* Called when the view needs to be shown.
|
||||||
*/
|
*/
|
||||||
public void show() {
|
public void showPrimarySecurityScreen() {
|
||||||
if (DEBUG) Log.d(TAG, "show()");
|
if (DEBUG) Log.d(TAG, "show()");
|
||||||
mSecurityContainer.showPrimarySecurityScreen(false);
|
mSecurityContainer.showPrimarySecurityScreen(false);
|
||||||
}
|
}
|
||||||
@@ -224,7 +224,6 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa
|
|||||||
*/
|
*/
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
if (DEBUG) Log.d(TAG, "screen on, instance " + Integer.toHexString(hashCode()));
|
if (DEBUG) Log.d(TAG, "screen on, instance " + Integer.toHexString(hashCode()));
|
||||||
mSecurityContainer.showPrimarySecurityScreen(false);
|
|
||||||
mSecurityContainer.onResume(KeyguardSecurityView.SCREEN_ON);
|
mSecurityContainer.onResume(KeyguardSecurityView.SCREEN_ON);
|
||||||
requestFocus();
|
requestFocus();
|
||||||
}
|
}
|
||||||
@@ -473,6 +472,10 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa
|
|||||||
return mSecurityContainer.getSecurityMode();
|
return mSecurityContainer.getSecurityMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SecurityMode getCurrentSecurityMode() {
|
||||||
|
return mSecurityContainer.getCurrentSecurityMode();
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract void onUserSwitching(boolean switching);
|
protected abstract void onUserSwitching(boolean switching);
|
||||||
|
|
||||||
protected abstract void onCreateOptions(Bundle options);
|
protected abstract void onCreateOptions(Bundle options);
|
||||||
|
|||||||
@@ -957,6 +957,7 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
// if the keyguard is already showing, don't bother
|
// if the keyguard is already showing, don't bother
|
||||||
if (mStatusBarKeyguardViewManager.isShowing()) {
|
if (mStatusBarKeyguardViewManager.isShowing()) {
|
||||||
if (DEBUG) Log.d(TAG, "doKeyguard: not showing because it is already showing");
|
if (DEBUG) Log.d(TAG, "doKeyguard: not showing because it is already showing");
|
||||||
|
resetStateLocked();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,13 +57,14 @@ public class KeyguardBouncer {
|
|||||||
mWindowManager = windowManager;
|
mWindowManager = windowManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show() {
|
public void show(boolean resetSecuritySelection) {
|
||||||
ensureView();
|
ensureView();
|
||||||
|
if (resetSecuritySelection) {
|
||||||
|
// showPrimarySecurityScreen() updates the current security method. This is needed in
|
||||||
|
// case we are already showing and the current security method changed.
|
||||||
|
mKeyguardView.showPrimarySecurityScreen();
|
||||||
|
}
|
||||||
if (mRoot.getVisibility() == View.VISIBLE || mShowingSoon) {
|
if (mRoot.getVisibility() == View.VISIBLE || mShowingSoon) {
|
||||||
|
|
||||||
// show() updates the current security method. This is needed in case we are already
|
|
||||||
// showing and the current security method changed.
|
|
||||||
mKeyguardView.show();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +75,7 @@ public class KeyguardBouncer {
|
|||||||
|
|
||||||
// Split up the work over multiple frames.
|
// Split up the work over multiple frames.
|
||||||
mChoreographer.postCallbackDelayed(Choreographer.CALLBACK_ANIMATION, mShowRunnable,
|
mChoreographer.postCallbackDelayed(Choreographer.CALLBACK_ANIMATION, mShowRunnable,
|
||||||
null, 48);
|
null, 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +97,7 @@ public class KeyguardBouncer {
|
|||||||
public void showWithDismissAction(OnDismissAction r) {
|
public void showWithDismissAction(OnDismissAction r) {
|
||||||
ensureView();
|
ensureView();
|
||||||
mKeyguardView.setOnDismissAction(r);
|
mKeyguardView.setOnDismissAction(r);
|
||||||
show();
|
show(false /* resetSecuritySelection */);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hide(boolean destroyView) {
|
public void hide(boolean destroyView) {
|
||||||
@@ -152,7 +153,11 @@ public class KeyguardBouncer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void prepare() {
|
public void prepare() {
|
||||||
|
boolean wasInitialized = mRoot != null;
|
||||||
ensureView();
|
ensureView();
|
||||||
|
if (wasInitialized) {
|
||||||
|
mKeyguardView.showPrimarySecurityScreen();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensureView() {
|
private void ensureView() {
|
||||||
@@ -184,14 +189,25 @@ public class KeyguardBouncer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return True if and only if the current security method should be shown before showing
|
* @return True if and only if the security method should be shown before showing the
|
||||||
* the notifications on Keyguard, like SIM PIN/PUK.
|
* notifications on Keyguard, like SIM PIN/PUK.
|
||||||
*/
|
*/
|
||||||
public boolean needsFullscreenBouncer() {
|
public boolean needsFullscreenBouncer() {
|
||||||
if (mKeyguardView != null) {
|
if (mKeyguardView != null) {
|
||||||
SecurityMode mode = mKeyguardView.getSecurityMode();
|
SecurityMode mode = mKeyguardView.getSecurityMode();
|
||||||
return mode == SecurityMode.SimPin
|
return mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk;
|
||||||
|| mode == SecurityMode.SimPuk;
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Like {@link #needsFullscreenBouncer}, but uses the currently visible security method, which
|
||||||
|
* makes this method much faster.
|
||||||
|
*/
|
||||||
|
public boolean isFullscreenBouncer() {
|
||||||
|
if (mKeyguardView != null) {
|
||||||
|
SecurityMode mode = mKeyguardView.getCurrentSecurityMode();
|
||||||
|
return mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public class StatusBarKeyguardViewManager {
|
|||||||
|
|
||||||
// The keyguard might be showing (already). So we need to hide it.
|
// The keyguard might be showing (already). So we need to hide it.
|
||||||
mPhoneStatusBar.hideKeyguard();
|
mPhoneStatusBar.hideKeyguard();
|
||||||
mBouncer.show();
|
mBouncer.show(true /* resetSecuritySelection */);
|
||||||
} else {
|
} else {
|
||||||
mPhoneStatusBar.showKeyguard();
|
mPhoneStatusBar.showKeyguard();
|
||||||
mBouncer.hide(false /* destroyView */);
|
mBouncer.hide(false /* destroyView */);
|
||||||
@@ -120,7 +120,7 @@ public class StatusBarKeyguardViewManager {
|
|||||||
|
|
||||||
private void showBouncer() {
|
private void showBouncer() {
|
||||||
if (mShowing) {
|
if (mShowing) {
|
||||||
mBouncer.show();
|
mBouncer.show(false /* resetSecuritySelection */);
|
||||||
}
|
}
|
||||||
updateStates();
|
updateStates();
|
||||||
}
|
}
|
||||||
@@ -130,7 +130,7 @@ public class StatusBarKeyguardViewManager {
|
|||||||
if (!afterKeyguardGone) {
|
if (!afterKeyguardGone) {
|
||||||
mBouncer.showWithDismissAction(r);
|
mBouncer.showWithDismissAction(r);
|
||||||
} else {
|
} else {
|
||||||
mBouncer.show();
|
mBouncer.show(false /* resetSecuritySelection */);
|
||||||
mAfterKeyguardGoneAction = r;
|
mAfterKeyguardGoneAction = r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -354,7 +354,7 @@ public class StatusBarKeyguardViewManager {
|
|||||||
boolean showing = mShowing;
|
boolean showing = mShowing;
|
||||||
boolean occluded = mOccluded;
|
boolean occluded = mOccluded;
|
||||||
boolean bouncerShowing = mBouncer.isShowing();
|
boolean bouncerShowing = mBouncer.isShowing();
|
||||||
boolean bouncerDismissible = !mBouncer.needsFullscreenBouncer();
|
boolean bouncerDismissible = !mBouncer.isFullscreenBouncer();
|
||||||
|
|
||||||
if ((bouncerDismissible || !showing) != (mLastBouncerDismissible || !mLastShowing)
|
if ((bouncerDismissible || !showing) != (mLastBouncerDismissible || !mLastShowing)
|
||||||
|| mFirstUpdate) {
|
|| mFirstUpdate) {
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public class StatusBarWindowManager {
|
|||||||
private final WindowManager mWindowManager;
|
private final WindowManager mWindowManager;
|
||||||
private View mStatusBarView;
|
private View mStatusBarView;
|
||||||
private WindowManager.LayoutParams mLp;
|
private WindowManager.LayoutParams mLp;
|
||||||
|
private WindowManager.LayoutParams mLpChanged;
|
||||||
private int mBarHeight;
|
private int mBarHeight;
|
||||||
private final boolean mKeyguardScreenRotation;
|
private final boolean mKeyguardScreenRotation;
|
||||||
|
|
||||||
@@ -85,41 +86,43 @@ public class StatusBarWindowManager {
|
|||||||
mStatusBarView = statusBarView;
|
mStatusBarView = statusBarView;
|
||||||
mBarHeight = barHeight;
|
mBarHeight = barHeight;
|
||||||
mWindowManager.addView(mStatusBarView, mLp);
|
mWindowManager.addView(mStatusBarView, mLp);
|
||||||
|
mLpChanged = new WindowManager.LayoutParams();
|
||||||
|
mLpChanged.copyFrom(mLp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyKeyguardFlags(State state) {
|
private void applyKeyguardFlags(State state) {
|
||||||
if (state.keyguardShowing) {
|
if (state.keyguardShowing) {
|
||||||
mLp.flags |= WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
|
mLpChanged.flags |= WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
|
||||||
mLp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
|
mLpChanged.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
|
||||||
} else {
|
} else {
|
||||||
mLp.flags &= ~WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
|
mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
|
||||||
mLp.privateFlags &= ~WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
|
mLpChanged.privateFlags &= ~WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void adjustScreenOrientation(State state) {
|
private void adjustScreenOrientation(State state) {
|
||||||
if (state.isKeyguardShowingAndNotOccluded()) {
|
if (state.isKeyguardShowingAndNotOccluded()) {
|
||||||
if (mKeyguardScreenRotation) {
|
if (mKeyguardScreenRotation) {
|
||||||
mLp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;
|
mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;
|
||||||
} else {
|
} else {
|
||||||
mLp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
|
mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mLp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyFocusableFlag(State state) {
|
private void applyFocusableFlag(State state) {
|
||||||
if (state.isKeyguardShowingAndNotOccluded() && state.keyguardNeedsInput
|
if (state.isKeyguardShowingAndNotOccluded() && state.keyguardNeedsInput
|
||||||
&& state.bouncerShowing) {
|
&& state.bouncerShowing) {
|
||||||
mLp.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
||||||
mLp.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
||||||
} else if (state.isKeyguardShowingAndNotOccluded() || state.statusBarFocusable) {
|
} else if (state.isKeyguardShowingAndNotOccluded() || state.statusBarFocusable) {
|
||||||
mLp.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
||||||
mLp.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
mLpChanged.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
||||||
} else {
|
} else {
|
||||||
mLp.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
mLpChanged.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
||||||
mLp.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,9 +130,9 @@ public class StatusBarWindowManager {
|
|||||||
boolean expanded = state.isKeyguardShowingAndNotOccluded() || state.statusBarExpanded
|
boolean expanded = state.isKeyguardShowingAndNotOccluded() || state.statusBarExpanded
|
||||||
|| state.keyguardFadingAway || state.bouncerShowing;
|
|| state.keyguardFadingAway || state.bouncerShowing;
|
||||||
if (expanded) {
|
if (expanded) {
|
||||||
mLp.height = ViewGroup.LayoutParams.MATCH_PARENT;
|
mLpChanged.height = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||||
} else {
|
} else {
|
||||||
mLp.height = mBarHeight;
|
mLpChanged.height = mBarHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,9 +144,9 @@ public class StatusBarWindowManager {
|
|||||||
if (state.isKeyguardShowingAndNotOccluded()
|
if (state.isKeyguardShowingAndNotOccluded()
|
||||||
&& state.statusBarState == StatusBarState.KEYGUARD
|
&& state.statusBarState == StatusBarState.KEYGUARD
|
||||||
&& !state.qsExpanded) {
|
&& !state.qsExpanded) {
|
||||||
mLp.userActivityTimeout = state.keyguardUserActivityTimeout;
|
mLpChanged.userActivityTimeout = state.keyguardUserActivityTimeout;
|
||||||
} else {
|
} else {
|
||||||
mLp.userActivityTimeout = -1;
|
mLpChanged.userActivityTimeout = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,9 +154,11 @@ public class StatusBarWindowManager {
|
|||||||
if (state.isKeyguardShowingAndNotOccluded()
|
if (state.isKeyguardShowingAndNotOccluded()
|
||||||
&& state.statusBarState == StatusBarState.KEYGUARD
|
&& state.statusBarState == StatusBarState.KEYGUARD
|
||||||
&& !state.qsExpanded) {
|
&& !state.qsExpanded) {
|
||||||
mLp.inputFeatures |= WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
|
mLpChanged.inputFeatures |=
|
||||||
|
WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
|
||||||
} else {
|
} else {
|
||||||
mLp.inputFeatures &= ~WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
|
mLpChanged.inputFeatures &=
|
||||||
|
~WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +170,9 @@ public class StatusBarWindowManager {
|
|||||||
applyUserActivityTimeout(state);
|
applyUserActivityTimeout(state);
|
||||||
applyInputFeatures(state);
|
applyInputFeatures(state);
|
||||||
applyFitsSystemWindows(state);
|
applyFitsSystemWindows(state);
|
||||||
mWindowManager.updateViewLayout(mStatusBarView, mLp);
|
if (mLp.copyFrom(mLpChanged) != 0) {
|
||||||
|
mWindowManager.updateViewLayout(mStatusBarView, mLp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyguardShowing(boolean showing) {
|
public void setKeyguardShowing(boolean showing) {
|
||||||
|
|||||||
Reference in New Issue
Block a user