Merge "Clear names from externally supplied WorkSources to WifiManager (b/10733757)" into klp-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f31a789774
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1867,13 +1867,16 @@ public class WifiManager {
|
||||
boolean changed = true;
|
||||
if (ws == null) {
|
||||
mWorkSource = null;
|
||||
} else if (mWorkSource == null) {
|
||||
changed = mWorkSource != null;
|
||||
mWorkSource = new WorkSource(ws);
|
||||
} else {
|
||||
changed = mWorkSource.diff(ws);
|
||||
if (changed) {
|
||||
mWorkSource.set(ws);
|
||||
ws.clearNames();
|
||||
if (mWorkSource == null) {
|
||||
changed = mWorkSource != null;
|
||||
mWorkSource = new WorkSource(ws);
|
||||
} else {
|
||||
changed = mWorkSource.diff(ws);
|
||||
if (changed) {
|
||||
mWorkSource.set(ws);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changed && mHeld) {
|
||||
|
||||
Reference in New Issue
Block a user