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

Commit 3e94615b authored by Nalla Kartheek's avatar Nalla Kartheek Committed by Steve Kondik
Browse files

P2P: Disable 5GHz channels in 2.4 GHz only mode

When P2P device is configured in 2.4GHz only mode supplicant
should not advertize 5GHz channels in its go negotiation frames.
  Hence disable 5GHz band channels when 2.4 GHz band only mode
selected in Wi-Fi advanced settings.

Change-Id: Ice8c9de34b19587c7e8432842a79551cc0e2333a
CRs-Fixed: 682823
parent c1976a34
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1016,5 +1016,14 @@ public class WifiNative {
        return channels;
    }

    public boolean disable5GHzFrequencies(boolean disable) {
        if (disable) {
            return doBooleanCommand("P2P_SET disallow_freq 2485-6000");
        } else {
            //Empty set means,it will enable all frequences
            return doBooleanCommand("P2P_SET disallow_freq \"\"");
        }
    }

    public native static boolean setMode(int mode);
}
+9 −0
Original line number Diff line number Diff line
@@ -151,6 +151,7 @@ public class WifiStateMachine extends StateMachine {
    private int mLastNetworkId;
    private boolean mEnableRssiPolling = false;
    private boolean mEnableBackgroundScan = false;
    private boolean mDisabled5GhzFrequencies = false;
    private int mRssiPollToken = 0;
    private int mReconnectCount = 0;
    /* 3 operational states for STA operation: CONNECT_MODE, SCAN_ONLY_MODE, SCAN_ONLY_WIFI_OFF_MODE
@@ -3222,6 +3223,14 @@ public class WifiStateMachine extends StateMachine {
                        mFrequencyBand.set(band);
                        // flush old data - like scan results
                        mWifiNative.bssFlush();
                        if (mFrequencyBand.get() == WifiManager.WIFI_FREQUENCY_BAND_2GHZ) {
                            mWifiNative.disable5GHzFrequencies(true);
                            mDisabled5GhzFrequencies = true;
                        } else if ((mFrequencyBand.get() != WifiManager.WIFI_FREQUENCY_BAND_2GHZ)
                                && (mDisabled5GhzFrequencies)) {
                            mWifiNative.disable5GHzFrequencies(false);
                            mDisabled5GhzFrequencies = false;
                        }
                        //Fetch the latest scan results when frequency band is set
                        startScanNative(WifiNative.SCAN_WITH_CONNECTION_SETUP);
                    } else {