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信息并上报

相关推荐
雨白9 小时前
单例设计模式:从 Java/Kotlin 实现到 Android 实战
android
hai_android14 小时前
一行 asLiveData,背后是一座生命周期的桥
android·java·kotlin
阿杰m15 小时前
Android源码第二十三章:Telephony、RIL 与 IMS——来电怎么到应用?
android
booboosui15 小时前
没人认领 .md:安卓把报告交给了音乐播放器打开
android
用户607097591490617 小时前
AOSP 14 OTA 升级指导(四):update_engine 内部机制——Action 流水线与写盘
android
恋猫de小郭21 小时前
Jetpack Compose 1.13 发布,憋了这么久终有交代了
android·前端·flutter
JMchen12321 小时前
【Android 性能优化实战 60 讲】12 异步 Inflate 实战与痛击:源码拆解原生瓶颈,手写增强版布局预加载框架
android·性能优化·实战·启动优化·异步inflate·x2c
好的佩奇1 天前
蓝牙之设备角色与连接
android·flutter·蓝牙
雨白2 天前
Android 消息机制剖析:从 Handler 投递到 Looper 循环的全链路
android
GY-932 天前
【Android】数据分层和依赖注入
android