OSDN Git Service

Strip names out of externally supplied WorkSources to WifiManager (b/10710007).
authorDavid Christie <dnchrist@google.com>
Sat, 14 Sep 2013 00:11:53 +0000 (17:11 -0700)
committerDavid Christie <dnchrist@google.com>
Sat, 14 Sep 2013 00:34:40 +0000 (17:34 -0700)
Change-Id: I69bd7ce9e942c2f9327415b2821d805e1b50a1a4

core/java/android/os/WorkSource.java
services/java/com/android/server/wifi/WifiService.java

index b79bdee..30d535b 100644 (file)
@@ -97,6 +97,16 @@ public class WorkSource implements Parcelable {
     }
 
     /**
+     * Clear names from this WorkSource.  Uids are left intact.
+     *
+     * <p>Useful when combining with another WorkSource that doesn't have names.
+     * @hide
+     */
+    public void clearNames() {
+        mNames = null;
+    }
+
+    /**
      * Clear this WorkSource to be empty.
      */
     public void clear() {
index 46f100e..5a24ebb 100644 (file)
@@ -342,6 +342,9 @@ public final class WifiService extends IWifiManager.Stub {
         enforceChangePermission();
         if (workSource != null) {
             enforceWorkSourcePermission();
+            // WifiManager currently doesn't use names, so need to clear names out of the
+            // supplied WorkSource to allow future WorkSource combining.
+            workSource.clearNames();
         }
         mWifiStateMachine.startScan(Binder.getCallingUid(), workSource);
     }