diff options
author | Irfan Sheriff <isheriff@google.com> | 2013-03-21 12:06:27 -0700 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2013-03-21 12:27:20 -0700 |
commit | 7b7beb7952440ee2e255694b7b19e60abae93dc0 (patch) | |
tree | 9583b84ed81d5930ed67393b90b259a2c99145fe | |
parent | 71b0017759b825f8bddcdda7425afc802e8918c9 (diff) | |
download | frameworks_base-7b7beb7952440ee2e255694b7b19e60abae93dc0.zip frameworks_base-7b7beb7952440ee2e255694b7b19e60abae93dc0.tar.gz frameworks_base-7b7beb7952440ee2e255694b7b19e60abae93dc0.tar.bz2 |
Notify user when wi-fi is toggled about scans
We let the user know when he turns off Wi-Fi that scans will continue to
be available.
User has the option to turn off the dialog and not receive this in the future.
Bug: 8141918
Change-Id: I115ce2ac57125b8ffbb34245dc25effd4b3bebb0
-rw-r--r-- | core/java/android/provider/Settings.java | 8 | ||||
-rw-r--r-- | services/java/com/android/server/wifi/WifiService.java | 12 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiManager.java | 9 |
3 files changed, 29 insertions, 0 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index d251ca2..8346cc1 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -4791,6 +4791,14 @@ public final class Settings { "wifi_scan_always_enabled"; /** + * Setting to indicate whether the user should be notified that scans are still + * available when Wi-Fi is turned off + * @hide + */ + public static final String WIFI_NOTIFY_SCAN_ALWAYS_AVAILABLE = + "wifi_notify_scan_always_enabled"; + + /** * Used to save the Wifi_ON state prior to tethering. * This state will be checked to restore Wifi after * the user turns off tethering. diff --git a/services/java/com/android/server/wifi/WifiService.java b/services/java/com/android/server/wifi/WifiService.java index c46f217..9dde58f 100644 --- a/services/java/com/android/server/wifi/WifiService.java +++ b/services/java/com/android/server/wifi/WifiService.java @@ -396,6 +396,18 @@ public final class WifiService extends IWifiManager.Stub { long ident = Binder.clearCallingIdentity(); try { + + /* Turning off Wi-Fi when scans are still available */ + if (!enable && isScanningAlwaysAvailable()) { + /* This can be changed by user in the app to not be notified again */ + boolean notifyUser = (Settings.Global.getInt(mContext.getContentResolver(), + Settings.Global.WIFI_NOTIFY_SCAN_ALWAYS_AVAILABLE, 1) == 1); + if (notifyUser) { + Intent intent = new Intent(WifiManager.ACTION_NOTIFY_SCAN_ALWAYS_AVAILABLE); + mContext.startActivityAsUser(intent, null, UserHandle.CURRENT); + } + } + if (! mSettingsStore.handleWifiToggled(enable)) { // Nothing to do if wifi cannot be toggled return true; diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index f654310..0c0a144 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -408,6 +408,15 @@ public class WifiManager { "android.net.wifi.action.REQUEST_SCAN_ALWAYS_AVAILABLE"; /** + * Activity Action: Show a system activity that notifies the user that + * scanning is still available when Wi-Fi is turned off + * @hide + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_NOTIFY_SCAN_ALWAYS_AVAILABLE = + "android.net.wifi.action.NOTIFY_SCAN_ALWAYS_AVAILABLE"; + + /** * Activity Action: Pick a Wi-Fi network to connect to. * <p>Input: Nothing. * <p>Output: Nothing. |