深入浅出 - Android系统移植与平台开发(十三) - Sensor HAL框架分析之三

 

让我们来看看SensorManager的代码

SensorManager框架层代码

 

@frameworks/base/core/java/android/hardware/SensorManager.java

public SensorManager(Looper mainLooper) {
       mMainLooper = mainLooper;    // 上面说了,这是Activity的Looper

       synchronized(sListeners) {
            if(!sSensorModuleInitialized) {
                sSensorModuleInitialized = true;
                nativeClassInit();        // 好像是调用本地方法初始化
                  sWindowManager = IWindowManager.Stub.asInterface(
                       ServiceManager.getService("window"));  // 获得Windows服务,不管它
                  if (sWindowManager != null) {
                   // if it's null we're running in the system process
                   // which won't get the rotated values
                   try {
                       sRotation = sWindowManager.watchRotation(
                                newIRotationWatcher.Stub() {
                      

你可能感兴趣的:(Android移植,Android平台移植)