Loading api/current.xml +22 −0 Original line number Diff line number Diff line Loading @@ -28335,6 +28335,28 @@ visibility="public" > </field> <field name="ACTION_POWER_CONNECTED" type="java.lang.String" transient="false" volatile="false" value=""android.intent.action.ACTION_POWER_CONNECTED"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_POWER_DISCONNECTED" type="java.lang.String" transient="false" volatile="false" value=""android.intent.action.ACTION_POWER_DISCONNECTED"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_PROVIDER_CHANGED" type="java.lang.String" transient="false" core/java/android/content/Intent.java +20 −0 Original line number Diff line number Diff line Loading @@ -508,6 +508,8 @@ import java.util.Set; * <li> {@link #ACTION_PACKAGE_DATA_CLEARED} * <li> {@link #ACTION_UID_REMOVED} * <li> {@link #ACTION_BATTERY_CHANGED} * <li> {@link #ACTION_POWER_CONNECTED} * <li> {@link #ACTION_POWER_DISCONNECTED} * </ul> * * <h3>Standard Categories</h3> Loading Loading @@ -1249,6 +1251,24 @@ public class Intent implements Parcelable { */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_BATTERY_LOW = "android.intent.action.BATTERY_LOW"; /** * Broadcast Action: External power has been connected to the device. * This is intended for applications that wish to register specifically to this notification. * Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to * stay active to receive this notification. This action can be used to implement actions * that wait until power is available to trigger. */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_POWER_CONNECTED = "android.intent.action.ACTION_POWER_CONNECTED"; /** * Broadcast Action: External power has been removed from the device. * This is intended for applications that wish to register specifically to this notification. * Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to * stay active to receive this notification. This action can be used to implement actions * that wait until power is available to trigger. */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_POWER_DISCONNECTED = "android.intent.action.ACTION_POWER_DISCONNECTED"; /** * Broadcast Action: Indicates low memory condition on the device */ Loading services/java/com/android/server/BatteryService.java +14 −0 Original line number Diff line number Diff line Loading @@ -247,6 +247,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; Loading Loading
api/current.xml +22 −0 Original line number Diff line number Diff line Loading @@ -28335,6 +28335,28 @@ visibility="public" > </field> <field name="ACTION_POWER_CONNECTED" type="java.lang.String" transient="false" volatile="false" value=""android.intent.action.ACTION_POWER_CONNECTED"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_POWER_DISCONNECTED" type="java.lang.String" transient="false" volatile="false" value=""android.intent.action.ACTION_POWER_DISCONNECTED"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_PROVIDER_CHANGED" type="java.lang.String" transient="false"
core/java/android/content/Intent.java +20 −0 Original line number Diff line number Diff line Loading @@ -508,6 +508,8 @@ import java.util.Set; * <li> {@link #ACTION_PACKAGE_DATA_CLEARED} * <li> {@link #ACTION_UID_REMOVED} * <li> {@link #ACTION_BATTERY_CHANGED} * <li> {@link #ACTION_POWER_CONNECTED} * <li> {@link #ACTION_POWER_DISCONNECTED} * </ul> * * <h3>Standard Categories</h3> Loading Loading @@ -1249,6 +1251,24 @@ public class Intent implements Parcelable { */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_BATTERY_LOW = "android.intent.action.BATTERY_LOW"; /** * Broadcast Action: External power has been connected to the device. * This is intended for applications that wish to register specifically to this notification. * Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to * stay active to receive this notification. This action can be used to implement actions * that wait until power is available to trigger. */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_POWER_CONNECTED = "android.intent.action.ACTION_POWER_CONNECTED"; /** * Broadcast Action: External power has been removed from the device. * This is intended for applications that wish to register specifically to this notification. * Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to * stay active to receive this notification. This action can be used to implement actions * that wait until power is available to trigger. */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_POWER_DISCONNECTED = "android.intent.action.ACTION_POWER_DISCONNECTED"; /** * Broadcast Action: Indicates low memory condition on the device */ Loading
services/java/com/android/server/BatteryService.java +14 −0 Original line number Diff line number Diff line Loading @@ -247,6 +247,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; Loading