Reading and Writing System Settings¶
You can use FIRERPA’s Settings-related interfaces to perform some Android system parameter settings or read system settings. This functionality can achieve many specific items, such as setting screen brightness, toggling developer mode, or even ringtone volume. Here, we’ll just provide some simple examples.
Calling the Interface¶
If you’re still confused at this point, don’t worry. Everything will be explained in detail below. Before starting, you need to first get a Settings instance. You can call it like this:
settings = d.stub("Settings")
Then, you can execute the following code to set the system screen brightness to manual mode. This way, your device’s screen brightness won’t change with ambient light, and you can set a fixed brightness for the screen.
settings.put_system("screen_brightness_mode", "0")
You can use the following two interfaces to get the current screen brightness and then reduce the screen brightness to 5.
settings.get_system("screen_brightness")
settings.put_system("screen_brightness", "5")
You can also use the following two interfaces to find out whether developer mode is enabled, and then disable developer mode.
settings.get_global("development_settings_enabled")
settings.put_global("development_settings_enabled", "0")
You can also use the following two interfaces to find out if the screen saver is enabled, and then disable the screen saver.
settings.get_secure("screensaver_enabled")
settings.put_secure("screensaver_enabled", "0)
That’s it for the introduction. The above is just to guide you on how to use it. You can continue reading to achieve maximum power.
Available Parameters¶
If you are confused about the string parameters like screen_brightness above, this section is prepared for you. The available parameters for this interface completely depend on what the system supports. You need to note that some constants may not be compatible in different versions of Android, and some manufacturers may have custom variables. You can find relevant available parameters in the following Android official documentation. You can use the fields in the following documents with the above interfaces for 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