Loading src/com/android/settings/wifi/WifiConfigController2.java +6 −22 Original line number Diff line number Diff line Loading @@ -70,7 +70,6 @@ import com.android.settings.wifi.details2.WifiPrivacyPreferenceController2; import com.android.settings.wifi.dpp.WifiDppUtils; import com.android.settingslib.Utils; import com.android.settingslib.utils.ThreadUtils; import com.android.settingslib.wifi.AccessPoint; import com.android.wifitrackerlib.WifiEntry; import com.android.wifitrackerlib.WifiEntry.ConnectedInfo; Loading Loading @@ -363,19 +362,6 @@ public class WifiConfigController2 implements TextWatcher, && signalLevel != null) { mConfigUi.setSubmitButton(res.getString(R.string.wifi_connect)); } else { // TODO(b/143326832): Add fine-grained state information. //WifiConfiguration config = mWifiEntry.getWifiConfiguration(); //String suggestionOrSpecifierPackageName = null; //if (config != null // && (config.fromWifiNetworkSpecifier // || config.fromWifiNetworkSuggestion)) { // suggestionOrSpecifierPackageName = config.creatorName; //} //String summary = AccessPoint.getSummary( // mConfigUi.getContext(), /* ssid */ null, state, isEphemeral, // suggestionOrSpecifierPackageName); //addRow(group, R.string.wifi_status, summary); if (signalLevel != null) { addRow(group, R.string.wifi_signal, signalLevel); } Loading @@ -390,11 +376,11 @@ public class WifiConfigController2 implements TextWatcher, final int frequency = info.frequencyMhz; String band = null; if (frequency >= WifiEntryShell.LOWER_FREQ_24GHZ && frequency < WifiEntryShell.HIGHER_FREQ_24GHZ) { if (frequency >= WifiEntry.MIN_FREQ_24GHZ && frequency < WifiEntry.MAX_FREQ_24GHZ) { band = res.getString(R.string.wifi_band_24ghz); } else if (frequency >= WifiEntryShell.LOWER_FREQ_5GHZ && frequency < WifiEntryShell.HIGHER_FREQ_5GHZ) { } else if (frequency >= WifiEntry.MIN_FREQ_5GHZ && frequency < WifiEntry.MAX_FREQ_5GHZ) { band = res.getString(R.string.wifi_band_5ghz); } else { Log.e(TAG, "Unexpected frequency " + frequency); Loading Loading @@ -598,13 +584,11 @@ public class WifiConfigController2 implements TextWatcher, WifiConfiguration config = new WifiConfiguration(); if (mWifiEntry == null) { config.SSID = AccessPoint.convertToQuotedString( mSsidView.getText().toString()); config.SSID = "\"" + mSsidView.getText().toString() + "\""; // If the user adds a network manually, assume that it is hidden. config.hiddenSSID = mHiddenSettingsSpinner.getSelectedItemPosition() == HIDDEN_NETWORK; } else if (!mWifiEntry.isSaved()) { config.SSID = AccessPoint.convertToQuotedString( mWifiEntry.getTitle()); config.SSID = "\"" + mWifiEntry.getTitle() + "\""; } else { config.networkId = mWifiEntry.getWifiConfiguration().networkId; config.hiddenSSID = mWifiEntry.getWifiConfiguration().hiddenSSID; Loading src/com/android/settings/wifi/WifiEntryShell.javadeleted 100644 → 0 +0 −49 Original line number Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.wifi; import com.android.wifitrackerlib.WifiEntry; /** * {@link WifiEntry is working in progess, many methods are not available, this class is to group * all the unavalable {@link AccessPoint} methods & constants. * * TODO(b/143326832): Replace all methods & constants with WifiEntry version when it's available. */ public class WifiEntryShell { public WifiEntryShell(){}; /** * Lower bound on the 2.4 GHz (802.11b/g/n) WLAN channels */ public static final int LOWER_FREQ_24GHZ = 2400; /** * Upper bound on the 2.4 GHz (802.11b/g/n) WLAN channels */ public static final int HIGHER_FREQ_24GHZ = 2500; /** * Lower bound on the 5.0 GHz (802.11a/h/j/n/ac) WLAN channels */ public static final int LOWER_FREQ_5GHZ = 4900; /** * Upper bound on the 5.0 GHz (802.11a/h/j/n/ac) WLAN channels */ public static final int HIGHER_FREQ_5GHZ = 5900; } src/com/android/settings/wifi/WifiUtils.java +2 −31 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.provider.Settings; import android.text.TextUtils; import com.android.settings.Utils; import com.android.settingslib.wifi.AccessPoint; import com.android.wifitrackerlib.WifiEntry; import java.nio.charset.StandardCharsets; Loading Loading @@ -158,11 +157,11 @@ public class WifiUtils { final int security; if (wifiEntry == null) { config.SSID = AccessPoint.convertToQuotedString(scanResult.SSID); config.SSID = "\"" + scanResult.SSID + "\""; security = getWifiEntrySecurity(scanResult); } else { if (wifiEntry.getWifiConfiguration() == null) { config.SSID = AccessPoint.convertToQuotedString(wifiEntry.getSsid()); config.SSID = "\"" + wifiEntry.getSsid() + "\""; } else { config.networkId = wifiEntry.getWifiConfiguration().networkId; config.hiddenSSID = wifiEntry.getWifiConfiguration().hiddenSSID; Loading Loading @@ -228,32 +227,4 @@ public class WifiUtils { return WifiEntry.SECURITY_NONE; } public static final int CONNECT_TYPE_OTHERS = 0; public static final int CONNECT_TYPE_OPEN_NETWORK = 1; public static final int CONNECT_TYPE_SAVED_NETWORK = 2; public static final int CONNECT_TYPE_OSU_PROVISION = 3; /** * Gets the connecting type of {@link AccessPoint}. */ public static int getConnectingType(AccessPoint accessPoint) { final WifiConfiguration config = accessPoint.getConfig(); if (accessPoint.isOsuProvider()) { return CONNECT_TYPE_OSU_PROVISION; } else if ((accessPoint.getSecurity() == AccessPoint.SECURITY_NONE) || (accessPoint.getSecurity() == AccessPoint.SECURITY_OWE)) { return CONNECT_TYPE_OPEN_NETWORK; } else if (accessPoint.isSaved() && config != null && config.getNetworkSelectionStatus() != null && config.getNetworkSelectionStatus().hasEverConnected()) { return CONNECT_TYPE_SAVED_NETWORK; } else if (accessPoint.isPasspoint()) { // Access point provided by an installed Passpoint provider, connect using // the associated config. return CONNECT_TYPE_SAVED_NETWORK; } else { return CONNECT_TYPE_OTHERS; } } } src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java +2 −5 Original line number Diff line number Diff line Loading @@ -65,7 +65,6 @@ import com.android.settings.datausage.WifiDataUsageSummaryPreferenceController; import com.android.settings.widget.EntityHeaderController; import com.android.settings.wifi.WifiDialog2; import com.android.settings.wifi.WifiDialog2.WifiDialog2Listener; import com.android.settings.wifi.WifiEntryShell; import com.android.settings.wifi.WifiUtils; import com.android.settings.wifi.dpp.WifiDppUtils; import com.android.settingslib.core.AbstractPreferenceController; Loading Loading @@ -576,11 +575,9 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle final int frequency = connectedInfo.frequencyMhz; String band = null; if (frequency >= WifiEntryShell.LOWER_FREQ_24GHZ && frequency < WifiEntryShell.HIGHER_FREQ_24GHZ) { if (frequency >= WifiEntry.MIN_FREQ_24GHZ && frequency < WifiEntry.MAX_FREQ_24GHZ) { band = mContext.getResources().getString(R.string.wifi_band_24ghz); } else if (frequency >= WifiEntryShell.LOWER_FREQ_5GHZ && frequency < WifiEntryShell.HIGHER_FREQ_5GHZ) { } else if (frequency >= WifiEntry.MIN_FREQ_5GHZ && frequency < WifiEntry.MAX_FREQ_5GHZ) { band = mContext.getResources().getString(R.string.wifi_band_5ghz); } else { // Connecting state is unstable, make it disappeared if unexpected Loading src/com/android/settings/wifi/dpp/WifiDppUtils.java +16 −61 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ public class WifiDppUtils { */ static final String TAG_FRAGMENT_ADD_DEVICE = "add_device_fragment"; /** The data is from {@code com.android.settingslib.wifi.AccessPoint.securityToString} */ /** The data is one of the static String SECURITY_* in {@link WifiQrCode} */ static final String EXTRA_WIFI_SECURITY = "security"; /** The data corresponding to {@code WifiConfiguration} SSID */ Loading Loading @@ -251,36 +251,6 @@ public class WifiDppUtils { return intent; } /** * Returns an intent to launch QR code scanner. It may return null if the security is not * supported by QR code scanner. * * @param context The context to use for the content resolver * @param wifiManager An instance of {@link WifiManager} * @param accessPoint An instance of {@link AccessPoint} * @return Intent for launching QR code scanner */ public static Intent getConfiguratorQrCodeScannerIntentOrNull(Context context, WifiManager wifiManager, AccessPoint accessPoint) { final Intent intent = new Intent(context, WifiDppConfiguratorActivity.class); if (isSupportConfiguratorQrCodeScanner(context, accessPoint)) { intent.setAction(WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_QR_CODE_SCANNER); } else { return null; } final WifiConfiguration wifiConfiguration = accessPoint.getConfig(); setConfiguratorIntentExtra(intent, wifiManager, wifiConfiguration); if (wifiConfiguration.networkId == WifiConfiguration.INVALID_NETWORK_ID) { throw new IllegalArgumentException("Invalid network ID"); } else { intent.putExtra(EXTRA_WIFI_NETWORK_ID, wifiConfiguration.networkId); } return intent; } /** * Returns an intent to launch QR code scanner. It may return null if the security is not * supported by QR code scanner. Loading Loading @@ -434,20 +404,6 @@ public class WifiDppUtils { } } /** * Checks if QR code scanner supports to config other devices with the Wi-Fi network * * @param context The context to use for {@link WifiManager#isEasyConnectSupported()} * @param accessPoint The {@link AccessPoint} of the Wi-Fi network */ public static boolean isSupportConfiguratorQrCodeScanner(Context context, AccessPoint accessPoint) { if (accessPoint.isPasspoint()) { return false; } return isSupportWifiDpp(context, accessPoint.getSecurity()); } /** * Checks if QR code generator supports to config other devices with the Wi-Fi network * Loading @@ -466,12 +422,11 @@ public class WifiDppUtils { * Checks if this device supports to be configured by the Wi-Fi network of the security * * @param context The context to use for {@code WifiManager} * @param accesspointSecurity The security constants defined in {@link AccessPoint} * @param wifiEntrySecurity The security constants defined in {@link WifiEntry} */ public static boolean isSupportEnrolleeQrCodeScanner(Context context, int accesspointSecurity) { return isSupportWifiDpp(context, accesspointSecurity) || isSupportZxing(context, accesspointSecurity); public static boolean isSupportEnrolleeQrCodeScanner(Context context, int wifiEntrySecurity) { return isSupportWifiDpp(context, wifiEntrySecurity) || isSupportZxing(context, wifiEntrySecurity); } private static boolean isSupportHotspotConfiguratorQrCodeGenerator( Loading @@ -483,39 +438,39 @@ public class WifiDppUtils { || softApConfiguration.getSecurityType() == SoftApConfiguration.SECURITY_TYPE_OPEN; } private static boolean isSupportWifiDpp(Context context, int accesspointSecurity) { private static boolean isSupportWifiDpp(Context context, int wifiEntrySecurity) { if (!isWifiDppEnabled(context)) { return false; } // DPP 1.0 only supports SAE and PSK. final WifiManager wifiManager = context.getSystemService(WifiManager.class); switch (accesspointSecurity) { case AccessPoint.SECURITY_SAE: switch (wifiEntrySecurity) { case WifiEntry.SECURITY_SAE: if (wifiManager.isWpa3SaeSupported()) { return true; } break; case AccessPoint.SECURITY_PSK: case WifiEntry.SECURITY_PSK: return true; default: } return false; } private static boolean isSupportZxing(Context context, int accesspointSecurity) { private static boolean isSupportZxing(Context context, int wifiEntrySecurity) { final WifiManager wifiManager = context.getSystemService(WifiManager.class); switch (accesspointSecurity) { case AccessPoint.SECURITY_PSK: case AccessPoint.SECURITY_WEP: case AccessPoint.SECURITY_NONE: switch (wifiEntrySecurity) { case WifiEntry.SECURITY_PSK: case WifiEntry.SECURITY_WEP: case WifiEntry.SECURITY_NONE: return true; case AccessPoint.SECURITY_SAE: case WifiEntry.SECURITY_SAE: if (wifiManager.isWpa3SaeSupported()) { return true; } break; case AccessPoint.SECURITY_OWE: case WifiEntry.SECURITY_OWE: if (wifiManager.isEnhancedOpenSupported()) { return true; } Loading Loading
src/com/android/settings/wifi/WifiConfigController2.java +6 −22 Original line number Diff line number Diff line Loading @@ -70,7 +70,6 @@ import com.android.settings.wifi.details2.WifiPrivacyPreferenceController2; import com.android.settings.wifi.dpp.WifiDppUtils; import com.android.settingslib.Utils; import com.android.settingslib.utils.ThreadUtils; import com.android.settingslib.wifi.AccessPoint; import com.android.wifitrackerlib.WifiEntry; import com.android.wifitrackerlib.WifiEntry.ConnectedInfo; Loading Loading @@ -363,19 +362,6 @@ public class WifiConfigController2 implements TextWatcher, && signalLevel != null) { mConfigUi.setSubmitButton(res.getString(R.string.wifi_connect)); } else { // TODO(b/143326832): Add fine-grained state information. //WifiConfiguration config = mWifiEntry.getWifiConfiguration(); //String suggestionOrSpecifierPackageName = null; //if (config != null // && (config.fromWifiNetworkSpecifier // || config.fromWifiNetworkSuggestion)) { // suggestionOrSpecifierPackageName = config.creatorName; //} //String summary = AccessPoint.getSummary( // mConfigUi.getContext(), /* ssid */ null, state, isEphemeral, // suggestionOrSpecifierPackageName); //addRow(group, R.string.wifi_status, summary); if (signalLevel != null) { addRow(group, R.string.wifi_signal, signalLevel); } Loading @@ -390,11 +376,11 @@ public class WifiConfigController2 implements TextWatcher, final int frequency = info.frequencyMhz; String band = null; if (frequency >= WifiEntryShell.LOWER_FREQ_24GHZ && frequency < WifiEntryShell.HIGHER_FREQ_24GHZ) { if (frequency >= WifiEntry.MIN_FREQ_24GHZ && frequency < WifiEntry.MAX_FREQ_24GHZ) { band = res.getString(R.string.wifi_band_24ghz); } else if (frequency >= WifiEntryShell.LOWER_FREQ_5GHZ && frequency < WifiEntryShell.HIGHER_FREQ_5GHZ) { } else if (frequency >= WifiEntry.MIN_FREQ_5GHZ && frequency < WifiEntry.MAX_FREQ_5GHZ) { band = res.getString(R.string.wifi_band_5ghz); } else { Log.e(TAG, "Unexpected frequency " + frequency); Loading Loading @@ -598,13 +584,11 @@ public class WifiConfigController2 implements TextWatcher, WifiConfiguration config = new WifiConfiguration(); if (mWifiEntry == null) { config.SSID = AccessPoint.convertToQuotedString( mSsidView.getText().toString()); config.SSID = "\"" + mSsidView.getText().toString() + "\""; // If the user adds a network manually, assume that it is hidden. config.hiddenSSID = mHiddenSettingsSpinner.getSelectedItemPosition() == HIDDEN_NETWORK; } else if (!mWifiEntry.isSaved()) { config.SSID = AccessPoint.convertToQuotedString( mWifiEntry.getTitle()); config.SSID = "\"" + mWifiEntry.getTitle() + "\""; } else { config.networkId = mWifiEntry.getWifiConfiguration().networkId; config.hiddenSSID = mWifiEntry.getWifiConfiguration().hiddenSSID; Loading
src/com/android/settings/wifi/WifiEntryShell.javadeleted 100644 → 0 +0 −49 Original line number Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.wifi; import com.android.wifitrackerlib.WifiEntry; /** * {@link WifiEntry is working in progess, many methods are not available, this class is to group * all the unavalable {@link AccessPoint} methods & constants. * * TODO(b/143326832): Replace all methods & constants with WifiEntry version when it's available. */ public class WifiEntryShell { public WifiEntryShell(){}; /** * Lower bound on the 2.4 GHz (802.11b/g/n) WLAN channels */ public static final int LOWER_FREQ_24GHZ = 2400; /** * Upper bound on the 2.4 GHz (802.11b/g/n) WLAN channels */ public static final int HIGHER_FREQ_24GHZ = 2500; /** * Lower bound on the 5.0 GHz (802.11a/h/j/n/ac) WLAN channels */ public static final int LOWER_FREQ_5GHZ = 4900; /** * Upper bound on the 5.0 GHz (802.11a/h/j/n/ac) WLAN channels */ public static final int HIGHER_FREQ_5GHZ = 5900; }
src/com/android/settings/wifi/WifiUtils.java +2 −31 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.provider.Settings; import android.text.TextUtils; import com.android.settings.Utils; import com.android.settingslib.wifi.AccessPoint; import com.android.wifitrackerlib.WifiEntry; import java.nio.charset.StandardCharsets; Loading Loading @@ -158,11 +157,11 @@ public class WifiUtils { final int security; if (wifiEntry == null) { config.SSID = AccessPoint.convertToQuotedString(scanResult.SSID); config.SSID = "\"" + scanResult.SSID + "\""; security = getWifiEntrySecurity(scanResult); } else { if (wifiEntry.getWifiConfiguration() == null) { config.SSID = AccessPoint.convertToQuotedString(wifiEntry.getSsid()); config.SSID = "\"" + wifiEntry.getSsid() + "\""; } else { config.networkId = wifiEntry.getWifiConfiguration().networkId; config.hiddenSSID = wifiEntry.getWifiConfiguration().hiddenSSID; Loading Loading @@ -228,32 +227,4 @@ public class WifiUtils { return WifiEntry.SECURITY_NONE; } public static final int CONNECT_TYPE_OTHERS = 0; public static final int CONNECT_TYPE_OPEN_NETWORK = 1; public static final int CONNECT_TYPE_SAVED_NETWORK = 2; public static final int CONNECT_TYPE_OSU_PROVISION = 3; /** * Gets the connecting type of {@link AccessPoint}. */ public static int getConnectingType(AccessPoint accessPoint) { final WifiConfiguration config = accessPoint.getConfig(); if (accessPoint.isOsuProvider()) { return CONNECT_TYPE_OSU_PROVISION; } else if ((accessPoint.getSecurity() == AccessPoint.SECURITY_NONE) || (accessPoint.getSecurity() == AccessPoint.SECURITY_OWE)) { return CONNECT_TYPE_OPEN_NETWORK; } else if (accessPoint.isSaved() && config != null && config.getNetworkSelectionStatus() != null && config.getNetworkSelectionStatus().hasEverConnected()) { return CONNECT_TYPE_SAVED_NETWORK; } else if (accessPoint.isPasspoint()) { // Access point provided by an installed Passpoint provider, connect using // the associated config. return CONNECT_TYPE_SAVED_NETWORK; } else { return CONNECT_TYPE_OTHERS; } } }
src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java +2 −5 Original line number Diff line number Diff line Loading @@ -65,7 +65,6 @@ import com.android.settings.datausage.WifiDataUsageSummaryPreferenceController; import com.android.settings.widget.EntityHeaderController; import com.android.settings.wifi.WifiDialog2; import com.android.settings.wifi.WifiDialog2.WifiDialog2Listener; import com.android.settings.wifi.WifiEntryShell; import com.android.settings.wifi.WifiUtils; import com.android.settings.wifi.dpp.WifiDppUtils; import com.android.settingslib.core.AbstractPreferenceController; Loading Loading @@ -576,11 +575,9 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle final int frequency = connectedInfo.frequencyMhz; String band = null; if (frequency >= WifiEntryShell.LOWER_FREQ_24GHZ && frequency < WifiEntryShell.HIGHER_FREQ_24GHZ) { if (frequency >= WifiEntry.MIN_FREQ_24GHZ && frequency < WifiEntry.MAX_FREQ_24GHZ) { band = mContext.getResources().getString(R.string.wifi_band_24ghz); } else if (frequency >= WifiEntryShell.LOWER_FREQ_5GHZ && frequency < WifiEntryShell.HIGHER_FREQ_5GHZ) { } else if (frequency >= WifiEntry.MIN_FREQ_5GHZ && frequency < WifiEntry.MAX_FREQ_5GHZ) { band = mContext.getResources().getString(R.string.wifi_band_5ghz); } else { // Connecting state is unstable, make it disappeared if unexpected Loading
src/com/android/settings/wifi/dpp/WifiDppUtils.java +16 −61 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ public class WifiDppUtils { */ static final String TAG_FRAGMENT_ADD_DEVICE = "add_device_fragment"; /** The data is from {@code com.android.settingslib.wifi.AccessPoint.securityToString} */ /** The data is one of the static String SECURITY_* in {@link WifiQrCode} */ static final String EXTRA_WIFI_SECURITY = "security"; /** The data corresponding to {@code WifiConfiguration} SSID */ Loading Loading @@ -251,36 +251,6 @@ public class WifiDppUtils { return intent; } /** * Returns an intent to launch QR code scanner. It may return null if the security is not * supported by QR code scanner. * * @param context The context to use for the content resolver * @param wifiManager An instance of {@link WifiManager} * @param accessPoint An instance of {@link AccessPoint} * @return Intent for launching QR code scanner */ public static Intent getConfiguratorQrCodeScannerIntentOrNull(Context context, WifiManager wifiManager, AccessPoint accessPoint) { final Intent intent = new Intent(context, WifiDppConfiguratorActivity.class); if (isSupportConfiguratorQrCodeScanner(context, accessPoint)) { intent.setAction(WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_QR_CODE_SCANNER); } else { return null; } final WifiConfiguration wifiConfiguration = accessPoint.getConfig(); setConfiguratorIntentExtra(intent, wifiManager, wifiConfiguration); if (wifiConfiguration.networkId == WifiConfiguration.INVALID_NETWORK_ID) { throw new IllegalArgumentException("Invalid network ID"); } else { intent.putExtra(EXTRA_WIFI_NETWORK_ID, wifiConfiguration.networkId); } return intent; } /** * Returns an intent to launch QR code scanner. It may return null if the security is not * supported by QR code scanner. Loading Loading @@ -434,20 +404,6 @@ public class WifiDppUtils { } } /** * Checks if QR code scanner supports to config other devices with the Wi-Fi network * * @param context The context to use for {@link WifiManager#isEasyConnectSupported()} * @param accessPoint The {@link AccessPoint} of the Wi-Fi network */ public static boolean isSupportConfiguratorQrCodeScanner(Context context, AccessPoint accessPoint) { if (accessPoint.isPasspoint()) { return false; } return isSupportWifiDpp(context, accessPoint.getSecurity()); } /** * Checks if QR code generator supports to config other devices with the Wi-Fi network * Loading @@ -466,12 +422,11 @@ public class WifiDppUtils { * Checks if this device supports to be configured by the Wi-Fi network of the security * * @param context The context to use for {@code WifiManager} * @param accesspointSecurity The security constants defined in {@link AccessPoint} * @param wifiEntrySecurity The security constants defined in {@link WifiEntry} */ public static boolean isSupportEnrolleeQrCodeScanner(Context context, int accesspointSecurity) { return isSupportWifiDpp(context, accesspointSecurity) || isSupportZxing(context, accesspointSecurity); public static boolean isSupportEnrolleeQrCodeScanner(Context context, int wifiEntrySecurity) { return isSupportWifiDpp(context, wifiEntrySecurity) || isSupportZxing(context, wifiEntrySecurity); } private static boolean isSupportHotspotConfiguratorQrCodeGenerator( Loading @@ -483,39 +438,39 @@ public class WifiDppUtils { || softApConfiguration.getSecurityType() == SoftApConfiguration.SECURITY_TYPE_OPEN; } private static boolean isSupportWifiDpp(Context context, int accesspointSecurity) { private static boolean isSupportWifiDpp(Context context, int wifiEntrySecurity) { if (!isWifiDppEnabled(context)) { return false; } // DPP 1.0 only supports SAE and PSK. final WifiManager wifiManager = context.getSystemService(WifiManager.class); switch (accesspointSecurity) { case AccessPoint.SECURITY_SAE: switch (wifiEntrySecurity) { case WifiEntry.SECURITY_SAE: if (wifiManager.isWpa3SaeSupported()) { return true; } break; case AccessPoint.SECURITY_PSK: case WifiEntry.SECURITY_PSK: return true; default: } return false; } private static boolean isSupportZxing(Context context, int accesspointSecurity) { private static boolean isSupportZxing(Context context, int wifiEntrySecurity) { final WifiManager wifiManager = context.getSystemService(WifiManager.class); switch (accesspointSecurity) { case AccessPoint.SECURITY_PSK: case AccessPoint.SECURITY_WEP: case AccessPoint.SECURITY_NONE: switch (wifiEntrySecurity) { case WifiEntry.SECURITY_PSK: case WifiEntry.SECURITY_WEP: case WifiEntry.SECURITY_NONE: return true; case AccessPoint.SECURITY_SAE: case WifiEntry.SECURITY_SAE: if (wifiManager.isWpa3SaeSupported()) { return true; } break; case AccessPoint.SECURITY_OWE: case WifiEntry.SECURITY_OWE: if (wifiManager.isEnhancedOpenSupported()) { return true; } Loading