Support ap error codes on Android 6-8.1

This commit is contained in:
Mygod
2021-06-11 02:35:11 -04:00
parent bb80359efb
commit 2bde3330b6
3 changed files with 25 additions and 15 deletions

View File

@@ -73,8 +73,7 @@ class LocalOnlyHotspotService : IpNeighbourMonitoringService(), CoroutineScope {
}
// based on: https://android.googlesource.com/platform/packages/services/Car/+/df5cd06/service/src/com/android/car/CarProjectionService.java#160
val sticky = registerReceiver(null, IntentFilter(WifiApManager.WIFI_AP_STATE_CHANGED_ACTION))!!
val apState = sticky.getIntExtra(WifiApManager.EXTRA_WIFI_AP_STATE,
WifiApManager.WIFI_AP_STATE_DISABLED)
val apState = sticky.getIntExtra(WifiApManager.EXTRA_WIFI_AP_STATE, 0)
val iface = sticky.getStringExtra(WifiApManager.EXTRA_WIFI_AP_INTERFACE_NAME)
if (apState != WifiApManager.WIFI_AP_STATE_ENABLED || iface.isNullOrEmpty()) {
if (apState == WifiApManager.WIFI_AP_STATE_FAILED) {