am 08ee7fa4: Merge "Fixing emergency dialer flicker on lock screen (issue 5314293)" into ics-factoryrom
* commit '08ee7fa463aee5e83f77789e9a99f17a34ab68b4':
Fixing emergency dialer flicker on lock screen (issue 5314293)
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 76550cf..19dc42b 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -947,9 +947,11 @@
*
* 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 07b4837..dd29164 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 6ff9a60..f7d936c 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 @@
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 8654a25..61e30bf 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 @@
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 @@
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 @@
};
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 @@
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 @@
}
}
- boolean shouldEnableUnlock() {
- return mShouldEnableUnlock;
- }
-
/**
* Determine the current status of the lock screen given the sim state and other stuff.
*/
@@ -443,9 +441,8 @@
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 @@
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 @@
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 @@
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 @@
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 4f6df36..3469483 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 @@
}
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 2f2d3b7..6d2f2f2 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 @@
}
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 88c42a6..9a6d2cc 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 @@
}
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 520d302..35421c7 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 @@
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 1acf681..184748a 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 @@
mOkButton.setOnClickListener(this);
mKeyguardStatusViewManager = new KeyguardStatusViewManager(this, updateMonitor,
- lockpatternutils, callback);
+ lockpatternutils, callback, true);
setFocusableInTouchMode(true);
}