Merge "[mainline] Expose getTetherApnRequired API as system API"
am: 3887ca1f22
Change-Id: I000c20b8e35165845dd1f8a247002a7fb8f71c3b
This commit is contained in:
@@ -8238,6 +8238,7 @@ package android.telephony {
|
|||||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isPotentialEmergencyNumber(@NonNull String);
|
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isPotentialEmergencyNumber(@NonNull String);
|
||||||
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRadioOn();
|
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRadioOn();
|
||||||
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRinging();
|
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRinging();
|
||||||
|
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isTetherApnRequired();
|
||||||
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isVideoCallingEnabled();
|
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isVideoCallingEnabled();
|
||||||
method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isVisualVoicemailEnabled(android.telecom.PhoneAccountHandle);
|
method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isVisualVoicemailEnabled(android.telecom.PhoneAccountHandle);
|
||||||
method public boolean needsOtaServiceProvisioning();
|
method public boolean needsOtaServiceProvisioning();
|
||||||
|
|||||||
@@ -529,7 +529,7 @@
|
|||||||
|
|
||||||
- TYPE_ETHERNET (9) is prepended to this list, and
|
- TYPE_ETHERNET (9) is prepended to this list, and
|
||||||
|
|
||||||
- the return value of TelephonyManager.getTetherApnRequired()
|
- the return value of TelephonyManager.isTetherApnRequired()
|
||||||
determines how the array is further modified:
|
determines how the array is further modified:
|
||||||
|
|
||||||
* TRUE (DUN REQUIRED).
|
* TRUE (DUN REQUIRED).
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ public class TetheringConfiguration {
|
|||||||
/** Check whether dun is required. */
|
/** Check whether dun is required. */
|
||||||
public static boolean checkDunRequired(Context ctx, int id) {
|
public static boolean checkDunRequired(Context ctx, int id) {
|
||||||
final TelephonyManager tm = (TelephonyManager) ctx.getSystemService(TELEPHONY_SERVICE);
|
final TelephonyManager tm = (TelephonyManager) ctx.getSystemService(TELEPHONY_SERVICE);
|
||||||
return (tm != null) ? tm.getTetherApnRequired(id) : false;
|
return (tm != null) ? tm.isTetherApnRequired(id) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Collection<Integer> getUpstreamIfaceTypes(Resources res, boolean dunRequired) {
|
private static Collection<Integer> getUpstreamIfaceTypes(Resources res, boolean dunRequired) {
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ public class TetheringConfigurationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDunFromTelephonyManagerMeansDun() {
|
public void testDunFromTelephonyManagerMeansDun() {
|
||||||
when(mTelephonyManager.getTetherApnRequired(anyInt())).thenReturn(true);
|
when(mTelephonyManager.isTetherApnRequired(anyInt())).thenReturn(true);
|
||||||
|
|
||||||
final TetheringConfiguration cfgWifi = getTetheringConfiguration(TYPE_WIFI);
|
final TetheringConfiguration cfgWifi = getTetheringConfiguration(TYPE_WIFI);
|
||||||
final TetheringConfiguration cfgMobileWifiHipri = getTetheringConfiguration(
|
final TetheringConfiguration cfgMobileWifiHipri = getTetheringConfiguration(
|
||||||
@@ -169,7 +169,7 @@ public class TetheringConfigurationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDunNotRequiredFromTelephonyManagerMeansNoDun() {
|
public void testDunNotRequiredFromTelephonyManagerMeansNoDun() {
|
||||||
when(mTelephonyManager.getTetherApnRequired(anyInt())).thenReturn(false);
|
when(mTelephonyManager.isTetherApnRequired(anyInt())).thenReturn(false);
|
||||||
|
|
||||||
final TetheringConfiguration cfgWifi = getTetheringConfiguration(TYPE_WIFI);
|
final TetheringConfiguration cfgWifi = getTetheringConfiguration(TYPE_WIFI);
|
||||||
final TetheringConfiguration cfgMobileWifiHipri = getTetheringConfiguration(
|
final TetheringConfiguration cfgMobileWifiHipri = getTetheringConfiguration(
|
||||||
@@ -212,7 +212,7 @@ public class TetheringConfigurationTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testNoDefinedUpstreamTypesAddsEthernet() {
|
public void testNoDefinedUpstreamTypesAddsEthernet() {
|
||||||
when(mResources.getIntArray(config_tether_upstream_types)).thenReturn(new int[]{});
|
when(mResources.getIntArray(config_tether_upstream_types)).thenReturn(new int[]{});
|
||||||
when(mTelephonyManager.getTetherApnRequired(anyInt())).thenReturn(false);
|
when(mTelephonyManager.isTetherApnRequired(anyInt())).thenReturn(false);
|
||||||
|
|
||||||
final TetheringConfiguration cfg = new TetheringConfiguration(
|
final TetheringConfiguration cfg = new TetheringConfiguration(
|
||||||
mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
|
mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
|
||||||
@@ -235,7 +235,7 @@ public class TetheringConfigurationTest {
|
|||||||
public void testDefinedUpstreamTypesSansEthernetAddsEthernet() {
|
public void testDefinedUpstreamTypesSansEthernetAddsEthernet() {
|
||||||
when(mResources.getIntArray(config_tether_upstream_types)).thenReturn(
|
when(mResources.getIntArray(config_tether_upstream_types)).thenReturn(
|
||||||
new int[]{TYPE_WIFI, TYPE_MOBILE_HIPRI});
|
new int[]{TYPE_WIFI, TYPE_MOBILE_HIPRI});
|
||||||
when(mTelephonyManager.getTetherApnRequired(anyInt())).thenReturn(false);
|
when(mTelephonyManager.isTetherApnRequired(anyInt())).thenReturn(false);
|
||||||
|
|
||||||
final TetheringConfiguration cfg = new TetheringConfiguration(
|
final TetheringConfiguration cfg = new TetheringConfiguration(
|
||||||
mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
|
mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
|
||||||
@@ -253,7 +253,7 @@ public class TetheringConfigurationTest {
|
|||||||
public void testDefinedUpstreamTypesWithEthernetDoesNotAddEthernet() {
|
public void testDefinedUpstreamTypesWithEthernetDoesNotAddEthernet() {
|
||||||
when(mResources.getIntArray(config_tether_upstream_types))
|
when(mResources.getIntArray(config_tether_upstream_types))
|
||||||
.thenReturn(new int[]{TYPE_WIFI, TYPE_ETHERNET, TYPE_MOBILE_HIPRI});
|
.thenReturn(new int[]{TYPE_WIFI, TYPE_ETHERNET, TYPE_MOBILE_HIPRI});
|
||||||
when(mTelephonyManager.getTetherApnRequired(anyInt())).thenReturn(false);
|
when(mTelephonyManager.isTetherApnRequired(anyInt())).thenReturn(false);
|
||||||
|
|
||||||
final TetheringConfiguration cfg = new TetheringConfiguration(
|
final TetheringConfiguration cfg = new TetheringConfiguration(
|
||||||
mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
|
mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
|
||||||
|
|||||||
@@ -7657,12 +7657,16 @@ public class TelephonyManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether DUN APN is required for tethering.
|
* Check whether DUN APN is required for tethering.
|
||||||
|
* <p>
|
||||||
|
* Requires Permission: READ_PRIVILEGED_PHONE_STATE.
|
||||||
*
|
*
|
||||||
* @return {@code true} if DUN APN is required for tethering.
|
* @return {@code true} if DUN APN is required for tethering.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public boolean getTetherApnRequired() {
|
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
return getTetherApnRequired(getSubId(SubscriptionManager.getActiveDataSubscriptionId()));
|
@SystemApi
|
||||||
|
public boolean isTetherApnRequired() {
|
||||||
|
return isTetherApnRequired(getSubId(SubscriptionManager.getActiveDataSubscriptionId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -7672,11 +7676,11 @@ public class TelephonyManager {
|
|||||||
* @return {@code true} if DUN APN is required for tethering.
|
* @return {@code true} if DUN APN is required for tethering.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public boolean getTetherApnRequired(int subId) {
|
public boolean isTetherApnRequired(int subId) {
|
||||||
try {
|
try {
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony != null)
|
if (telephony != null)
|
||||||
return telephony.getTetherApnRequiredForSubscriber(subId);
|
return telephony.isTetherApnRequiredForSubscriber(subId);
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
Rlog.e(TAG, "hasMatchedTetherApnSetting RemoteException", ex);
|
Rlog.e(TAG, "hasMatchedTetherApnSetting RemoteException", ex);
|
||||||
} catch (NullPointerException ex) {
|
} catch (NullPointerException ex) {
|
||||||
|
|||||||
@@ -819,7 +819,7 @@ interface ITelephony {
|
|||||||
* @return {@code true} if DUN APN is required for tethering.
|
* @return {@code true} if DUN APN is required for tethering.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
boolean getTetherApnRequiredForSubscriber(int subId);
|
boolean isTetherApnRequiredForSubscriber(int subId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables framework IMS and triggers IMS Registration.
|
* Enables framework IMS and triggers IMS Registration.
|
||||||
|
|||||||
Reference in New Issue
Block a user