Fixed tethering failed when device is on CBRS

Fixed by using the correct sub id for CBRS subscription

Bug: 133852860
Test: Manual
Merged-In: If01e17becce9684556345eb76512f617b9a9278c
Change-Id: If01e17becce9684556345eb76512f617b9a9278c
(cherry picked from commit a952d2018b)
This commit is contained in:
Jack Yu
2019-06-06 17:13:06 -07:00
committed by Nathan Harold
parent 84b311d3a2
commit 807a82b3aa
3 changed files with 26 additions and 4 deletions

View File

@@ -3175,4 +3175,24 @@ public class SubscriptionManager {
return result;
}
/**
* Get active data subscription id.
* See {@link PhoneStateListener#onActiveDataSubscriptionIdChanged(int)} for the details.
*
* @return Active data subscription id
*
* //TODO: Refactor this API in b/134702460
* @hide
*/
public static int getActiveDataSubscriptionId() {
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
return iSub.getActiveDataSubscriptionId();
}
} catch (RemoteException ex) {
}
return SubscriptionManager.INVALID_SUBSCRIPTION_ID;
}
}

View File

@@ -2418,7 +2418,7 @@ public class TelephonyManager {
@Deprecated
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
public @NetworkType int getNetworkType() {
return getNetworkType(getSubId(SubscriptionManager.getDefaultDataSubscriptionId()));
return getNetworkType(getSubId(SubscriptionManager.getActiveDataSubscriptionId()));
}
/**
@@ -2501,7 +2501,7 @@ public class TelephonyManager {
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
public @NetworkType int getDataNetworkType() {
return getDataNetworkType(getSubId(SubscriptionManager.getDefaultDataSubscriptionId()));
return getDataNetworkType(getSubId(SubscriptionManager.getActiveDataSubscriptionId()));
}
/**
@@ -7245,7 +7245,7 @@ public class TelephonyManager {
* @hide
*/
public boolean getTetherApnRequired() {
return getTetherApnRequired(getSubId(SubscriptionManager.getDefaultDataSubscriptionId()));
return getTetherApnRequired(getSubId(SubscriptionManager.getActiveDataSubscriptionId()));
}
/**
@@ -8011,7 +8011,7 @@ public class TelephonyManager {
ITelephony telephony = getITelephony();
if (telephony != null)
return telephony.isDataConnectivityPossible(getSubId(SubscriptionManager
.getDefaultDataSubscriptionId()));
.getActiveDataSubscriptionId()));
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#isDataAllowed", e);
}

View File

@@ -285,4 +285,6 @@ interface ISub {
boolean isActiveSubId(int subId, String callingPackage);
boolean setAlwaysAllowMmsData(int subId, boolean alwaysAllow);
int getActiveDataSubscriptionId();
}