Respect system thisDevice

This commit is contained in:
Mygod
2020-07-07 04:54:26 +08:00
parent 82dc01ab37
commit 1ef2718d8c
5 changed files with 42 additions and 22 deletions

View File

@@ -6,11 +6,10 @@ import android.os.Parcelable
import android.system.Os
import android.system.OsConstants
import android.text.TextUtils
import be.mygod.librootkotlinx.ParcelableInt
import be.mygod.librootkotlinx.ParcelableList
import be.mygod.librootkotlinx.RootCommand
import be.mygod.librootkotlinx.RootCommandNoResult
import androidx.annotation.RequiresApi
import be.mygod.librootkotlinx.*
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.deletePersistentGroup
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.requestDeviceAddress
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.requestPersistentGroupInfo
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.setWifiP2pChannels
import be.mygod.vpnhotspot.util.Services
@@ -34,6 +33,14 @@ object RepeaterCommands {
}
}
@Parcelize
@RequiresApi(29)
class RequestDeviceAddress : RootCommand<ParcelableLong?> {
override suspend fun execute() = Services.p2p!!.run {
requestDeviceAddress(obtainChannel())?.let { ParcelableLong(it.addr) }
}
}
@Parcelize
class RequestPersistentGroupInfo : RootCommand<ParcelableList> {
override suspend fun execute() = Services.p2p!!.run {