1440 } else if (action.equals(Intent.ACTION_BATTERY_LOW)) {
1441 if (VDBG) Log.d(LOG_TAG, "mReceiver: ACTION_BATTERY_LOW");
1442 notifier.sendBatteryLow(); // Play a warning tone if in-call
通过CallNotifier来处理信息
packages/apps/Phone/src/com/android/phone/CallNotifier.java
1231 private void onBatteryLow() {
1232 if (DBG) log("onBatteryLow()...");
1233
1234 // A "low battery" warning tone is now played by
1235 // StatusBarPolicy.updateBattery().
1236 }
从以上代码可以看出,Phone中并没有实现此功能,说是通过StatusBarPolicy.updateBattery()来实现
而StatusBarPolicy中的代码非常简单,根本就没有实现此功能
PS:
其实在BatteryService函数update中还会发送如下信息,如果有哪位同学想要研究的话,可以接着研究
1)Intent.ACTION_POWER_CONNECTED
2)Intent.ACTION_POWER_DISCONNECTED
301 // Separate broadcast is sent for power connected / not connected
302 // since the standard intent will not wake any applications and some
303 // applications may want to have smart behavior based on this.
304 Intent statusIntent = new Intent();
305 statusIntent.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
306 if (mPlugType != 0 && mLastPlugType == 0) {
307 statusIntent.setAction(Intent.ACTION_POWER_CONNECTED);
308 mContext.sendBroadcast(statusIntent);
309 }
310 else if (mPlugType == 0 && mLastPlugType != 0) {
311 statusIntent.setAction(Intent.ACTION_POWER_DISCONNECTED);
312 mContext.sendBroadcast(statusIntent);
313 }