Read and Write System Properties (prop)¶
This API is used to read or modify system properties, similar to the functionality of the getprop and setprop commands. You might ask, "Why not just use the commands? What's special about this?"
Indeed, but you should know that this API can directly set ro. Android properties, which the system's built-in commands cannot do.
Get Property¶
You can use the following API to get the value of ro.secure. Of course, this is not limited to just this one property; all system properties can be read using this API. This is just an example.
d.getprop("ro.secure")
Set Property¶
You can also use the following API to set the value of ro.secure to "0". Of course, you can set any property with this API, including the values of read-only (ro.) properties, which is the main advantage of this interface.
d.setprop("ro.secure", "0")