summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2014-12-10 14:25:37 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-12-10 14:25:39 +0000
commit28fffd58a1e9eea2e84c15b124cbfde1c8dbb2c8 (patch)
tree0eb005132c3fe10d97d0df574ff46861cfc9d9a5
parent33cd463bbbbe47010ed44815fbfd0ab5e8fbf825 (diff)
parent83bc2aafd7563dd12673bbafe6226d4db0c89beb (diff)
downloadframeworks_base-28fffd58a1e9eea2e84c15b124cbfde1c8dbb2c8.zip
frameworks_base-28fffd58a1e9eea2e84c15b124cbfde1c8dbb2c8.tar.gz
frameworks_base-28fffd58a1e9eea2e84c15b124cbfde1c8dbb2c8.tar.bz2
Merge "CarrierText clear itself when no mob. data support" into lmp-mr1-dev
-rw-r--r--packages/Keyguard/src/com/android/keyguard/CarrierText.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/CarrierText.java b/packages/Keyguard/src/com/android/keyguard/CarrierText.java
index 7f4ce59..d8b0c71 100644
--- a/packages/Keyguard/src/com/android/keyguard/CarrierText.java
+++ b/packages/Keyguard/src/com/android/keyguard/CarrierText.java
@@ -21,6 +21,7 @@ import java.util.Locale;
import android.content.Context;
import android.content.res.TypedArray;
+import android.net.ConnectivityManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.text.TextUtils;
@@ -140,14 +141,23 @@ public class CarrierText extends TextView {
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
- mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
- mKeyguardUpdateMonitor.registerCallback(mCallback);
+ if (ConnectivityManager.from(mContext).isNetworkSupported(
+ ConnectivityManager.TYPE_MOBILE)) {
+ mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
+ mKeyguardUpdateMonitor.registerCallback(mCallback);
+ } else {
+ // Don't listen and clear out the text when the device isn't a phone.
+ mKeyguardUpdateMonitor = null;
+ setText("");
+ }
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
- mKeyguardUpdateMonitor.removeCallback(mCallback);
+ if (mKeyguardUpdateMonitor != null) {
+ mKeyguardUpdateMonitor.removeCallback(mCallback);
+ }
}
/**