Properly disable WiFi tethering

When Tethering.stopTethering(<wifi>) is called, we set
mWifiTetheringRequested to false and request the AP be torn down.
Previously, we would discard WIFI_AP_STATE_CHANGED_ACTION Intents,
because mWifiTetheringRequested was set to false.  This would in
turn cause us to leave tethering enabled, because we only tear down
tethering upon noticing that the interface is going down
(as signalled by WifiManager via this Intent).

In the past, this was covered up because we would tear down tethering
when the interface was taken down.  Now that we rely on SoftApManager
to notify us of AP state, we need to pay very close attention to what
is being said about the state.

Bug: 30124308
Test: Can toggle tethering on and off reliably on shamu, bullhead,
      angler with no SIM.

Change-Id: If46a8ee11cf4c07c5cc336523f5e5f00273500ec
(cherry picked from commit e52b24a0c52c6e29ea99760c920724f4143ac605)
1 file changed