Fix CtsTetheringTest on devices without permanent softAp interfaces.

Normally stop wifi tethering flow would be:
Tethering#stopTethering -> WifiManager#stopSoftAp -> softAp disabled,
then have WIIF_AP_STATE_CHANGED intent -> stop IpServer and broadcast
TETHER_STATE_CHANGED intent. SoftAp is disabled before tethering stop.

Because tethering would shutdown the corresponding IpServer if it
observed the interface is removed. For those devices that softAp
interface would be removed when stop tethering, the flow may be
Tethering#stopTethering -> WifiManager#stopSoftAp -> softAp disabing,
softAp interface is removed -> tethering trigger stop IpServer and
broadcast TETHER_STATE_CHANGED intent -> -> softAp disabled, then wifi
broadcast WIIF_AP_STATE_CHANGED intent. In this case, tethering is
stopped ready before softap is disabled.
For this case, CtsTeteringTest would have race between two test cases.
If two case need to start wifi tethering for testing and stop wifi
tethering after finish testing.
The second test may suffer from startTethering fail problem due to
softAP is not disabled yet.
    E WifiService: Tethering is already active.

Bug: 157806780
Test: atest CtsTetheringTest

Original-Change: https://android-review.googlesource.com/1331096
Merged-In: I0ba6bc9dcbf7829dcad5561c707d5f5c5540f10b
Change-Id: I0ba6bc9dcbf7829dcad5561c707d5f5c5540f10b
1 file changed
tree: 19c348654dbfd34dc53673a944af51f2954b2bcd
  1. tests/