From 1cd6db44f236fe8951a70ea757bbad393d7b434a Mon Sep 17 00:00:00 2001 From: Rebecca Silberstein Date: Fri, 4 Aug 2017 16:05:00 -0700 Subject: [PATCH] WifiManager: update docs on setWifiEnabled Update documentation to the setWifiEnabled call reflect what a return of false would be for. Note: False will be returned if the caller requested to enable/disable wifi while in softap mode or airplane mode is active. Bug: 64374508 Test: checked generated docs Change-Id: I1b1de84afee3844d326e7780a935a30d7f64d220 --- wifi/java/android/net/wifi/WifiManager.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index 7173775a34fab..4684c77ddb4dd 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -1755,9 +1755,18 @@ public class WifiManager { /** * Enable or disable Wi-Fi. + * + * Note: This method will return false if wifi cannot be enabled (e.g., an incompatible mode + * where the user has enabled tethering or Airplane Mode). + * + * Applications need to have the {@link android.Manifest.permission#CHANGE_WIFI_STATE} + * permission to toggle wifi. Callers without the permissions will trigger a + * {@link java.lang.SecurityException}. + * * @param enabled {@code true} to enable, {@code false} to disable. * @return {@code true} if the operation succeeds (or if the existing state - * is the same as the requested state). + * is the same as the requested state). False if wifi cannot be toggled on/off when the + * request is made. */ public boolean setWifiEnabled(boolean enabled) { try {