From 10efdc0abfbc2b26e4c49cb8ffb02e52edcd287e Mon Sep 17 00:00:00 2001 From: Michael Kwan Date: Fri, 14 Apr 2017 12:34:46 -0700 Subject: [PATCH] Add isSmallBatteryDevice flag to ActivityManager. Bug: 37351903 Change-Id: I6fed08c35474b10987388070eafb7b16e6944638 (cherry picked from commit 15eb998e65eceef991a55cf15dba9f1769b182db) --- core/java/android/app/ActivityManager.java | 12 ++++++++++++ .../com/android/internal/os/RoSystemProperties.java | 2 ++ 2 files changed, 14 insertions(+) diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index f398c8dc9d6a2..8fa06786252bd 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -1111,6 +1111,18 @@ public class ActivityManager { return RoSystemProperties.CONFIG_LOW_RAM; } + /** + * Returns true if this is a small battery device. Exactly whether a device is considered to be + * small battery is ultimately up to the device configuration, but currently it generally means + * something in the class of a device with 1000 mAh or less. This is mostly intended to be used + * to determine whether certain features should be altered to account for a drastically smaller + * battery. + * @hide + */ + public static boolean isSmallBatteryDevice() { + return RoSystemProperties.CONFIG_SMALL_BATTERY; + } + /** * Used by persistent processes to determine if they are running on a * higher-end device so should be okay using hardware drawing acceleration diff --git a/core/java/com/android/internal/os/RoSystemProperties.java b/core/java/com/android/internal/os/RoSystemProperties.java index 1d26df0de12cb..89a4e17aa9767 100644 --- a/core/java/com/android/internal/os/RoSystemProperties.java +++ b/core/java/com/android/internal/os/RoSystemProperties.java @@ -33,6 +33,8 @@ public class RoSystemProperties { // ------ ro.config.* -------- // public static final boolean CONFIG_LOW_RAM = SystemProperties.getBoolean("ro.config.low_ram", false); + public static final boolean CONFIG_SMALL_BATTERY = + SystemProperties.getBoolean("ro.config.small_battery", false); // ------ ro.fw.* ------------ // public static final boolean FW_SYSTEM_USER_SPLIT =