summaryrefslogtreecommitdiffstats
path: root/core/java/android/os
diff options
context:
space:
mode:
authorDavid Christie <dnchrist@google.com>2013-09-20 20:04:04 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-09-20 20:04:04 +0000
commitf31a78977401b155c0781dfe7d7cb6b7b38543c0 (patch)
tree3fc6d945eded827082b1ce4f24205cc8cea8393b /core/java/android/os
parenta5fb1204385be2ab58bb4b653fbffae4f365b98c (diff)
parenta31510e47a0f0c2525702c2f10a85064322a28f2 (diff)
downloadframeworks_base-f31a78977401b155c0781dfe7d7cb6b7b38543c0.zip
frameworks_base-f31a78977401b155c0781dfe7d7cb6b7b38543c0.tar.gz
frameworks_base-f31a78977401b155c0781dfe7d7cb6b7b38543c0.tar.bz2
Merge "Clear names from externally supplied WorkSources to WifiManager (b/10733757)" into klp-dev
Diffstat (limited to 'core/java/android/os')
-rw-r--r--core/java/android/os/WorkSource.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/core/java/android/os/WorkSource.java b/core/java/android/os/WorkSource.java
index 30d535b..e66df04 100644
--- a/core/java/android/os/WorkSource.java
+++ b/core/java/android/os/WorkSource.java
@@ -103,7 +103,21 @@ public class WorkSource implements Parcelable {
* @hide
*/
public void clearNames() {
- mNames = null;
+ if (mNames != null) {
+ mNames = null;
+ // Clear out any duplicate uids now that we don't have names to disambiguate them.
+ int destIndex = 1;
+ int newNum = mNum;
+ for (int sourceIndex = 1; sourceIndex < mNum; sourceIndex++) {
+ if (mUids[sourceIndex] == mUids[sourceIndex - 1]) {
+ newNum--;
+ } else {
+ mUids[destIndex] = mUids[sourceIndex];
+ destIndex++;
+ }
+ }
+ mNum = newNum;
+ }
}
/**