Integrate SoftApManager to WifiStateMachine

Refactor WifiStateMachine to use SoftApManager for managing soft AP
instance.  This consolidate all soft AP related states in WifiStateMachine
to a single SoftApState.

While there, fix number of existing issues in WifiController:
- fix a possible race condition in WifiController where it will
  transition to a new state before AP is completely stopped.  Currently it is
  being worked around in WifiStateMachine by having the soft AP states defer
  the commands that might be issued during this race window.  This doesn't
  really scale and not really clear to the reader.  Fix it by only transition
  out of ApEnabledState when AP is completely stopped.
- fix a bug in WifiController where it doesn't transition out of
  ApEnabledState when AP is stopped internally (either tether notification
  timed out or WiFi becomes untethered), results in WifiController and
  WifiStateMachine being out of sync.
- fix couple unintentional fall through case statements.

Bug: 26876260
TEST=run frameworks-wifi test
TEST=run autotests

Change-Id: I1d12690b51265dacd087f22f601b7b0ea0a1082e
3 files changed
tree: f38ca1386273f5c91350c490ac07d30d3fc3c6ca
  1. service/
  2. tests/