diff options
author | David Christie <dnchrist@google.com> | 2013-09-20 20:04:04 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-09-20 20:04:04 +0000 |
commit | f31a78977401b155c0781dfe7d7cb6b7b38543c0 (patch) | |
tree | 3fc6d945eded827082b1ce4f24205cc8cea8393b /core/java/android/os | |
parent | a5fb1204385be2ab58bb4b653fbffae4f365b98c (diff) | |
parent | a31510e47a0f0c2525702c2f10a85064322a28f2 (diff) | |
download | frameworks_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.java | 16 |
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; + } } /** |