Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f6923908 authored by Wink Saville's avatar Wink Saville Committed by Android Git Automerger
Browse files

am ad5b0eb7: Merge "Notify user when wi-fi is toggled about scans" into jb-mr2-dev

* commit 'ad5b0eb7':
  Notify user when wi-fi is toggled about scans
parents e0ada631 ad5b0eb7
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -4790,6 +4790,14 @@ public final class Settings {
       public static final String WIFI_SCAN_ALWAYS_AVAILABLE =
                "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
+12 −0
Original line number Diff line number Diff line
@@ -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;
+9 −0
Original line number Diff line number Diff line
@@ -407,6 +407,15 @@ public class WifiManager {
    public static final String ACTION_REQUEST_SCAN_ALWAYS_AVAILABLE =
            "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.