Simplify the return condition in stop()

Previously, the return condition in stop() will check if the state
is STOPPING and the reason is ERROR_INVALID_NETWORK. The condition
is too restricted so that if another event is happened after binder
died, the exception will be thrown and crash the system.
Since calling stop() twice doesn't make sense, so relax the condition
of return when the state is STOPPING.

Bug: 182586681
Test: atest FrameworksNetTests
Change-Id: I2454c1c080d8954dd3785d4ac6e96fc4131fdb47
This commit is contained in:
lucaslin
2021-07-01 02:29:53 +08:00
parent 4bb141787b
commit 40d931c474
2 changed files with 6 additions and 6 deletions

View File

@@ -5450,6 +5450,8 @@ public class ConnectivityServiceTest {
// the follow-up network disconnection will be processed first.
mWiFiNetworkAgent.setKeepaliveResponseDelay(3 * TIMEOUT_MS);
ka.stop();
// Call stop() twice shouldn't result in crash, b/182586681.
ka.stop();
// Make sure the stop has been processed. Wait for executor idle is needed to prevent
// flaky since the actual stop call to the service is delegated to executor thread.