diff options
author | paulhu <paulhu@google.com> | 2021-03-20 00:09:34 +0800 |
---|---|---|
committer | paulhu <paulhu@google.com> | 2021-03-22 19:28:40 +0800 |
commit | 3ce12e7b655156ee9c45ded8f17eb8f298d4c12f (patch) | |
tree | 43e45ddc78de39bdea2d495735b175aa057b84d4 /packages/SystemUI/src/com/android/keyguard/CarrierTextController.java | |
parent | 07f3583061ae752791a45208b780c770c430a1ba (diff) |
Fix CS external dependencies on SystemUI
- Use formal API getSystemService to get ConnectivityManager.
- Use formal API PackageManager#hasSystemFeature(
PackageManager#FEATURE_TELEPHONY) to know whether device
supports telephony.
- Use formal API TelephonyManager#isDataCapable() to know
whether device has mobile ability.
- Replace NetworkCapabilities#equalsTransportTypes with
comparing two NetworkCapabilities' transport types directly.
- Replace ConnectivityManager#INET_CONDITION_ACTION by listening
onCapabilitiesChanged() network callback.
Bug: 183068713
Test: atest SystemUITests
Change-Id: I4a53223f36ea09a062a9ddea668a9d0662f0dbbc
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/CarrierTextController.java')
-rw-r--r-- | packages/SystemUI/src/com/android/keyguard/CarrierTextController.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java index b1e14346c3fa..d52a25139ce7 100644 --- a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java +++ b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java @@ -22,8 +22,8 @@ import static android.telephony.PhoneStateListener.LISTEN_NONE; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.pm.PackageManager; import android.content.res.Resources; -import android.net.ConnectivityManager; import android.net.wifi.WifiManager; import android.os.Handler; import android.telephony.PhoneStateListener; @@ -179,8 +179,8 @@ public class CarrierTextController { mBgHandler = new Handler(Dependency.get(Dependency.BG_LOOPER)); mKeyguardUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class); mBgHandler.post(() -> { - boolean supported = ConnectivityManager.from(mContext).isNetworkSupported( - ConnectivityManager.TYPE_MOBILE); + boolean supported = + mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY); if (supported && mNetworkSupported.compareAndSet(false, supported)) { // This will set/remove the listeners appropriately. Note that it will never double // add the listeners. |