summaryrefslogtreecommitdiffstats
path: root/packages/Keyguard/src/com
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2014-12-05 10:16:24 -0500
committerJason Monk <jmonk@google.com>2014-12-05 18:09:36 -0500
commit83bc2aafd7563dd12673bbafe6226d4db0c89beb (patch)
tree9fec868baa25ab9d34b5845d8c6f6092fc8ae96b /packages/Keyguard/src/com
parentfb967585cc43937a88b0ed9a5e434a50b0a498b9 (diff)
downloadframeworks_base-83bc2aafd7563dd12673bbafe6226d4db0c89beb.zip
frameworks_base-83bc2aafd7563dd12673bbafe6226d4db0c89beb.tar.gz
frameworks_base-83bc2aafd7563dd12673bbafe6226d4db0c89beb.tar.bz2
CarrierText clear itself when no mob. data support
Bug: 18552426 Change-Id: I48e7d1434861dc99284bb0b58c023c1d749e513a
Diffstat (limited to 'packages/Keyguard/src/com')
-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);
+ }
}
/**