Merge "Revert "WifiManager: Return status from startScan()"" into pi-dev

This commit is contained in:
Doris Ling
2018-04-26 23:26:09 +00:00
committed by Android (Google) Code Review
3 changed files with 3 additions and 14 deletions

View File

@@ -85,7 +85,7 @@ interface IWifiManager
boolean disableNetwork(int netId, String packageName);
boolean startScan(String packageName);
void startScan(String packageName);
List<ScanResult> getScanResults(String callingPackage);

View File

@@ -1635,7 +1635,8 @@ public class WifiManager {
public boolean startScan(WorkSource workSource) {
try {
String packageName = mContext.getOpPackageName();
return mService.startScan(packageName);
mService.startScan(packageName);
return true;
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}

View File

@@ -1070,16 +1070,4 @@ i * Verify that a call to cancel WPS immediately returns a failure.
fail("setWifiApConfiguration should rethrow Exceptions from WifiService");
} catch (SecurityException e) { }
}
/**
* Check the call to startScan calls WifiService.
*/
@Test
public void testStartScan() throws Exception {
when(mWifiService.startScan(TEST_PACKAGE_NAME)).thenReturn(true);
assertTrue(mWifiManager.startScan());
when(mWifiService.startScan(TEST_PACKAGE_NAME)).thenReturn(false);
assertFalse(mWifiManager.startScan());
}
}