Setting up the Android project: First, create a new Android project in Android Studio. Name it something like "MySystemUIOverlay".
Configuring the manifest file:
<!-- AndroidManifest.xml -->
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mysystemuioverlay">
<application
android:hasCode="false"
android:icon="@android:drawable/ic_menu_compass"
android:label="My SystemUI Overlay">
<overlay
android:targetPackage="com.android.systemui"
android:isStatic="true"
android:priority="1" />
</application>
</manifest>
<!-- Explanation:
- package: Unique identifier for your overlay
- android:hasCode="false": Indicates this app has no Java code
- android:targetPackage: Specifies which app this overlay is for
- android:isStatic="true": Overlay is compiled into the system
- android:priority: Determines order if multiple overlays target the same resource -->
Creating resource files: Let's create a few example resource files to demonstrate different types of overlays.
<!-- res/values/colors.xml -->
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Override the accent color of the system -->
<color name="system_accent_color">#FF4081</color>
<!-- Override the primary color of the system -->
<color name="system_primary_color">#3F51B5</color>
</resources>
<!-- res/values/dimens.xml -->
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Override the status bar height -->
<dimen name="status_bar_height">28dp</dimen>
<!-- Override the quick settings tile size -->
<dimen name="qs_tile_height">84dp</dimen>
</resources>
<!-- res/values/strings.xml -->
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Override a system string -->
<string name="global_action_restart">Reboot Device</string>
</resources>
Building the RRO APK: Use Android Studio to build your project. This will generate an APK file.
Installing the RRO APK: You can install the APK using adb: