diff --git a/app/src/main/java/com/termux/api/BrightnessAPI.java b/app/src/main/java/com/termux/api/BrightnessAPI.java index 3780e90..198dc96 100644 --- a/app/src/main/java/com/termux/api/BrightnessAPI.java +++ b/app/src/main/java/com/termux/api/BrightnessAPI.java @@ -11,6 +11,10 @@ public class BrightnessAPI { public static void onReceive(final TermuxApiReceiver receiver, final Context context, final Intent intent) { final ContentResolver contentResolver = context.getContentResolver(); + if (intent.hasExtra("auto")) { + boolean auto = intent.getBooleanExtra("auto", false); + Settings.System.putInt(contentResolver, Settings.System.SCREEN_BRIGHTNESS_MODE, auto?Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC:Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); + } int brightness = intent.getIntExtra("brightness", 0); @@ -19,7 +23,6 @@ public class BrightnessAPI { } else if (brightness >= 255) { brightness = 255; } - Settings.System.putInt(contentResolver, Settings.System.SCREEN_BRIGHTNESS, brightness); ResultReturner.noteDone(receiver, intent); }