Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a31510e4 authored by David Christie's avatar David Christie
Browse files

Clear names from externally supplied WorkSources to WifiManager (b/10733757)

Change-Id: I36102f13962df2093c1e35fb40081ead647eff32
parent 1199a37a
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -103,7 +103,21 @@ public class WorkSource implements Parcelable {
     * @hide
     */
    public void clearNames() {
        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;
        }
    }

    /**
+9 −6
Original line number Diff line number Diff line
@@ -1867,7 +1867,9 @@ public class WifiManager {
                boolean changed = true;
                if (ws == null) {
                    mWorkSource = null;
                } else if (mWorkSource == null) {
                } else {
                    ws.clearNames();
                    if (mWorkSource == null) {
                        changed = mWorkSource != null;
                        mWorkSource = new WorkSource(ws);
                    } else {
@@ -1876,6 +1878,7 @@ public class WifiManager {
                            mWorkSource.set(ws);
                        }
                    }
                }
                if (changed && mHeld) {
                    try {
                        mService.updateWifiLockWorkSource(mBinder, mWorkSource);