diff options
author | Steve Kondik <steve@cyngn.com> | 2015-11-04 10:43:28 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-11-04 10:58:59 -0800 |
commit | 8331d3e508498a19c296fed41b9d4b23ea960031 (patch) | |
tree | ab450acfb4e38ffdba3ae893a83a052cc0041783 /packages | |
parent | b956432599de00a5edfeccc56615cb03c229c4e9 (diff) | |
parent | 64a04eb003d2af5bbc84db3062ee4d6a4194c513 (diff) | |
download | frameworks_base-8331d3e508498a19c296fed41b9d4b23ea960031.zip frameworks_base-8331d3e508498a19c296fed41b9d4b23ea960031.tar.gz frameworks_base-8331d3e508498a19c296fed41b9d4b23ea960031.tar.bz2 |
Merge branch 'LA.BF64.1.2.2_rb4.6' of git://codeaurora.org/platform/frameworks/base into cm-13.0
Change-Id: I261957864b149edb709e6f76ed382043f9a96936
Diffstat (limited to 'packages')
3 files changed, 67 insertions, 2 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/CarrierText.java b/packages/Keyguard/src/com/android/keyguard/CarrierText.java index 416c7b0..f04db02 100644 --- a/packages/Keyguard/src/com/android/keyguard/CarrierText.java +++ b/packages/Keyguard/src/com/android/keyguard/CarrierText.java @@ -39,6 +39,7 @@ import com.android.internal.telephony.IccCardConstants; import com.android.internal.telephony.IccCardConstants.State; import com.android.internal.telephony.TelephonyIntents; import com.android.settingslib.WirelessUtils; +import android.telephony.TelephonyManager; public class CarrierText extends TextView { private static final boolean DEBUG = KeyguardConstants.DEBUG; @@ -52,6 +53,8 @@ public class CarrierText extends TextView { private WifiManager mWifiManager; + private boolean[] mSimErrorState = new boolean[TelephonyManager.getDefault().getPhoneCount()]; + private KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { @Override public void onRefreshCarrierInfo() { @@ -65,6 +68,22 @@ public class CarrierText extends TextView { public void onStartedWakingUp() { setSelected(true); }; + + public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) { + if (slotId < 0) { + Log.d(TAG, "onSimStateChanged() - slotId invalid: " + slotId); + return; + } + + Log.d(TAG,"onSimStateChanged: " + getStatusForIccState(simState)); + if (getStatusForIccState(simState) == StatusMode.SimIoError) { + mSimErrorState[slotId] = true; + updateCarrierText(); + } else if (mSimErrorState[slotId]) { + mSimErrorState[slotId] = false; + updateCarrierText(); + } + }; }; /** * The status of this lock screen. Primarily used for widgets on LockScreen. @@ -102,6 +121,35 @@ public class CarrierText extends TextView { mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); } + /** + * Checks if there are faulty cards. Adds the text depending on the slot of the card + * @param text: current carrier text based on the sim state + * @param noSims: whether a valid sim card is inserted + * @return text + */ + private CharSequence updateCarrierTextWithSimIoError(CharSequence text, boolean noSims) { + final CharSequence carrier = ""; + CharSequence carrierTextForSimState = getCarrierTextForSimState( + IccCardConstants.State.CARD_IO_ERROR, carrier); + for (int index = 0; index < mSimErrorState.length; index++) { + if (mSimErrorState[index]) { + // In the case when no sim cards are detected but a faulty card is inserted + // overwrite the text and only show "Invalid card" + if (noSims) { + return concatenate(carrierTextForSimState, + getContext().getText(com.android.internal.R.string.emergency_calls_only)); + } else if (index == 0) { + // prepend "Invalid card" when faulty card is inserted in slot 0 + text = concatenate(carrierTextForSimState, text); + } else { + // concatenate "Invalid card" when faulty card is inserted in slot 1 + text = concatenate(text, carrierTextForSimState); + } + } + } + return text; + } + protected void updateCarrierText() { boolean allSimsMissing = true; boolean anySimReadyAndInService = false; @@ -180,6 +228,7 @@ public class CarrierText extends TextView { } } + displayText = updateCarrierTextWithSimIoError(displayText, allSimsMissing); // APM (airplane mode) != no carrier state. There are carrier services // (e.g. WFC = Wi-Fi calling) which may operate in APM. if (!anySimReadyAndInService && WirelessUtils.isAirplaneModeOn(mContext)) { diff --git a/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java b/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java index cbf22c0..1411aaa 100644 --- a/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java +++ b/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java @@ -22,6 +22,7 @@ import android.content.Intent; import android.content.res.Configuration; import android.os.PowerManager; import android.os.SystemClock; +import android.os.SystemProperties; import android.os.UserHandle; import android.telecom.TelecomManager; import android.util.AttributeSet; @@ -135,7 +136,7 @@ public class EmergencyButton extends Button { } } - private void updateEmergencyCallButton() { + public void updateEmergencyCallButton() { boolean visible = false; if (mIsVoiceCapable) { // Emergency calling requires voice capability. @@ -149,7 +150,8 @@ public class EmergencyButton extends Button { visible = mEnableEmergencyCallWhileSimLocked; } else { // Only show if there is a secure screen (pin/pattern/SIM pin/SIM puk); - visible = mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser()); + visible = mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser()) || + SystemProperties.getBoolean("persist.radio.emgcy_btn_onswipe", false); } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index 1a2fa97..a7648bf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -36,6 +36,7 @@ import android.os.IBinder; import android.os.Message; import android.os.Messenger; import android.os.RemoteException; +import android.os.SystemProperties; import android.os.UserHandle; import android.provider.MediaStore; import android.service.media.CameraPrewarmService; @@ -52,6 +53,7 @@ import android.widget.FrameLayout; import android.widget.TextView; import com.android.internal.widget.LockPatternUtils; +import com.android.keyguard.EmergencyButton; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.EventLogConstants; @@ -88,6 +90,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private static final int DOZE_ANIMATION_ELEMENT_DURATION = 250; private static final long TRANSIENT_FP_ERROR_TIMEOUT = 1300; + private EmergencyButton mEmergencyButton; private KeyguardAffordanceView mCameraImageView; private KeyguardAffordanceView mLeftAffordanceView; private LockIcon mLockIcon; @@ -188,6 +191,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL super.onFinishInflate(); mLockPatternUtils = new LockPatternUtils(mContext); mPreviewContainer = (ViewGroup) findViewById(R.id.preview_container); + mEmergencyButton = (EmergencyButton) findViewById(R.id.emergency_call_button); mCameraImageView = (KeyguardAffordanceView) findViewById(R.id.camera_button); mLeftAffordanceView = (KeyguardAffordanceView) findViewById(R.id.left_button); mLockIcon = (LockIcon) findViewById(R.id.lock_icon); @@ -197,6 +201,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL mUnlockMethodCache = UnlockMethodCache.getInstance(getContext()); mUnlockMethodCache.addListener(this); mLockIcon.update(); + updateEmergencyButton(); setClipChildren(false); setClipToPadding(false); mPreviewInflater = new PreviewInflater(mContext, new LockPatternUtils(mContext)); @@ -229,6 +234,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL mIndicationText.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize( com.android.internal.R.dimen.text_size_small_material)); + updateEmergencyButton(); } public void setActivityStarter(ActivityStarter activityStarter) { @@ -699,4 +705,12 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL updateLeftAffordanceIcon(); updateLeftPreview(); } + + private void updateEmergencyButton() { + if (SystemProperties.getBoolean("persist.radio.emgcy_btn_onswipe",false)) { + if (mEmergencyButton != null) { + mEmergencyButton.updateEmergencyCallButton(); + } + } + } } |