Fixing emergency dialer flicker on lock screen (issue 5314293)
Change-Id: Ia9bf4acb84923e200b89ee55fc53bc92877001cf
This commit is contained in:
@ -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);
|
||||
|
@ -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>>
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -171,7 +171,7 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient
|
||||
}
|
||||
|
||||
mKeyguardStatusViewManager = new KeyguardStatusViewManager(this, mUpdateMonitor,
|
||||
mLockPatternUtils, mCallback);
|
||||
mLockPatternUtils, mCallback, true);
|
||||
|
||||
mLockPatternView = (LockPatternView) findViewById(R.id.lockPattern);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user