summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2015-08-06 22:19:06 -0700
committerDianne Hackborn <hackbod@google.com>2015-08-07 14:23:32 -0700
commit4a503b1ece485d44c15eb02ec2bcd464b46e6f7f (patch)
tree72a22a0708c74e5f99a8bf2f4cb68f3d6ac15cf7 /core/java/android
parent1d7c32548c30c62a35c54a624f89d5f9db31b9d4 (diff)
downloadframeworks_base-4a503b1ece485d44c15eb02ec2bcd464b46e6f7f.zip
frameworks_base-4a503b1ece485d44c15eb02ec2bcd464b46e6f7f.tar.gz
frameworks_base-4a503b1ece485d44c15eb02ec2bcd464b46e6f7f.tar.bz2
Fix issue #22989030: Separate battery whitelists
We now have a new whitelist you can put apps in, which opts them out of the old battery saver mode and new app idle, but doesn't keep them from going in to doze. This is for a few special cases that we had previously whitelisted for battery saver, and inherited to the new modes... ultimately we should figure out how to get these apps out of the whitelist completely, but this will help for now. Apps in this new whitelist are not shown in the UI, because they are still significantly restricted by not being able to operate normally in doze. This also means they are still visible in the list of all apps for the user to be able to put them on/off the complete whitelist if that is what they really want. In the course of doing this, I needed to clean up code in the network policy manager to better separate management of the two firewall rules that now have different whitelists applied to them. This also hopefully just generally simplifies and cleans up that code. Hopefully! Change-Id: I92e15f2f85899571dd8b049b5e3eb1354f55f353
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/usage/UsageStatsManagerInternal.java7
-rw-r--r--core/java/android/os/IDeviceIdleController.aidl4
-rw-r--r--core/java/android/util/SparseIntArray.java8
3 files changed, 19 insertions, 0 deletions
diff --git a/core/java/android/app/usage/UsageStatsManagerInternal.java b/core/java/android/app/usage/UsageStatsManagerInternal.java
index 9113426..948ea1e 100644
--- a/core/java/android/app/usage/UsageStatsManagerInternal.java
+++ b/core/java/android/app/usage/UsageStatsManagerInternal.java
@@ -77,6 +77,13 @@ public abstract class UsageStatsManagerInternal {
public abstract boolean isAppIdle(String packageName, int userId);
/**
+ * Returns all of the uids for a given user where all packages associating with that uid
+ * are in the app idle state -- there are no associated apps that are not idle. This means
+ * all of the returned uids can be safely considered app idle.
+ */
+ public abstract int[] getIdleUidsForUser(int userId);
+
+ /**
* @return True if currently app idle parole mode is on. This means all idle apps are allow to
* run for a short period of time.
*/
diff --git a/core/java/android/os/IDeviceIdleController.aidl b/core/java/android/os/IDeviceIdleController.aidl
index d3eec1e..f55883a 100644
--- a/core/java/android/os/IDeviceIdleController.aidl
+++ b/core/java/android/os/IDeviceIdleController.aidl
@@ -22,10 +22,14 @@ import android.os.UserHandle;
interface IDeviceIdleController {
void addPowerSaveWhitelistApp(String name);
void removePowerSaveWhitelistApp(String name);
+ String[] getSystemPowerWhitelistExceptIdle();
String[] getSystemPowerWhitelist();
+ String[] getFullPowerWhitelistExceptIdle();
String[] getFullPowerWhitelist();
+ int[] getAppIdWhitelistExceptIdle();
int[] getAppIdWhitelist();
int[] getAppIdTempWhitelist();
+ boolean isPowerSaveWhitelistExceptIdleApp(String name);
boolean isPowerSaveWhitelistApp(String name);
void addPowerSaveTempWhitelistApp(String name, long duration, int userId, String reason);
long addPowerSaveTempWhitelistAppForMms(String name, int userId, String reason);
diff --git a/core/java/android/util/SparseIntArray.java b/core/java/android/util/SparseIntArray.java
index 2b85a21..e5c729d 100644
--- a/core/java/android/util/SparseIntArray.java
+++ b/core/java/android/util/SparseIntArray.java
@@ -184,6 +184,14 @@ public class SparseIntArray implements Cloneable {
}
/**
+ * Directly set the value at a particular index.
+ * @hide
+ */
+ public void setValueAt(int index, int value) {
+ mValues[index] = value;
+ }
+
+ /**
* Returns the index for which {@link #keyAt} would return the
* specified key, or a negative number if the specified
* key is not mapped.