Rename *Iface* APIs to *Interface*
Address API review feedback, other APIs have been refering to these as "interface" instead of "iface" so migrate the APIs named *Iface* to *Interface*. Bug: 183972554 Test: atest android.net.UnderlyingNetworkInfoTest Change-Id: I38b476e762fb57fa88c4a789092d0af6f5330d80
This commit is contained in:
@@ -223,9 +223,9 @@ package android.net {
|
|||||||
public final class UnderlyingNetworkInfo implements android.os.Parcelable {
|
public final class UnderlyingNetworkInfo implements android.os.Parcelable {
|
||||||
ctor public UnderlyingNetworkInfo(int, @NonNull String, @NonNull java.util.List<java.lang.String>);
|
ctor public UnderlyingNetworkInfo(int, @NonNull String, @NonNull java.util.List<java.lang.String>);
|
||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
method @NonNull public String getIface();
|
method @NonNull public String getInterface();
|
||||||
method public int getOwnerUid();
|
method public int getOwnerUid();
|
||||||
method @NonNull public java.util.List<java.lang.String> getUnderlyingIfaces();
|
method @NonNull public java.util.List<java.lang.String> getUnderlyingInterfaces();
|
||||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||||
field @NonNull public static final android.os.Parcelable.Creator<android.net.UnderlyingNetworkInfo> CREATOR;
|
field @NonNull public static final android.os.Parcelable.Creator<android.net.UnderlyingNetworkInfo> CREATOR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,13 +71,13 @@ public final class UnderlyingNetworkInfo implements Parcelable {
|
|||||||
|
|
||||||
/** Get the interface name of this network. */
|
/** Get the interface name of this network. */
|
||||||
@NonNull
|
@NonNull
|
||||||
public String getIface() {
|
public String getInterface() {
|
||||||
return mIface;
|
return mIface;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the names of the interfaces underlying this network. */
|
/** Get the names of the interfaces underlying this network. */
|
||||||
@NonNull
|
@NonNull
|
||||||
public List<String> getUnderlyingIfaces() {
|
public List<String> getUnderlyingInterfaces() {
|
||||||
return mUnderlyingIfaces;
|
return mUnderlyingIfaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,8 +124,8 @@ public final class UnderlyingNetworkInfo implements Parcelable {
|
|||||||
if (!(o instanceof UnderlyingNetworkInfo)) return false;
|
if (!(o instanceof UnderlyingNetworkInfo)) return false;
|
||||||
final UnderlyingNetworkInfo that = (UnderlyingNetworkInfo) o;
|
final UnderlyingNetworkInfo that = (UnderlyingNetworkInfo) o;
|
||||||
return mOwnerUid == that.getOwnerUid()
|
return mOwnerUid == that.getOwnerUid()
|
||||||
&& Objects.equals(mIface, that.getIface())
|
&& Objects.equals(mIface, that.getInterface())
|
||||||
&& Objects.equals(mUnderlyingIfaces, that.getUnderlyingIfaces());
|
&& Objects.equals(mUnderlyingIfaces, that.getUnderlyingInterfaces());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -382,8 +382,8 @@ public class NetworkStatsFactory {
|
|||||||
|
|
||||||
// Migrate data usage over a VPN to the TUN network.
|
// Migrate data usage over a VPN to the TUN network.
|
||||||
for (UnderlyingNetworkInfo info : vpnArray) {
|
for (UnderlyingNetworkInfo info : vpnArray) {
|
||||||
delta.migrateTun(info.getOwnerUid(), info.getIface(),
|
delta.migrateTun(info.getOwnerUid(), info.getInterface(),
|
||||||
info.getUnderlyingIfaces());
|
info.getUnderlyingInterfaces());
|
||||||
// Filter out debug entries as that may lead to over counting.
|
// Filter out debug entries as that may lead to over counting.
|
||||||
delta.filterDebugEntries();
|
delta.filterDebugEntries();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,15 +36,15 @@ class UnderlyingNetworkInfoTest {
|
|||||||
@Test
|
@Test
|
||||||
fun testParcelUnparcel() {
|
fun testParcelUnparcel() {
|
||||||
val testInfo = UnderlyingNetworkInfo(TEST_OWNER_UID, TEST_IFACE, TEST_IFACE_LIST)
|
val testInfo = UnderlyingNetworkInfo(TEST_OWNER_UID, TEST_IFACE, TEST_IFACE_LIST)
|
||||||
assertEquals(TEST_OWNER_UID, testInfo.ownerUid)
|
assertEquals(TEST_OWNER_UID, testInfo.getOwnerUid())
|
||||||
assertEquals(TEST_IFACE, testInfo.iface)
|
assertEquals(TEST_IFACE, testInfo.getInterface())
|
||||||
assertEquals(TEST_IFACE_LIST, testInfo.underlyingIfaces)
|
assertEquals(TEST_IFACE_LIST, testInfo.getUnderlyingInterfaces())
|
||||||
assertParcelSane(testInfo, 3)
|
assertParcelSane(testInfo, 3)
|
||||||
|
|
||||||
val emptyInfo = UnderlyingNetworkInfo(0, String(), listOf())
|
val emptyInfo = UnderlyingNetworkInfo(0, String(), listOf())
|
||||||
assertEquals(0, emptyInfo.ownerUid)
|
assertEquals(0, emptyInfo.getOwnerUid())
|
||||||
assertEquals(String(), emptyInfo.iface)
|
assertEquals(String(), emptyInfo.getInterface())
|
||||||
assertEquals(listOf(), emptyInfo.underlyingIfaces)
|
assertEquals(listOf(), emptyInfo.getUnderlyingInterfaces())
|
||||||
assertParcelSane(emptyInfo, 3)
|
assertParcelSane(emptyInfo, 3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5898,9 +5898,9 @@ public class ConnectivityServiceTest {
|
|||||||
assertEquals("Should have exactly one VPN:", 1, infos.length);
|
assertEquals("Should have exactly one VPN:", 1, infos.length);
|
||||||
UnderlyingNetworkInfo info = infos[0];
|
UnderlyingNetworkInfo info = infos[0];
|
||||||
assertEquals("Unexpected VPN owner:", (int) vpnUid, info.getOwnerUid());
|
assertEquals("Unexpected VPN owner:", (int) vpnUid, info.getOwnerUid());
|
||||||
assertEquals("Unexpected VPN interface:", vpnIfname, info.getIface());
|
assertEquals("Unexpected VPN interface:", vpnIfname, info.getInterface());
|
||||||
assertSameElementsNoDuplicates(underlyingIfaces,
|
assertSameElementsNoDuplicates(underlyingIfaces,
|
||||||
info.getUnderlyingIfaces().toArray(new String[0]));
|
info.getUnderlyingInterfaces().toArray(new String[0]));
|
||||||
} else {
|
} else {
|
||||||
assertEquals(0, infos.length);
|
assertEquals(0, infos.length);
|
||||||
return;
|
return;
|
||||||
@@ -6044,8 +6044,8 @@ public class ConnectivityServiceTest {
|
|||||||
// network for the VPN...
|
// network for the VPN...
|
||||||
verify(mStatsManager, never()).notifyNetworkStatus(any(List.class),
|
verify(mStatsManager, never()).notifyNetworkStatus(any(List.class),
|
||||||
any(List.class), any() /* anyString() doesn't match null */,
|
any(List.class), any() /* anyString() doesn't match null */,
|
||||||
argThat(infos -> infos.get(0).getUnderlyingIfaces().size() == 1
|
argThat(infos -> infos.get(0).getUnderlyingInterfaces().size() == 1
|
||||||
&& WIFI_IFNAME.equals(infos.get(0).getUnderlyingIfaces().get(0))));
|
&& WIFI_IFNAME.equals(infos.get(0).getUnderlyingInterfaces().get(0))));
|
||||||
verifyNoMoreInteractions(mStatsManager);
|
verifyNoMoreInteractions(mStatsManager);
|
||||||
reset(mStatsManager);
|
reset(mStatsManager);
|
||||||
|
|
||||||
@@ -6059,8 +6059,8 @@ public class ConnectivityServiceTest {
|
|||||||
waitForIdle();
|
waitForIdle();
|
||||||
verify(mStatsManager).notifyNetworkStatus(any(List.class),
|
verify(mStatsManager).notifyNetworkStatus(any(List.class),
|
||||||
any(List.class), any() /* anyString() doesn't match null */,
|
any(List.class), any() /* anyString() doesn't match null */,
|
||||||
argThat(vpnInfos -> vpnInfos.get(0).getUnderlyingIfaces().size() == 1
|
argThat(vpnInfos -> vpnInfos.get(0).getUnderlyingInterfaces().size() == 1
|
||||||
&& WIFI_IFNAME.equals(vpnInfos.get(0).getUnderlyingIfaces().get(0))));
|
&& WIFI_IFNAME.equals(vpnInfos.get(0).getUnderlyingInterfaces().get(0))));
|
||||||
mEthernetNetworkAgent.disconnect();
|
mEthernetNetworkAgent.disconnect();
|
||||||
waitForIdle();
|
waitForIdle();
|
||||||
reset(mStatsManager);
|
reset(mStatsManager);
|
||||||
|
|||||||
Reference in New Issue
Block a user