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

相关推荐
安卓与AI研习社1 小时前
Android ANR 到底怎么定位?从触发原理到日志判断的完整方法
android
阿pin3 小时前
Android随笔-MVI
android·mvi
leobertlan4 小时前
【好玩系列】训练一个神经网络指导小孩玩游戏
android·机器学习·程序员
Android-Flutter4 小时前
android LeakCanary 工作原理 详解
android·kotlin
newcih5 小时前
从原理到实战:LSPosed 模块开发完全指南(2026 修订版)
android·xposed·lsposed
AFinalStone5 小时前
Android 7系统无障碍服务(一)全景图与架构概览
android·无障碍服务
Android-Flutter5 小时前
android 自定义view 详解
android·kotlin
WAsbry6 小时前
协程任务的失败控制:取消、异常传播与Supervisor
android
Android打工仔6 小时前
从 finally 理解程序的控制流:它为什么不是 catch 后面的代码?
android·kotlin
随遇丿而安6 小时前
第15周:Service 全功能 + 后台优化
android