diff options
| -rwxr-xr-x | api/system-current.txt | 1 | ||||
| -rw-r--r-- | wifi/java/android/net/wifi/WifiInfo.java | 16 |
2 files changed, 15 insertions, 2 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 305d5713b975..1c2b84bc83df 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5671,6 +5671,7 @@ package android.net.wifi { public class WifiInfo implements android.os.Parcelable { method public boolean isOsuAp(); method public boolean isPasspointAp(); + method @Nullable public static String sanitizeSsid(@Nullable String); } public class WifiManager { diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java index 8bad71ba747b..0204113b614b 100644 --- a/wifi/java/android/net/wifi/WifiInfo.java +++ b/wifi/java/android/net/wifi/WifiInfo.java @@ -658,9 +658,21 @@ public class WifiInfo implements Parcelable { } } - /** {@hide} */ + /** + * Remove double quotes (") surrounding a SSID string, if present. Otherwise, return the + * string unmodified. Return null if the input string was null. + * @hide + */ + @Nullable + @SystemApi + public static String sanitizeSsid(@Nullable String string) { + return removeDoubleQuotes(string); + } + + /** @hide */ @UnsupportedAppUsage - public static String removeDoubleQuotes(String string) { + @Nullable + public static String removeDoubleQuotes(@Nullable String string) { if (string == null) return null; final int length = string.length(); if ((length > 1) && (string.charAt(0) == '"') && (string.charAt(length - 1) == '"')) { |