SoftAp: Use toString() API in place of toBinaryString for indexes

Security option index values are currently converted using
toBinaryString() which converts indexes to binary String. Thus
index values doesn't match the expected Security config values in
SoftApConfiguration.

This commit uses toString() API to avoid index mismatch.

Bug: 197497991
Test: manual test
atest -c WifiTetherSecurityPreferenceControllerTest

Change-Id: I43d236d071a8141845f312c63b1a693fde254358
This commit is contained in:
Weng Su
2021-11-19 23:03:32 +08:00
parent 0b911cf91c
commit 5c00d3c074

View File

@@ -82,7 +82,7 @@ public class WifiTetherSecurityPreferenceController extends WifiTetherBasePrefer
if (!mIsWpa3Supported && mSecurityMap.keySet()
.removeIf(key -> key > SoftApConfiguration.SECURITY_TYPE_WPA2_PSK)) {
preference.setEntries(mSecurityMap.values().stream().toArray(CharSequence[]::new));
preference.setEntryValues(mSecurityMap.keySet().stream().map(Integer::toBinaryString)
preference.setEntryValues(mSecurityMap.keySet().stream().map(i -> Integer.toString(i))
.toArray(CharSequence[]::new));
}