Merge "WifiScanner: retrieve single scan results"

am: 3c70a2fad2

Change-Id: I0db176ca82665c8b8089a5110074d5f1edf3738d
This commit is contained in:
Rebecca Silberstein
2016-09-20 15:58:17 +00:00
committed by android-build-merger

View File

@@ -34,9 +34,10 @@ import com.android.internal.util.AsyncChannel;
import com.android.internal.util.Preconditions; import com.android.internal.util.Preconditions;
import com.android.internal.util.Protocol; import com.android.internal.util.Protocol;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
* This class provides a way to scan the Wifi universe around the device * This class provides a way to scan the Wifi universe around the device
* Get an instance of this class by calling * Get an instance of this class by calling
@@ -822,6 +823,22 @@ public class WifiScanner {
mAsyncChannel.sendMessage(CMD_STOP_SINGLE_SCAN, 0, key); mAsyncChannel.sendMessage(CMD_STOP_SINGLE_SCAN, 0, key);
} }
/**
* Retrieve the most recent scan results from a single scan request.
* {@hide}
*/
public List<ScanResult> getSingleScanResults() {
validateChannel();
Message reply = mAsyncChannel.sendMessageSynchronously(CMD_GET_SINGLE_SCAN_RESULTS, 0);
if (reply.what == WifiScanner.CMD_OP_SUCCEEDED) {
return Arrays.asList(((ParcelableScanResults) reply.obj).getResults());
}
OperationResult result = (OperationResult) reply.obj;
Log.e(TAG, "Error retrieving SingleScan results reason: " + result.reason
+ " description: " + result.description);
return new ArrayList<ScanResult>();
}
private void startPnoScan(ScanSettings scanSettings, PnoSettings pnoSettings, int key) { private void startPnoScan(ScanSettings scanSettings, PnoSettings pnoSettings, int key) {
// Bundle up both the settings and send it across. // Bundle up both the settings and send it across.
Bundle pnoParams = new Bundle(); Bundle pnoParams = new Bundle();
@@ -1201,6 +1218,8 @@ public class WifiScanner {
public static final int CMD_REGISTER_SCAN_LISTENER = BASE + 27; public static final int CMD_REGISTER_SCAN_LISTENER = BASE + 27;
/** @hide */ /** @hide */
public static final int CMD_DEREGISTER_SCAN_LISTENER = BASE + 28; public static final int CMD_DEREGISTER_SCAN_LISTENER = BASE + 28;
/** @hide */
public static final int CMD_GET_SINGLE_SCAN_RESULTS = BASE + 29;
private Context mContext; private Context mContext;
private IWifiScanner mService; private IWifiScanner mService;