summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2018-04-28 00:09:03 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-04-28 00:09:03 +0000
commit7d8f472a86f2d2dee7719c1e467d808608fcfe0a (patch)
tree66e77d09725a08328a26a3f158564bd996f85ae9 /service
parent4f896dcee93f4054ad505f3f70aadd530a68455c (diff)
parent228b7f2b090e473e05ac1b9db0a4f58ebf570d01 (diff)
Merge "Revert "Revert "WifiService: Return status from startScan()""" into pi-dev
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java28
1 files changed, 16 insertions, 12 deletions
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index 3f566c355..4d9dbf7e7 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -600,15 +600,14 @@ public class WifiServiceImpl extends IWifiManager.Stub {
}
/**
- * see {@link android.net.wifi.WifiManager#startScan}
- * and {@link android.net.wifi.WifiManager#startCustomizedScan}
+ * See {@link android.net.wifi.WifiManager#startScan}
*
* @param packageName Package name of the app that requests wifi scan.
*/
@Override
- public void startScan(String packageName) {
+ public boolean startScan(String packageName) {
if (enforceChangePermission(packageName) != MODE_ALLOWED) {
- return;
+ return false;
}
int callingUid = Binder.getCallingUid();
@@ -624,19 +623,24 @@ public class WifiServiceImpl extends IWifiManager.Stub {
// be sent directly until b/31398592 is fixed.
sendFailedScanBroadcast();
mScanPending = true;
- return;
+ return false;
}
}
- boolean success = mWifiInjector.getWifiStateMachineHandler().runWithScissors(() -> {
- if (!mScanRequestProxy.startScan(callingUid, packageName)) {
- Log.e(TAG, "Failed to start scan");
- }
- }, RUN_WITH_SCISSORS_TIMEOUT_MILLIS);
- if (!success) {
- // TODO: should return false here
+ Mutable<Boolean> scanSuccess = new Mutable<>();
+ boolean runWithScissorsSuccess = mWifiInjector.getWifiStateMachineHandler()
+ .runWithScissors(() -> {
+ scanSuccess.value = mScanRequestProxy.startScan(callingUid, packageName);
+ }, RUN_WITH_SCISSORS_TIMEOUT_MILLIS);
+ if (!runWithScissorsSuccess) {
Log.e(TAG, "Failed to post runnable to start scan");
sendFailedScanBroadcast();
+ return false;
}
+ if (!scanSuccess.value) {
+ Log.e(TAG, "Failed to start scan");
+ return false;
+ }
+ return true;
}
// Send a failed scan broadcast to indicate the current scan request failed.