diff --git a/README.md b/README.md index 0be9e261..ccca8d5b 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ API light grey list: * (since API 24) [`Landroid/bluetooth/BluetoothPan;->isTetheringOn()Z`](https://android.googlesource.com/platform/prebuilts/runtime/+/94fec32/appcompat/hiddenapi-light-greylist.txt#1498) * (since API 24) [`Landroid/net/ConnectivityManager;->getLastTetherError(Ljava/lang/String;)I`](https://android.googlesource.com/platform/prebuilts/runtime/+/94fec32/appcompat/hiddenapi-light-greylist.txt#3783) -* (deprecated since API 26) [`Landroid/net/wifi/WifiManager;->setWifiApEnabled(Landroid/net/wifi/WifiConfiguration;Z)Z`](https://android.googlesource.com/platform/prebuilts/runtime/+/94fec32/appcompat/hiddenapi-dark-greylist.txt#4378) +* (deprecated since API 25) [`Landroid/net/wifi/WifiManager;->setWifiApEnabled(Landroid/net/wifi/WifiConfiguration;Z)Z`](https://android.googlesource.com/platform/prebuilts/runtime/+/94fec32/appcompat/hiddenapi-dark-greylist.txt#4378) * [`Landroid/net/wifi/p2p/WifiP2pGroup;->getNetworkId()I`](https://android.googlesource.com/platform/prebuilts/runtime/+/94fec32/appcompat/hiddenapi-light-greylist.txt#4399) * [`Landroid/net/wifi/p2p/WifiP2pGroupList;->getGroupList()Ljava/util/Collection;`](https://android.googlesource.com/platform/prebuilts/runtime/+/94fec32/appcompat/hiddenapi-light-greylist.txt#4405) * [`Landroid/net/wifi/p2p/WifiP2pManager;->deletePersistentGroup(Landroid/net/wifi/p2p/WifiP2pManager$Channel;ILandroid/net/wifi/p2p/WifiP2pManager$ActionListener;)V`](https://android.googlesource.com/platform/prebuilts/runtime/+/94fec32/appcompat/hiddenapi-light-greylist.txt#4411) diff --git a/mobile/src/main/AndroidManifest.xml b/mobile/src/main/AndroidManifest.xml index 33f225cc..c9c1c26e 100644 --- a/mobile/src/main/AndroidManifest.xml +++ b/mobile/src/main/AndroidManifest.xml @@ -130,7 +130,7 @@ diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetherManager.kt b/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetherManager.kt index ea46f0c4..9d60dcb9 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetherManager.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetherManager.kt @@ -170,7 +170,7 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(), } @Suppress("DEPRECATION") - @Deprecated("Not usable since API 26") + @Deprecated("Not usable since API 25") class WifiLegacy(parent: TetheringFragment) : TetherManager(parent) { override val title get() = parent.getString(R.string.tethering_manage_wifi_legacy) override val tetherType get() = TetherType.WIFI diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringFragment.kt b/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringFragment.kt index ec392310..a4319fe9 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringFragment.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringFragment.kt @@ -69,7 +69,7 @@ class TetheringFragment : Fragment(), ServiceConnection { list.addAll(tetherManagers) tetherManagers.forEach { it.updateErrorMessage(erroredIfaces) } } - if (Build.VERSION.SDK_INT < 26) { + if (Build.VERSION.SDK_INT < 25) { list.add(wifiManagerLegacy) wifiManagerLegacy.onTetheringStarted() } diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringTileService.kt b/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringTileService.kt index 58cf7153..724cbbf0 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringTileService.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringTileService.kt @@ -176,7 +176,7 @@ sealed class TetheringTileService : TetherListeningTileService(), TetheringManag } @Suppress("DEPRECATION") - @Deprecated("Not usable since API 26") + @Deprecated("Not usable since API 25") class WifiLegacy : TetheringTileService() { override val labelString get() = R.string.tethering_manage_wifi_legacy override val tetherType get() = TetherType.WIFI diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApManager.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApManager.kt index 27e62a47..9b793fab 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApManager.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApManager.kt @@ -4,6 +4,11 @@ import android.net.wifi.WifiConfiguration import android.net.wifi.WifiManager import be.mygod.vpnhotspot.App.Companion.app +/** + * Although the functionalities were removed in API 26, it is already not functioning correctly on API 25. + * + * See also: https://android.googlesource.com/platform/frameworks/base/+/5c0b10a4a9eecc5307bb89a271221f2b20448797%5E%21/ + */ object WifiApManager { private val setWifiApEnabled = WifiManager::class.java.getDeclaredMethod("setWifiApEnabled", WifiConfiguration::class.java, Boolean::class.java) @@ -20,12 +25,12 @@ object WifiApManager { private fun WifiManager.setWifiApEnabled(wifiConfig: WifiConfiguration?, enabled: Boolean) = setWifiApEnabled.invoke(this, wifiConfig, enabled) as Boolean - @Deprecated("No longer usable since API 26.") + @Deprecated("No longer usable since API 25.") fun start(wifiConfig: WifiConfiguration? = null) { app.wifi.isWifiEnabled = false app.wifi.setWifiApEnabled(wifiConfig, true) } - @Deprecated("No longer usable since API 26.") + @Deprecated("No longer usable since API 25.") fun stop() { app.wifi.setWifiApEnabled(null, false) app.wifi.isWifiEnabled = true diff --git a/mobile/src/main/res/values-v25/bools.xml b/mobile/src/main/res/values-v25/bools.xml new file mode 100644 index 00000000..34904e41 --- /dev/null +++ b/mobile/src/main/res/values-v25/bools.xml @@ -0,0 +1,4 @@ + + + false + diff --git a/mobile/src/main/res/values-v26/bools.xml b/mobile/src/main/res/values-v26/bools.xml index 45a5d4b5..e3b6da48 100644 --- a/mobile/src/main/res/values-v26/bools.xml +++ b/mobile/src/main/res/values-v26/bools.xml @@ -1,5 +1,4 @@ true - false diff --git a/mobile/src/main/res/values/bools.xml b/mobile/src/main/res/values/bools.xml index b61cf4cf..86a4cdf3 100644 --- a/mobile/src/main/res/values/bools.xml +++ b/mobile/src/main/res/values/bools.xml @@ -1,5 +1,5 @@ false - true + true