diff options
author | Justin Klaassen <justinklaassen@google.com> | 2018-04-03 23:21:57 -0400 |
---|---|---|
committer | Justin Klaassen <justinklaassen@google.com> | 2018-04-03 23:21:57 -0400 |
commit | 4d01eeaffaa720e4458a118baa137a11614f00f7 (patch) | |
tree | 66751893566986236788e3c796a7cc5e90d05f52 /android/os/BatteryManager.java | |
parent | a192cc2a132cb0ee8588e2df755563ec7008c179 (diff) | |
download | android-28-4d01eeaffaa720e4458a118baa137a11614f00f7.tar.gz |
Import Android SDK Platform P [4697573]
/google/data/ro/projects/android/fetch_artifact \
--bid 4697573 \
--target sdk_phone_armv7-win_sdk \
sdk-repo-linux-sources-4697573.zip
AndroidVersion.ApiLevel has been modified to appear as 28
Change-Id: If80578c3c657366cc9cf75f8db13d46e2dd4e077
Diffstat (limited to 'android/os/BatteryManager.java')
-rw-r--r-- | android/os/BatteryManager.java | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/android/os/BatteryManager.java b/android/os/BatteryManager.java index 843bdb50..63631618 100644 --- a/android/os/BatteryManager.java +++ b/android/os/BatteryManager.java @@ -16,6 +16,7 @@ package android.os; +import android.annotation.SystemApi; import android.annotation.SystemService; import android.content.Context; import android.content.Intent; @@ -138,6 +139,23 @@ public class BatteryManager { */ public static final String EXTRA_SEQUENCE = "seq"; + /** + * Extra for {@link android.content.Intent#ACTION_BATTERY_LEVEL_CHANGED}: + * Contains list of Bundles representing battery events + * @hide + */ + @SystemApi + public static final String EXTRA_EVENTS = "android.os.extra.EVENTS"; + + /** + * Extra for event in {@link android.content.Intent#ACTION_BATTERY_LEVEL_CHANGED}: + * Long value representing time when event occurred as returned by + * {@link android.os.SystemClock#elapsedRealtime()} + * @hide + */ + @SystemApi + public static final String EXTRA_EVENT_TIMESTAMP = "android.os.extra.EVENT_TIMESTAMP"; + // values for "status" field in the ACTION_BATTERY_CHANGED Intent public static final int BATTERY_STATUS_UNKNOWN = Constants.BATTERY_STATUS_UNKNOWN; public static final int BATTERY_STATUS_CHARGING = Constants.BATTERY_STATUS_CHARGING; @@ -157,11 +175,11 @@ public class BatteryManager { // values of the "plugged" field in the ACTION_BATTERY_CHANGED intent. // These must be powers of 2. /** Power source is an AC charger. */ - public static final int BATTERY_PLUGGED_AC = 1; + public static final int BATTERY_PLUGGED_AC = OsProtoEnums.BATTERY_PLUGGED_AC; // = 1 /** Power source is a USB port. */ - public static final int BATTERY_PLUGGED_USB = 2; + public static final int BATTERY_PLUGGED_USB = OsProtoEnums.BATTERY_PLUGGED_USB; // = 2 /** Power source is wireless. */ - public static final int BATTERY_PLUGGED_WIRELESS = 4; + public static final int BATTERY_PLUGGED_WIRELESS = OsProtoEnums.BATTERY_PLUGGED_WIRELESS; // = 4 /** @hide */ public static final int BATTERY_PLUGGED_ANY = @@ -323,4 +341,16 @@ public class BatteryManager { public long getLongProperty(int id) { return queryProperty(id); } + + /** + * Return true if the plugType given is wired + * @param plugType {@link #BATTERY_PLUGGED_AC}, {@link #BATTERY_PLUGGED_USB}, + * or {@link #BATTERY_PLUGGED_WIRELESS} + * + * @return true if plugType is wired + * @hide + */ + public static boolean isPlugWired(int plugType) { + return plugType == BATTERY_PLUGGED_USB || plugType == BATTERY_PLUGGED_AC; + } } |