Android emulator API 31-33 system brightness slider not updating

137 Views Asked by At

on the emulator with API versions 31-33, when running this code, and looking at the notifications shade to check the brightness slider, it seems unchanged.

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M || Settings.System.canWrite(context))
{
    Settings.System.putInt(context.contentResolver,Settings.System.SCREEN_BRIGHTNESS_MODE,Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL)
    Settings.System.putInt(context.contentResolver,Settings.System.SCREEN_BRIGHTNESS,somethingBetween0And255())
}

after the above code runs, calling Settings.System.getInt does show that the value has been updated, though, but not the brightness slider.

I also checked on my physical phone, which is API 32, and confirmed that the above code works as expected, and the brightness does change, but not sure if it will work on all physical phones of this API.

0

There are 0 best solutions below