RRO Example

Here are steps to create an RRO app:

  1. Setting up the Android project: First, create a new Android project in Android Studio. Name it something like "MySystemUIOverlay".

  2. 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 -->
  1. 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>
  1. Building the RRO APK: Use Android Studio to build your project. This will generate an APK file.

  2. Installing the RRO APK: You can install the APK using adb:

adb shell cmd overlay enable com.example.mysystemuioverlay

To see the changes, you may need to restart SystemUI or reboot your device:

adb shell stop; adb shell start  # Restart SystemUI

Or

adb reboot  # Reboot device

Last updated