I'm using the following code:
//brilho
try {
//sets manual mode and brightnes 255
Settings.System.putInt(act.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); //this will set the manual mode (set the automatic mode off)
Settings.System.putInt(act.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 85); //maximo 255 -> diminui 1/3
int br = Settings.System.getInt(act.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS);
WindowManager.LayoutParams lp = act.getWindow().getAttributes();
lp.screenBrightness = (float) br / 85;
act.getWindow().setAttributes(lp);
} catch (Exception e) {
e.getMessage();
}
However, I can only change the brightness of the activity that I call the method. I needed to change the whole tablet. Is there any way to do this without user intervention? Thank you in advance.