diff --git a/build.gradle b/build.gradle index 9dd59c5c..2e2166e5 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { ext { androidPluginVersion = '3.2.0-beta05' kotlinVersion = '1.2.60' - androidxVersion = '1.0.0-beta01' + androidxVersion = '1.0.0-rc01' } repositories { google() diff --git a/mobile/build.gradle b/mobile/build.gradle index a85854f5..ce741fda 100644 --- a/mobile/build.gradle +++ b/mobile/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' android { - buildToolsVersion "28.0.1" + buildToolsVersion "28.0.2" compileSdkVersion 28 defaultConfig { applicationId "be.mygod.vpnhotspot" diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/client/ClientMonitorService.kt b/mobile/src/main/java/be/mygod/vpnhotspot/client/ClientMonitorService.kt index 38a08ee5..e0065f80 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/client/ClientMonitorService.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/client/ClientMonitorService.kt @@ -21,8 +21,9 @@ class ClientMonitorService : Service(), ServiceConnection, IpNeighbourMonitor.Ca private var tetheredInterfaces = emptySet() private val receiver = broadcastReceiver { _, intent -> - tetheredInterfaces = TetheringManager.getTetheredIfaces(intent.extras).toSet() + - TetheringManager.getLocalOnlyTetheredIfaces(intent.extras) + val extras = intent.extras!! + tetheredInterfaces = TetheringManager.getTetheredIfaces(extras).toSet() + + TetheringManager.getLocalOnlyTetheredIfaces(extras) populateClients() } diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/manage/RepeaterManager.kt b/mobile/src/main/java/be/mygod/vpnhotspot/manage/RepeaterManager.kt index 8c2e8492..4559571f 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/manage/RepeaterManager.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/manage/RepeaterManager.kt @@ -92,7 +92,7 @@ class RepeaterManager(private val parent: TetheringFragment) : Manager(), Servic .setNegativeButton(android.R.string.cancel, null) .setNeutralButton(R.string.repeater_wps_dialog_pbc) { _, _ -> binder?.startWps(null) } .create() - dialog.window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE) + dialog.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE) dialog.show() } 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 7b4b6ccb..a4557e04 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetherManager.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetherManager.kt @@ -113,6 +113,7 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(), TetheringManager.TETHER_ERROR_ENABLE_NAT_ERROR -> "TETHER_ERROR_ENABLE_NAT_ERROR" TetheringManager.TETHER_ERROR_DISABLE_NAT_ERROR -> "TETHER_ERROR_DISABLE_NAT_ERROR" TetheringManager.TETHER_ERROR_IFACE_CFG_ERROR -> "TETHER_ERROR_IFACE_CFG_ERROR" + TetheringManager.TETHER_ERROR_PROVISION_FAILED -> "TETHER_ERROR_PROVISION_FAILED" else -> app.getString(R.string.failure_reason_unknown, error) } } catch (e: SecurityException) { 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 b8cbb115..3d6dafca 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringFragment.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringFragment.kt @@ -88,9 +88,10 @@ class TetheringFragment : Fragment(), ServiceConnection { var tetheringBinder: TetheringService.Binder? = null val adapter = ManagerAdapter() private val receiver = broadcastReceiver { _, intent -> - adapter.update(TetheringManager.getTetheredIfaces(intent.extras), - TetheringManager.getLocalOnlyTetheredIfaces(intent.extras), - intent.extras.getStringArrayList(TetheringManager.EXTRA_ERRORED_TETHER)) + val extras = intent.extras!! + adapter.update(TetheringManager.getTetheredIfaces(extras), + TetheringManager.getLocalOnlyTetheredIfaces(extras), + extras.getStringArrayList(TetheringManager.EXTRA_ERRORED_TETHER)!!) } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/IpNeighbour.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/IpNeighbour.kt index 2e573f8c..a3e0c589 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/IpNeighbour.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/IpNeighbour.kt @@ -63,12 +63,10 @@ data class IpNeighbour(val ip: String, val dev: String, val lladdr: String, val private var arpCacheTime = -ARP_CACHE_EXPIRE private fun arp(): List> { if (System.nanoTime() - arpCacheTime >= ARP_CACHE_EXPIRE) try { - arpCache = File("/proc/net/arp").bufferedReader().useLines { - it.map { it.split(spaces) } - .drop(1) - .filter { it.size >= 6 && mac.matcher(it[ARP_HW_ADDRESS]).matches() } - .toList() - } + arpCache = File("/proc/net/arp").bufferedReader().readLines() + .map { it.split(spaces) } + .drop(1) + .filter { it.size >= 6 && mac.matcher(it[ARP_HW_ADDRESS]).matches() } } catch (e: IOException) { e.printStackTrace() Crashlytics.logException(e) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiP2pDialogFragment.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiP2pDialogFragment.kt index 02e84cc0..52e7fb20 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiP2pDialogFragment.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiP2pDialogFragment.kt @@ -55,7 +55,7 @@ class WifiP2pDialogFragment : DialogFragment(), TextWatcher, DialogInterface.OnC setNegativeButton(context.getString(R.string.wifi_cancel), this@WifiP2pDialogFragment) setNeutralButton(context.getString(R.string.repeater_reset_credentials), this@WifiP2pDialogFragment) val arguments = arguments!! - configurer = arguments.getParcelable(KEY_CONFIGURER) + configurer = arguments.getParcelable(KEY_CONFIGURER)!! val mWifiConfig = arguments.getParcelable(KEY_CONFIGURATION) if (mWifiConfig != null) { mSsid.text = mWifiConfig.SSID diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiP2pManagerHelper.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiP2pManagerHelper.kt index a1fab70a..c3f07e25 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiP2pManagerHelper.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiP2pManagerHelper.kt @@ -76,7 +76,7 @@ object WifiP2pManagerHelper { WifiP2pManager.Channel::class.java, Int::class.java, WifiP2pManager.ActionListener::class.java) } fun WifiP2pManager.deletePersistentGroup(c: WifiP2pManager.Channel, netId: Int, - listener: WifiP2pManager.ActionListener) { + listener: WifiP2pManager.ActionListener) { try { deletePersistentGroup.invoke(this, c, netId, listener) } catch (e: NoSuchMethodException) {