Merge "WifiManager: Return status from startScan()" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
deb2e6ed8c
@@ -85,7 +85,7 @@ interface IWifiManager
|
|||||||
|
|
||||||
boolean disableNetwork(int netId, String packageName);
|
boolean disableNetwork(int netId, String packageName);
|
||||||
|
|
||||||
void startScan(String packageName);
|
boolean startScan(String packageName);
|
||||||
|
|
||||||
List<ScanResult> getScanResults(String callingPackage);
|
List<ScanResult> getScanResults(String callingPackage);
|
||||||
|
|
||||||
|
|||||||
@@ -1635,8 +1635,7 @@ public class WifiManager {
|
|||||||
public boolean startScan(WorkSource workSource) {
|
public boolean startScan(WorkSource workSource) {
|
||||||
try {
|
try {
|
||||||
String packageName = mContext.getOpPackageName();
|
String packageName = mContext.getOpPackageName();
|
||||||
mService.startScan(packageName);
|
return mService.startScan(packageName);
|
||||||
return true;
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1070,4 +1070,16 @@ i * Verify that a call to cancel WPS immediately returns a failure.
|
|||||||
fail("setWifiApConfiguration should rethrow Exceptions from WifiService");
|
fail("setWifiApConfiguration should rethrow Exceptions from WifiService");
|
||||||
} catch (SecurityException e) { }
|
} 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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user