Merge "Remove gaillard@google.com from OWNERS of statsd"
diff --git a/api/current.txt b/api/current.txt
index be38bbc..28fcac4 100755
--- a/api/current.txt
+++ b/api/current.txt
@@ -27249,8 +27249,8 @@
}
public class InetAddresses {
- method public static boolean isNumericAddress(String);
- method public static java.net.InetAddress parseNumericAddress(String);
+ method public static boolean isNumericAddress(@NonNull String);
+ method @NonNull public static java.net.InetAddress parseNumericAddress(@NonNull String);
}
public final class IpPrefix implements android.os.Parcelable {
@@ -27840,25 +27840,25 @@
public class VpnService.Builder {
ctor public VpnService.Builder();
- method public android.net.VpnService.Builder addAddress(java.net.InetAddress, int);
- method public android.net.VpnService.Builder addAddress(String, int);
- method public android.net.VpnService.Builder addAllowedApplication(String) throws android.content.pm.PackageManager.NameNotFoundException;
- method public android.net.VpnService.Builder addDisallowedApplication(String) throws android.content.pm.PackageManager.NameNotFoundException;
- method public android.net.VpnService.Builder addDnsServer(java.net.InetAddress);
- method public android.net.VpnService.Builder addDnsServer(String);
- method public android.net.VpnService.Builder addRoute(java.net.InetAddress, int);
- method public android.net.VpnService.Builder addRoute(String, int);
- method public android.net.VpnService.Builder addSearchDomain(String);
- method public android.net.VpnService.Builder allowBypass();
- method public android.net.VpnService.Builder allowFamily(int);
- method public android.os.ParcelFileDescriptor establish();
- method public android.net.VpnService.Builder setBlocking(boolean);
- method public android.net.VpnService.Builder setConfigureIntent(android.app.PendingIntent);
- method public android.net.VpnService.Builder setHttpProxy(@NonNull android.net.ProxyInfo);
- method public android.net.VpnService.Builder setMetered(boolean);
- method public android.net.VpnService.Builder setMtu(int);
- method public android.net.VpnService.Builder setSession(String);
- method public android.net.VpnService.Builder setUnderlyingNetworks(android.net.Network[]);
+ method @NonNull public android.net.VpnService.Builder addAddress(@NonNull java.net.InetAddress, int);
+ method @NonNull public android.net.VpnService.Builder addAddress(@NonNull String, int);
+ method @NonNull public android.net.VpnService.Builder addAllowedApplication(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
+ method @NonNull public android.net.VpnService.Builder addDisallowedApplication(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
+ method @NonNull public android.net.VpnService.Builder addDnsServer(@NonNull java.net.InetAddress);
+ method @NonNull public android.net.VpnService.Builder addDnsServer(@NonNull String);
+ method @NonNull public android.net.VpnService.Builder addRoute(@NonNull java.net.InetAddress, int);
+ method @NonNull public android.net.VpnService.Builder addRoute(@NonNull String, int);
+ method @NonNull public android.net.VpnService.Builder addSearchDomain(@NonNull String);
+ method @NonNull public android.net.VpnService.Builder allowBypass();
+ method @NonNull public android.net.VpnService.Builder allowFamily(int);
+ method @Nullable public android.os.ParcelFileDescriptor establish();
+ method @NonNull public android.net.VpnService.Builder setBlocking(boolean);
+ method @NonNull public android.net.VpnService.Builder setConfigureIntent(@NonNull android.app.PendingIntent);
+ method @NonNull public android.net.VpnService.Builder setHttpProxy(@NonNull android.net.ProxyInfo);
+ method @NonNull public android.net.VpnService.Builder setMetered(boolean);
+ method @NonNull public android.net.VpnService.Builder setMtu(int);
+ method @NonNull public android.net.VpnService.Builder setSession(@NonNull String);
+ method @NonNull public android.net.VpnService.Builder setUnderlyingNetworks(@Nullable android.net.Network[]);
}
}
diff --git a/api/system-current.txt b/api/system-current.txt
index e09da3d..41d8eea 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -3133,8 +3133,8 @@
public class LinkAddress implements android.os.Parcelable {
ctor public LinkAddress(java.net.InetAddress, int, int, int);
- ctor public LinkAddress(java.net.InetAddress, int);
- ctor public LinkAddress(String);
+ ctor public LinkAddress(@NonNull java.net.InetAddress, int);
+ ctor public LinkAddress(@NonNull String);
ctor public LinkAddress(String, int, int);
method public boolean isGlobalPreferred();
method public boolean isIPv4();
@@ -6070,7 +6070,7 @@
public abstract class NetworkService.NetworkServiceProvider implements java.lang.AutoCloseable {
ctor public NetworkService.NetworkServiceProvider(int);
method public abstract void close();
- method public void getNetworkRegistrationState(int, android.telephony.NetworkServiceCallback);
+ method public void getNetworkRegistrationState(int, @NonNull android.telephony.NetworkServiceCallback);
method public final int getSlotId();
method public final void notifyNetworkRegistrationStateChanged();
}
@@ -6251,12 +6251,12 @@
}
public class ServiceState implements android.os.Parcelable {
- method public android.telephony.NetworkRegistrationState getNetworkRegistrationState(int, int);
- method public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStates();
- method @Deprecated public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStates(int);
- method @Deprecated public android.telephony.NetworkRegistrationState getNetworkRegistrationStates(int, int);
- method public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStatesForDomain(int);
- method public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStatesForTransportType(int);
+ method @Nullable public android.telephony.NetworkRegistrationState getNetworkRegistrationState(int, int);
+ method @NonNull public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStates();
+ method @Deprecated @NonNull public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStates(int);
+ method @Deprecated @Nullable public android.telephony.NetworkRegistrationState getNetworkRegistrationStates(int, int);
+ method @NonNull public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStatesForDomain(int);
+ method @NonNull public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStatesForTransportType(int);
field public static final int ROAMING_TYPE_DOMESTIC = 2; // 0x2
field public static final int ROAMING_TYPE_INTERNATIONAL = 3; // 0x3
field public static final int ROAMING_TYPE_NOT_ROAMING = 0; // 0x0
@@ -6563,9 +6563,9 @@
method public void getDataCallList(@NonNull android.telephony.data.DataServiceCallback);
method public final int getSlotId();
method public final void notifyDataCallListChanged(java.util.List<android.telephony.data.DataCallResponse>);
- method public void setDataProfile(java.util.List<android.telephony.data.DataProfile>, boolean, @Nullable android.telephony.data.DataServiceCallback);
- method public void setInitialAttachApn(android.telephony.data.DataProfile, boolean, @Nullable android.telephony.data.DataServiceCallback);
- method public void setupDataCall(int, android.telephony.data.DataProfile, boolean, boolean, int, @Nullable android.net.LinkProperties, @Nullable android.telephony.data.DataServiceCallback);
+ method public void setDataProfile(@NonNull java.util.List<android.telephony.data.DataProfile>, boolean, @Nullable android.telephony.data.DataServiceCallback);
+ method public void setInitialAttachApn(@NonNull android.telephony.data.DataProfile, boolean, @Nullable android.telephony.data.DataServiceCallback);
+ method public void setupDataCall(int, @NonNull android.telephony.data.DataProfile, boolean, boolean, int, @Nullable android.net.LinkProperties, @Nullable android.telephony.data.DataServiceCallback);
}
public class DataServiceCallback {
@@ -6584,7 +6584,7 @@
public abstract class QualifiedNetworksService extends android.app.Service {
ctor public QualifiedNetworksService();
- method public abstract android.telephony.data.QualifiedNetworksService.NetworkAvailabilityUpdater createNetworkAvailabilityUpdater(int);
+ method @NonNull public abstract android.telephony.data.QualifiedNetworksService.NetworkAvailabilityUpdater createNetworkAvailabilityUpdater(int);
field public static final String QUALIFIED_NETWORKS_SERVICE_INTERFACE = "android.telephony.data.QualifiedNetworksService";
}
@@ -6592,7 +6592,7 @@
ctor public QualifiedNetworksService.NetworkAvailabilityUpdater(int);
method public abstract void close();
method public final int getSlotIndex();
- method public final void updateQualifiedNetworkTypes(int, int[]);
+ method public final void updateQualifiedNetworkTypes(int, @Nullable int[]);
}
}
diff --git a/api/test-current.txt b/api/test-current.txt
index 34d737f..91dea4e 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -626,8 +626,8 @@
public class LinkAddress implements android.os.Parcelable {
ctor public LinkAddress(java.net.InetAddress, int, int, int);
- ctor public LinkAddress(java.net.InetAddress, int);
- ctor public LinkAddress(String);
+ ctor public LinkAddress(@NonNull java.net.InetAddress, int);
+ ctor public LinkAddress(@NonNull String);
ctor public LinkAddress(String, int, int);
method public boolean isGlobalPreferred();
method public boolean isIPv4();
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index 24a907b..63ba00b 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -4277,6 +4277,8 @@
* @return {@code uid} if the connection is found and the app has permission to observe it
* (e.g., if it is associated with the calling VPN app's tunnel) or
* {@link android.os.Process#INVALID_UID} if the connection is not found.
+ * Throws {@link SecurityException} if the caller is not the active VPN for the current user.
+ * Throws {@link IllegalArgumentException} if an unsupported protocol is requested.
*/
public int getConnectionOwnerUid(int protocol, @NonNull InetSocketAddress local,
@NonNull InetSocketAddress remote) {
diff --git a/core/java/android/net/InetAddresses.java b/core/java/android/net/InetAddresses.java
index 8e6c69a..01b795e 100644
--- a/core/java/android/net/InetAddresses.java
+++ b/core/java/android/net/InetAddresses.java
@@ -16,6 +16,8 @@
package android.net;
+import android.annotation.NonNull;
+
import libcore.net.InetAddressUtils;
import java.net.InetAddress;
@@ -40,7 +42,7 @@
* @param address the address to parse.
* @return true if the supplied address is numeric, false otherwise.
*/
- public static boolean isNumericAddress(String address) {
+ public static boolean isNumericAddress(@NonNull String address) {
return InetAddressUtils.isNumericAddress(address);
}
@@ -57,7 +59,7 @@
* @return an {@link InetAddress} instance corresponding to the address.
* @throws IllegalArgumentException if {@code address} is not a numeric address.
*/
- public static InetAddress parseNumericAddress(String address) {
+ public static @NonNull InetAddress parseNumericAddress(@NonNull String address) {
return InetAddressUtils.parseNumericAddress(address);
}
}
diff --git a/core/java/android/net/LinkAddress.java b/core/java/android/net/LinkAddress.java
index 8d779aa..8b01960 100644
--- a/core/java/android/net/LinkAddress.java
+++ b/core/java/android/net/LinkAddress.java
@@ -25,6 +25,7 @@
import static android.system.OsConstants.RT_SCOPE_SITE;
import static android.system.OsConstants.RT_SCOPE_UNIVERSE;
+import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
@@ -177,7 +178,7 @@
*/
@SystemApi
@TestApi
- public LinkAddress(InetAddress address, int prefixLength) {
+ public LinkAddress(@NonNull InetAddress address, int prefixLength) {
this(address, prefixLength, 0, 0);
this.scope = scopeForUnicastAddress(address);
}
@@ -196,12 +197,12 @@
/**
* Constructs a new {@code LinkAddress} from a string such as "192.0.2.5/24" or
* "2001:db8::1/64". The flags are set to zero and the scope is determined from the address.
- * @param string The string to parse.
+ * @param address The string to parse.
* @hide
*/
@SystemApi
@TestApi
- public LinkAddress(String address) {
+ public LinkAddress(@NonNull String address) {
this(address, 0, 0);
this.scope = scopeForUnicastAddress(this.address);
}
@@ -209,7 +210,7 @@
/**
* Constructs a new {@code LinkAddress} from a string such as "192.0.2.5/24" or
* "2001:db8::1/64", with the specified flags and scope.
- * @param string The string to parse.
+ * @param address The string to parse.
* @param flags The address flags.
* @param scope The address scope.
* @hide
diff --git a/core/java/android/net/VpnService.java b/core/java/android/net/VpnService.java
index ebb1ae4..870d8b1 100644
--- a/core/java/android/net/VpnService.java
+++ b/core/java/android/net/VpnService.java
@@ -20,6 +20,7 @@
import static android.system.OsConstants.AF_INET6;
import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.UnsupportedAppUsage;
@@ -479,7 +480,8 @@
* system-managed dialogs and notifications. This is recommended
* not required.
*/
- public Builder setSession(String session) {
+ @NonNull
+ public Builder setSession(@NonNull String session) {
mConfig.session = session;
return this;
}
@@ -489,7 +491,8 @@
* configure the VPN connection. If it is not set, the button
* to configure will not be shown in system-managed dialogs.
*/
- public Builder setConfigureIntent(PendingIntent intent) {
+ @NonNull
+ public Builder setConfigureIntent(@NonNull PendingIntent intent) {
mConfig.configureIntent = intent;
return this;
}
@@ -501,6 +504,7 @@
*
* @throws IllegalArgumentException if the value is not positive.
*/
+ @NonNull
public Builder setMtu(int mtu) {
if (mtu <= 0) {
throw new IllegalArgumentException("Bad mtu");
@@ -513,6 +517,7 @@
* Sets an HTTP proxy for the VPN network. This proxy is only a recommendation
* and it is possible that some apps will ignore it.
*/
+ @NonNull
public Builder setHttpProxy(@NonNull ProxyInfo proxyInfo) {
mConfig.proxyInfo = proxyInfo;
return this;
@@ -528,7 +533,8 @@
*
* @throws IllegalArgumentException if the address is invalid.
*/
- public Builder addAddress(InetAddress address, int prefixLength) {
+ @NonNull
+ public Builder addAddress(@NonNull InetAddress address, int prefixLength) {
check(address, prefixLength);
if (address.isAnyLocalAddress()) {
@@ -550,7 +556,8 @@
* @throws IllegalArgumentException if the address is invalid.
* @see #addAddress(InetAddress, int)
*/
- public Builder addAddress(String address, int prefixLength) {
+ @NonNull
+ public Builder addAddress(@NonNull String address, int prefixLength) {
return addAddress(InetAddress.parseNumericAddress(address), prefixLength);
}
@@ -563,7 +570,8 @@
*
* @throws IllegalArgumentException if the route is invalid.
*/
- public Builder addRoute(InetAddress address, int prefixLength) {
+ @NonNull
+ public Builder addRoute(@NonNull InetAddress address, int prefixLength) {
check(address, prefixLength);
int offset = prefixLength / 8;
@@ -591,7 +599,8 @@
* @throws IllegalArgumentException if the route is invalid.
* @see #addRoute(InetAddress, int)
*/
- public Builder addRoute(String address, int prefixLength) {
+ @NonNull
+ public Builder addRoute(@NonNull String address, int prefixLength) {
return addRoute(InetAddress.parseNumericAddress(address), prefixLength);
}
@@ -605,7 +614,8 @@
*
* @throws IllegalArgumentException if the address is invalid.
*/
- public Builder addDnsServer(InetAddress address) {
+ @NonNull
+ public Builder addDnsServer(@NonNull InetAddress address) {
if (address.isLoopbackAddress() || address.isAnyLocalAddress()) {
throw new IllegalArgumentException("Bad address");
}
@@ -627,14 +637,16 @@
* @throws IllegalArgumentException if the address is invalid.
* @see #addDnsServer(InetAddress)
*/
- public Builder addDnsServer(String address) {
+ @NonNull
+ public Builder addDnsServer(@NonNull String address) {
return addDnsServer(InetAddress.parseNumericAddress(address));
}
/**
* Add a search domain to the DNS resolver.
*/
- public Builder addSearchDomain(String domain) {
+ @NonNull
+ public Builder addSearchDomain(@NonNull String domain) {
if (mConfig.searchDomains == null) {
mConfig.searchDomains = new ArrayList<String>();
}
@@ -660,6 +672,7 @@
*
* @return this {@link Builder} object to facilitate chaining of method calls.
*/
+ @NonNull
public Builder allowFamily(int family) {
if (family == AF_INET) {
mConfig.allowIPv4 = true;
@@ -703,7 +716,8 @@
*
* @return this {@link Builder} object to facilitate chaining method calls.
*/
- public Builder addAllowedApplication(String packageName)
+ @NonNull
+ public Builder addAllowedApplication(@NonNull String packageName)
throws PackageManager.NameNotFoundException {
if (mConfig.disallowedApplications != null) {
throw new UnsupportedOperationException("addDisallowedApplication already called");
@@ -735,7 +749,8 @@
*
* @return this {@link Builder} object to facilitate chaining method calls.
*/
- public Builder addDisallowedApplication(String packageName)
+ @NonNull
+ public Builder addDisallowedApplication(@NonNull String packageName)
throws PackageManager.NameNotFoundException {
if (mConfig.allowedApplications != null) {
throw new UnsupportedOperationException("addAllowedApplication already called");
@@ -758,6 +773,7 @@
*
* @return this {@link Builder} object to facilitate chaining of method calls.
*/
+ @NonNull
public Builder allowBypass() {
mConfig.allowBypass = true;
return this;
@@ -772,6 +788,7 @@
*
* @return this {@link Builder} object to facilitate chaining method calls.
*/
+ @NonNull
public Builder setBlocking(boolean blocking) {
mConfig.blocking = blocking;
return this;
@@ -786,7 +803,8 @@
*
* @return this {@link Builder} object to facilitate chaining method calls.
*/
- public Builder setUnderlyingNetworks(Network[] networks) {
+ @NonNull
+ public Builder setUnderlyingNetworks(@Nullable Network[] networks) {
mConfig.underlyingNetworks = networks != null ? networks.clone() : null;
return this;
}
@@ -807,6 +825,7 @@
* @see #setUnderlyingNetworks(Networks[])
* @see ConnectivityManager#isActiveNetworkMetered()
*/
+ @NonNull
public Builder setMetered(boolean isMetered) {
mConfig.isMetered = isMetered;
return this;
@@ -855,6 +874,7 @@
* in {@code AndroidManifest.xml}.
* @see VpnService
*/
+ @Nullable
public ParcelFileDescriptor establish() {
mConfig.addresses = mAddresses;
mConfig.routes = mRoutes;
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index de07b86..5444c69 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -477,22 +477,16 @@
- the return value of TelephonyManager.getTetherApnRequired()
determines how the array is further modified:
- * DUN_REQUIRED
- TYPE_MOBILE is removed (if present)
- TYPE_MOBILE_HIPRI is removed (if present)
- TYPE_MOBILE_DUN is appended (if not already present)
+ * TRUE (DUN REQUIRED).
+ TYPE_MOBILE is removed (if present).
+ TYPE_MOBILE_HIPRI is removed (if present).
+ TYPE_MOBILE_DUN is appended (if not already present).
- * DUN_NOT_REQUIRED
- TYPE_MOBILE_DUN is removed (if present)
- TYPE_MOBILE is appended (if not already present)
- TYPE_MOBILE_HIPRI is appended (if not already present)
-
- * DUN_UNSPECIFIED
- if any of TYPE_MOBILE{,_DUN,_HIPRI} are present:
- change nothing
- else:
- TYPE_MOBILE is appended
- TYPE_MOBILE_HIPRI is appended
+ * FALSE (DUN NOT REQUIRED).
+ TYPE_MOBILE_DUN is removed (if present).
+ If both of TYPE_MOBILE{,_HIPRI} are not present:
+ TYPE_MOBILE is appended.
+ TYPE_MOBILE_HIPRI is appended.
For other changes applied to this list, now and in the future, see
com.android.server.connectivity.tethering.TetheringConfiguration.
diff --git a/packages/SettingsLib/common.mk b/packages/SettingsLib/common.mk
index 8d24eab..8c309ff 100644
--- a/packages/SettingsLib/common.mk
+++ b/packages/SettingsLib/common.mk
@@ -31,4 +31,3 @@
androidx.legacy_legacy-preference-v14 \
SettingsLib
-LOCAL_RESOURCE_DIR += $(call my-dir)/res
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 90281b7..cc3e6fb 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -5565,6 +5565,8 @@
}
public void handleUpdateLinkProperties(NetworkAgentInfo nai, LinkProperties newLp) {
+ ensureRunningOnConnectivityServiceThread();
+
if (getNetworkAgentInfoForNetId(nai.network.netId) != nai) {
// Ignore updates for disconnected networks
return;
diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java
index c91e1a1..13ff30d 100644
--- a/services/core/java/com/android/server/connectivity/Tethering.java
+++ b/services/core/java/com/android/server/connectivity/Tethering.java
@@ -289,8 +289,8 @@
}
private void maybeUpdateConfiguration() {
- final int dunCheck = TetheringConfiguration.checkDunRequired(mContext);
- if (dunCheck == mConfig.dunCheck) return;
+ final boolean isDunRequired = TetheringConfiguration.checkDunRequired(mContext);
+ if (isDunRequired == mConfig.isDunRequired) return;
updateConfiguration();
}
diff --git a/services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java b/services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java
index 8a46ff1..935b795 100644
--- a/services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java
+++ b/services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java
@@ -67,11 +67,6 @@
private static final String[] EMPTY_STRING_ARRAY = new String[0];
- @VisibleForTesting
- public static final int DUN_NOT_REQUIRED = 0;
- public static final int DUN_REQUIRED = 1;
- public static final int DUN_UNSPECIFIED = 2;
-
// Default ranges used for the legacy DHCP server.
// USB is 192.168.42.1 and 255.255.255.0
// Wifi is 192.168.43.1 and 255.255.255.0
@@ -90,7 +85,6 @@
public final String[] tetherableUsbRegexs;
public final String[] tetherableWifiRegexs;
public final String[] tetherableBluetoothRegexs;
- public final int dunCheck;
public final boolean isDunRequired;
public final boolean chooseUpstreamAutomatically;
public final Collection<Integer> preferredUpstreamIfaceTypes;
@@ -116,12 +110,10 @@
tetherableWifiRegexs = getResourceStringArray(res, config_tether_wifi_regexs);
tetherableBluetoothRegexs = getResourceStringArray(res, config_tether_bluetooth_regexs);
- dunCheck = checkDunRequired(ctx);
- configLog.log("DUN check returned: " + dunCheckString(dunCheck));
+ isDunRequired = checkDunRequired(ctx);
chooseUpstreamAutomatically = getResourceBoolean(res, config_tether_upstream_automatic);
- preferredUpstreamIfaceTypes = getUpstreamIfaceTypes(res, dunCheck);
- isDunRequired = preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN);
+ preferredUpstreamIfaceTypes = getUpstreamIfaceTypes(res, isDunRequired);
legacyDhcpRanges = getLegacyDhcpRanges(res);
defaultIPv4DNS = copy(DEFAULT_IPV4_DNS);
@@ -230,53 +222,43 @@
return upstreamNames;
}
- public static int checkDunRequired(Context ctx) {
+ /** Check whether dun is required. */
+ public static boolean checkDunRequired(Context ctx) {
final TelephonyManager tm = (TelephonyManager) ctx.getSystemService(TELEPHONY_SERVICE);
- return (tm != null) ? tm.getTetherApnRequired() : DUN_UNSPECIFIED;
+ return (tm != null) ? tm.getTetherApnRequired() : false;
}
- private static String dunCheckString(int dunCheck) {
- switch (dunCheck) {
- case DUN_NOT_REQUIRED: return "DUN_NOT_REQUIRED";
- case DUN_REQUIRED: return "DUN_REQUIRED";
- case DUN_UNSPECIFIED: return "DUN_UNSPECIFIED";
- default:
- return String.format("UNKNOWN (%s)", dunCheck);
- }
- }
-
- private static Collection<Integer> getUpstreamIfaceTypes(Resources res, int dunCheck) {
+ private static Collection<Integer> getUpstreamIfaceTypes(Resources res, boolean dunRequired) {
final int[] ifaceTypes = res.getIntArray(config_tether_upstream_types);
final ArrayList<Integer> upstreamIfaceTypes = new ArrayList<>(ifaceTypes.length);
for (int i : ifaceTypes) {
switch (i) {
case TYPE_MOBILE:
case TYPE_MOBILE_HIPRI:
- if (dunCheck == DUN_REQUIRED) continue;
+ if (dunRequired) continue;
break;
case TYPE_MOBILE_DUN:
- if (dunCheck == DUN_NOT_REQUIRED) continue;
+ if (!dunRequired) continue;
break;
}
upstreamIfaceTypes.add(i);
}
// Fix up upstream interface types for DUN or mobile. NOTE: independent
- // of the value of |dunCheck|, cell data of one form or another is
+ // of the value of |dunRequired|, cell data of one form or another is
// *always* an upstream, regardless of the upstream interface types
// specified by configuration resources.
- if (dunCheck == DUN_REQUIRED) {
+ if (dunRequired) {
appendIfNotPresent(upstreamIfaceTypes, TYPE_MOBILE_DUN);
- } else if (dunCheck == DUN_NOT_REQUIRED) {
- appendIfNotPresent(upstreamIfaceTypes, TYPE_MOBILE);
- appendIfNotPresent(upstreamIfaceTypes, 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 (!(containsOneOf(upstreamIfaceTypes,
- TYPE_MOBILE_DUN, TYPE_MOBILE, TYPE_MOBILE_HIPRI))) {
+ // This preserves backwards compatibility and prevents the DUN and default
+ // mobile types incorrectly appearing together, which could happen on
+ // previous releases in the common case where checkDunRequired returned
+ // DUN_UNSPECIFIED.
+ if (!containsOneOf(upstreamIfaceTypes, TYPE_MOBILE, TYPE_MOBILE_HIPRI)) {
upstreamIfaceTypes.add(TYPE_MOBILE);
upstreamIfaceTypes.add(TYPE_MOBILE_HIPRI);
}
diff --git a/telephony/java/android/telephony/NetworkService.java b/telephony/java/android/telephony/NetworkService.java
index 6c45cc4..bec9494 100644
--- a/telephony/java/android/telephony/NetworkService.java
+++ b/telephony/java/android/telephony/NetworkService.java
@@ -26,6 +26,7 @@
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
+import android.telephony.NetworkRegistrationState.Domain;
import android.util.SparseArray;
import com.android.internal.annotations.VisibleForTesting;
@@ -99,11 +100,12 @@
/**
* API to get network registration state. The result will be passed to the callback.
- * @param domain
- * @param callback
+ * @param domain Network domain
+ * @param callback The callback for reporting network registration state
* @return SIM slot id the network service associated with.
*/
- public void getNetworkRegistrationState(int domain, NetworkServiceCallback callback) {
+ public void getNetworkRegistrationState(@Domain int domain,
+ @NonNull NetworkServiceCallback callback) {
callback.onGetNetworkRegistrationStateComplete(
NetworkServiceCallback.RESULT_ERROR_UNSUPPORTED, null);
}
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index 3dc1199..f2daace 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -17,6 +17,8 @@
package android.telephony;
import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
@@ -1760,6 +1762,7 @@
* @return List of {@link NetworkRegistrationState}
* @hide
*/
+ @NonNull
@SystemApi
public List<NetworkRegistrationState> getNetworkRegistrationStates() {
synchronized (mNetworkRegistrationStates) {
@@ -1776,6 +1779,7 @@
*
* @deprecated Use {@link #getNetworkRegistrationStatesFromTransportType(int)}
*/
+ @NonNull
@Deprecated
@SystemApi
public List<NetworkRegistrationState> getNetworkRegistrationStates(int transportType) {
@@ -1789,6 +1793,7 @@
* @return List of {@link NetworkRegistrationState}
* @hide
*/
+ @NonNull
@SystemApi
public List<NetworkRegistrationState> getNetworkRegistrationStatesForTransportType(
int transportType) {
@@ -1812,6 +1817,7 @@
* @return List of {@link NetworkRegistrationState}
* @hide
*/
+ @NonNull
@SystemApi
public List<NetworkRegistrationState> getNetworkRegistrationStatesForDomain(
@Domain int domain) {
@@ -1838,6 +1844,7 @@
*
* @deprecated Use {@link #getNetworkRegistrationState(int, int)}
*/
+ @Nullable
@Deprecated
@SystemApi
public NetworkRegistrationState getNetworkRegistrationStates(@Domain int domain,
@@ -1854,6 +1861,7 @@
* @hide
*
*/
+ @Nullable
@SystemApi
public NetworkRegistrationState getNetworkRegistrationState(@Domain int domain,
int transportType) {
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 179cab0..6aa4266 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -6907,14 +6907,12 @@
}
/**
- * Check TETHER_DUN_REQUIRED and TETHER_DUN_APN settings, net.tethering.noprovisioning
- * SystemProperty to decide whether DUN APN is required for
- * tethering.
+ * Check whether DUN APN is required for tethering.
*
- * @return 0: Not required. 1: required. 2: Not set.
+ * @return {@code true} if DUN APN is required for tethering.
* @hide
*/
- public int getTetherApnRequired() {
+ public boolean getTetherApnRequired() {
try {
ITelephony telephony = getITelephony();
if (telephony != null)
@@ -6924,7 +6922,7 @@
} catch (NullPointerException ex) {
Rlog.e(TAG, "hasMatchedTetherApnSetting NPE", ex);
}
- return 2;
+ return false;
}
diff --git a/telephony/java/android/telephony/data/DataService.java b/telephony/java/android/telephony/data/DataService.java
index 79572b9..a3fa77b 100644
--- a/telephony/java/android/telephony/data/DataService.java
+++ b/telephony/java/android/telephony/data/DataService.java
@@ -152,8 +152,9 @@
* @param callback The result callback for this request. Null if the client does not care
* about the result.
*/
- public void setupDataCall(int accessNetworkType, DataProfile dataProfile, boolean isRoaming,
- boolean allowRoaming, @SetupDataReason int reason,
+ public void setupDataCall(int accessNetworkType, @NonNull DataProfile dataProfile,
+ boolean isRoaming, boolean allowRoaming,
+ @SetupDataReason int reason,
@Nullable LinkProperties linkProperties,
@Nullable DataServiceCallback callback) {
// The default implementation is to return unsupported.
@@ -192,7 +193,7 @@
* @param callback The result callback for this request. Null if the client does not care
* about the result.
*/
- public void setInitialAttachApn(DataProfile dataProfile, boolean isRoaming,
+ public void setInitialAttachApn(@NonNull DataProfile dataProfile, boolean isRoaming,
@Nullable DataServiceCallback callback) {
// The default implementation is to return unsupported.
if (callback != null) {
@@ -211,7 +212,7 @@
* @param callback The result callback for this request. Null if the client does not care
* about the result.
*/
- public void setDataProfile(List<DataProfile> dps, boolean isRoaming,
+ public void setDataProfile(@NonNull List<DataProfile> dps, boolean isRoaming,
@Nullable DataServiceCallback callback) {
// The default implementation is to return unsupported.
if (callback != null) {
diff --git a/telephony/java/android/telephony/data/QualifiedNetworksService.java b/telephony/java/android/telephony/data/QualifiedNetworksService.java
index 45b4849..c38f278 100644
--- a/telephony/java/android/telephony/data/QualifiedNetworksService.java
+++ b/telephony/java/android/telephony/data/QualifiedNetworksService.java
@@ -16,6 +16,8 @@
package android.telephony.data;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.app.Service;
import android.content.Intent;
@@ -132,7 +134,7 @@
* for data setup.
*/
public final void updateQualifiedNetworkTypes(@ApnType int apnTypes,
- int[] qualifiedNetworkTypes) {
+ @Nullable int[] qualifiedNetworkTypes) {
mHandler.obtainMessage(QNS_UPDATE_QUALIFIED_NETWORKS, mSlotIndex, apnTypes,
qualifiedNetworkTypes).sendToTarget();
}
@@ -233,6 +235,7 @@
* @param slotIndex SIM slot index the qualified networks service associated with.
* @return Qualified networks service instance
*/
+ @NonNull
public abstract NetworkAvailabilityUpdater createNetworkAvailabilityUpdater(int slotIndex);
/** @hide */
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 3d4fc17..3959244 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -700,13 +700,12 @@
int getPreferredNetworkType(int subId);
/**
- * Check TETHER_DUN_REQUIRED and TETHER_DUN_APN settings, net.tethering.noprovisioning
- * SystemProperty to decide whether DUN APN is required for
- * tethering.
+ * Check whether DUN APN is required for tethering.
*
- * @return 0: Not required. 1: required. 2: Not set.
+ * @return {@code true} if DUN APN is required for tethering.
+ * @hide
*/
- int getTetherApnRequired();
+ boolean getTetherApnRequired();
/**
* Enables framework IMS and triggers IMS Registration.
diff --git a/tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java b/tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
index 01b904d8..f8cfd8f 100644
--- a/tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
+++ b/tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
@@ -24,9 +24,7 @@
import static android.provider.Settings.Global.TETHER_ENABLE_LEGACY_DHCP_SERVER;
import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
-import static com.android.server.connectivity.tethering.TetheringConfiguration.DUN_NOT_REQUIRED;
-import static com.android.server.connectivity.tethering.TetheringConfiguration.DUN_REQUIRED;
-import static com.android.server.connectivity.tethering.TetheringConfiguration.DUN_UNSPECIFIED;
+import static com.android.internal.R.array.config_tether_upstream_types;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -52,6 +50,7 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import java.util.Arrays;
import java.util.Iterator;
@RunWith(AndroidJUnit4.class)
@@ -112,74 +111,103 @@
.thenReturn(new String[]{ "test_wlan\\d" });
when(mResources.getStringArray(com.android.internal.R.array.config_tether_bluetooth_regexs))
.thenReturn(new String[0]);
- when(mResources.getIntArray(com.android.internal.R.array.config_tether_upstream_types))
- .thenReturn(new int[0]);
+ when(mResources.getIntArray(config_tether_upstream_types)).thenReturn(new int[0]);
when(mResources.getStringArray(
com.android.internal.R.array.config_mobile_hotspot_provision_app))
.thenReturn(new String[0]);
mContentResolver = new MockContentResolver();
mContentResolver.addProvider(Settings.AUTHORITY, new FakeSettingsProvider());
+ mHasTelephonyManager = true;
mMockContext = new MockContext(mContext);
}
+ private TetheringConfiguration getTetheringConfiguration(int[] legacyTetherUpstreamTypes) {
+ when(mResources.getIntArray(config_tether_upstream_types)).thenReturn(
+ legacyTetherUpstreamTypes);
+ return new TetheringConfiguration(mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
+ }
+
+ @Test
+ public void testNoTelephonyManagerMeansNoDun() {
+ mHasTelephonyManager = false;
+ final TetheringConfiguration cfg = getTetheringConfiguration(
+ new int[]{TYPE_MOBILE_DUN, TYPE_WIFI});
+ assertFalse(cfg.isDunRequired);
+ assertFalse(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN));
+ // Just to prove we haven't clobbered Wi-Fi:
+ assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_WIFI));
+ }
+
@Test
public void testDunFromTelephonyManagerMeansDun() {
- when(mResources.getIntArray(com.android.internal.R.array.config_tether_upstream_types))
- .thenReturn(new int[]{TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI});
- mHasTelephonyManager = true;
- when(mTelephonyManager.getTetherApnRequired()).thenReturn(DUN_REQUIRED);
+ when(mTelephonyManager.getTetherApnRequired()).thenReturn(true);
- final TetheringConfiguration cfg = new TetheringConfiguration(
- mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
- assertTrue(cfg.isDunRequired);
- assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN));
- assertFalse(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE));
- assertFalse(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI));
- // Just to prove we haven't clobbered Wi-Fi:
- assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_WIFI));
+ final TetheringConfiguration cfgWifi = getTetheringConfiguration(new int[]{TYPE_WIFI});
+ final TetheringConfiguration cfgMobileWifiHipri = getTetheringConfiguration(
+ new int[]{TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI});
+ final TetheringConfiguration cfgWifiDun = getTetheringConfiguration(
+ new int[]{TYPE_WIFI, TYPE_MOBILE_DUN});
+ final TetheringConfiguration cfgMobileWifiHipriDun = getTetheringConfiguration(
+ new int[]{TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI, TYPE_MOBILE_DUN});
+
+ for (TetheringConfiguration cfg : Arrays.asList(cfgWifi, cfgMobileWifiHipri,
+ cfgWifiDun, cfgMobileWifiHipriDun)) {
+ String msg = "config=" + cfg.toString();
+ assertTrue(msg, cfg.isDunRequired);
+ assertTrue(msg, cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN));
+ assertFalse(msg, cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE));
+ assertFalse(msg, cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI));
+ // Just to prove we haven't clobbered Wi-Fi:
+ assertTrue(msg, cfg.preferredUpstreamIfaceTypes.contains(TYPE_WIFI));
+ }
}
@Test
public void testDunNotRequiredFromTelephonyManagerMeansNoDun() {
- when(mResources.getIntArray(com.android.internal.R.array.config_tether_upstream_types))
- .thenReturn(new int[]{TYPE_MOBILE_DUN, TYPE_WIFI});
- mHasTelephonyManager = true;
- when(mTelephonyManager.getTetherApnRequired()).thenReturn(DUN_NOT_REQUIRED);
+ when(mTelephonyManager.getTetherApnRequired()).thenReturn(false);
- final TetheringConfiguration cfg = new TetheringConfiguration(
- mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
- assertFalse(cfg.isDunRequired);
- assertFalse(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN));
- assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE));
- assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI));
- // Just to prove we haven't clobbered Wi-Fi:
- assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_WIFI));
- }
+ final TetheringConfiguration cfgWifi = getTetheringConfiguration(new int[]{TYPE_WIFI});
+ final TetheringConfiguration cfgMobileWifiHipri = getTetheringConfiguration(
+ new int[]{TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI});
+ final TetheringConfiguration cfgWifiDun = getTetheringConfiguration(
+ new int[]{TYPE_WIFI, TYPE_MOBILE_DUN});
+ final TetheringConfiguration cfgWifiMobile = getTetheringConfiguration(
+ new int[]{TYPE_WIFI, TYPE_MOBILE});
+ final TetheringConfiguration cfgWifiHipri = getTetheringConfiguration(
+ new int[]{TYPE_WIFI, TYPE_MOBILE_HIPRI});
+ final TetheringConfiguration cfgMobileWifiHipriDun = getTetheringConfiguration(
+ new int[]{TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI, TYPE_MOBILE_DUN});
- @Test
- public void testDunFromUpstreamConfigMeansDun() {
- when(mResources.getIntArray(com.android.internal.R.array.config_tether_upstream_types))
- .thenReturn(new int[]{TYPE_MOBILE_DUN, TYPE_WIFI});
- mHasTelephonyManager = false;
- when(mTelephonyManager.getTetherApnRequired()).thenReturn(DUN_UNSPECIFIED);
+ String msg;
+ // TYPE_MOBILE_DUN should not be present in all of the combinations.
+ // TYPE_WIFI should not be affected.
+ for (TetheringConfiguration cfg : Arrays.asList(cfgWifi, cfgMobileWifiHipri, cfgWifiDun,
+ cfgWifiMobile, cfgWifiHipri, cfgMobileWifiHipriDun)) {
+ msg = "config=" + cfg.toString();
+ assertFalse(msg, cfg.isDunRequired);
+ assertFalse(msg, cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN));
+ assertTrue(msg, cfg.preferredUpstreamIfaceTypes.contains(TYPE_WIFI));
+ }
- final TetheringConfiguration cfg = new TetheringConfiguration(
- mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
- assertTrue(cfg.isDunRequired);
- assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN));
- // Just to prove we haven't clobbered Wi-Fi:
- 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));
+ for (TetheringConfiguration cfg : Arrays.asList(cfgWifi, cfgMobileWifiHipri, cfgWifiDun,
+ cfgMobileWifiHipriDun)) {
+ msg = "config=" + cfg.toString();
+ assertTrue(msg, cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE));
+ assertTrue(msg, cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI));
+ }
+ msg = "config=" + cfgWifiMobile.toString();
+ assertTrue(msg, cfgWifiMobile.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE));
+ assertFalse(msg, cfgWifiMobile.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI));
+ msg = "config=" + cfgWifiHipri.toString();
+ assertFalse(msg, cfgWifiHipri.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE));
+ assertTrue(msg, cfgWifiHipri.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI));
+
}
@Test
public void testNoDefinedUpstreamTypesAddsEthernet() {
- when(mResources.getIntArray(com.android.internal.R.array.config_tether_upstream_types))
- .thenReturn(new int[]{});
- mHasTelephonyManager = false;
- when(mTelephonyManager.getTetherApnRequired()).thenReturn(DUN_UNSPECIFIED);
+ when(mResources.getIntArray(config_tether_upstream_types)).thenReturn(new int[]{});
+ when(mTelephonyManager.getTetherApnRequired()).thenReturn(false);
final TetheringConfiguration cfg = new TetheringConfiguration(
mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
@@ -187,8 +215,10 @@
assertTrue(upstreamIterator.hasNext());
assertEquals(TYPE_ETHERNET, upstreamIterator.next().intValue());
// The following is because the code always adds some kind of mobile
- // upstream, be it DUN or, in this case where we use DUN_UNSPECIFIED,
- // both vanilla and hipri mobile types.
+ // upstream, be it DUN or, in this case where DUN is NOT required,
+ // make sure there is at least one of MOBILE or HIPRI. With the empty
+ // list of the configuration in this test, it will always add both
+ // MOBILE and HIPRI, in that order.
assertTrue(upstreamIterator.hasNext());
assertEquals(TYPE_MOBILE, upstreamIterator.next().intValue());
assertTrue(upstreamIterator.hasNext());
@@ -198,10 +228,9 @@
@Test
public void testDefinedUpstreamTypesSansEthernetAddsEthernet() {
- when(mResources.getIntArray(com.android.internal.R.array.config_tether_upstream_types))
- .thenReturn(new int[]{TYPE_WIFI, TYPE_MOBILE_HIPRI});
- mHasTelephonyManager = false;
- when(mTelephonyManager.getTetherApnRequired()).thenReturn(DUN_UNSPECIFIED);
+ when(mResources.getIntArray(config_tether_upstream_types)).thenReturn(
+ new int[]{TYPE_WIFI, TYPE_MOBILE_HIPRI});
+ when(mTelephonyManager.getTetherApnRequired()).thenReturn(false);
final TetheringConfiguration cfg = new TetheringConfiguration(
mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
@@ -217,10 +246,9 @@
@Test
public void testDefinedUpstreamTypesWithEthernetDoesNotAddEthernet() {
- when(mResources.getIntArray(com.android.internal.R.array.config_tether_upstream_types))
+ when(mResources.getIntArray(config_tether_upstream_types))
.thenReturn(new int[]{TYPE_WIFI, TYPE_ETHERNET, TYPE_MOBILE_HIPRI});
- mHasTelephonyManager = false;
- when(mTelephonyManager.getTetherApnRequired()).thenReturn(DUN_UNSPECIFIED);
+ when(mTelephonyManager.getTetherApnRequired()).thenReturn(false);
final TetheringConfiguration cfg = new TetheringConfiguration(
mMockContext, mLog, INVALID_SUBSCRIPTION_ID);
@@ -276,9 +304,7 @@
when(mResourcesForSubId.getStringArray(
com.android.internal.R.array.config_tether_bluetooth_regexs))
.thenReturn(new String[0]);
- when(mResourcesForSubId.getIntArray(
- com.android.internal.R.array.config_tether_upstream_types))
- .thenReturn(new int[0]);
+ when(mResourcesForSubId.getIntArray(config_tether_upstream_types)).thenReturn(new int[0]);
when(mResourcesForSubId.getStringArray(
com.android.internal.R.array.config_mobile_hotspot_provision_app))
.thenReturn(PROVISIONING_APP_NAME);