switch (msg.what) {
default:
return false;
- case android.net.NetworkFactory.EVENT_UNFULFILLABLE_REQUEST: {
+ case NetworkFactory.EVENT_UNFULFILLABLE_REQUEST: {
handleReleaseNetworkRequest((NetworkRequest) msg.obj, msg.sendingUid,
/* callOnUnavailable */ true);
break;
/**
* @return VPN information for accounting, or null if we can't retrieve all required
- * information, e.g underlying ifaces.
+ * information, e.g primary underlying iface.
*/
@Nullable
private VpnInfo createVpnInfo(Vpn vpn) {
// see VpnService.setUnderlyingNetworks()'s javadoc about how to interpret
// the underlyingNetworks list.
if (underlyingNetworks == null) {
- NetworkAgentInfo defaultNai = getDefaultNetwork();
- if (defaultNai != null && defaultNai.linkProperties != null) {
- underlyingNetworks = new Network[] { defaultNai.network };
+ NetworkAgentInfo defaultNetwork = getDefaultNetwork();
+ if (defaultNetwork != null && defaultNetwork.linkProperties != null) {
+ info.primaryUnderlyingIface = getDefaultNetwork().linkProperties.getInterfaceName();
}
- }
- if (underlyingNetworks != null && underlyingNetworks.length > 0) {
- List<String> interfaces = new ArrayList<>();
- for (Network network : underlyingNetworks) {
- LinkProperties lp = getLinkProperties(network);
- if (lp != null) {
- interfaces.add(lp.getInterfaceName());
- }
- }
- if (!interfaces.isEmpty()) {
- info.underlyingIfaces = interfaces.toArray(new String[interfaces.size()]);
+ } else if (underlyingNetworks.length > 0) {
+ LinkProperties linkProperties = getLinkProperties(underlyingNetworks[0]);
+ if (linkProperties != null) {
+ info.primaryUnderlyingIface = linkProperties.getInterfaceName();
}
}
- return info.underlyingIfaces == null ? null : info;
+ return info.primaryUnderlyingIface == null ? null : info;
}
/**