java wifi定位原理_wifi基础知识及原理

wifi相关的文件位置:

WIFI Settings应用程序位于

packages/apps/Settings/src/com/android/settings/wifi/

JAVA部分:

frameworks/base/services/java/com/android/server/

frameworks/base/wifi/java/android/net/wifi/

JNI部分:

frameworks/base/core/jni/android_net_wifi_Wifi.cpp

wifi管理库。

hardware/libhardware_legary/wifi/

wifi用户空间的程序和库:

external/wpa_supplicant/

生成库libwpaclient.so和守护进程wpa_supplicant。

调用流程:

wifi模块的初始化:

(frameworks/base/services/java/com/android/server/SystemServer.Java)

在 SystemServer 启动的时候,会生成一个ConnectivityService 的实例,

classServerThread extends Thread {

。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

try {

Slog.i(TAG,"Connectivity Service");

connectivity= ConnectivityService.getInstance(context);

ServiceManager.addService(Context.CONNECTIVITY_SERVICE,connectivity);

} catch(Throwable e) {

Slog.e(TAG,"Failure starting Connectivity Service", e);

}

。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

}

其中 ,ConnectivityService.getInstance(context);  对应于(frameworks/base/services/java/com/android/server/ ConnectivityService.Java)ConnectivityService.Java。

下面看下ConnectivityService.Java中的

public static ConnectivityServicegetInstance(Context context) {

returnConnectivityThread.getServiceInstance(context);

}函数, 继续往下看:

public static ConnectivityService getServiceInstance(Context context) {

ConnectivityThread thread = newConnectivityThread(context);

thread.start();

synchronized (thread) {

while (sServiceInstance == null) {

try {

// Wait until sServiceInstance has beeninitialized.

thread.wait();

} catch (InterruptedExceptionignore) {

Slog.e(TAG,

"UnexpectedInterruptedException while waiting"+

" forConnectivityService thread");

}

}

}

return sServiceInstance;

}

}

继续往下跟:

private static class ConnectivityThreadextends Thread {

private Context mContext;

private ConnectivityThread(Context context) {

super("ConnectivityThread");

mContext = context;

}

@Override

public voi

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值