System Settings¶
You can use FIRERPA’s Settings-related interfaces to configure certain Android system parameters or read system settings. This feature covers a wide range of actions, for example setting screen brightness, toggling developer mode, or even adjusting the ringtone volume. Here we only demonstrate a few simple examples.
Calling the Interface¶
Before you begin, you need to obtain a Settings instance. You can call it as shown below.
settings = d.stub("Settings")
Set the system screen brightness to manual mode, so that your device’s screen brightness will not change with ambient light, allowing you to set a fixed brightness value.
settings.put_system("screen_brightness_mode", "0")
Get the current screen brightness, then lower it to 5.
settings.get_system("screen_brightness")
settings.put_system("screen_brightness", "5")
Check whether developer mode is enabled, then disable it.
settings.get_global("development_settings_enabled")
settings.put_global("development_settings_enabled", "0")
Check whether the screensaver is enabled, then disable it.
settings.get_secure("screensaver_enabled")
settings.put_secure("screensaver_enabled", "0")
The following example sets the screen brightness to manual, brightness to 64, and keeps the screen on forever.
settings.put_system("screen_brightness", "64")
settings.put_system("screen_brightness_mode", "1")
settings.put_system("screen_off_timeout", "604800000")
Available Parameters¶
If you’re unsure about strings like screen_brightness, this section is for you. The parameters available for this interface depend entirely on what the system supports. Please note that some constants may be incompatible across different Android versions, and some manufacturers have their own custom variables. You can find the relevant available parameters in the Android official documentation linked below, and then use the above interfaces to configure system settings.
Tip
We list the officially defined available fields below, but the actual available fields in the system are far more than these. You can use the command settings list [system|global|secure] to see what settings are actually available in each category.