chenxiaolong / PixelLight

A flashlight app for Google Pixel devices that uses private APIs to access high brightness modes
GNU General Public License v3.0
8 stars 1 forks source link

PixelLight

app icon

latest release badge license badge

PixelLight is a bare-bones flashlight app for Google Pixel devices that can access higher brightness levels than what is typically allowed by the standard Android 13+ torch APIs.

It allows access to the same brightness levels as Google Magnifier, except without the excessive 200% CPU usage due to constant camera processing. However, due to how the Pixel private API works, avoiding camera processing entirely is not possible. The CPU usage while the flashlight is on will generally hover around 25%.

Features

Limitations

Permissions

The CAMERA permission is required because Pixel's private API for high brightness modes is only accessible when using the camera as a camera, not when using the camera as a flashlight with the official Android 13+ APIs. Internally, PixelLight is taking a picture every time the flashlight is turned on or the brightness is changed. These exist only in memory and are never saved to disk.

The FOREGROUND_SERVICE and POST_NOTIFICATIONS permissions are required to allow the flashlight to remain on while the app is in the background. They are also required for the quick settings tile to work.

PixelLight does not and will never have the INTERNET permission.

Verifying digital signatures

First, use apksigner to print the digests of the APK signing certificate:

apksigner verify --print-certs PixelLight-<version>-release.apk

Then, check that the SHA-256 digest of the APK signing certificate is:

03a9ed333be772cf612af84fc4bf2cc95428ff5a10c057d3b60d86b0f8fec2c3

Building from source

PixelLight can be built like most other Android apps using Android Studio or the gradle command line.

To build the APK:

./gradlew assembleDebug

The APK will be signed with the default autogenerated debug key.

To create a release build with a specific signing key, set the following environment variables:

export RELEASE_KEYSTORE=/path/to/keystore.jks
export RELEASE_KEY_ALIAS=alias_name

read -r -s RELEASE_KEYSTORE_PASSPHRASE
read -r -s RELEASE_KEY_PASSPHRASE
export RELEASE_KEYSTORE_PASSPHRASE
export RELEASE_KEY_PASSPHRASE

and then build the release APK:

./gradlew assembleRelease

Contributing

Bug fix and translation pull requests are welcome and much appreciated!

However, aside from that, PixelLight will only ever support Google Pixel devices and is intentionally featureless. I am unlikely to implement any new features.

License

PixelLight itself is licensed under GPLv3. Please see LICENSE for the full license text.