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
// TODO: Find an lighter weight approach.
private class LoggingCallbackWrapper extends Callback {
private static final String PREFIX = "INVOKE ";
- private Callback mCallback;
+ private final Callback mCallback;
public LoggingCallbackWrapper(Callback callback) {
- mCallback = callback;
+ mCallback = (callback != null) ? callback : new Callback();
}
private void log(String msg) {
stopAllIP();
resetLinkProperties();
+ mCallback.onLinkPropertiesChange(new LinkProperties(mLinkProperties));
if (mStartTimeMillis > 0) {
recordMetric(IpManagerEvent.COMPLETE_LIFECYCLE);
mStartTimeMillis = 0;
/**
* Tests for IpManager.
+ *
+ * TODO: Rename to IpClientTest.
*/
@RunWith(AndroidJUnit4.class)
@SmallTest
verify(mNMService, times(1)).registerObserver(arg.capture());
mObserver = arg.getValue();
reset(mNMService);
+ final LinkProperties emptyLp = new LinkProperties();
+ emptyLp.setInterfaceName(ifname);
+ verify(mCb, timeout(100)).onLinkPropertiesChange(eq(emptyLp));
+ reset(mCb);
return ipm;
}