Read and Write System Settings (settings)

You can use FIRERPA’s Settings-related interfaces to configure certain Android system parameters or retrieve system settings. This feature supports a wide range of operations, such as adjusting screen brightness, enabling/disabling Developer Options, or changing ringtone volume. Here we will demonstrate only a few simple examples.

Calling the Interface

If you’re still confused at this point, don’t worry—we’ll explain everything in detail below. Before proceeding, you need to first obtain a Settings instance. You can do so as shown in the following code:

settings = d.stub("Settings")

Next, execute the following code to set the screen brightness mode to manual. This prevents your device’s screen brightness from automatically adjusting according to ambient light, allowing you to set a fixed brightness level.

settings.put_system("screen_brightness_mode", "0")

You can use the following two methods to retrieve the current screen brightness, then reduce it to 5:

settings.get_system("screen_brightness")
settings.put_system("screen_brightness", "5")

Similarly, use the following two methods to check whether Developer Options are enabled, and then disable them:

settings.get_global("development_settings_enabled")
settings.put_global("development_settings_enabled", "0")

You can also use these two methods to check if the screensaver is enabled, and then disable it:

settings.get_secure("screensaver_enabled")
settings.put_secure("screensaver_enabled", "0")

That concludes our introduction. The above examples are meant to guide you on how to use these features. Continue reading to unlock their full potential.

Available Parameters

If you’re unsure about strings like screen_brightness mentioned above, this section is for you. The available parameters for this interface depend entirely on what the system supports. Please note that some constants may not be compatible across different Android versions, and some manufacturers may define custom variables. You can find a list of supported parameters in the official Android documentation links provided below. Use the field names listed in these documents together with the interfaces described above to configure system settings.

https://developer.android.com/reference/android/provider/Settings.System
https://developer.android.com/reference/android/provider/Settings.Secure
https://developer.android.com/reference/android/provider/Settings.Global