am 1ed143ea: Merge "Clean up SIM PIN and PUK screens in keyguard." into jb-mr1-dev
* commit '1ed143ea341d2dac29cc3aafaf2fbeb1b13c5251': Clean up SIM PIN and PUK screens in keyguard.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
**
|
||||
** Copyright 2008, The Android Open Source Project
|
||||
** Copyright 2012, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License")
|
||||
** you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -67,10 +67,10 @@
|
||||
<ImageButton android:id="@+id/delete_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@*android:drawable/ic_input_delete"
|
||||
android:clickable="true"
|
||||
android:padding="8dip"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
android:layout_marginEnd="4dip"
|
||||
android:layout_marginStart="4dip"
|
||||
android:gravity="center_vertical"
|
||||
android:background="@android:drawable/edit_text">
|
||||
android:background="#70000000">
|
||||
|
||||
<!-- displays dots as user enters pin -->
|
||||
<EditText android:id="@+id/sim_pin_entry"
|
||||
@@ -60,19 +60,26 @@
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceLargeInverse"
|
||||
android:textColor="@*android:color/primary_text_holo_light"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="@*android:dimen/keyguard_lockscreen_pin_margin_left"
|
||||
android:textStyle="normal"
|
||||
android:inputType="textPassword"
|
||||
android:textSize="36sp"
|
||||
android:background="@null"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="#ffffffff"
|
||||
android:imeOptions="flagForceAscii|actionDone"
|
||||
/>
|
||||
|
||||
<ImageButton android:id="@+id/delete_button"
|
||||
android:src="@android:drawable/ic_input_delete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="-3dip"
|
||||
android:layout_marginBottom="-3dip"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@android:drawable/ic_input_delete"
|
||||
android:clickable="true"
|
||||
android:padding="8dip"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
<!-- This is the SIM PUK view that allows the user to recover their device by entering the
|
||||
carrier-provided PUK code and entering a new SIM PIN for it. -->
|
||||
<com.android.internal.policy.impl.keyguard.KeyguardSimPukView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/keyguard_sim_puk_view"
|
||||
@@ -24,98 +26,62 @@
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<include layout="@layout/keyguard_navigation"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
<LinearLayout
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1"/>
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center">
|
||||
|
||||
<LinearLayout android:id="@+id/topDisplayGroup"
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_lockscreen_sim"/>
|
||||
|
||||
<include layout="@layout/keyguard_navigation"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Password entry field -->
|
||||
<!-- Note: the entire container is styled to look like the edit field,
|
||||
since the backspace/IME switcher looks better inside -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginEnd="4dip"
|
||||
android:layout_marginStart="4dip"
|
||||
android:gravity="center_vertical"
|
||||
android:background="#70000000">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingEnd="0dip"
|
||||
android:layout_marginEnd="10dip"
|
||||
android:layout_marginStart="10dip">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginEnd="6dip"
|
||||
android:layout_marginStart="6dip"
|
||||
android:gravity="center_vertical"
|
||||
android:background="@*android:drawable/edit_text">
|
||||
|
||||
<!-- displays dots as user enters puk -->
|
||||
<EditText android:id="@+id/sim_puk_entry"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:textStyle="bold"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="#000"
|
||||
android:hint="@string/kg_puk_enter_puk_hint"
|
||||
/>
|
||||
|
||||
<ImageButton android:id="@+id/puk_delete_button"
|
||||
android:src="@*android:drawable/ic_input_delete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="-3dip"
|
||||
android:layout_marginBottom="-3dip"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginEnd="6dip"
|
||||
android:layout_marginStart="6dip"
|
||||
android:gravity="center_vertical"
|
||||
android:background="@*android:drawable/edit_text">
|
||||
|
||||
<!-- displays dots as user enters new pin -->
|
||||
<EditText android:id="@+id/sim_pin_entry"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:textStyle="bold"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="#000"
|
||||
android:hint="@string/kg_puk_enter_pin_hint"
|
||||
/>
|
||||
|
||||
<ImageButton android:id="@+id/pin_delete_button"
|
||||
android:src="@*android:drawable/ic_input_delete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="-3dip"
|
||||
android:layout_marginBottom="-3dip"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<!-- displays dots as user enters pin -->
|
||||
<EditText android:id="@+id/sim_pin_entry"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="@*android:dimen/keyguard_lockscreen_pin_margin_left"
|
||||
android:textStyle="normal"
|
||||
android:inputType="textPassword"
|
||||
android:textSize="36sp"
|
||||
android:background="@null"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="#ffffffff"
|
||||
android:imeOptions="flagForceAscii|actionDone"
|
||||
/>
|
||||
|
||||
<ImageButton android:id="@+id/delete_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@android:drawable/ic_input_delete"
|
||||
android:clickable="true"
|
||||
android:padding="8dip"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Numeric keyboard -->
|
||||
@@ -125,9 +91,14 @@
|
||||
android:layout_marginEnd="4dip"
|
||||
android:paddingTop="4dip"
|
||||
android:paddingBottom="4dip"
|
||||
android:background="#80ffffff"
|
||||
android:background="#40000000"
|
||||
android:keyBackground="@*android:drawable/btn_keyboard_key_ics"
|
||||
android:clickable="true"
|
||||
/>
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/kg_secure_padding_height"
|
||||
android:background="@drawable/lockscreen_protection_pattern" />
|
||||
|
||||
</com.android.internal.policy.impl.keyguard.KeyguardSimPukView>
|
||||
|
||||
@@ -3833,10 +3833,12 @@
|
||||
<string name="kg_pin_instructions">Enter PIN</string>
|
||||
<!-- Instructions for using the password unlock screen -->
|
||||
<string name="kg_password_instructions">Enter Password</string>
|
||||
<!-- Hint shown in the PUK unlock screen PUK TextView -->
|
||||
<string name="kg_puk_enter_puk_hint">PUK code</string>
|
||||
<!-- Hint shown in the PUK screen that asks the user to enter the PUK code given to them by their provider -->
|
||||
<string name="kg_puk_enter_puk_hint">SIM is now disabled. Enter PUK code to continue. Contact carrier for details.</string>
|
||||
<!-- Hint shown in the PUK unlock screen PIN TextView -->
|
||||
<string name="kg_puk_enter_pin_hint">New PIN code</string>
|
||||
<string name="kg_puk_enter_pin_hint">Enter desired PIN code</string>
|
||||
<!-- Message shown when the user needs to confirm the PIN they just entered in the PUK screen -->
|
||||
<string name="kg_enter_confirm_pin_hint">Confirm desired PIN code</string>
|
||||
<!-- Message shown in dialog while the device is unlocking the SIM card -->
|
||||
<string name="kg_sim_unlock_progress_dialog_message">Unlocking SIM card\u2026</string>
|
||||
<!-- Message shown when the user enters the wrong PIN code -->
|
||||
@@ -3844,11 +3846,11 @@
|
||||
<!-- Message shown when the user enters an invalid SIM pin password in PUK screen -->
|
||||
<string name="kg_invalid_sim_pin_hint">Type a PIN that is 4 to 8 numbers.</string>
|
||||
<!-- Message shown when the user enters an invalid PUK code in the PUK screen -->
|
||||
<string name="kg_invalid_sim_puk_hint">Type a PUK that is 8 numbers or longer.</string>
|
||||
<!-- Instructions for PUK unlock screen -->
|
||||
<string name="kg_sim_puk_recovery_hint">Type PUK and new PIN code</string>
|
||||
<string name="kg_invalid_sim_puk_hint">PUK code should be 8 numbers or more.</string>
|
||||
<!-- Message shown when the user enters an invalid PUK code -->
|
||||
<string name="kg_invalid_puk">The PUK you typed isn\'t correct.</string>
|
||||
<string name="kg_invalid_puk">Re-enter the correct PUK code. Repeated attempts will permanently disable the SIM.</string>
|
||||
<!-- String shown in PUK screen when PIN codes don't match -->
|
||||
<string name="kg_invalid_confirm_pin_hint" product="default">PIN codes does not match</string>
|
||||
<!-- Message shown when the user exceeds the maximum number of pattern attempts -->
|
||||
<string name="kg_login_too_many_attempts">Too many pattern attempts</string>
|
||||
<!-- Instructions show in account unlock screen allowing user to enter their email password -->
|
||||
@@ -3864,7 +3866,7 @@
|
||||
<!-- Hint text shown when user has too many failed password attempts in account unlock screen of keyguard -->
|
||||
<string name="kg_login_account_recovery_hint">Forgot your username or password\?\nVisit <b>google.com/accounts/recovery</b>.</string>
|
||||
<!-- Message shown while device checks username/password in account unlock screen of keyguard -->
|
||||
<string name="kg_login_checking_password">Checking\u2026</string>
|
||||
<string name="kg_login_checking_password">Unlocking SIM\u2026</string>
|
||||
<!-- Message shown in dialog when max number of attempts are reached for PIN screen of keyguard -->
|
||||
<string name="kg_too_many_failed_pin_attempts_dialog_message">
|
||||
You have incorrectly typed your PIN <xliff:g id="number">%d</xliff:g> times.
|
||||
|
||||
@@ -1275,10 +1275,7 @@
|
||||
<java-symbol type="id" name="glow_pad_view" />
|
||||
<java-symbol type="id" name="sim_pin_entry" />
|
||||
<java-symbol type="id" name="delete_button" />
|
||||
<java-symbol type="id" name="sim_puk_entry" />
|
||||
<java-symbol type="id" name="sim_pin_entry" />
|
||||
<java-symbol type="id" name="puk_delete_button" />
|
||||
<java-symbol type="id" name="pin_delete_button" />
|
||||
<java-symbol type="id" name="keyguard_user_avatar" />
|
||||
<java-symbol type="id" name="keyguard_user_name" />
|
||||
<java-symbol type="id" name="keyguard_transport_control" />
|
||||
@@ -1409,6 +1406,8 @@
|
||||
<java-symbol type="string" name="kg_failed_attempts_almost_at_wipe" />
|
||||
<java-symbol type="string" name="kg_failed_attempts_now_wiping" />
|
||||
<java-symbol type="string" name="kg_failed_attempts_almost_at_login" />
|
||||
<java-symbol type="string" name="kg_enter_confirm_pin_hint" />
|
||||
<java-symbol type="string" name="kg_invalid_confirm_pin_hint" />
|
||||
|
||||
<!-- From services -->
|
||||
<java-symbol type="anim" name="screen_rotate_0_enter" />
|
||||
|
||||
@@ -98,11 +98,19 @@ public class EmergencyButton extends Button {
|
||||
}
|
||||
|
||||
private void updateEmergencyCallButton(State simState, int phoneState) {
|
||||
boolean enabled = mLockPatternUtils.isEmergencyCallCapable()
|
||||
|| (phoneState == TelephonyManager.CALL_STATE_OFFHOOK); // voice call in progress
|
||||
if (enabled && KeyguardUpdateMonitor.isSimLocked(simState)) {
|
||||
// Some countries can't handle emergency calls while SIM is locked.
|
||||
enabled = mLockPatternUtils.isEmergencyCallEnabledWhileSimLocked();
|
||||
boolean enabled = false;
|
||||
if (phoneState == TelephonyManager.CALL_STATE_OFFHOOK) {
|
||||
enabled = true; // always show "return to call" if phone is off-hook
|
||||
} else if (mLockPatternUtils.isEmergencyCallCapable()) {
|
||||
boolean simLocked = KeyguardUpdateMonitor.getInstance(mContext).isSimLocked();
|
||||
if (simLocked) {
|
||||
// Some countries can't handle emergency calls while SIM is locked.
|
||||
enabled = mLockPatternUtils.isEmergencyCallEnabledWhileSimLocked();
|
||||
} else {
|
||||
// True if we need to show a secure screen (pin/pattern/SIM pin/SIM puk);
|
||||
// hides emergency button on "Slide" screen if device is not secure.
|
||||
enabled = mLockPatternUtils.isSecure();
|
||||
}
|
||||
}
|
||||
mLockPatternUtils.updateEmergencyCallButtonState(this, phoneState, enabled,
|
||||
KeyguardViewManager.USE_UPPER_CASE, false);
|
||||
|
||||
@@ -19,13 +19,11 @@ import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.text.Editable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -42,16 +40,11 @@ import com.android.internal.widget.PasswordEntryKeyboardView;
|
||||
import com.android.internal.R;
|
||||
|
||||
public class KeyguardSimPukView extends LinearLayout implements View.OnClickListener,
|
||||
View.OnFocusChangeListener, KeyguardSecurityView, OnEditorActionListener {
|
||||
KeyguardSecurityView, OnEditorActionListener {
|
||||
|
||||
private static final int DIGIT_PRESS_WAKE_MILLIS = 5000;
|
||||
|
||||
private TextView mPukText;
|
||||
private TextView mPinText;
|
||||
private TextView mFocusedEntry;
|
||||
|
||||
private View mDelPukButton;
|
||||
private View mDelPinButton;
|
||||
private View mDeleteButton;
|
||||
|
||||
private ProgressDialog mSimUnlockProgressDialog = null;
|
||||
private KeyguardSecurityCallback mCallback;
|
||||
@@ -66,6 +59,60 @@ public class KeyguardSimPukView extends LinearLayout implements View.OnClickList
|
||||
|
||||
private volatile boolean mCheckInProgress;
|
||||
|
||||
private TextView mSimPinEntry;
|
||||
|
||||
private String mPukText;
|
||||
|
||||
private String mPinText;
|
||||
private StateMachine mStateMachine = new StateMachine();
|
||||
|
||||
private class StateMachine {
|
||||
final int ENTER_PUK = 0;
|
||||
final int ENTER_PIN = 1;
|
||||
final int CONFIRM_PIN = 2;
|
||||
final int DONE = 3;
|
||||
private int state = ENTER_PUK;
|
||||
|
||||
public void next() {
|
||||
int msg = 0;
|
||||
if (state == ENTER_PUK) {
|
||||
if (checkPuk()) {
|
||||
state = ENTER_PIN;
|
||||
msg = R.string.kg_puk_enter_pin_hint;
|
||||
} else {
|
||||
msg = R.string.kg_invalid_sim_puk_hint;
|
||||
}
|
||||
} else if (state == ENTER_PIN) {
|
||||
if (checkPin()) {
|
||||
state = CONFIRM_PIN;
|
||||
msg = R.string.kg_enter_confirm_pin_hint;
|
||||
} else {
|
||||
msg = R.string.kg_invalid_sim_pin_hint;
|
||||
}
|
||||
} else if (state == CONFIRM_PIN) {
|
||||
if (confirmPin()) {
|
||||
state = DONE;
|
||||
msg = R.string.kg_login_checking_password;
|
||||
updateSim();
|
||||
} else {
|
||||
msg = R.string.kg_invalid_confirm_pin_hint;
|
||||
}
|
||||
}
|
||||
mSimPinEntry.setText(null);
|
||||
if (msg != 0) {
|
||||
mNavigationManager.setMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
void reset() {
|
||||
mPinText="";
|
||||
mPukText="";
|
||||
state = ENTER_PUK;
|
||||
mNavigationManager.setMessage(R.string.kg_puk_enter_puk_hint);
|
||||
mSimPinEntry.requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
public KeyguardSimPukView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
@@ -86,15 +133,10 @@ public class KeyguardSimPukView extends LinearLayout implements View.OnClickList
|
||||
|
||||
mNavigationManager = new KeyguardNavigationManager(this);
|
||||
|
||||
mPukText = (TextView) findViewById(R.id.sim_puk_entry);
|
||||
mPukText.setOnEditorActionListener(this);
|
||||
mPinText = (TextView) findViewById(R.id.sim_pin_entry);
|
||||
mPinText.setOnEditorActionListener(this);
|
||||
mDelPukButton = findViewById(R.id.puk_delete_button);
|
||||
mDelPukButton.setOnClickListener(this);
|
||||
mDelPinButton = findViewById(R.id.pin_delete_button);
|
||||
mDelPinButton.setOnClickListener(this);
|
||||
|
||||
mSimPinEntry = (TextView) findViewById(R.id.sim_pin_entry);
|
||||
mSimPinEntry.setOnEditorActionListener(this);
|
||||
mDeleteButton = findViewById(R.id.delete_button);
|
||||
mDeleteButton.setOnClickListener(this);
|
||||
mKeyboardView = (PasswordEntryKeyboardView) findViewById(R.id.keyboard);
|
||||
mKeyboardHelper = new PasswordEntryKeyboardHelper(mContext, mKeyboardView, this, false,
|
||||
new int[] {
|
||||
@@ -106,22 +148,12 @@ public class KeyguardSimPukView extends LinearLayout implements View.OnClickList
|
||||
});
|
||||
mKeyboardHelper.setKeyboardMode(PasswordEntryKeyboardHelper.KEYBOARD_MODE_NUMERIC);
|
||||
mKeyboardHelper.setEnableHaptics(mLockPatternUtils.isTactileFeedbackEnabled());
|
||||
|
||||
mNavigationManager.setMessage(R.string.kg_sim_puk_recovery_hint);
|
||||
|
||||
mPinText.setFocusableInTouchMode(true);
|
||||
mPinText.setOnFocusChangeListener(this);
|
||||
mPukText.setFocusableInTouchMode(true);
|
||||
mPukText.setOnFocusChangeListener(this);
|
||||
|
||||
setFocusableInTouchMode(true);
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onRequestFocusInDescendants(int direction, Rect previouslyFocusedRect) {
|
||||
return mPukText.requestFocus(direction, previouslyFocusedRect);
|
||||
return mSimPinEntry.requestFocus(direction, previouslyFocusedRect);
|
||||
}
|
||||
|
||||
public boolean needsInput() {
|
||||
@@ -182,18 +214,9 @@ public class KeyguardSimPukView extends LinearLayout implements View.OnClickList
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
if (v == mDelPukButton) {
|
||||
if (mFocusedEntry != mPukText)
|
||||
mPukText.requestFocus();
|
||||
final Editable digits = mPukText.getEditableText();
|
||||
final int len = digits.length();
|
||||
if (len > 0) {
|
||||
digits.delete(len-1, len);
|
||||
}
|
||||
} else if (v == mDelPinButton) {
|
||||
if (mFocusedEntry != mPinText)
|
||||
mPinText.requestFocus();
|
||||
final Editable digits = mPinText.getEditableText();
|
||||
if (v == mDeleteButton) {
|
||||
mSimPinEntry.requestFocus();
|
||||
final Editable digits = mSimPinEntry.getEditableText();
|
||||
final int len = digits.length();
|
||||
if (len > 0) {
|
||||
digits.delete(len-1, len);
|
||||
@@ -202,12 +225,6 @@ public class KeyguardSimPukView extends LinearLayout implements View.OnClickList
|
||||
mCallback.userActivity(DIGIT_PRESS_WAKE_MILLIS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFocusChange(View view, boolean hasFocus) {
|
||||
if (hasFocus)
|
||||
mFocusedEntry = (TextView) view;
|
||||
}
|
||||
|
||||
private Dialog getSimUnlockProgressDialog() {
|
||||
if (mSimUnlockProgressDialog == null) {
|
||||
mSimUnlockProgressDialog = new ProgressDialog(mContext);
|
||||
@@ -223,32 +240,37 @@ public class KeyguardSimPukView extends LinearLayout implements View.OnClickList
|
||||
return mSimUnlockProgressDialog;
|
||||
}
|
||||
|
||||
private void checkPuk() {
|
||||
private boolean checkPuk() {
|
||||
// make sure the puk is at least 8 digits long.
|
||||
if (mPukText.getText().length() < 8) {
|
||||
// otherwise, display a message to the user, and don't submit.
|
||||
mNavigationManager.setMessage(R.string.kg_invalid_sim_puk_hint);
|
||||
mPukText.setText("");
|
||||
return;
|
||||
if (mSimPinEntry.getText().length() >= 8) {
|
||||
mPukText = mSimPinEntry.getText().toString();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean checkPin() {
|
||||
// make sure the PIN is between 4 and 8 digits
|
||||
if (mPinText.getText().length() < 4
|
||||
|| mPinText.getText().length() > 8) {
|
||||
// otherwise, display a message to the user, and don't submit.
|
||||
mNavigationManager.setMessage(R.string.kg_invalid_sim_pin_hint);
|
||||
mPinText.setText("");
|
||||
return;
|
||||
int length = mSimPinEntry.getText().length();
|
||||
if (length >= 4 && length <= 8) {
|
||||
mPinText = mSimPinEntry.getText().toString();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean confirmPin() {
|
||||
return mPinText.equals(mSimPinEntry.getText().toString());
|
||||
}
|
||||
|
||||
private void updateSim() {
|
||||
getSimUnlockProgressDialog().show();
|
||||
|
||||
if (!mCheckInProgress) {
|
||||
mCheckInProgress = true;
|
||||
new CheckSimPuk(mPukText.getText().toString(),
|
||||
mPinText.getText().toString()) {
|
||||
new CheckSimPuk(mPukText, mPinText) {
|
||||
void onSimLockChangedResponse(final boolean success) {
|
||||
mPinText.post(new Runnable() {
|
||||
post(new Runnable() {
|
||||
public void run() {
|
||||
if (mSimUnlockProgressDialog != null) {
|
||||
mSimUnlockProgressDialog.hide();
|
||||
@@ -256,9 +278,8 @@ public class KeyguardSimPukView extends LinearLayout implements View.OnClickList
|
||||
if (success) {
|
||||
mCallback.dismiss(true);
|
||||
} else {
|
||||
mStateMachine.reset();
|
||||
mNavigationManager.setMessage(R.string.kg_invalid_puk);
|
||||
mPukText.setText("");
|
||||
mPinText.setText("");
|
||||
}
|
||||
mCheckInProgress = false;
|
||||
}
|
||||
@@ -273,24 +294,10 @@ public class KeyguardSimPukView extends LinearLayout implements View.OnClickList
|
||||
// Check if this was the result of hitting the enter key
|
||||
mCallback.userActivity(DIGIT_PRESS_WAKE_MILLIS);
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
if (actionId == EditorInfo.IME_NULL
|
||||
|| actionId == EditorInfo.IME_ACTION_DONE
|
||||
if (actionId == EditorInfo.IME_NULL || actionId == EditorInfo.IME_ACTION_DONE
|
||||
|| actionId == EditorInfo.IME_ACTION_NEXT) {
|
||||
if (view == mPukText && mPukText.getText().length() < 8) {
|
||||
mNavigationManager.setMessage(R.string.kg_invalid_sim_puk_hint);
|
||||
mPukText.setText("");
|
||||
mPukText.requestFocus();
|
||||
return true;
|
||||
} else if (view == mPinText) {
|
||||
if (mPinText.getText().length() < 4 || mPinText.getText().length() > 8) {
|
||||
mNavigationManager.setMessage(R.string.kg_invalid_sim_pin_hint);
|
||||
mPinText.setText("");
|
||||
mPinText.requestFocus();
|
||||
} else {
|
||||
checkPuk();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
mStateMachine.next();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -303,10 +310,7 @@ public class KeyguardSimPukView extends LinearLayout implements View.OnClickList
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
mNavigationManager.setMessage(R.string.kg_sim_puk_recovery_hint);
|
||||
mPinText.setText("");
|
||||
mPukText.setText("");
|
||||
mPukText.requestFocus();
|
||||
mStateMachine.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -184,8 +184,8 @@ class KeyguardStatusViewManager {
|
||||
Settings.Secure.LOCK_SCREEN_OWNER_INFO_ENABLED, 1, UserHandle.USER_CURRENT) != 0;
|
||||
String text = Settings.Secure.getStringForUser(res, Settings.Secure.LOCK_SCREEN_OWNER_INFO,
|
||||
UserHandle.USER_CURRENT);
|
||||
text = text != null ? text.trim() : null; // Remove trailing newlines
|
||||
if (ownerInfoEnabled && !TextUtils.isEmpty(text)) {
|
||||
text = text.trim(); // Remove trailing newlines
|
||||
maybeSetUpperCaseText(mOwnerInfoView, text);
|
||||
mOwnerInfoView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user