GpsLocationProvider: Read data enabled status from TelephonyManager.

Bug: 18814559
Change-Id: I0333050d2a5b8d484466e1b1914dcfb9965398c9
This commit is contained in:
Shishir Agrawal
2015-02-10 19:02:38 -08:00
parent 3bb5fdc7e6
commit 64ce5f8fab
2 changed files with 3 additions and 5 deletions

View File

@ -788,9 +788,7 @@ public class GpsLocationProvider implements LocationProviderInterface {
} }
if (info != null) { if (info != null) {
boolean dataEnabled = TelephonyManager.getIntWithSubId(mContext.getContentResolver(), boolean dataEnabled = TelephonyManager.getDefault().getDataEnabled();
Settings.Global.MOBILE_DATA, SubscriptionManager.getDefaultSubId(),
1) == 1;
boolean networkAvailable = info.isAvailable() && dataEnabled; boolean networkAvailable = info.isAvailable() && dataEnabled;
String defaultApn = getSelectedApn(); String defaultApn = getSelectedApn();
if (defaultApn == null) { if (defaultApn == null) {

View File

@ -3669,12 +3669,12 @@ public class TelephonyManager {
/** @hide */ /** @hide */
@SystemApi @SystemApi
public boolean getDataEnabled(int subId) { public boolean getDataEnabled(int subId) {
boolean retVal; boolean retVal = false;
try { try {
retVal = getITelephony().getDataEnabled(subId); retVal = getITelephony().getDataEnabled(subId);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#getDataEnabled", e); Log.e(TAG, "Error calling ITelephony#getDataEnabled", e);
retVal = false; } catch (NullPointerException e) {
} }
Log.d(TAG, "getDataEnabled: retVal=" + retVal); Log.d(TAG, "getDataEnabled: retVal=" + retVal);
return retVal; return retVal;