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

Commit 96dc88eb authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN Committed by Gerrit Code Review
Browse files

Merge "Remove aidl wrappers for framework parcelables"

parents 858e653c 15eaa7ac
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@ package android.net.ip;

import static android.net.RouteInfo.RTN_UNICAST;
import static android.net.shared.IpConfigurationParcelableUtil.toStableParcelable;
import static android.net.shared.LinkPropertiesParcelableUtil.fromStableParcelable;
import static android.net.shared.LinkPropertiesParcelableUtil.toStableParcelable;

import static com.android.server.util.PermissionUtil.checkNetworkStackCallingPermission;

@@ -33,7 +31,6 @@ import android.net.LinkAddress;
import android.net.LinkProperties;
import android.net.ProvisioningConfigurationParcelable;
import android.net.ProxyInfo;
import android.net.ProxyInfoParcelable;
import android.net.RouteInfo;
import android.net.TcpKeepalivePacketDataParcelable;
import android.net.apf.ApfCapabilities;
@@ -201,7 +198,7 @@ public class IpClient extends StateMachine {
        public void onProvisioningSuccess(LinkProperties newLp) {
            log("onProvisioningSuccess({" + newLp + "})");
            try {
                mCallback.onProvisioningSuccess(toStableParcelable(newLp));
                mCallback.onProvisioningSuccess(newLp);
            } catch (RemoteException e) {
                log("Failed to call onProvisioningSuccess", e);
            }
@@ -210,7 +207,7 @@ public class IpClient extends StateMachine {
        public void onProvisioningFailure(LinkProperties newLp) {
            log("onProvisioningFailure({" + newLp + "})");
            try {
                mCallback.onProvisioningFailure(toStableParcelable(newLp));
                mCallback.onProvisioningFailure(newLp);
            } catch (RemoteException e) {
                log("Failed to call onProvisioningFailure", e);
            }
@@ -219,7 +216,7 @@ public class IpClient extends StateMachine {
        public void onLinkPropertiesChange(LinkProperties newLp) {
            log("onLinkPropertiesChange({" + newLp + "})");
            try {
                mCallback.onLinkPropertiesChange(toStableParcelable(newLp));
                mCallback.onLinkPropertiesChange(newLp);
            } catch (RemoteException e) {
                log("Failed to call onLinkPropertiesChange", e);
            }
@@ -525,9 +522,9 @@ public class IpClient extends StateMachine {
            IpClient.this.setTcpBufferSizes(tcpBufferSizes);
        }
        @Override
        public void setHttpProxy(ProxyInfoParcelable proxyInfo) {
        public void setHttpProxy(ProxyInfo proxyInfo) {
            checkNetworkStackCallingPermission();
            IpClient.this.setHttpProxy(fromStableParcelable(proxyInfo));
            IpClient.this.setHttpProxy(proxyInfo);
        }
        @Override
        public void setMulticastFilter(boolean enabled) {
+3 −9
Original line number Diff line number Diff line
@@ -16,13 +16,10 @@

package android.net.ip;

import static android.net.shared.LinkPropertiesParcelableUtil.fromStableParcelable;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.anyString;
import static org.mockito.Mockito.eq;
@@ -207,8 +204,7 @@ public class IpClientTest {
        verify(mNetd, timeout(TEST_TIMEOUT_MS).times(1)).interfaceSetEnableIPv6(iface, false);
        verify(mNetd, timeout(TEST_TIMEOUT_MS).times(1)).interfaceClearAddrs(iface);
        verify(mCb, timeout(TEST_TIMEOUT_MS).times(1))
                .onLinkPropertiesChange(argThat(
                        lp -> fromStableParcelable(lp).equals(makeEmptyLinkProperties(iface))));
                .onLinkPropertiesChange(makeEmptyLinkProperties(iface));
    }

    @Test
@@ -253,15 +249,13 @@ public class IpClientTest {
        mObserver.onInterfaceAddressUpdated(new LinkAddress(addresses[lastAddr]), iface);
        LinkProperties want = linkproperties(links(addresses), routes(prefixes));
        want.setInterfaceName(iface);
        verify(mCb, timeout(TEST_TIMEOUT_MS).times(1)).onProvisioningSuccess(argThat(
                lp -> fromStableParcelable(lp).equals(want)));
        verify(mCb, timeout(TEST_TIMEOUT_MS).times(1)).onProvisioningSuccess(want);

        ipc.shutdown();
        verify(mNetd, timeout(TEST_TIMEOUT_MS).times(1)).interfaceSetEnableIPv6(iface, false);
        verify(mNetd, timeout(TEST_TIMEOUT_MS).times(1)).interfaceClearAddrs(iface);
        verify(mCb, timeout(TEST_TIMEOUT_MS).times(1))
                .onLinkPropertiesChange(argThat(
                        lp -> fromStableParcelable(lp).equals(makeEmptyLinkProperties(iface))));
                .onLinkPropertiesChange(makeEmptyLinkProperties(iface));
    }

    @Test