summaryrefslogtreecommitdiff
path: root/core/java/android/util/SparseLongArray.java
diff options
context:
space:
mode:
authorSuprabh Shukla <suprabh@google.com>2017-06-14 16:14:43 -0700
committerSuprabh Shukla <suprabh@google.com>2017-07-05 15:39:42 -0700
commite6e723d588bf7ebd7ec28d97c31ee44b5b4e0b54 (patch)
tree18c6acc48a0a71a8641bf69e62bf3512b89fd8d6 /core/java/android/util/SparseLongArray.java
parentf43346c19efd8ae828b785ae8f1ae440a2cb7801 (diff)
Stop tracking user specific uid cpu time on user stop
Telling kernel module uid_cputime to stop accounting time for uids belonging to a stopped user. Upon user remove, removing uid states for those uids. Test: adb shell am instrument -e class \ com.android.internal.os.BatteryStatsUserLifecycleTests -w \ com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner adb shell am instrument -e class android.util.SparseLongArrayTest -w \ com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner Bug: 62390461 Change-Id: Ibe07778465e3d2c13679e4d88d32f7b92fa959d9
Diffstat (limited to 'core/java/android/util/SparseLongArray.java')
-rw-r--r--core/java/android/util/SparseLongArray.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/util/SparseLongArray.java b/core/java/android/util/SparseLongArray.java
index 0166c4af47b2..81db2b7ff715 100644
--- a/core/java/android/util/SparseLongArray.java
+++ b/core/java/android/util/SparseLongArray.java
@@ -119,6 +119,23 @@ public class SparseLongArray implements Cloneable {
}
/**
+ * @hide
+ * Remove a range of mappings as a batch.
+ *
+ * @param index Index to begin at
+ * @param size Number of mappings to remove
+ *
+ * <p>For indices outside of the range <code>0...size()-1</code>,
+ * the behavior is undefined.</p>
+ */
+ public void removeAtRange(int index, int size) {
+ size = Math.min(size, mSize - index);
+ System.arraycopy(mKeys, index + size, mKeys, index, mSize - (index + size));
+ System.arraycopy(mValues, index + size, mValues, index, mSize - (index + size));
+ mSize -= size;
+ }
+
+ /**
* Removes the mapping at the given index.
*/
public void removeAt(int index) {