From 0f7b3f8ba5c2f0b8f96e072bd866c9fb374ebdeb Mon Sep 17 00:00:00 2001 From: John Wang Date: Tue, 31 May 2011 11:20:55 -0700 Subject: [PATCH] Add SIM PUK unlockscreen. Puk unlockscreen is implemented as SimPukUnlockScreen. Added config_enable_puk_unlock_screen to control the display of puk unlock screen. Using config_voice_capable to control the display of emergency call button. bug:4384956 Change-Id: I2b8256b4ecdf3d4f1e85c4e868fac1810cfd29be --- .../internal/widget/LockPatternUtils.java | 24 +- .../keyguard_screen_sim_puk_landscape.xml | 182 +++++++ .../keyguard_screen_sim_puk_portrait.xml | 185 +++++++ core/res/res/values/config.xml | 4 + core/res/res/values/strings.xml | 11 + .../policy/impl/KeyguardUpdateMonitor.java | 4 +- .../policy/impl/LockPatternKeyguardView.java | 38 +- .../internal/policy/impl/LockScreen.java | 16 +- .../policy/impl/SimPukUnlockScreen.java | 470 ++++++++++++++++++ .../internal/policy/impl/SimUnlockScreen.java | 14 +- 10 files changed, 925 insertions(+), 23 deletions(-) create mode 100644 core/res/res/layout/keyguard_screen_sim_puk_landscape.xml create mode 100644 core/res/res/layout/keyguard_screen_sim_puk_portrait.xml create mode 100644 policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 0dc0422967afc..682ebc4203dc4 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -33,6 +33,7 @@ import android.provider.Settings; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Log; +import android.view.View; import android.widget.Button; import java.io.File; @@ -775,6 +776,16 @@ public class LockPatternUtils { setBoolean(LOCKOUT_PERMANENT_KEY, locked); } + public boolean isEmergencyCallCapable() { + return mContext.getResources().getBoolean( + com.android.internal.R.bool.config_voice_capable); + } + + public boolean isPukUnlockScreenEnable() { + return mContext.getResources().getBoolean( + com.android.internal.R.bool.config_enable_puk_unlock_screen); + } + /** * @return A formatted string of the next alarm (for showing on the lock screen), * or null if there is no next alarm. @@ -827,11 +838,22 @@ public class LockPatternUtils { } /** - * Sets the text on the emergency button to indicate what action will be taken. + * Sets the emergency button visibility based on isEmergencyCallCapable(). + * + * If the emergency button is visible, sets the text on the emergency button + * to indicate what action will be taken. + * * If there's currently a call in progress, the button will take them to the call * @param button the button to update */ public void updateEmergencyCallButtonState(Button button) { + if (isEmergencyCallCapable()) { + button.setVisibility(View.VISIBLE); + } else { + button.setVisibility(View.GONE); + return; + } + int newState = TelephonyManager.getDefault().getCallState(); int textId; if (newState == TelephonyManager.CALL_STATE_OFFHOOK) { diff --git a/core/res/res/layout/keyguard_screen_sim_puk_landscape.xml b/core/res/res/layout/keyguard_screen_sim_puk_landscape.xml new file mode 100644 index 0000000000000..d58fb232e310f --- /dev/null +++ b/core/res/res/layout/keyguard_screen_sim_puk_landscape.xml @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +