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

Commit 50473fb0 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

Wi-Fi: Ping the driver for wifi-only devices

Wifi-only devices are not capable to find APs with hidden SSID unless a DRIVER COUNTRY command
will send to wifi driver. This change has:

- Send DRIVER COUNTRY command to ping the driver (to correct the seek of hiddens SSIDs)
- Save mCountryCode as uppercase because the wifi_countrycode_values array is in uppercase.
  Otherwise the preference will not be found.

Patchset 7: Rebase
            Do not set mCountryCode if country is null

Change-Id: Ie0f838aef07eaf683b713f7f0e46ff3c751523ab

Conflicts:
	wifi/java/android/net/wifi/WifiNative.java
	wifi/java/android/net/wifi/WifiStateMachine.java
parent abb835dc
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -462,6 +462,10 @@ public class WifiNative {
    }

    public boolean setCountryCode(String countryCode) {
        if (countryCode == null) {
            // Ping the driver
            return doBooleanCommand("DRIVER COUNTRY");
        }
        return doBooleanCommand("DRIVER COUNTRY " + countryCode.toUpperCase(Locale.ROOT));
    }

+9 −1
Original line number Diff line number Diff line
@@ -1715,7 +1715,15 @@ public class WifiStateMachine extends StateMachine {
        if (countryCode != null && !countryCode.isEmpty()) {
            setCountryCode(countryCode, false);
        } else {
            //use driver default
            // On wifi-only devices, some drivers don't find hidden SSIDs unless DRIVER COUNTRY
            // is called. Pinging the wifi driver without country code resolves this issue.
            ConnectivityManager cm =
                    (ConnectivityManager)mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
            if (!cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)) {
                setCountryCode(null, false);
            }

            // In other case, mmc tables from carrier do the trick of starting up the wifi driver
        }
    }