diff options
| -rw-r--r-- | wifi/java/android/net/wifi/WifiManager.java | 24 | ||||
| -rw-r--r-- | wifi/tests/src/android/net/wifi/WifiManagerTest.java | 9 |
2 files changed, 21 insertions, 12 deletions
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index 0e0a524e158e..164b7b059183 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -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; } /** diff --git a/wifi/tests/src/android/net/wifi/WifiManagerTest.java b/wifi/tests/src/android/net/wifi/WifiManagerTest.java index 84ac1183c897..b235ccc7a89e 100644 --- a/wifi/tests/src/android/net/wifi/WifiManagerTest.java +++ b/wifi/tests/src/android/net/wifi/WifiManagerTest.java @@ -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()); + } } |