Remove BSSID if randomization is enabled
This commit is contained in:
@@ -546,7 +546,9 @@ data class SoftApConfigurationCompat(
|
||||
else -> passphrase
|
||||
}, securityType)
|
||||
setChannelsCompat(builder, channels)
|
||||
setBssid(builder, bssid?.toPlatform())
|
||||
setBssid(builder, bssid?.run {
|
||||
if (Build.VERSION.SDK_INT >= 31 && macRandomizationSetting != RANDOMIZATION_NONE) null else toPlatform()
|
||||
})
|
||||
setMaxNumberOfClients(builder, maxNumberOfClients)
|
||||
try {
|
||||
setShutdownTimeoutMillis(builder, shutdownTimeoutMillis)
|
||||
|
||||
@@ -155,9 +155,6 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
|
||||
if (text.isNullOrEmpty()) 0 else text.toString().toLong()
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 23 || arg.p2pMode) channels = generateChannels()
|
||||
bssid = if (dialogView.bssid.length() != 0) {
|
||||
MacAddressCompat.fromString(dialogView.bssid.text.toString())
|
||||
} else null
|
||||
maxNumberOfClients = dialogView.maxClient.text.let { text ->
|
||||
if (text.isNullOrEmpty()) 0 else text.toString().toInt()
|
||||
}
|
||||
@@ -167,6 +164,10 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
|
||||
blockedClientList = (dialogView.blockedList.text ?: "").split(nonMacChars)
|
||||
.filter { it.isNotEmpty() }.map { MacAddressCompat.fromString(it).toPlatform() }
|
||||
macRandomizationSetting = dialogView.macRandomization.selectedItemPosition
|
||||
bssid = if ((arg.p2pMode || Build.VERSION.SDK_INT < 31 && macRandomizationSetting ==
|
||||
SoftApConfigurationCompat.RANDOMIZATION_NONE) && dialogView.bssid.length() != 0) {
|
||||
MacAddressCompat.fromString(dialogView.bssid.text.toString())
|
||||
} else null
|
||||
isBridgedModeOpportunisticShutdownEnabled = dialogView.bridgedModeOpportunisticShutdown.isChecked
|
||||
isIeee80211axEnabled = dialogView.ieee80211ax.isChecked
|
||||
isIeee80211beEnabled = dialogView.ieee80211be.isChecked
|
||||
@@ -254,6 +255,7 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
|
||||
if (arg.p2pMode) dialogView.hiddenSsid.isGone = true
|
||||
if (arg.p2pMode && Build.VERSION.SDK_INT >= 29) dialogView.macRandomization.isEnabled = false
|
||||
else if (arg.p2pMode || Build.VERSION.SDK_INT < 31) dialogView.macRandomizationWrapper.isGone = true
|
||||
else dialogView.macRandomization.onItemSelectedListener = this@WifiApDialogFragment
|
||||
if (arg.p2pMode || Build.VERSION.SDK_INT < 31) {
|
||||
dialogView.ieee80211ax.isGone = true
|
||||
dialogView.bridgedModeOpportunisticShutdown.isGone = true
|
||||
@@ -382,8 +384,11 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
|
||||
} else null
|
||||
dialogView.bandError.isGone = bandError.isNullOrEmpty()
|
||||
dialogView.bandError.text = bandError
|
||||
val hideBssid = !arg.p2pMode && Build.VERSION.SDK_INT >= 31 &&
|
||||
dialogView.macRandomization.selectedItemPosition != SoftApConfigurationCompat.RANDOMIZATION_NONE
|
||||
dialogView.bssidWrapper.isGone = hideBssid
|
||||
dialogView.bssidWrapper.error = null
|
||||
val bssidValid = dialogView.bssid.length() == 0 || try {
|
||||
val bssidValid = hideBssid || dialogView.bssid.length() == 0 || try {
|
||||
val mac = MacAddressCompat.fromString(dialogView.bssid.text.toString())
|
||||
if (Build.VERSION.SDK_INT >= 30 && !arg.p2pMode) {
|
||||
SoftApConfigurationCompat.testPlatformValidity(mac.toPlatform())
|
||||
|
||||
@@ -349,24 +349,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_subhead"
|
||||
android:text="@string/wifi_hotspot_ap_advanced_title" />
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/bssid_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dip"
|
||||
app:counterEnabled="true"
|
||||
app:counterMaxLength="17"
|
||||
app:errorEnabled="true"
|
||||
android:hint="@string/wifi_advanced_mac_address_title">
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/bssid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:imeOptions="flagForceAscii"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:maxLength="17" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/mac_randomization_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
@@ -386,25 +368,43 @@
|
||||
android:minHeight="@dimen/touch_target_min"
|
||||
android:entries="@array/wifi_mac_randomization"
|
||||
android:prompt="@string/wifi_mac_randomization" />
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/persistent_randomized_mac_wrapper"
|
||||
</LinearLayout>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/bssid_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dip"
|
||||
app:counterEnabled="true"
|
||||
app:counterMaxLength="17"
|
||||
app:errorEnabled="true"
|
||||
android:hint="@string/wifi_advanced_mac_address_title">
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/bssid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dip"
|
||||
app:counterEnabled="true"
|
||||
app:counterMaxLength="17"
|
||||
app:errorEnabled="true"
|
||||
android:hint="@string/wifi_advanced_mac_address_persistent_randomized">
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/persistent_randomized_mac"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:imeOptions="flagForceAscii"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:maxLength="17" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
</LinearLayout>
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:imeOptions="flagForceAscii"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:maxLength="17" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/persistent_randomized_mac_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dip"
|
||||
app:counterEnabled="true"
|
||||
app:counterMaxLength="17"
|
||||
app:errorEnabled="true"
|
||||
android:hint="@string/wifi_advanced_mac_address_persistent_randomized">
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/persistent_randomized_mac"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_edit_content"
|
||||
android:imeOptions="flagForceAscii"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:maxLength="17" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/hidden_ssid"
|
||||
style="@style/wifi_item_label"
|
||||
|
||||
Reference in New Issue
Block a user