'How can I spoof prop values that don't belong to android.os.Build?

With the following segment of code I'm able to spoof certain build.prop parameters such as brand, manufactuer, device, product and model:

data class DeviceEntries(
    val deviceName: String,
    val props: HashMap<String, String>,
    val featureLevelName: String,
    val androidVersion: AndroidVersion?,
    val lcd_density: String,
)

/**
 * List of all devices and their build props
 * GOOGLE PIXEL 6 PRO
 */
val allDevices = listOf(

    DeviceEntries("None", hashMapOf(), "None", null, ""),

    DeviceEntries(
        "PIXEL 6 PRO", hashMapOf(
            Pair("BRAND", "google"),
            Pair("MANUFACTURER", "Google"),
            Pair("DEVICE", "raven"),
            Pair("PRODUCT", "raven"),
            Pair("MODEL", "Pixel 6 Pro"),
        ),
        "Pixel 2021",
        getAndroidVersionFromLabel("S 12.0"),
        "450",
    ),
)

However I'm not able to spoof the value ro.sf.lcd_density As far as I know, it doesn't belong to android.os.Build so I can't add it or don't know how to add it inside hashMapOf section. I created the variable lcd_density and added the value 450 (desired density) hoping it would do the trick... but it doesn't.

Above is just a segment of the file, the full file can be found at: https://github.com/titooo7/GFN-FPS-Unlocker/blob/main/app/src/main/java/soy_titooo/xposed/gfnfpsunlocker/DeviceProps.kt

This is the first android app that I was able to fork and modify slightly to fit my purpose. Spoofing the density is the only bit that I can't get done yet

PS: I'm not using executing 'wm density' command as the purpose of the app is to spoof those props values only for certain apps and not the whole system



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source