第4课第4节_Android灯光系统_源码分析_电池灯

电池的监听器:


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

原文地址:https://www.cnblogs.com/zhulinhaibao/p/7068508.html