diff options
| author | Jason Monk <jmonk@google.com> | 2014-12-10 14:25:37 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-12-10 14:25:39 +0000 |
| commit | 28fffd58a1e9eea2e84c15b124cbfde1c8dbb2c8 (patch) | |
| tree | 0eb005132c3fe10d97d0df574ff46861cfc9d9a5 | |
| parent | 33cd463bbbbe47010ed44815fbfd0ab5e8fbf825 (diff) | |
| parent | 83bc2aafd7563dd12673bbafe6226d4db0c89beb (diff) | |
| download | frameworks_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.java | 16 |
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); + } } /** |
