Return empty scan results for background user
Bug: 7087342
Change-Id: I62493e5004111311b7ac9b7610c85e6784e2c7e4
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index 7ed4f8a..c139e0c 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -16,6 +16,7 @@
package com.android.server;
+import android.app.ActivityManager;
import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationManager;
@@ -55,6 +56,7 @@
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
+import android.os.UserHandle;
import android.os.WorkSource;
import android.provider.Settings;
import android.text.TextUtils;
@@ -834,7 +836,11 @@
*/
public List<ScanResult> getScanResults() {
enforceAccessPermission();
- return mWifiStateMachine.syncGetScanResultsList();
+ if (UserHandle.getCallingUserId() != ActivityManager.getCurrentUser()) {
+ return new ArrayList<ScanResult>();
+ } else {
+ return mWifiStateMachine.syncGetScanResultsList();
+ }
}
/**