SpoofProvider: Refactor and adjust a bit

* Show default device on top under different category
* Remove spoof configuration when default is selected

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2024-11-19 13:37:26 +07:00
parent a26a4953c8
commit 84cd577a3c
12 changed files with 229 additions and 186 deletions

View File

@@ -36,22 +36,22 @@ class SpoofProviderTest {
@Test
fun testSpoofingDeviceLocale() {
assertThat(spoofProvider.isLocaleSpoofEnabled()).isFalse()
assertThat(spoofProvider.isLocaleSpoofEnabled).isFalse()
spoofProvider.setSpoofLocale(Locale.JAPAN)
assertThat(spoofProvider.isLocaleSpoofEnabled()).isTrue()
assertThat(spoofProvider.getSpoofLocale() == Locale.JAPAN).isTrue()
assertThat(spoofProvider.isLocaleSpoofEnabled).isTrue()
assertThat(spoofProvider.locale == Locale.JAPAN).isTrue()
}
@Test
fun testSpoofingDeviceProperties() {
assertThat(spoofProvider.isDeviceSpoofEnabled()).isFalse()
assertThat(spoofProvider.isDeviceSpoofEnabled).isFalse()
val properties = Properties().apply {
setProperty("UserReadableName", "Test")
}
spoofProvider.setSpoofDeviceProperties(properties)
assertThat(spoofProvider.isDeviceSpoofEnabled()).isTrue()
assertThat(spoofProvider.getSpoofDeviceProperties() == properties).isTrue()
assertThat(spoofProvider.isDeviceSpoofEnabled).isTrue()
assertThat(spoofProvider.deviceProperties == properties).isTrue()
}
}