Loading telephony/java/android/telephony/SubscriptionManager.java +20 −0 Original line number Diff line number Diff line Loading @@ -3183,4 +3183,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; } } telephony/java/android/telephony/TelephonyManager.java +4 −4 Original line number Diff line number Diff line Loading @@ -2555,7 +2555,7 @@ public class TelephonyManager { * @return the NETWORK_TYPE_xxxx for current data connection. */ public @NetworkType int getNetworkType() { return getNetworkType(getSubId(SubscriptionManager.getDefaultDataSubscriptionId())); return getNetworkType(getSubId(SubscriptionManager.getActiveDataSubscriptionId())); } /** Loading Loading @@ -2638,7 +2638,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())); } /** Loading Loading @@ -7385,7 +7385,7 @@ public class TelephonyManager { * @hide */ public boolean getTetherApnRequired() { return getTetherApnRequired(getSubId(SubscriptionManager.getDefaultDataSubscriptionId())); return getTetherApnRequired(getSubId(SubscriptionManager.getActiveDataSubscriptionId())); } /** Loading Loading @@ -8168,7 +8168,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); } Loading telephony/java/com/android/internal/telephony/ISub.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -281,4 +281,6 @@ interface ISub { boolean isActiveSubId(int subId, String callingPackage); boolean setAlwaysAllowMmsData(int subId, boolean alwaysAllow); int getActiveDataSubscriptionId(); } Loading
telephony/java/android/telephony/SubscriptionManager.java +20 −0 Original line number Diff line number Diff line Loading @@ -3183,4 +3183,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; } }
telephony/java/android/telephony/TelephonyManager.java +4 −4 Original line number Diff line number Diff line Loading @@ -2555,7 +2555,7 @@ public class TelephonyManager { * @return the NETWORK_TYPE_xxxx for current data connection. */ public @NetworkType int getNetworkType() { return getNetworkType(getSubId(SubscriptionManager.getDefaultDataSubscriptionId())); return getNetworkType(getSubId(SubscriptionManager.getActiveDataSubscriptionId())); } /** Loading Loading @@ -2638,7 +2638,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())); } /** Loading Loading @@ -7385,7 +7385,7 @@ public class TelephonyManager { * @hide */ public boolean getTetherApnRequired() { return getTetherApnRequired(getSubId(SubscriptionManager.getDefaultDataSubscriptionId())); return getTetherApnRequired(getSubId(SubscriptionManager.getActiveDataSubscriptionId())); } /** Loading Loading @@ -8168,7 +8168,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); } Loading
telephony/java/com/android/internal/telephony/ISub.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -281,4 +281,6 @@ interface ISub { boolean isActiveSubId(int subId, String callingPackage); boolean setAlwaysAllowMmsData(int subId, boolean alwaysAllow); int getActiveDataSubscriptionId(); }