Android 13 to add support for adjusting the flashlight’s brightness

Mobile LED flashes have become a staple on virtually all Android smartphones. If your smartphone has a rear camera, chances are it also has an LED flash module. This LED flash is designed to light up objects in low light to get better shots of them, but it can also double up as a general-purpose flashlight applicable in various use cases.

For the longest time, since they were introduced, you could only turn them off or on with no fine-tuning in between the two states by varying how much light is outputted by the flashlight. However, this will be changing with the release of Android 13 later this year.

Android 13 is adding a few APIs that among them contain the “getTorchStrengthLevel” and “turnOnTorchWithStrengthLevel” methods which will be added to the “CameraManager” class. As indicated by their names, The first method will be responsible for returning the brightness level of the LED flash, while the second method sets the brightness level of the LED flash from a minimum of “1” to a maximum determined by the hardware.

READ:  Android 13 Preview: What is new?

In the previous Android versions, the flashlight could only be toggled on or off by use of the “setTorchMode” API. The introduction of these new APIs in Android 13 will make it possible for apps to be able to fine-tune the flashlight’s brightness with more finesse and accuracy.

However, despite the introduction, not all devices running Android 13 will be able to use the feature. If an application needs to use the feature, it will first use the “CameraCharacteristics.FLASH_INFO_STRENGTH_MAXIMUM_LEVEL” command to check whether a value greater than “1” is returned.

If the value that is returned is greater than 1, then the brightness range will be between 1 and that value, however, if 1 is returned, then the device’s hardware does not allow for fine-tuning of its LED brightness level.

It is not necessarily a matter of powerful hardware that will support LED brightness tuning and less powerful ones will not, the reason is that the feature will require an update to the camera hardware abstraction layer (HAL) before a device can gain the new functionality. The HAL is the software that is located between the OS, Android in this case, and the underlying hardware. It forms a bridge between the hardware and the apps you interact with

In order for Android 13 to control the level of the flashlight’s brightness, an update for the HAL is required to make it possible for the OS to make commands directly to the hardware controlling the amount of brightness that is produced.

Since many OEMs do not develop HAL on their own but rather depend on sourcing the OS from different vendors before they can implement it in their devices, it only leaves manufacturers like Google with their Pixel line up to be the first to introduce the feature while other manufacturers will follow suit down the line once an update to the HAL has been rolled out.

For comparison, Apple, who have total control over both the hardware and software running on their iPhones, have had the feature to control the brightness level of their flashlights for years now, but it is better late than never for Android.

Naftaly is a Computer Science graduate with a passion for tech, video games and pop culture. When he is not writing articles for AndroidKenya, he is probably rewatching the Lord of the Rings trilogy for the hundredth time. Email at criskariuki@gmail.com Twitter @KarisNaftaly

Leave a Reply

Your email address will not be published.