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

Commit 9a465a92 authored by Chong Zhang's avatar Chong Zhang Committed by Android Git Automerger
Browse files

am 411af374: am dbb0b824: Merge "wifi-display: add a global setting to force...

am 411af374: am dbb0b824: Merge "wifi-display: add a global setting to force WPS config method" into klp-dev

* commit '411af374':
  wifi-display: add a global setting to force WPS config method
parents 0df62d47 411af374
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -5106,6 +5106,21 @@ public final class Settings {
       public static final String WIFI_DISPLAY_CERTIFICATION_ON =
               "wifi_display_certification_on";

       /**
        * WPS Configuration method used by Wifi display, this setting only
        * takes effect when WIFI_DISPLAY_CERTIFICATION_ON is 1 (enabled).
        *
        * Possible values are:
        *
        * WpsInfo.INVALID: use default WPS method chosen by framework
        * WpsInfo.PBC    : use Push button
        * WpsInfo.KEYPAD : use Keypad
        * WpsInfo.DISPLAY: use Display
        * @hide
        */
       public static final String WIFI_DISPLAY_WPS_CONFIG =
           "wifi_display_wps_config";

       /**
        * Whether to notify the user of open networks.
        * <p>
+13 −1
Original line number Diff line number Diff line
@@ -150,6 +150,8 @@ final class WifiDisplayController implements DumpUtils.Dump {

    // Certification
    private boolean mWifiDisplayCertMode;
    private int mWifiDisplayWpsConfig = WpsInfo.INVALID;

    private WifiP2pDevice mThisDevice;

    public WifiDisplayController(Context context, Handler handler, Listener listener) {
@@ -179,6 +181,8 @@ final class WifiDisplayController implements DumpUtils.Dump {
                Settings.Global.WIFI_DISPLAY_ON), false, settingsObserver);
        resolver.registerContentObserver(Settings.Global.getUriFor(
                Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON), false, settingsObserver);
        resolver.registerContentObserver(Settings.Global.getUriFor(
                Settings.Global.WIFI_DISPLAY_WPS_CONFIG), false, settingsObserver);
        updateSettings();
    }

@@ -189,6 +193,12 @@ final class WifiDisplayController implements DumpUtils.Dump {
        mWifiDisplayCertMode = Settings.Global.getInt(resolver,
                Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON, 0) != 0;

        mWifiDisplayWpsConfig = WpsInfo.INVALID;
        if (mWifiDisplayCertMode) {
            mWifiDisplayWpsConfig = Settings.Global.getInt(resolver,
                  Settings.Global.WIFI_DISPLAY_WPS_CONFIG, WpsInfo.INVALID);
        }

        updateWfdEnableState();
    }

@@ -608,7 +618,9 @@ final class WifiDisplayController implements DumpUtils.Dump {
            mConnectingDevice = mDesiredDevice;
            WifiP2pConfig config = new WifiP2pConfig();
            WpsInfo wps = new WpsInfo();
            if (mConnectingDevice.wpsPbcSupported()) {
            if (mWifiDisplayWpsConfig != WpsInfo.INVALID) {
                wps.setup = mWifiDisplayWpsConfig;
            } else if (mConnectingDevice.wpsPbcSupported()) {
                wps.setup = WpsInfo.PBC;
            } else if (mConnectingDevice.wpsDisplaySupported()) {
                // We do keypad if peer does display