Loading src/com/android/settings/wifi/WifiConfigController2.java +2 −2 Original line number Diff line number Diff line Loading @@ -341,7 +341,7 @@ public class WifiConfigController2 implements TextWatcher, if ((!mWifiEntry.isSaved() && mWifiEntry.getConnectedState() != WifiEntry.CONNECTED_STATE_CONNECTED && !WifiEntryShell.isPasspoint(mWifiEntry)) && !mWifiEntry.isSubscription()) || mMode != WifiConfigUiBase2.MODE_VIEW) { showSecurityFields(/* refreshEapMethods */ true, /* refreshCertificates */ true); showIpConfigFields(); Loading Loading @@ -417,7 +417,7 @@ public class WifiConfigController2 implements TextWatcher, } if (mWifiEntry.isSaved() || mWifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_CONNECTED || WifiEntryShell.isPasspoint(mWifiEntry)) { || mWifiEntry.isSubscription()) { mConfigUi.setForgetButton(res.getString(R.string.wifi_forget)); } } Loading src/com/android/settings/wifi/WifiEntryShell.java +0 −23 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.settings.wifi; import android.net.wifi.WifiConfiguration; import com.android.wifitrackerlib.WifiEntry; /** Loading Loading @@ -50,20 +48,6 @@ public class WifiEntryShell { */ public static final int HIGHER_FREQ_5GHZ = 5900; /** * Mapping of the corresponding {@link WifiConfiguration} field */ public static int getNetworkId(WifiEntry wifiEntry) { return 0; } /** * Mapping of the corresponding {@link WifiConfiguration} field */ public static boolean hiddenSSID(WifiEntry wifiEntry) { return false; } /** * Mapping of the corresponding {@link AccessPoint} method */ Loading @@ -73,13 +57,6 @@ public class WifiEntryShell { // Passpoint methods /** * Mapping of the corresponding {@link AccessPoint} method */ public static boolean isPasspoint(WifiEntry wifiEntry) { return false; } /** * Mapping of the corresponding {@link AccessPoint} method */ Loading src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java +3 −3 Original line number Diff line number Diff line Loading @@ -537,7 +537,7 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle } private void refreshSsid() { if (WifiEntryShell.isPasspoint(mWifiEntry) || WifiEntryShell.isOsuProvider(mWifiEntry)) { if (mWifiEntry.isSubscription() || WifiEntryShell.isOsuProvider(mWifiEntry)) { mSsidPref.setVisible(true); mSsidPref.setSummary(mWifiEntry.getTitle()); } else { Loading Loading @@ -723,7 +723,7 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle * Forgets the wifi network associated with this preference. */ private void forgetNetwork() { if (WifiEntryShell.isPasspoint(mWifiEntry)) { if (mWifiEntry.isSubscription()) { // Post a dialog to confirm if user really want to forget the passpoint network. showConfirmForgetDialog(); return; Loading Loading @@ -851,7 +851,7 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle // For saved Passpoint network, framework doesn't have the field to keep the MAC choice // persistently, so Passpoint network will always use the default value so far, which is // randomized MAC address, so don't need to modify title. if (WifiEntryShell.isPasspoint(mWifiEntry)) { if (mWifiEntry.isSubscription()) { return; } Loading src/com/android/settings/wifi/dpp/WifiDppUtils.java +7 −47 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.os.Vibrator; import android.text.TextUtils; import com.android.settings.R; import com.android.settings.wifi.WifiEntryShell; import com.android.settingslib.wifi.AccessPoint; import com.android.wifitrackerlib.WifiEntry; Loading Loading @@ -150,24 +149,6 @@ public class WifiDppUtils { return wifiConfiguration.preSharedKey; } private static String getPresharedKey(WifiManager wifiManager, WifiEntry wifiEntry) { final List<WifiConfiguration> privilegedWifiConfigurations = wifiManager.getPrivilegedConfiguredNetworks(); for (WifiConfiguration privilegedWifiConfiguration : privilegedWifiConfigurations) { if (privilegedWifiConfiguration.networkId == WifiEntryShell.getNetworkId(wifiEntry)) { // WEP uses a shared key hence the AuthAlgorithm.SHARED is used to identify it. if (wifiEntry.getSecurity() == WifiEntry.SECURITY_WEP) { return privilegedWifiConfiguration .wepKeys[privilegedWifiConfiguration.wepTxKeyIndex]; } else { return privilegedWifiConfiguration.preSharedKey; } } } return ""; } private static String removeFirstAndLastDoubleQuotes(String str) { if (TextUtils.isEmpty(str)) { return str; Loading Loading @@ -268,7 +249,8 @@ public class WifiDppUtils { return null; } setConfiguratorIntentExtra(intent, wifiManager, wifiEntry); final WifiConfiguration wifiConfiguration = wifiEntry.getWifiConfiguration(); setConfiguratorIntentExtra(intent, wifiManager, wifiConfiguration); // For a transition mode Wi-Fi AP, creates a QR code that's compatible with more devices if (wifiEntry.getSecurity() == WifiEntry.SECURITY_PSK_SAE_TRANSITION) { Loading Loading @@ -326,13 +308,13 @@ public class WifiDppUtils { return null; } setConfiguratorIntentExtra(intent, wifiManager, wifiEntry); final WifiConfiguration wifiConfiguration = wifiEntry.getWifiConfiguration(); setConfiguratorIntentExtra(intent, wifiManager, wifiConfiguration); final int networkId = WifiEntryShell.getNetworkId(wifiEntry); if (networkId == WifiConfiguration.INVALID_NETWORK_ID) { if (wifiConfiguration.networkId == WifiConfiguration.INVALID_NETWORK_ID) { throw new IllegalArgumentException("Invalid network ID"); } else { intent.putExtra(EXTRA_WIFI_NETWORK_ID, networkId); intent.putExtra(EXTRA_WIFI_NETWORK_ID, wifiConfiguration.networkId); } return intent; Loading Loading @@ -417,28 +399,6 @@ public class WifiDppUtils { intent.putExtra(EXTRA_WIFI_HIDDEN_SSID, wifiConfiguration.hiddenSSID); } private static void setConfiguratorIntentExtra(Intent intent, WifiManager wifiManager, WifiEntry wifiEntry) { final String ssid = removeFirstAndLastDoubleQuotes(wifiEntry.getTitle()); final String security = getSecurityString(wifiEntry); // When the value of this key is read, the actual key is not returned, just a "*". // Call privileged system API to obtain actual key. final String preSharedKey = removeFirstAndLastDoubleQuotes(getPresharedKey(wifiManager, wifiEntry)); if (!TextUtils.isEmpty(ssid)) { intent.putExtra(EXTRA_WIFI_SSID, ssid); } if (!TextUtils.isEmpty(security)) { intent.putExtra(EXTRA_WIFI_SECURITY, security); } if (!TextUtils.isEmpty(preSharedKey)) { intent.putExtra(EXTRA_WIFI_PRE_SHARED_KEY, preSharedKey); } intent.putExtra(EXTRA_WIFI_HIDDEN_SSID, WifiEntryShell.hiddenSSID(wifiEntry)); } /** * Shows authentication screen to confirm credentials (pin, pattern or password) for the current * user of the device. Loading Loading @@ -504,7 +464,7 @@ public class WifiDppUtils { * @param wifiEntry The {@link WifiEntry} of the Wi-Fi network */ public static boolean isSupportConfiguratorQrCodeScanner(Context context, WifiEntry wifiEntry) { if (WifiEntryShell.isPasspoint(wifiEntry)) { if (wifiEntry.isSubscription()) { return false; } return isSupportWifiDpp(context, wifiEntry.getSecurity()); Loading Loading
src/com/android/settings/wifi/WifiConfigController2.java +2 −2 Original line number Diff line number Diff line Loading @@ -341,7 +341,7 @@ public class WifiConfigController2 implements TextWatcher, if ((!mWifiEntry.isSaved() && mWifiEntry.getConnectedState() != WifiEntry.CONNECTED_STATE_CONNECTED && !WifiEntryShell.isPasspoint(mWifiEntry)) && !mWifiEntry.isSubscription()) || mMode != WifiConfigUiBase2.MODE_VIEW) { showSecurityFields(/* refreshEapMethods */ true, /* refreshCertificates */ true); showIpConfigFields(); Loading Loading @@ -417,7 +417,7 @@ public class WifiConfigController2 implements TextWatcher, } if (mWifiEntry.isSaved() || mWifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_CONNECTED || WifiEntryShell.isPasspoint(mWifiEntry)) { || mWifiEntry.isSubscription()) { mConfigUi.setForgetButton(res.getString(R.string.wifi_forget)); } } Loading
src/com/android/settings/wifi/WifiEntryShell.java +0 −23 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.settings.wifi; import android.net.wifi.WifiConfiguration; import com.android.wifitrackerlib.WifiEntry; /** Loading Loading @@ -50,20 +48,6 @@ public class WifiEntryShell { */ public static final int HIGHER_FREQ_5GHZ = 5900; /** * Mapping of the corresponding {@link WifiConfiguration} field */ public static int getNetworkId(WifiEntry wifiEntry) { return 0; } /** * Mapping of the corresponding {@link WifiConfiguration} field */ public static boolean hiddenSSID(WifiEntry wifiEntry) { return false; } /** * Mapping of the corresponding {@link AccessPoint} method */ Loading @@ -73,13 +57,6 @@ public class WifiEntryShell { // Passpoint methods /** * Mapping of the corresponding {@link AccessPoint} method */ public static boolean isPasspoint(WifiEntry wifiEntry) { return false; } /** * Mapping of the corresponding {@link AccessPoint} method */ Loading
src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java +3 −3 Original line number Diff line number Diff line Loading @@ -537,7 +537,7 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle } private void refreshSsid() { if (WifiEntryShell.isPasspoint(mWifiEntry) || WifiEntryShell.isOsuProvider(mWifiEntry)) { if (mWifiEntry.isSubscription() || WifiEntryShell.isOsuProvider(mWifiEntry)) { mSsidPref.setVisible(true); mSsidPref.setSummary(mWifiEntry.getTitle()); } else { Loading Loading @@ -723,7 +723,7 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle * Forgets the wifi network associated with this preference. */ private void forgetNetwork() { if (WifiEntryShell.isPasspoint(mWifiEntry)) { if (mWifiEntry.isSubscription()) { // Post a dialog to confirm if user really want to forget the passpoint network. showConfirmForgetDialog(); return; Loading Loading @@ -851,7 +851,7 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle // For saved Passpoint network, framework doesn't have the field to keep the MAC choice // persistently, so Passpoint network will always use the default value so far, which is // randomized MAC address, so don't need to modify title. if (WifiEntryShell.isPasspoint(mWifiEntry)) { if (mWifiEntry.isSubscription()) { return; } Loading
src/com/android/settings/wifi/dpp/WifiDppUtils.java +7 −47 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.os.Vibrator; import android.text.TextUtils; import com.android.settings.R; import com.android.settings.wifi.WifiEntryShell; import com.android.settingslib.wifi.AccessPoint; import com.android.wifitrackerlib.WifiEntry; Loading Loading @@ -150,24 +149,6 @@ public class WifiDppUtils { return wifiConfiguration.preSharedKey; } private static String getPresharedKey(WifiManager wifiManager, WifiEntry wifiEntry) { final List<WifiConfiguration> privilegedWifiConfigurations = wifiManager.getPrivilegedConfiguredNetworks(); for (WifiConfiguration privilegedWifiConfiguration : privilegedWifiConfigurations) { if (privilegedWifiConfiguration.networkId == WifiEntryShell.getNetworkId(wifiEntry)) { // WEP uses a shared key hence the AuthAlgorithm.SHARED is used to identify it. if (wifiEntry.getSecurity() == WifiEntry.SECURITY_WEP) { return privilegedWifiConfiguration .wepKeys[privilegedWifiConfiguration.wepTxKeyIndex]; } else { return privilegedWifiConfiguration.preSharedKey; } } } return ""; } private static String removeFirstAndLastDoubleQuotes(String str) { if (TextUtils.isEmpty(str)) { return str; Loading Loading @@ -268,7 +249,8 @@ public class WifiDppUtils { return null; } setConfiguratorIntentExtra(intent, wifiManager, wifiEntry); final WifiConfiguration wifiConfiguration = wifiEntry.getWifiConfiguration(); setConfiguratorIntentExtra(intent, wifiManager, wifiConfiguration); // For a transition mode Wi-Fi AP, creates a QR code that's compatible with more devices if (wifiEntry.getSecurity() == WifiEntry.SECURITY_PSK_SAE_TRANSITION) { Loading Loading @@ -326,13 +308,13 @@ public class WifiDppUtils { return null; } setConfiguratorIntentExtra(intent, wifiManager, wifiEntry); final WifiConfiguration wifiConfiguration = wifiEntry.getWifiConfiguration(); setConfiguratorIntentExtra(intent, wifiManager, wifiConfiguration); final int networkId = WifiEntryShell.getNetworkId(wifiEntry); if (networkId == WifiConfiguration.INVALID_NETWORK_ID) { if (wifiConfiguration.networkId == WifiConfiguration.INVALID_NETWORK_ID) { throw new IllegalArgumentException("Invalid network ID"); } else { intent.putExtra(EXTRA_WIFI_NETWORK_ID, networkId); intent.putExtra(EXTRA_WIFI_NETWORK_ID, wifiConfiguration.networkId); } return intent; Loading Loading @@ -417,28 +399,6 @@ public class WifiDppUtils { intent.putExtra(EXTRA_WIFI_HIDDEN_SSID, wifiConfiguration.hiddenSSID); } private static void setConfiguratorIntentExtra(Intent intent, WifiManager wifiManager, WifiEntry wifiEntry) { final String ssid = removeFirstAndLastDoubleQuotes(wifiEntry.getTitle()); final String security = getSecurityString(wifiEntry); // When the value of this key is read, the actual key is not returned, just a "*". // Call privileged system API to obtain actual key. final String preSharedKey = removeFirstAndLastDoubleQuotes(getPresharedKey(wifiManager, wifiEntry)); if (!TextUtils.isEmpty(ssid)) { intent.putExtra(EXTRA_WIFI_SSID, ssid); } if (!TextUtils.isEmpty(security)) { intent.putExtra(EXTRA_WIFI_SECURITY, security); } if (!TextUtils.isEmpty(preSharedKey)) { intent.putExtra(EXTRA_WIFI_PRE_SHARED_KEY, preSharedKey); } intent.putExtra(EXTRA_WIFI_HIDDEN_SSID, WifiEntryShell.hiddenSSID(wifiEntry)); } /** * Shows authentication screen to confirm credentials (pin, pattern or password) for the current * user of the device. Loading Loading @@ -504,7 +464,7 @@ public class WifiDppUtils { * @param wifiEntry The {@link WifiEntry} of the Wi-Fi network */ public static boolean isSupportConfiguratorQrCodeScanner(Context context, WifiEntry wifiEntry) { if (WifiEntryShell.isPasspoint(wifiEntry)) { if (wifiEntry.isSubscription()) { return false; } return isSupportWifiDpp(context, wifiEntry.getSecurity()); Loading