Loading services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java +13 −2 Original line number Original line Diff line number Diff line Loading @@ -163,20 +163,31 @@ public class TetheringConfiguration { } } // Fix up upstream interface types for DUN or mobile. NOTE: independent // Fix up upstream interface types for DUN or mobile. NOTE: independent // of the value of |requiresDun|, cell data of one form or another is // of the value of |dunCheck|, cell data of one form or another is // *always* an upstream, regardless of the upstream interface types // *always* an upstream, regardless of the upstream interface types // specified by configuration resources. // specified by configuration resources. if (dunCheck == DUN_REQUIRED) { if (dunCheck == DUN_REQUIRED) { if (!upstreamIfaceTypes.contains(TYPE_MOBILE_DUN)) { if (!upstreamIfaceTypes.contains(TYPE_MOBILE_DUN)) { upstreamIfaceTypes.add(TYPE_MOBILE_DUN); upstreamIfaceTypes.add(TYPE_MOBILE_DUN); } } } else { } else if (dunCheck == DUN_NOT_REQUIRED) { if (!upstreamIfaceTypes.contains(TYPE_MOBILE)) { if (!upstreamIfaceTypes.contains(TYPE_MOBILE)) { upstreamIfaceTypes.add(TYPE_MOBILE); upstreamIfaceTypes.add(TYPE_MOBILE); } } if (!upstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI)) { if (!upstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI)) { upstreamIfaceTypes.add(TYPE_MOBILE_HIPRI); upstreamIfaceTypes.add(TYPE_MOBILE_HIPRI); } } } else { // Fix upstream interface types for case DUN_UNSPECIFIED. // Do not modify if a cellular interface type is already present in the // upstream interface types. Add TYPE_MOBILE and TYPE_MOBILE_HIPRI if no // cellular interface types are found in the upstream interface types. if (!(upstreamIfaceTypes.contains(TYPE_MOBILE_DUN) || upstreamIfaceTypes.contains(TYPE_MOBILE) || upstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI))) { upstreamIfaceTypes.add(TYPE_MOBILE); upstreamIfaceTypes.add(TYPE_MOBILE_HIPRI); } } } return upstreamIfaceTypes; return upstreamIfaceTypes; Loading tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -128,5 +128,8 @@ public class TetheringConfigurationTest { assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN)); assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN)); // Just to prove we haven't clobbered Wi-Fi: // Just to prove we haven't clobbered Wi-Fi: assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_WIFI)); assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_WIFI)); // Check that we have not added new cellular interface types assertFalse(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE)); assertFalse(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI)); } } } } Loading
services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java +13 −2 Original line number Original line Diff line number Diff line Loading @@ -163,20 +163,31 @@ public class TetheringConfiguration { } } // Fix up upstream interface types for DUN or mobile. NOTE: independent // Fix up upstream interface types for DUN or mobile. NOTE: independent // of the value of |requiresDun|, cell data of one form or another is // of the value of |dunCheck|, cell data of one form or another is // *always* an upstream, regardless of the upstream interface types // *always* an upstream, regardless of the upstream interface types // specified by configuration resources. // specified by configuration resources. if (dunCheck == DUN_REQUIRED) { if (dunCheck == DUN_REQUIRED) { if (!upstreamIfaceTypes.contains(TYPE_MOBILE_DUN)) { if (!upstreamIfaceTypes.contains(TYPE_MOBILE_DUN)) { upstreamIfaceTypes.add(TYPE_MOBILE_DUN); upstreamIfaceTypes.add(TYPE_MOBILE_DUN); } } } else { } else if (dunCheck == DUN_NOT_REQUIRED) { if (!upstreamIfaceTypes.contains(TYPE_MOBILE)) { if (!upstreamIfaceTypes.contains(TYPE_MOBILE)) { upstreamIfaceTypes.add(TYPE_MOBILE); upstreamIfaceTypes.add(TYPE_MOBILE); } } if (!upstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI)) { if (!upstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI)) { upstreamIfaceTypes.add(TYPE_MOBILE_HIPRI); upstreamIfaceTypes.add(TYPE_MOBILE_HIPRI); } } } else { // Fix upstream interface types for case DUN_UNSPECIFIED. // Do not modify if a cellular interface type is already present in the // upstream interface types. Add TYPE_MOBILE and TYPE_MOBILE_HIPRI if no // cellular interface types are found in the upstream interface types. if (!(upstreamIfaceTypes.contains(TYPE_MOBILE_DUN) || upstreamIfaceTypes.contains(TYPE_MOBILE) || upstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI))) { upstreamIfaceTypes.add(TYPE_MOBILE); upstreamIfaceTypes.add(TYPE_MOBILE_HIPRI); } } } return upstreamIfaceTypes; return upstreamIfaceTypes; Loading
tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -128,5 +128,8 @@ public class TetheringConfigurationTest { assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN)); assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN)); // Just to prove we haven't clobbered Wi-Fi: // Just to prove we haven't clobbered Wi-Fi: assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_WIFI)); assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_WIFI)); // Check that we have not added new cellular interface types assertFalse(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE)); assertFalse(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI)); } } } }