Log.i(TAG, \\\\\\\"Starting Battery Service.\\\\\\\");
         BatteryService battery = new BatteryService(context);
         ServiceManager.addService(\\\\\\\"battery\\\\\\\", battery);



   gFieldIds.mAcOnline = env->GetFieldID(clazz, \\\\\\\"mAcOnline\\\\\\\", \\\\\\\"Z\\\\\\\"); 
   gFieldIds.mUsbOnline = env->GetFieldID(clazz, \\\\\\\"mUsbOnline\\\\\\\", \\\\\\\"Z\\\\\\\"); 
   gFieldIds.mBatteryStatus = env->GetFieldID(clazz, \\\\\\\"mBatteryStatus\\\\\\\", \\\\\\\"I\\\\\\\"); 
   gFieldIds.mBatteryHealth = env->GetFieldID(clazz, \\\\\\\"mBatteryHealth\\\\\\\", \\\\\\\"I\\\\\\\"); 
   gFieldIds.mBatteryPresent = env->GetFieldID(clazz, \\\\\\\"mBatteryPresent\\\\\\\", \\\\\\\"Z\\\\\\\"); 
   gFieldIds.mBatteryLevel = env->GetFieldID(clazz, \\\\\\\"mBatteryLevel\\\\\\\", \\\\\\\"I\\\\\\\"); 
   gFieldIds.mBatteryTechnology = env->GetFieldID(clazz, \\\\\\\"mBatteryTechnology\\\\\\\", \\\\\\\"Ljava/lang/String;\\\\\\\"); 
   gFieldIds.mBatteryVoltage = env->GetFieldID(clazz, \\\\\\\"mBatteryVoltage\\\\\\\", \\\\\\\"I\\\\\\\"); 
   gFieldIds.mBatteryTemperature = env->GetFieldID(clazz, \\\\\\\"mBatteryTemperature\\\\\\\", \\\\\\\"I\\\\\\\");

#define AC_ONLINE_PATH "/sys/class/power_supply/ac/online"#define USB_ONLINE_PATH "/sys/class/power_supply/usb/online"#define BATTERY_STATUS_PATH "/sys/class/power_supply/battery/status"#define BATTERY_HEALTH_PATH "/sys/class/power_supply/battery/health"#define BATTERY_PRESENT_PATH "/sys/class/power_supply/battery/present"#define BATTERY_CAPACITY_PATH "/sys/class/power_supply/battery/capacity"#define BATTERY_VOLTAGE_PATH "/sys/class/power_supply/battery/batt_vol"#define BATTERY_TEMPERATURE_PATH "/sys/class/power_supply/battery/batt_temp"#define BATTERY_TECHNOLOGY_PATH "/sys/class/power_supply/battery/technology"

 
   


----------------------------------------------------------------------------------------------------------------------------------- 
3. 数据接收
   应用如果想要接收到BatteryService发送出来的电池信息,则需要注册一个Intent为Intent.ACTION_BATTERY_CHANGED的BroadcastReceiver。
 
   


-----------------------------------------------------------------------------------------------------------------------------------
4. 数据更新
        电池的信息会随着时间不停变化,自然地,就需要考虑如何实时的更新电池的数据信息。在BatteryService启动的时候,会同时通过UEventObserver启动一个onUEvent Thread。

 
   




     在UEvent thread中会不停调用 update()方法,来更新电池的信息数据。




\">