android-config-overlays icon indicating copy to clipboard operation
android-config-overlays copied to clipboard

A collection of Runtime Resource Overlays to customize Android's behavior.

android-config-overlays

A collection of Runtime Resource Overlays to customize Android's behavior.

Configurations

config_allowAllRotations

This allows the screen to be rotated via the accelerometer in all 4 rotations - portrait, landscape, reverse landscape, and reverse portrait (upside-down). It also enables lockscreen rotation.

config_brightnessThresholdsOfPeakRefreshRate

This forces 60 Hz at or below a settings get system screen_brightness of 3, working around the 90 Hz green tint on the Pixel 4 XL.

Note: unfortunately, DisplayModeDirector isInsideZone() still makes use of the screen brightness integer. This means it is not possible to distinguish between certain brightness levels with the same accuracy, resulting in either allowing some green tint in (brightness of 2) or missing out on some non-green-tint brightness (brightness of 3).

Build

Many thanks to Know RRO (Runtime Resource Overlay) in Android AOSP and How to Completely Take Control of Ambient EQ on the Google Pixel 4 for the guidance with these steps.

  1. Set up the Android SDK and build tools for your Android version (newer SDK versions may be backwards compatible)

  2. Change into the directory of the desired overlay, e.g. config_allowAllRotations

cd <path to folder containing AndroidManifest.xml>
  1. Compile the RRO (Runtime Resource Overlay) into an Android package
$ ~/Android/Sdk/build-tools/30.0.2/aapt package -M AndroidManifest.xml -S res/ -I ~/Android/Sdk/platforms/android-30/android.jar -F MyOverlayPackage.apk.unsigned
  1. Sign the .apk file
~/Android/Sdk/build-tools/30.0.2/apksigner sign --ks ~/.android/mykeys.keystore MyOverlayPackage.apk.unsigned
  1. Zip-align the .apk file
~/Android/Sdk/build-tools/30.0.2/zipalign 4 MyOverlayPackage.apk.unsigned MyOverlayPackage.apk
  1. Optional: delete the unsigned .apk file
rm MyOverlayPackage.apk.unsigned

Usage

Place the compiled .apk into the appropriate system or vendor partition within the overlay folder, e.g. system/vendor/overlay/MyOverlayPackage.apk.

Magisk module

  1. Create a basic Magisk module

module.prop:

id=your_unique_module_id
name=My Awesome Android Overlay
version=v1.0
versionCode=1
author=Awesome Author Name Here
description=Changes the doodad to be more whizbang
  1. Create the overlay folder next to module.prop, e.g. system/vendor/overlay

  2. Place the compiled .apk files into the overlay folder above

  3. Compress the module.prop and overlay folder next to each other in a .zip file

  4. Install using Magisk Manager

  5. Reboot and test your changes, using Safe Mode in case your device fails to boot