Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06e89d6c authored by Aaron Huang's avatar Aaron Huang Committed by Automerger Merge Worker
Browse files

Merge "Rename *Iface* APIs to *Interface*" am: f2810586 am: 27d2960c

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1693585

Change-Id: I9aa62677f52ac78916c518d1378a05bda143f676
parents 8d8a727c 27d2960c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -89,9 +89,9 @@ package android.net {
  public final class UnderlyingNetworkInfo implements android.os.Parcelable {
    ctor public UnderlyingNetworkInfo(int, @NonNull String, @NonNull java.util.List<java.lang.String>);
    method public int describeContents();
    method @NonNull public String getIface();
    method @NonNull public String getInterface();
    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);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.UnderlyingNetworkInfo> CREATOR;
  }
+4 −4
Original line number Diff line number Diff line
@@ -71,13 +71,13 @@ public final class UnderlyingNetworkInfo implements Parcelable {

    /** Get the interface name of this network. */
    @NonNull
    public String getIface() {
    public String getInterface() {
        return mIface;
    }

    /** Get the names of the interfaces underlying this network. */
    @NonNull
    public List<String> getUnderlyingIfaces() {
    public List<String> getUnderlyingInterfaces() {
        return mUnderlyingIfaces;
    }

@@ -124,8 +124,8 @@ public final class UnderlyingNetworkInfo implements Parcelable {
        if (!(o instanceof UnderlyingNetworkInfo)) return false;
        final UnderlyingNetworkInfo that = (UnderlyingNetworkInfo) o;
        return mOwnerUid == that.getOwnerUid()
                && Objects.equals(mIface, that.getIface())
                && Objects.equals(mUnderlyingIfaces, that.getUnderlyingIfaces());
                && Objects.equals(mIface, that.getInterface())
                && Objects.equals(mUnderlyingIfaces, that.getUnderlyingInterfaces());
    }

    @Override
+6 −6
Original line number Diff line number Diff line
@@ -36,15 +36,15 @@ class UnderlyingNetworkInfoTest {
    @Test
    fun testParcelUnparcel() {
        val testInfo = UnderlyingNetworkInfo(TEST_OWNER_UID, TEST_IFACE, TEST_IFACE_LIST)
        assertEquals(TEST_OWNER_UID, testInfo.ownerUid)
        assertEquals(TEST_IFACE, testInfo.iface)
        assertEquals(TEST_IFACE_LIST, testInfo.underlyingIfaces)
        assertEquals(TEST_OWNER_UID, testInfo.getOwnerUid())
        assertEquals(TEST_IFACE, testInfo.getInterface())
        assertEquals(TEST_IFACE_LIST, testInfo.getUnderlyingInterfaces())
        assertParcelSane(testInfo, 3)

        val emptyInfo = UnderlyingNetworkInfo(0, String(), listOf())
        assertEquals(0, emptyInfo.ownerUid)
        assertEquals(String(), emptyInfo.iface)
        assertEquals(listOf(), emptyInfo.underlyingIfaces)
        assertEquals(0, emptyInfo.getOwnerUid())
        assertEquals(String(), emptyInfo.getInterface())
        assertEquals(listOf(), emptyInfo.getUnderlyingInterfaces())
        assertParcelSane(emptyInfo, 3)
    }
}
 No newline at end of file
+6 −6
Original line number Diff line number Diff line
@@ -5835,9 +5835,9 @@ public class ConnectivityServiceTest {
            assertEquals("Should have exactly one VPN:", 1, infos.length);
            UnderlyingNetworkInfo info = infos[0];
            assertEquals("Unexpected VPN owner:", (int) vpnUid, info.getOwnerUid());
            assertEquals("Unexpected VPN interface:", vpnIfname, info.getIface());
            assertEquals("Unexpected VPN interface:", vpnIfname, info.getInterface());
            assertSameElementsNoDuplicates(underlyingIfaces,
                    info.getUnderlyingIfaces().toArray(new String[0]));
                    info.getUnderlyingInterfaces().toArray(new String[0]));
        } else {
            assertEquals(0, infos.length);
            return;
@@ -5981,8 +5981,8 @@ public class ConnectivityServiceTest {
        // network for the VPN...
        verify(mStatsManager, never()).notifyNetworkStatus(any(List.class),
                any(List.class), any() /* anyString() doesn't match null */,
                argThat(infos -> infos.get(0).getUnderlyingIfaces().size() == 1
                        && WIFI_IFNAME.equals(infos.get(0).getUnderlyingIfaces().get(0))));
                argThat(infos -> infos.get(0).getUnderlyingInterfaces().size() == 1
                        && WIFI_IFNAME.equals(infos.get(0).getUnderlyingInterfaces().get(0))));
        verifyNoMoreInteractions(mStatsManager);
        reset(mStatsManager);
@@ -5995,8 +5995,8 @@ public class ConnectivityServiceTest {
        waitForIdle();
        verify(mStatsManager).notifyNetworkStatus(any(List.class),
                any(List.class), any() /* anyString() doesn't match null */,
                argThat(vpnInfos -> vpnInfos.get(0).getUnderlyingIfaces().size() == 1
                        && WIFI_IFNAME.equals(vpnInfos.get(0).getUnderlyingIfaces().get(0))));
                argThat(vpnInfos -> vpnInfos.get(0).getUnderlyingInterfaces().size() == 1
                        && WIFI_IFNAME.equals(vpnInfos.get(0).getUnderlyingInterfaces().get(0))));
        mEthernetNetworkAgent.disconnect();
        waitForIdle();
        reset(mStatsManager);
+2 −2
Original line number Diff line number Diff line
@@ -382,8 +382,8 @@ public class NetworkStatsFactory {

        // Migrate data usage over a VPN to the TUN network.
        for (UnderlyingNetworkInfo info : vpnArray) {
            delta.migrateTun(info.getOwnerUid(), info.getIface(),
                    info.getUnderlyingIfaces());
            delta.migrateTun(info.getOwnerUid(), info.getInterface(),
                    info.getUnderlyingInterfaces());
            // Filter out debug entries as that may lead to over counting.
            delta.filterDebugEntries();
        }