Skip to content
Snippets Groups Projects
Commit 87b8bf85 authored by SongFerngWang's avatar SongFerngWang
Browse files

[mainline] Expose getTetherApnRequired API as system API

1. getTetherApnRequired API rename to isTetherApnRequired.
2. Expose isTetherApnRequired API as system API.

Bug: 142365448
Test: Build pass.
      atest TetheringConfigurationTest (PASS)

Change-Id: Iafb2e4fbddb0251e23673742d990ad098a8ae375
parent c08ea88e
No related branches found
No related tags found
No related merge requests found
...@@ -251,7 +251,7 @@ public class TetheringConfiguration { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment