summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2015-02-24 08:55:26 -0500
committerThe Android Automerger <android-build@google.com>2015-03-03 20:04:16 -0800
commitf1f0c57b9dc1f51b9567de88b6ba9a1dfc08ef1a (patch)
treeae84cbdff4ae855e457149b696e8b29018df9a94
parentceb1699ba3303191025aa7e2fae0e983174283d3 (diff)
downloadbase-f1f0c57b9dc1f51b9567de88b6ba9a1dfc08ef1a.tar.gz
Keyguard: Use plmn/spn broadcast when no SIMs
The keyguard needs to show either 'emergency calls only' or 'no service' depending on whether there is service available, so try to pull this from the old sticky broadcast containing plmn/spn. Bug: 19476978 Change-Id: I83523cc4c7dd5f46bd97df2cc9ecdb38d1c2e001
-rw-r--r--packages/Keyguard/src/com/android/keyguard/CarrierText.java26
1 files changed, 23 insertions, 3 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/CarrierText.java b/packages/Keyguard/src/com/android/keyguard/CarrierText.java
index d8b0c7170a86..b9263bf52703 100644
--- a/packages/Keyguard/src/com/android/keyguard/CarrierText.java
+++ b/packages/Keyguard/src/com/android/keyguard/CarrierText.java
@@ -20,6 +20,8 @@ import java.util.List;
import java.util.Locale;
import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
import android.content.res.TypedArray;
import android.net.ConnectivityManager;
import android.telephony.SubscriptionInfo;
@@ -33,6 +35,7 @@ import android.widget.TextView;
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.IccCardConstants.State;
+import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.widget.LockPatternUtils;
public class CarrierText extends TextView {
@@ -120,10 +123,27 @@ public class CarrierText extends TextView {
subs.get(0).getCarrierName());
} else {
// We don't have a SubscriptionInfo to get the emergency calls only from.
- // Lets just make it ourselves.
+ // Grab it from the old sticky broadcast if possible instead. We can use it
+ // here because no subscriptions are active, so we don't have
+ // to worry about MSIM clashing.
+ CharSequence text =
+ getContext().getText(com.android.internal.R.string.emergency_calls_only);
+ Intent i = getContext().registerReceiver(null,
+ new IntentFilter(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION));
+ if (i != null) {
+ String spn = "";
+ String plmn = "";
+ if (i.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_SPN, false)) {
+ spn = i.getStringExtra(TelephonyIntents.EXTRA_SPN);
+ }
+ if (i.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_PLMN, false)) {
+ plmn = i.getStringExtra(TelephonyIntents.EXTRA_PLMN);
+ }
+ if (DEBUG) Log.d(TAG, "Getting plmn/spn sticky brdcst " + plmn + "/" + spn);
+ text = concatenate(plmn, spn);
+ }
displayText = makeCarrierStringOnEmergencyCapable(
- getContext().getText(R.string.keyguard_missing_sim_message_short),
- getContext().getText(com.android.internal.R.string.emergency_calls_only));
+ getContext().getText(R.string.keyguard_missing_sim_message_short), text);
}
}
setText(displayText);