diff options
9 files changed, 23 insertions, 32 deletions
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 4d828c448fe2..e3a4df9358f9 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -936,9 +936,11 @@ public class LockPatternUtils { * * If there's currently a call in progress, the button will take them to the call * @param button the button to update + * @param showIfCapable indicates whether the button should be shown if emergency calls are + * possible on the device */ - public void updateEmergencyCallButtonState(Button button) { - if (isEmergencyCallCapable()) { + public void updateEmergencyCallButtonState(Button button, boolean showIfCapable) { + if (isEmergencyCallCapable() && showIfCapable) { button.setVisibility(View.VISIBLE); } else { button.setVisibility(View.GONE); diff --git a/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml b/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml index 07b4837624a9..dd291644e4f3 100644 --- a/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml +++ b/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml @@ -80,7 +80,8 @@ android:layout_alignParentBottom="true" android:drawableLeft="@drawable/ic_emergency" style="@style/Widget.Button.Transparent" - android:drawablePadding="8dip"/> + android:drawablePadding="8dip" + android:visibility="gone"/> </RelativeLayout>> diff --git a/policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java b/policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java index 6ff9a608ad44..f7d936c87050 100644 --- a/policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java +++ b/policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java @@ -112,7 +112,7 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree mUpdateMonitor = updateMonitor; mKeyguardStatusViewManager = new KeyguardStatusViewManager(this, updateMonitor, - lockPatternUtils, callback); + lockPatternUtils, callback, true); } public void afterTextChanged(Editable s) { diff --git a/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java index 8654a25d2f89..61e30bfba05c 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java @@ -87,7 +87,7 @@ class KeyguardStatusViewManager implements OnClickListener { private LockPatternUtils mLockPatternUtils; private KeyguardUpdateMonitor mUpdateMonitor; private Button mEmergencyCallButton; - private boolean mShouldEnableUnlock; + private boolean mUnlockDisabledDueToSimState; // Shadowed text values private CharSequence mCarrierText; @@ -97,7 +97,7 @@ class KeyguardStatusViewManager implements OnClickListener { private CharSequence mOwnerInfoText; private boolean mShowingStatus; private KeyguardScreenCallback mCallback; - private boolean mHideEmergencyCallButton = false; + private final boolean mShowEmergencyButtonByDefault; private class TransientTextManager { private TextView mTextView; @@ -149,7 +149,8 @@ class KeyguardStatusViewManager implements OnClickListener { }; public KeyguardStatusViewManager(View view, KeyguardUpdateMonitor updateMonitor, - LockPatternUtils lockPatternUtils, KeyguardScreenCallback callback) { + LockPatternUtils lockPatternUtils, KeyguardScreenCallback callback, + boolean showEmergencyButtonByDefault) { mContainer = view; mDateFormatString = getContext().getString(R.string.full_wday_month_day_no_year); mLockPatternUtils = lockPatternUtils; @@ -163,6 +164,7 @@ class KeyguardStatusViewManager implements OnClickListener { mOwnerInfoView = (TextView) findViewById(R.id.propertyOf); mTransportView = (TransportControlView) findViewById(R.id.transport); mEmergencyCallButton = (Button) findViewById(R.id.emergencyCallButton); + mShowEmergencyButtonByDefault = showEmergencyButtonByDefault; if (mEmergencyCallButton != null) { mEmergencyCallButton.setText(R.string.lockscreen_emergency_call); mEmergencyCallButton.setOnClickListener(this); @@ -393,10 +395,6 @@ class KeyguardStatusViewManager implements OnClickListener { } } - boolean shouldEnableUnlock() { - return mShouldEnableUnlock; - } - /** * Determine the current status of the lock screen given the sim state and other stuff. */ @@ -443,9 +441,8 @@ class KeyguardStatusViewManager implements OnClickListener { CharSequence carrierText = null; int carrierHelpTextId = 0; - mShouldEnableUnlock = true; + mUnlockDisabledDueToSimState = false; mStatus = getStatusForIccState(simState); - switch (mStatus) { case Normal: carrierText = LockPatternUtils.getCarrierString(mUpdateMonitor.getTelephonyPlmn(), @@ -466,13 +463,14 @@ class KeyguardStatusViewManager implements OnClickListener { case SimPermDisabled: carrierText = getContext().getText(R.string.lockscreen_missing_sim_message_short); carrierHelpTextId = R.string.lockscreen_permanent_disabled_sim_instructions; + mUnlockDisabledDueToSimState = true; break; case SimMissingLocked: carrierText = LockPatternUtils.getCarrierString(mUpdateMonitor.getTelephonyPlmn(), getContext().getText(R.string.lockscreen_missing_sim_message_short)); carrierHelpTextId = R.string.lockscreen_missing_sim_instructions; - mShouldEnableUnlock = false; + mUnlockDisabledDueToSimState = true; break; case SimLocked: @@ -484,7 +482,7 @@ class KeyguardStatusViewManager implements OnClickListener { carrierText = LockPatternUtils.getCarrierString(mUpdateMonitor.getTelephonyPlmn(), getContext().getText(R.string.lockscreen_sim_puk_locked_message)); if (!mLockPatternUtils.isPukUnlockScreenEnable()) { - mShouldEnableUnlock = false; + mUnlockDisabledDueToSimState = true; } break; } @@ -556,10 +554,8 @@ class KeyguardStatusViewManager implements OnClickListener { private void updateEmergencyCallButtonState() { if (mEmergencyCallButton != null) { - mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton); - if (mHideEmergencyCallButton) { - mEmergencyCallButton.setVisibility(View.GONE); - } + boolean showIfCapable = mShowEmergencyButtonByDefault || mUnlockDisabledDueToSimState; + mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton, showIfCapable); } } @@ -608,9 +604,4 @@ class KeyguardStatusViewManager implements OnClickListener { mCallback.takeEmergencyCallAction(); } } - - public void hideEmergencyCallButton() { - mHideEmergencyCallButton = true; - } - } diff --git a/policy/src/com/android/internal/policy/impl/LockScreen.java b/policy/src/com/android/internal/policy/impl/LockScreen.java index 4f6df3659f67..3469483330d6 100644 --- a/policy/src/com/android/internal/policy/impl/LockScreen.java +++ b/policy/src/com/android/internal/policy/impl/LockScreen.java @@ -336,10 +336,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen { } mStatusViewManager = new KeyguardStatusViewManager(this, mUpdateMonitor, mLockPatternUtils, - mCallback); - - // LockScreen doesn't show the emergency call button by default - mStatusViewManager.hideEmergencyCallButton(); + mCallback, false); setFocusable(true); setFocusableInTouchMode(true); diff --git a/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java b/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java index 2f2d3b7c635d..6d2f2f29fc05 100644 --- a/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java +++ b/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java @@ -98,7 +98,7 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen } mStatusViewManager = new KeyguardStatusViewManager(this, mUpdateMonitor, mLockPatternUtils, - mCallback); + mCallback, true); final int quality = lockPatternUtils.getKeyguardStoredPasswordQuality(); mIsAlpha = DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC == quality diff --git a/policy/src/com/android/internal/policy/impl/PatternUnlockScreen.java b/policy/src/com/android/internal/policy/impl/PatternUnlockScreen.java index 0cafeb5a147f..e70892c1d88a 100644 --- a/policy/src/com/android/internal/policy/impl/PatternUnlockScreen.java +++ b/policy/src/com/android/internal/policy/impl/PatternUnlockScreen.java @@ -171,7 +171,7 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient } mKeyguardStatusViewManager = new KeyguardStatusViewManager(this, mUpdateMonitor, - mLockPatternUtils, mCallback); + mLockPatternUtils, mCallback, true); mLockPatternView = (LockPatternView) findViewById(R.id.lockPattern); diff --git a/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java b/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java index 520d3021476d..35421c78659c 100644 --- a/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java +++ b/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java @@ -117,7 +117,7 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen, requestFocus(mPukText); mKeyguardStatusViewManager = new KeyguardStatusViewManager(this, updateMonitor, - lockpatternutils, callback); + lockpatternutils, callback, true); setFocusableInTouchMode(true); } diff --git a/policy/src/com/android/internal/policy/impl/SimUnlockScreen.java b/policy/src/com/android/internal/policy/impl/SimUnlockScreen.java index 1acf68172241..184748abe83f 100644 --- a/policy/src/com/android/internal/policy/impl/SimUnlockScreen.java +++ b/policy/src/com/android/internal/policy/impl/SimUnlockScreen.java @@ -100,7 +100,7 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie mOkButton.setOnClickListener(this); mKeyguardStatusViewManager = new KeyguardStatusViewManager(this, updateMonitor, - lockpatternutils, callback); + lockpatternutils, callback, true); setFocusableInTouchMode(true); } |