android wifi 热点获取client的名称

TetheringManager.java

registerTetheringEventCallback(Executor executor, TetheringEventCallback callback){

final ITetheringEventCallback remoteCallback = new ITetheringEventCallback.Stub() {

public void onTetherClientsChanged(final List<TetheredClient> clients) {

executor.execute(() -> callback.onClientsChanged(clients));

}

}

}

TetheredClient里的AddressInfo.getHostname 可以获取wifi客户端的名称

追代码(未验证)猜测:

Tethering.updateConnectedClients--->ConnectedClientsTracker.updateConnectedClients

public boolean updateConnectedClients(

Iterable<IpServer> ipServers, @Nullable List<WifiClient> wifiClients) {

for (IpServer server : ipServers) {

for (TetheredClient client : server.getAllLeases()) {

final TetheredClient prunedClient = pruneExpired(client, now);

if (prunedClient == null) continue; // All addresses expired

addLease(clientsMap, prunedClient);

}

}

}

最后是用ipserver获取所有的 dhcp信息并上报

相关推荐
淡淡的香烟5 分钟前
Android15适配16kb完整版
android
杉氧27 分钟前
跨平台持久化:Flutter 本地数据库的多线程安全与架构设计实践
android·前端·flutter
小孔龙38 分钟前
Compose 布局与绘制:LayoutNode、DisplayList 与 GraphicsLayer
android·android jetpack
淡淡的香烟1 小时前
Android常用adb命令
android·adb
艾莉丝努力练剑3 小时前
【MYSQL】MYSQL学习的一大重点:事务(上)- 原子性与持久性
android·数据库·学习·mysql·面试
plainGeekDev14 小时前
工厂模式 → Hilt
android·java·kotlin
雨白14 小时前
深入理解 Kotlin 协程 (十):引而不发,探秘 Flow 冷流机制与异常透明性
android·kotlin
plainGeekDev15 小时前
Application 单例 → Hilt Singleton
android·java·kotlin
程序员码歌16 小时前
我全程用 AI开发了一款微信小游戏,上线了
android·前端·游戏开发
黄林晴17 小时前
你敢信吗?同样是跨端,KMP 跟 RN 居然差这么多!
android·前端