ClientModeManager: delay resetting role until ClientModeImpl has stopped

Only reset mRole once the CMM and all associated
ClientModeImpls have been stopped. This is necessary
because ClientModeImpl sends broadcasts during stop,
and the role must remain primary for
ClientModeManagerBroadcastQueue to send them out.

Ideally, ClientModeImpl.stop() should be synchronous,
so that when it returns, ClientModeManager can be
sure that all cleanup has been completed.
Unfortunately, stop() internally uses quitNow(),
which posts to the StateMachine Handler asynchronously.

Removed a test case in ConcreteClientModeManagerTest
as it is illegal to stop a ClientModeManager
twice.

Bug: 177578395
Test: atest FrameworksWifiTests
Test: WifiCrashTest.test_wifi_cond_crash_reconnect
Change-Id: I5dde6cd2e511f7ef3adf87a096eff73199bcc886
3 files changed