Requesting extension for app brightness without requiring permissions

Dear members,
Newbie here, validating my idea for an extension and if someone can build it for the community.

The requirement is to change screen brightness just for the app. The existing extensions seem to require permissions to modify brightness system-wide. However, I found some articles that Android apps can temporarily modify brightness just for the app, and that doesn’t need additional permissions.

Things I noticed were related to: WindowManager.LayoutParams
and layoutParams.screenBrightness

Does this make sense? If so, can someone try making a component, may be?
Thanks!

However, it will require write system settings

Not sure. The discussions on various websites say that doesn’t require that permission.

2 Likes

Yeah, exactly that.

The extension above requires permission settings; and that’s why I came here to ask :slight_smile:

Oops, I read it after I linked, sorry…

Maybe someone can see the code linked above and make it an extension. Android-er: Change Android Screen Brightness, LayoutParams.screenBrightness

4 Likes

Hello, Here’s a small extension that changes the window’s brightness, without requiring any special permission, using the code in the link posted here .

blocks(1)

  • SetWindowBrightness: Overrides the user’s preferred brightness of the screen. The value can be a number from 1 to 100. Note: this change applies to the current window only, it’s not global to the whole device.
  • GetWindowBrightness: Returns a value between 1 to 100 representing the window brightness. Returns -1 if the window uses the user’s preferred screen brightness.

Download Link:
AIX: io.mohamed.brightness.aix (4.3 KB)
AIA: brightness.aia (6.6 KB)

Source:

Hope it helps!

11 Likes

Thanks Mohamed for your time and help! It does exactly what I needed. Appreciate the code that helps understand how extensions are built.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.