am e0fa592a: Merge "Show enter PIN/PUK before notifications on Keyguard."
* commit 'e0fa592afc163708d7707158ff76ee8148d90e79': Show enter PIN/PUK before notifications on Keyguard.
This commit is contained in:
@@ -22,10 +22,8 @@ import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
|
||||
import com.android.keyguard.KeyguardUpdateMonitor.DisplayClientState;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.SearchManager;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.appwidget.AppWidgetHost;
|
||||
import android.appwidget.AppWidgetHostView;
|
||||
@@ -36,7 +34,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentSender;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Rect;
|
||||
import android.media.RemoteControlClient;
|
||||
@@ -44,7 +41,6 @@ import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.os.SystemClock;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.provider.Settings;
|
||||
@@ -55,9 +51,7 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.RemoteViews.OnClickHandler;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
public class KeyguardHostView extends KeyguardViewBase {
|
||||
private static final String TAG = "KeyguardHostView";
|
||||
@@ -595,16 +589,16 @@ public class KeyguardHostView extends KeyguardViewBase {
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onScreenTurnedOn() {
|
||||
super.onScreenTurnedOn();
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (mViewStateManager != null) {
|
||||
mViewStateManager.showUsabilityHints();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScreenTurnedOff() {
|
||||
super.onScreenTurnedOff();
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
// We use mAppWidgetToShow to show a particular widget after you add it-- once the screen
|
||||
// turns off we reset that behavior
|
||||
clearAppWidgetToShow();
|
||||
|
||||
@@ -28,7 +28,7 @@ public class KeyguardSecurityModel {
|
||||
* The different types of security available for {@link Mode#UnlockScreen}.
|
||||
* @see com.android.internal.policy.impl.LockPatternKeyguardView#getUnlockMode()
|
||||
*/
|
||||
enum SecurityMode {
|
||||
public enum SecurityMode {
|
||||
Invalid, // NULL state
|
||||
None, // No security enabled
|
||||
Pattern, // Unlock by drawing a pattern.
|
||||
|
||||
@@ -217,9 +217,9 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the screen turned off.
|
||||
* Called when the Keyguard is not actively shown anymore on the screen.
|
||||
*/
|
||||
public void onScreenTurnedOff() {
|
||||
public void onPause() {
|
||||
if (DEBUG) Log.d(TAG, String.format("screen off, instance %s at %s",
|
||||
Integer.toHexString(hashCode()), SystemClock.uptimeMillis()));
|
||||
// Once the screen turns off, we no longer consider this to be first boot and we want the
|
||||
@@ -231,9 +231,9 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the screen turned on.
|
||||
* Called when the Keyguard is actively shown on the screen.
|
||||
*/
|
||||
public void onScreenTurnedOn() {
|
||||
public void onResume() {
|
||||
if (DEBUG) Log.d(TAG, "screen on, instance " + Integer.toHexString(hashCode()));
|
||||
mSecurityContainer.showPrimarySecurityScreen(false);
|
||||
mSecurityContainer.onResume(KeyguardSecurityView.SCREEN_ON);
|
||||
@@ -476,6 +476,10 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa
|
||||
mSecurityContainer.setLockPatternUtils(utils);
|
||||
}
|
||||
|
||||
public SecurityMode getSecurityMode() {
|
||||
return mSecurityContainer.getSecurityMode();
|
||||
}
|
||||
|
||||
protected abstract void onUserSwitching(boolean switching);
|
||||
|
||||
protected abstract void onCreateOptions(Bundle options);
|
||||
|
||||
@@ -1285,6 +1285,9 @@ public class KeyguardViewMediator extends SystemUI {
|
||||
flags |= StatusBarManager.DISABLE_SEARCH;
|
||||
}
|
||||
}
|
||||
if (isShowingAndNotOccluded()) {
|
||||
flags |= StatusBarManager.DISABLE_HOME;
|
||||
}
|
||||
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "adjustStatusBarLocked: mShowing=" + mShowing + " mOccluded=" + mOccluded
|
||||
|
||||
@@ -17,20 +17,18 @@
|
||||
package com.android.systemui.statusbar.phone;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.android.internal.policy.IKeyguardShowCallback;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.keyguard.KeyguardHostView;
|
||||
import com.android.keyguard.KeyguardViewBase;
|
||||
import com.android.keyguard.R;
|
||||
import com.android.keyguard.ViewMediatorCallback;
|
||||
import com.android.systemui.keyguard.KeyguardViewMediator;
|
||||
|
||||
import static com.android.keyguard.KeyguardSecurityModel.*;
|
||||
|
||||
/**
|
||||
* A class which manages the bouncer on the lockscreen.
|
||||
*/
|
||||
@@ -66,6 +64,7 @@ public class KeyguardBouncer {
|
||||
if (!mKeyguardView.dismiss()) {
|
||||
mRoot.setVisibility(View.VISIBLE);
|
||||
mKeyguardView.requestFocus();
|
||||
mKeyguardView.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,14 +83,8 @@ public class KeyguardBouncer {
|
||||
}
|
||||
|
||||
public void onScreenTurnedOff() {
|
||||
if (mKeyguardView != null) {
|
||||
mKeyguardView.onScreenTurnedOff();
|
||||
}
|
||||
}
|
||||
|
||||
public void onScreenTurnedOn() {
|
||||
if (mKeyguardView != null) {
|
||||
mKeyguardView.onScreenTurnedOn();
|
||||
if (mKeyguardView != null && mRoot.getVisibility() == View.VISIBLE) {
|
||||
mKeyguardView.onPause();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,4 +129,17 @@ public class KeyguardBouncer {
|
||||
public boolean onBackPressed() {
|
||||
return mKeyguardView != null && mKeyguardView.handleBackKey();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if and only if the current security method should be shown before showing
|
||||
* the notifications on Keyguard, like SIM PIN/PUK.
|
||||
*/
|
||||
public boolean needsFullscreenBouncer() {
|
||||
if (mKeyguardView != null) {
|
||||
SecurityMode mode = mKeyguardView.getSecurityMode();
|
||||
return mode == SecurityMode.SimPin
|
||||
|| mode == SecurityMode.SimPuk;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2945,7 +2945,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
|
||||
if (isFlippedToSettings()) {
|
||||
flipToNotifications();
|
||||
}
|
||||
mStatusBarWindow.setSystemUiVisibility(View.STATUS_BAR_DISABLE_HOME);
|
||||
mKeyguardStatusView.setVisibility(View.VISIBLE);
|
||||
mNotificationPanelHeader.setVisibility(View.GONE);
|
||||
if (mKeyguardSettingsFlipButton == null) {
|
||||
@@ -2962,13 +2961,13 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
|
||||
|
||||
public void hideKeyguard() {
|
||||
mOnKeyguard = false;
|
||||
mStatusBarWindow.setSystemUiVisibility(0);
|
||||
mKeyguardStatusView.setVisibility(View.GONE);
|
||||
mNotificationPanelHeader.setVisibility(View.VISIBLE);
|
||||
if (mKeyguardSettingsFlipButton != null) {
|
||||
mKeyguardSettingsFlipButton.setVisibility(View.GONE);
|
||||
}
|
||||
updateRowStates();
|
||||
instantCollapseNotificationPanel();
|
||||
}
|
||||
|
||||
public void userActivity() {
|
||||
@@ -2997,6 +2996,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
|
||||
mNotificationPanel.setExpandedFraction(1);
|
||||
}
|
||||
|
||||
private void instantCollapseNotificationPanel() {
|
||||
mNotificationPanel.setExpandedFraction(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivated(View view) {
|
||||
userActivity();
|
||||
|
||||
@@ -80,11 +80,27 @@ public class StatusBarKeyguardViewManager {
|
||||
public void show(Bundle options) {
|
||||
mShowing = true;
|
||||
mStatusBarWindowManager.setKeyguardShowing(true);
|
||||
mPhoneStatusBar.showKeyguard();
|
||||
mBouncer.prepare();
|
||||
showBouncerOrKeyguard();
|
||||
updateBackButtonState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the notification keyguard or the bouncer depending on
|
||||
* {@link KeyguardBouncer#needsFullscreenBouncer()}.
|
||||
*/
|
||||
private void showBouncerOrKeyguard() {
|
||||
if (mBouncer.needsFullscreenBouncer()) {
|
||||
|
||||
// The keyguard might be showing (already). So we need to hide it.
|
||||
mPhoneStatusBar.hideKeyguard();
|
||||
mBouncer.show();
|
||||
} else {
|
||||
mPhoneStatusBar.showKeyguard();
|
||||
mBouncer.hide();
|
||||
mBouncer.prepare();
|
||||
}
|
||||
}
|
||||
|
||||
public void showBouncer() {
|
||||
mBouncer.show();
|
||||
updateBackButtonState();
|
||||
@@ -94,8 +110,7 @@ public class StatusBarKeyguardViewManager {
|
||||
* Reset the state of the view.
|
||||
*/
|
||||
public void reset() {
|
||||
mBouncer.reset();
|
||||
mPhoneStatusBar.showKeyguard();
|
||||
showBouncerOrKeyguard();
|
||||
updateBackButtonState();
|
||||
}
|
||||
|
||||
@@ -106,7 +121,6 @@ public class StatusBarKeyguardViewManager {
|
||||
|
||||
public void onScreenTurnedOn(final IKeyguardShowCallback callback) {
|
||||
mScreenOn = true;
|
||||
mBouncer.onScreenTurnedOn();
|
||||
if (callback != null) {
|
||||
callbackAfterDraw(callback);
|
||||
}
|
||||
@@ -185,7 +199,8 @@ public class StatusBarKeyguardViewManager {
|
||||
|
||||
private void updateBackButtonState() {
|
||||
int vis = mContainer.getSystemUiVisibility();
|
||||
if (mBouncer.isShowing()) {
|
||||
boolean bouncerDismissable = mBouncer.isShowing() && !mBouncer.needsFullscreenBouncer();
|
||||
if (bouncerDismissable || !mShowing) {
|
||||
mContainer.setSystemUiVisibility(vis & ~View.STATUS_BAR_DISABLE_BACK);
|
||||
} else {
|
||||
mContainer.setSystemUiVisibility(vis | View.STATUS_BAR_DISABLE_BACK);
|
||||
|
||||
@@ -128,6 +128,10 @@ public class StatusBarWindowManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void applyFitsSystemWindows(State state) {
|
||||
mStatusBarView.setFitsSystemWindows(!state.isKeyguardShowingAndNotOccluded());
|
||||
}
|
||||
|
||||
private void applyUserActivityTimeout(State state) {
|
||||
if (state.isKeyguardShowingAndNotOccluded()) {
|
||||
mLp.userActivityTimeout = state.keyguardUserActivityTimeout;
|
||||
@@ -151,6 +155,7 @@ public class StatusBarWindowManager {
|
||||
applyHeight(state);
|
||||
applyUserActivityTimeout(state);
|
||||
applyInputFeatures(state);
|
||||
applyFitsSystemWindows(state);
|
||||
mWindowManager.updateViewLayout(mStatusBarView, mLp);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user