Merge "WifiManager: setWifiApEnabled always returns false" into oc-dev
am: c0643da09e
Change-Id: Ibaec59c3416f502c6ff9b131d12f38c6205f2287
This commit is contained in:
@@ -1802,25 +1802,25 @@ public class WifiManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Start AccessPoint mode with the specified
|
||||
* configuration. If the radio is already running in
|
||||
* AP mode, update the new configuration
|
||||
* Note that starting in access point mode disables station
|
||||
* mode operation
|
||||
* This call will be deprecated and removed in an upcoming release. It is no longer used to
|
||||
* start WiFi Tethering. Please use {@link ConnectivityManager#startTethering(int, boolean,
|
||||
* ConnectivityManager#OnStartTetheringCallback)} if
|
||||
* the caller has proper permissions. Callers can also use the LocalOnlyHotspot feature for a
|
||||
* hotspot capable of communicating with co-located devices {@link
|
||||
* WifiManager#startLocalOnlyHotspot(LocalOnlyHotspotCallback)}.
|
||||
*
|
||||
* @param wifiConfig SSID, security and channel details as
|
||||
* part of WifiConfiguration
|
||||
* @return {@code true} if the operation succeeds, {@code false} otherwise
|
||||
* @return {@code false}
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public boolean setWifiApEnabled(WifiConfiguration wifiConfig, boolean enabled) {
|
||||
try {
|
||||
mService.setWifiApEnabled(wifiConfig, enabled);
|
||||
return true;
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
String packageName = mContext.getOpPackageName();
|
||||
|
||||
Log.w(TAG, packageName + " attempted call to setWifiApEnabled: enabled = " + enabled);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -778,4 +778,13 @@ public class WifiManagerTest {
|
||||
verify(mWifiService).stopWatchLocalOnlyHotspot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that calls to setWifiApEnabled return false.
|
||||
*/
|
||||
@Test
|
||||
public void testSetWifiApEnabledReturnsFalse() throws Exception {
|
||||
assertFalse(mWifiManager.setWifiApEnabled(null, true));
|
||||
assertFalse(mWifiManager.setWifiApEnabled(null, false));
|
||||
verify(mWifiService, never()).setWifiApEnabled(any(), anyBoolean());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user