Wait for connect before dropping permissions

WifiManager#connect is implemented with a oneway binder call, so it may
return before the permission check. The previous code could drop shell
permissions before the check is performed.

Use WifiManager.ActionListener to wait for the operation to end before
dropping permissions.

Also refactor current usages of various "run as shell" utilities to use
TestPermissionUtil.runAsShell, which is the "standard" utility used in
connectivity tests (both in CTS and in other tests).

Bug: 170371191
Test: atest CtsNetTestCasesLatestSdk:CaptivePortalTest
Change-Id: I0f47c455f2c1596a887abab7d35146d8557d736a
1 file changed
tree: dd06fba40793967ab1393fbe4bb98f1767d4f006
  1. tests/