diff options
| author | Jing Ji <jji@google.com> | 2021-10-25 14:55:38 -0700 |
|---|---|---|
| committer | Jing Ji <jji@google.com> | 2022-01-24 18:34:48 -0800 |
| commit | 1507931e89f5136813ba082d1a5472e2d9a0873f (patch) | |
| tree | 7f038200d332eeec5eb12d958d48abdb700c21ad /core/java/android/util/SparseArrayMap.java | |
| parent | b60f95be23103b5e59d80b3e2419baae62fcad0e (diff) | |
Add background restriction levels definition and its controller
This CL adds the definition of background app restriction levels.
The existing various system background app restriction features will
be mapped into the levels here, including app standby buckets,
background restrictions (forced-app-standby) etc. Future CLs may
apply restrictions to background apps accordingly.
BYPASS_INCLUSIVE_LANGUAGE_REASON=Legacy API name
Bug: 200326767
Test: atest FrameworksMockingServicesTests:BackgroundRestrictionTest
Change-Id: Icf82031c572e7b8e82e6528402e9df4de5b7a675
Diffstat (limited to 'core/java/android/util/SparseArrayMap.java')
| -rw-r--r-- | core/java/android/util/SparseArrayMap.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/util/SparseArrayMap.java b/core/java/android/util/SparseArrayMap.java index cd592a710a02..e5bb9f453a88 100644 --- a/core/java/android/util/SparseArrayMap.java +++ b/core/java/android/util/SparseArrayMap.java @@ -62,6 +62,14 @@ public class SparseArrayMap<K, V> { } /** + * Removes all the data for the keyIndex, if there was any. + * @hide + */ + public void deleteAt(int keyIndex) { + mData.removeAt(keyIndex); + } + + /** * Removes the data for the key and mapKey, if there was any. * * @return Returns the value that was stored under the keys, or null if there was none. @@ -142,6 +150,15 @@ public class SparseArrayMap<K, V> { return data == null ? 0 : data.size(); } + /** + * Returns the number of elements in the map of the given keyIndex. + * @hide + */ + public int numElementsForKeyAt(int keyIndex) { + ArrayMap<K, V> data = mData.valueAt(keyIndex); + return data == null ? 0 : data.size(); + } + /** Returns the value V at the given key and map index. */ @Nullable public V valueAt(int keyIndex, int mapIndex) { |
