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

Commit b3f9f4a3 authored by Erik Kline's avatar Erik Kline
Browse files

Send empty LinkProperties when entering StoppedState.

Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
    - changing from DHCPv4 to static while continuously pinging the
      default gateway works jsut fine
    - dumpsys log shows that during the change we send the empty LP:
  12-06 08:46:51.085 - CMD_ON_QUIT wlan0/23 0 0 null [rcvd_in=StoppingState, proc_in=StoppingState]
  12-06 08:46:51.092 - INVOKE onLinkPropertiesChange({{InterfaceName: wlan0 LinkAddresses: []  Routes: [] DnsAddresses: [] Domains: null MTU: 0}})

Bug: 69800563
Change-Id: I01047e9a72fce718a167c592bf14406c3bab3ba9
parent 86c99513
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -163,10 +163,10 @@ public class IpClient extends StateMachine {
    // TODO: Find an lighter weight approach.
    // TODO: Find an lighter weight approach.
    private class LoggingCallbackWrapper extends Callback {
    private class LoggingCallbackWrapper extends Callback {
        private static final String PREFIX = "INVOKE ";
        private static final String PREFIX = "INVOKE ";
        private Callback mCallback;
        private final Callback mCallback;


        public LoggingCallbackWrapper(Callback callback) {
        public LoggingCallbackWrapper(Callback callback) {
            mCallback = callback;
            mCallback = (callback != null) ? callback : new Callback();
        }
        }


        private void log(String msg) {
        private void log(String msg) {
@@ -1273,6 +1273,7 @@ public class IpClient extends StateMachine {
            stopAllIP();
            stopAllIP();


            resetLinkProperties();
            resetLinkProperties();
            mCallback.onLinkPropertiesChange(new LinkProperties(mLinkProperties));
            if (mStartTimeMillis > 0) {
            if (mStartTimeMillis > 0) {
                recordMetric(IpManagerEvent.COMPLETE_LIFECYCLE);
                recordMetric(IpManagerEvent.COMPLETE_LIFECYCLE);
                mStartTimeMillis = 0;
                mStartTimeMillis = 0;
+6 −0
Original line number Original line Diff line number Diff line
@@ -69,6 +69,8 @@ import java.util.Set;


/**
/**
 * Tests for IpManager.
 * Tests for IpManager.
 *
 * TODO: Rename to IpClientTest.
 */
 */
@RunWith(AndroidJUnit4.class)
@RunWith(AndroidJUnit4.class)
@SmallTest
@SmallTest
@@ -111,6 +113,10 @@ public class IpManagerTest {
        verify(mNMService, times(1)).registerObserver(arg.capture());
        verify(mNMService, times(1)).registerObserver(arg.capture());
        mObserver = arg.getValue();
        mObserver = arg.getValue();
        reset(mNMService);
        reset(mNMService);
        final LinkProperties emptyLp = new LinkProperties();
        emptyLp.setInterfaceName(ifname);
        verify(mCb, timeout(100)).onLinkPropertiesChange(eq(emptyLp));
        reset(mCb);
        return ipm;
        return ipm;
    }
    }