From eaf2ac464b1cd741d7d0fe700771b1b7c00ddb29 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Fri, 7 Feb 2014 13:01:07 -0800 Subject: Battery stats: more events, fixes. Add new history events for top application package and foreground application packages. Doing this involved a fair amount of improvement to history events. The event code is now separated out to have "start" and "finish" identifies, and we use that to now keep track of which events are active. With that, when resetting the stats, we can spit out all of the currently active events at the front of the new history. Also fixed some problems when I re-arranged the history delta int bits that were conflicting with the packing of the battery status bits. These packing structures are changed to work together correctly. Change-Id: Ic8b815060dd8a50ff4a0a209efc2e1044215cd88 --- core/java/android/util/SparseBooleanArray.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'core/java/android/util/SparseBooleanArray.java') diff --git a/core/java/android/util/SparseBooleanArray.java b/core/java/android/util/SparseBooleanArray.java index 905dcb018b96..f59ef0f6de07 100644 --- a/core/java/android/util/SparseBooleanArray.java +++ b/core/java/android/util/SparseBooleanArray.java @@ -115,6 +115,13 @@ public class SparseBooleanArray implements Cloneable { } } + /** @hide */ + public void removeAt(int index) { + System.arraycopy(mKeys, index + 1, mKeys, index, mSize - (index + 1)); + System.arraycopy(mValues, index + 1, mValues, index, mSize - (index + 1)); + mSize--; + } + /** * Adds a mapping from the specified key to the specified value, * replacing the previous mapping from the specified key if there @@ -191,6 +198,11 @@ public class SparseBooleanArray implements Cloneable { return mValues[index]; } + /** @hide */ + public void setValueAt(int index, boolean value) { + mValues[index] = value; + } + /** * Returns the index for which {@link #keyAt} would return the * specified key, or a negative number if the specified -- cgit v1.2.3