Merge "Remove usage of Telephonymanager getDefault() hidden API"

am: 29146f991b

Change-Id: I3b389f3d8f4cae83fa7cf462eb222cdf8995b483
This commit is contained in:
Jayachandran Chinnakkannu
2019-11-17 22:30:59 -08:00
committed by android-build-merger

View File

@@ -321,7 +321,11 @@ class GnssNetworkConnectivityHandler {
private void handleUpdateNetworkState(Network network, boolean isConnected,
NetworkCapabilities capabilities) {
boolean networkAvailable = isConnected && TelephonyManager.getDefault().getDataEnabled();
boolean networkAvailable = false;
TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
if (telephonyManager != null) {
networkAvailable = isConnected && telephonyManager.getDataEnabled();
}
NetworkAttributes networkAttributes = updateTrackedNetworksState(isConnected, network,
capabilities);
String apn = networkAttributes.mApn;