电池的监听器:
Android灯光系统的源码分析与使用
4. 电池灯
a. batteryPropertiesRegistrar.registerListener(new BatteryListener());
b. sendIntentLocked(); //这个是比较重要的
c. mLed.updateLightsLocked();
d.
// Register for broadcasts from other components of the system.
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
mContext.registerReceiver(new BatteryReceiver(), filter, null, mHandler);
e.
onReceive
handleBatteryStateChangedLocked
updatePowerStateLocked
参考文章
Android4.4电池管理
http://blog.csdn.net/wlwl0071986/article/details/38778897