Add dhcp in advanced settings toggle.

Test: Unit Test
Fix: 329002870
Change-Id: I5c57deb1e8ed0dd59a7699b56f5eb99ca29876b8
This commit is contained in:
Charlotte Lu
2024-03-11 11:28:41 +08:00
parent 46369353ed
commit 08f8f0ce9e
7 changed files with 151 additions and 0 deletions

View File

@@ -63,4 +63,32 @@ class WifiPrivacyPreferenceController(context: Context, preferenceKey: String) :
}
})
}
companion object {
private const val PREF_SEND_DHCP_HOST_NAME_ENABLE = 0
private const val PREF_SEND_DHCP_HOST_NAME_DISABLE = 1
/**
* Returns preference index value.
*
* @param isSendDhcpHostnameEnabled determines whether device name can be sent.
* @return index value of preference
*/
fun translateSendDhcpHostnameEnabledToPrefValue(
isSendDhcpHostnameEnabled: Boolean
): Int {
return if (isSendDhcpHostnameEnabled) PREF_SEND_DHCP_HOST_NAME_ENABLE
else PREF_SEND_DHCP_HOST_NAME_DISABLE
}
/**
* Returns whether device name can be sent.
*
* @param prefDhcpRandomized is preference index value
* @return is send dhcp host name enabled
*/
fun translatePrefValueToSendDhcpHostnameEnabled(prefDhcpRandomized: Int): Boolean {
return prefDhcpRandomized == PREF_SEND_DHCP_HOST_NAME_ENABLE
}
}
}