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

Commit af50a693 authored by David Su's avatar David Su Committed by Android (Google) Code Review
Browse files

Merge changes from topic "api-review-removedoublequotes"

* changes:
  SettingsLib: Rename removeDoubleQuotes to sanitizeSsid
  Networking: Rename removeDoubleQuotes to sanitizeSsid
  Wifi: Rename removeDoubleQuotes to sanitizeSsid
parents 653dd7b1 9c9c02ca
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7580,7 +7580,7 @@ package android.net.wifi {
    method public boolean isEphemeral();
    method public boolean isOsuAp();
    method public boolean isPasspointAp();
    method @Nullable public static String removeDoubleQuotes(@Nullable String);
    method @Nullable public static String sanitizeSsid(@Nullable String);
    field public static final String DEFAULT_MAC_ADDRESS = "02:00:00:00:00:00";
    field public static final int INVALID_RSSI = -127; // 0xffffff81
  }
+2 −2
Original line number Diff line number Diff line
@@ -539,13 +539,13 @@ public class NetworkPolicyManager {

    /** @hide */
    public static String resolveNetworkId(WifiConfiguration config) {
        return WifiInfo.removeDoubleQuotes(config.isPasspoint()
        return WifiInfo.sanitizeSsid(config.isPasspoint()
                ? config.providerFriendlyName : config.SSID);
    }

    /** @hide */
    public static String resolveNetworkId(String ssid) {
        return WifiInfo.removeDoubleQuotes(ssid);
        return WifiInfo.sanitizeSsid(ssid);
    }

    /** @hide */
+2 −2
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ import static android.net.NetworkStats.METERED_YES;
import static android.net.NetworkStats.ROAMING_ALL;
import static android.net.NetworkStats.ROAMING_NO;
import static android.net.NetworkStats.ROAMING_YES;
import static android.net.wifi.WifiInfo.removeDoubleQuotes;
import static android.net.wifi.WifiInfo.sanitizeSsid;

import android.compat.annotation.UnsupportedAppUsage;
import android.os.Parcel;
@@ -401,7 +401,7 @@ public class NetworkTemplate implements Parcelable {
        switch (ident.mType) {
            case TYPE_WIFI:
                return Objects.equals(
                        removeDoubleQuotes(mNetworkId), removeDoubleQuotes(ident.mNetworkId));
                        sanitizeSsid(mNetworkId), sanitizeSsid(ident.mNetworkId));
            default:
                return false;
        }
+1 −1
Original line number Diff line number Diff line
@@ -216,7 +216,7 @@ public class NetworkPolicyEditor {
    private static NetworkTemplate buildUnquotedNetworkTemplate(NetworkTemplate template) {
        if (template == null) return null;
        final String networkId = template.getNetworkId();
        final String strippedNetworkId = WifiInfo.removeDoubleQuotes(networkId);
        final String strippedNetworkId = WifiInfo.sanitizeSsid(networkId);
        if (!TextUtils.equals(strippedNetworkId, networkId)) {
            return new NetworkTemplate(
                    template.getMatchRule(), template.getSubscriberId(), strippedNetworkId);
+6 −6
Original line number Diff line number Diff line
@@ -188,14 +188,14 @@ public class NetworkNotificationManager {
        int icon = getIcon(transportType, notifyType);
        if (notifyType == NotificationType.NO_INTERNET && transportType == TRANSPORT_WIFI) {
            title = r.getString(R.string.wifi_no_internet,
                    WifiInfo.removeDoubleQuotes(nai.networkCapabilities.getSSID()));
                    WifiInfo.sanitizeSsid(nai.networkCapabilities.getSSID()));
            details = r.getString(R.string.wifi_no_internet_detailed);
        } else if (notifyType == NotificationType.PRIVATE_DNS_BROKEN) {
            if (transportType == TRANSPORT_CELLULAR) {
                title = r.getString(R.string.mobile_no_internet);
            } else if (transportType == TRANSPORT_WIFI) {
                title = r.getString(R.string.wifi_no_internet,
                        WifiInfo.removeDoubleQuotes(nai.networkCapabilities.getSSID()));
                        WifiInfo.sanitizeSsid(nai.networkCapabilities.getSSID()));
            } else {
                title = r.getString(R.string.other_networks_no_internet);
            }
@@ -203,19 +203,19 @@ public class NetworkNotificationManager {
        } else if (notifyType == NotificationType.PARTIAL_CONNECTIVITY
                && transportType == TRANSPORT_WIFI) {
            title = r.getString(R.string.network_partial_connectivity,
                    WifiInfo.removeDoubleQuotes(nai.networkCapabilities.getSSID()));
                    WifiInfo.sanitizeSsid(nai.networkCapabilities.getSSID()));
            details = r.getString(R.string.network_partial_connectivity_detailed);
        } else if (notifyType == NotificationType.LOST_INTERNET &&
                transportType == TRANSPORT_WIFI) {
            title = r.getString(R.string.wifi_no_internet,
                    WifiInfo.removeDoubleQuotes(nai.networkCapabilities.getSSID()));
                    WifiInfo.sanitizeSsid(nai.networkCapabilities.getSSID()));
            details = r.getString(R.string.wifi_no_internet_detailed);
        } else if (notifyType == NotificationType.SIGN_IN) {
            switch (transportType) {
                case TRANSPORT_WIFI:
                    title = r.getString(R.string.wifi_available_sign_in, 0);
                    details = r.getString(R.string.network_available_sign_in_detailed,
                            WifiInfo.removeDoubleQuotes(nai.networkCapabilities.getSSID()));
                            WifiInfo.sanitizeSsid(nai.networkCapabilities.getSSID()));
                    break;
                case TRANSPORT_CELLULAR:
                    title = r.getString(R.string.network_available_sign_in, 0);
@@ -236,7 +236,7 @@ public class NetworkNotificationManager {
                    break;
            }
        } else if (notifyType == NotificationType.LOGGED_IN) {
            title = WifiInfo.removeDoubleQuotes(nai.networkCapabilities.getSSID());
            title = WifiInfo.sanitizeSsid(nai.networkCapabilities.getSSID());
            details = r.getString(R.string.captive_portal_logged_in_detailed);
        } else if (notifyType == NotificationType.NETWORK_SWITCH) {
            String fromTransport = getTransportName(transportType);
Loading