diff options
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/BatteryService.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/services/java/com/android/server/BatteryService.java b/services/java/com/android/server/BatteryService.java index 73ff501..e9f9fe2 100644 --- a/services/java/com/android/server/BatteryService.java +++ b/services/java/com/android/server/BatteryService.java @@ -237,6 +237,20 @@ class BatteryService extends Binder { logOutlier = true; } + // Separate broadcast is sent for power connected / not connected + // since the standard intent will not wake any applications and some + // applications may want to have smart behavior based on this. + if (mPlugType != 0 && mLastPlugType == 0) { + Intent intent = new Intent(Intent.ACTION_POWER_CONNECTED); + intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); + mContext.sendBroadcast(intent); + } + else if (mPlugType == 0 && mLastPlugType != 0) { + Intent intent = new Intent(Intent.ACTION_POWER_DISCONNECTED); + intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); + mContext.sendBroadcast(intent); + } + mLastBatteryStatus = mBatteryStatus; mLastBatteryHealth = mBatteryHealth; mLastBatteryPresent = mBatteryPresent; |