Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.6k views
in Technique[技术] by (71.8m points)

tether - Programmatically enable USB tethering on Android 11

all.

I normally write my own enable/disable usb tether scripts for each Android version I'm on, but 11 got me stumped. It looks like they've moved the tethering modules to a different location and it doesn't appear tethering can be called from "connectivity" (IConnectivityManager.aidl) any longer.

Android 10:

https://github.com/aosp-mirror/platform_frameworks_base/blob/android10-release/core/java/android/net/IConnectivityManager.aidl

line 113: int setUsbTethering(boolean enable, String callerPkg);

changes in 11:

https://source.android.com/devices/architecture/modular-system/tethering

"service list" brings up tethering on line 191 with reference to "android.net.ITetheringConnector" which I found below.

Tether-related references in 11:

https://github.com/aosp-mirror/platform_frameworks_base/tree/android11-release/packages/Tethering/common/TetheringLib/src/android/net

Line 29 Void setUsbTethering(boolean enable, String callerPkg, IIntResultListener receiver); in the above appears to be the command, but I have no idea what needs to happen in the "IIntResultListener receiver" field. I assume something has to happen in this package first:

https://github.com/aosp-mirror/platform_frameworks_base/blob/android11-release/packages/Tethering/common/TetheringLib/src/android/net/IIntResultListener.aidl

oneway

interface IIntResultListener {  

        void onResult(int resultCode);  
}

Too much of a newb to figure this one out. Any help is appreciated.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...