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

Commit f31a7897 authored by David Christie's avatar David Christie Committed by Android (Google) Code Review
Browse files

Merge "Clear names from externally supplied WorkSources to WifiManager (b/10733757)" into klp-dev

parents a5fb1204 a31510e4
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);