Loading
Fix testLegacyLockdownVpn flaky
When WiFi disconnects, the VPN disconnects immediately. The broadcast can therefore be sent before the broadcast receiver is registered, which causes the receiver to not see the broadcast. The puzzling part is that CONNECTIVITY_ACTION is a sticky broadcast, so one would expect the broadcast to still be received, even if the registration is done after the broadcast is sent. The reason this doesn't happen is that the context used by the test is a BroadcastInterceptingContext, which does not treat sticky broadcasts as sticky. Bug: 184115648 Test: atest --iterations 1000 'ConnectivityServiceTest#testLegacyLockdownVpn' Change-Id: Ib44c92839d25951cc7d2db0f923e1b104690e1e0