summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java12
-rw-r--r--policy/src/com/android/internal/policy/impl/LockScreen.java5
-rw-r--r--policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java26
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindow.java44
4 files changed, 74 insertions, 13 deletions
diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
index 27706ef..8693294 100644
--- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
+++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
@@ -667,6 +667,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
case DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC:
case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC:
+ case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX:
currentMode = UnlockMode.Password;
break;
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
@@ -687,8 +688,17 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
private void showTimeoutDialog() {
int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
+ int messageId = R.string.lockscreen_too_many_failed_attempts_dialog_message;;
+ if(getUnlockMode() == UnlockMode.Password) {
+ if(mLockPatternUtils.getKeyguardStoredPasswordQuality() ==
+ DevicePolicyManager.PASSWORD_QUALITY_NUMERIC) {
+ messageId = R.string.lockscreen_too_many_failed_pin_attempts_dialog_message;
+ } else {
+ messageId = R.string.lockscreen_too_many_failed_password_attempts_dialog_message;
+ }
+ }
String message = mContext.getString(
- R.string.lockscreen_too_many_failed_attempts_dialog_message,
+ messageId,
mUpdateMonitor.getFailedAttempts(),
timeoutInSeconds);
final AlertDialog dialog = new AlertDialog.Builder(mContext)
diff --git a/policy/src/com/android/internal/policy/impl/LockScreen.java b/policy/src/com/android/internal/policy/impl/LockScreen.java
index a5ef1fa..b3707b0 100644
--- a/policy/src/com/android/internal/policy/impl/LockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/LockScreen.java
@@ -220,7 +220,6 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
}
});
-
setFocusable(true);
setFocusableInTouchMode(true);
setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
@@ -518,7 +517,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
mScreenLocked.setText("");
// layout
- mScreenLocked.setVisibility(View.VISIBLE);
+ mScreenLocked.setVisibility(View.INVISIBLE);
mSelector.setVisibility(View.VISIBLE);
mEmergencyCallText.setVisibility(View.GONE);
break;
@@ -658,7 +657,6 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
/** {@inheritDoc} */
public void onResume() {
resetStatusInfo(mUpdateMonitor);
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
}
/** {@inheritDoc} */
@@ -676,6 +674,5 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
}
public void onPhoneStateChanged(String newState) {
- mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
}
}
diff --git a/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java b/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java
index 39f2917..60cd56c 100644
--- a/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java
@@ -53,6 +53,8 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
private final KeyguardUpdateMonitor mUpdateMonitor;
private final KeyguardScreenCallback mCallback;
+ private boolean mIsAlpha;
+
private EditText mPasswordEntry;
private Button mEmergencyCallButton;
private LockPatternUtils mLockPatternUtils;
@@ -87,8 +89,9 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
}
final int quality = lockPatternUtils.getKeyguardStoredPasswordQuality();
- final boolean isAlpha = DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC == quality
- || DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC == quality;
+ mIsAlpha = DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC == quality
+ || DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC == quality
+ || DevicePolicyManager.PASSWORD_QUALITY_COMPLEX == quality;
mKeyboardView = (PasswordEntryKeyboardView) findViewById(R.id.keyboard);
mPasswordEntry = (EditText) findViewById(R.id.passwordEntry);
@@ -99,7 +102,7 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
mTitle = (TextView) findViewById(R.id.enter_password_label);
mKeyboardHelper = new PasswordEntryKeyboardHelper(context, mKeyboardView, this);
- mKeyboardHelper.setKeyboardMode(isAlpha ? PasswordEntryKeyboardHelper.KEYBOARD_MODE_ALPHA
+ mKeyboardHelper.setKeyboardMode(mIsAlpha ? PasswordEntryKeyboardHelper.KEYBOARD_MODE_ALPHA
: PasswordEntryKeyboardHelper.KEYBOARD_MODE_NUMERIC);
mKeyboardView.setVisibility(mCreationHardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO
@@ -108,10 +111,11 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
// This allows keyboards with overlapping qwerty/numeric keys to choose just the
// numeric keys.
- if (isAlpha) {
+ if (mIsAlpha) {
mPasswordEntry.setKeyListener(TextKeyListener.getInstance());
} else {
mPasswordEntry.setKeyListener(DigitsKeyListener.getInstance());
+ mTitle.setText(R.string.keyguard_password_enter_pin_password_code);
}
mKeyboardHelper.setVibratePattern(mLockPatternUtils.isTactileFeedbackEnabled() ?
@@ -138,6 +142,7 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
public void onResume() {
// start fresh
mPasswordEntry.setText("");
+ resetStatusInfo();
mPasswordEntry.requestFocus();
mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
@@ -174,6 +179,9 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
handleAttemptLockout(deadline);
}
+ mTitle.setText(R.string.lockscreen_password_wrong);
+ } else if (entry.length() > 0) {
+ mTitle.setText(R.string.lockscreen_password_wrong);
}
mPasswordEntry.setText("");
}
@@ -197,8 +205,8 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
@Override
public void onFinish() {
mPasswordEntry.setEnabled(true);
- mTitle.setText(R.string.keyguard_password_enter_password_code);
mKeyboardView.setEnabled(true);
+ resetStatusInfo();
}
}.start();
}
@@ -264,4 +272,12 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
}
+ private void resetStatusInfo() {
+ if(mIsAlpha) {
+ mTitle.setText(R.string.keyguard_password_enter_password_code);
+ } else {
+ mTitle.setText(R.string.keyguard_password_enter_pin_password_code);
+ }
+ }
+
}
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index 0cb0efc..1c78a01 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -54,6 +54,7 @@ import android.util.Config;
import android.util.EventLog;
import android.util.Log;
import android.util.SparseArray;
+import android.view.ActionBarView;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
import android.view.KeyCharacterMap;
@@ -80,6 +81,12 @@ import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
+import com.android.internal.view.menu.ContextMenuBuilder;
+import com.android.internal.view.menu.MenuBuilder;
+import com.android.internal.view.menu.MenuDialogHelper;
+import com.android.internal.view.menu.MenuView;
+import com.android.internal.view.menu.SubMenuBuilder;
+
/**
* Android-specific Window.
* <p>
@@ -113,6 +120,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
private LayoutInflater mLayoutInflater;
private TextView mTitleView;
+
+ private ActionBarView mActionBar;
private DrawableFeatureState[] mDrawables;
@@ -271,6 +280,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
public void setTitle(CharSequence title) {
if (mTitleView != null) {
mTitleView.setText(title);
+ } else if (mActionBar != null) {
+ mActionBar.setTitle(title);
}
mTitle = title;
}
@@ -310,9 +321,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
if (st.createdPanelView == null) {
// Init the panel state's menu--return false if init failed
- if (st.menu == null) {
- if (!initializePanelMenu(st) || (st.menu == null)) {
- return false;
+ if (st.menu == null || st.refreshMenuContent) {
+ if (st.menu == null) {
+ if (!initializePanelMenu(st) || (st.menu == null)) {
+ return false;
+ }
}
// Call callback, and return if it doesn't want to display menu
if ((cb == null) || !cb.onCreatePanelMenu(st.featureId, st.menu)) {
@@ -321,6 +334,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
return false;
}
+ st.refreshMenuContent = false;
}
// Callback and return if the callback does not want to show the menu
@@ -540,6 +554,16 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
}
}
+ @Override
+ public void invalidatePanelMenu(int featureId) {
+ PanelFeatureState st = getPanelState(featureId, true);
+ if (st.menu != null) {
+ st.menu.clear();
+ }
+ st.refreshMenuContent = true;
+ st.refreshDecorView = true;
+ }
+
/**
* Called when the panel key is pushed down.
* @param featureId The feature ID of the relevant panel (defaults to FEATURE_OPTIONS_PANEL}.
@@ -2097,6 +2121,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
if (a.getBoolean(com.android.internal.R.styleable.Window_windowNoTitle, false)) {
requestFeature(FEATURE_NO_TITLE);
+ } else if (a.getBoolean(com.android.internal.R.styleable.Window_windowActionBar, false)) {
+ // Don't allow an action bar if there is no title.
+ requestFeature(FEATURE_ACTION_BAR);
}
if (a.getBoolean(com.android.internal.R.styleable.Window_windowFullscreen, false)) {
@@ -2180,6 +2207,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
// If the window is floating, we need a dialog layout
if (mIsFloating) {
layoutResource = com.android.internal.R.layout.dialog_title;
+ } else if ((features & (1 << FEATURE_ACTION_BAR)) != 0) {
+ layoutResource = com.android.internal.R.layout.screen_action_bar;
} else {
layoutResource = com.android.internal.R.layout.screen_title;
}
@@ -2264,6 +2293,13 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
} else {
mTitleView.setText(mTitle);
}
+ } else {
+ mActionBar = (ActionBarView) findViewById(com.android.internal.R.id.action_bar);
+ if (mActionBar != null) {
+ if (mActionBar.getTitle() == null) {
+ mActionBar.setTitle(mTitle);
+ }
+ }
}
}
}
@@ -2617,6 +2653,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
boolean refreshDecorView;
+ boolean refreshMenuContent;
+
boolean wasLastOpen;
boolean wasLastExpanded;