Merge "allKeys in DeviceConfigHelper should be populated with keys." into main

This commit is contained in:
Holly Jiuyu Sun authored and Android (Google) Code Review committed 2024-05-08 19:30:09 +00:00
commit e498d6ea55
2 files changed
+6 -4

No files matched your search

@@ -154,7 +154,7 @@ class DeviceConfigWrapper private constructor(propReader: PropReader) {
}
companion object {
val configHelper by lazy { DeviceConfigHelper(::DeviceConfigWrapper) }
@JvmStatic val configHelper by lazy { DeviceConfigHelper(::DeviceConfigWrapper) }
@JvmStatic fun get() = configHelper.config
}
@@ -48,12 +48,14 @@ class DeviceConfigHelper<ConfigType>(private val factory: (PropReader) -> Config
PropReader(
object : PropProvider {
override fun <T : Any> get(key: String, fallback: T): T {
if (fallback is Int)
if (fallback is Int) {
allKeys.add(key)
return DeviceConfig.getInt(NAMESPACE_LAUNCHER, key, fallback) as T
else if (fallback is Boolean)
} else if (fallback is Boolean) {
allKeys.add(key)
return DeviceConfig.getBoolean(NAMESPACE_LAUNCHER, key, fallback)
as T
else return fallback
} else return fallback
}
}
)