Fabricated RRO (FRRO)

Fabricated RRO is build on top traditional RRO system

Fabricated Runtime Resource Overlays (Fabricated RROs) are a more recent addition to Android's theming capabilities. They're particularly useful for device manufacturers and system customization. Let's dive into how Fabricated RROs work in Android:

  1. Concept of Fabricated RROs: Fabricated RROs are overlays that are created dynamically at runtime, rather than being pre-installed as APKs. This allows for more flexible and dynamic theming options.

  2. Key Components: a. OverlayManagerService (OMS): Still plays a central role, but now includes support for Fabricated Overlays. b. FabricatedOverlay: A new class introduced to represent dynamically created overlays. c. OverlayConfig: Handles configuration for Fabricated Overlays, including reading from device config.

  3. Creation Process: Fabricated RROs are typically created programmatically, often during the boot process or when certain system events occur. They don't exist as separate APK files.

  4. FabricatedOverlay.Builder: This builder class is used to construct Fabricated Overlays. It allows setting various properties of the overlay, including:

    • Target package

    • Name

    • Resources to overlay

  5. Resource Addition: Resources are added to the Fabricated Overlay using methods like setResourceValue(). This allows for dynamic resource creation without needing to package resources in an APK.

  6. Registration: Once created, Fabricated Overlays are registered with the OverlayManagerService using the registerFabricatedOverlay() method.

  7. Overlay Application: After registration, Fabricated Overlays are treated similarly to traditional RROs in terms of application and priority.

  8. Performance Considerations: Fabricated RROs are designed to be lightweight and efficient, as they don't require loading entire APKs.

  9. Use Cases:

    • Dynamic theming based on user preferences or system state

    • OEM customizations that need to be applied dynamically

    • A/B testing of UI changes without needing to install separate APKs

Here's a simplified example of how you might create a Fabricated Overlay in code:

FabricatedOverlay overlay = new FabricatedOverlay.Builder("com.android.systemui", "FabricatedTheme", "com.example.fabricated")
    .setResourceValue("color", "accent_color", Color.BLUE)
    .setResourceValue("dimen", "status_bar_height", 48)
    .build();

overlayManager.registerFabricatedOverlay(overlay);

This code creates a Fabricated Overlay targeting SystemUI, sets a blue accent color and a custom status bar height, then registers it with the OverlayManager.

Key Differences from Traditional RROs:

  1. No separate APK file

  2. Can be created and modified at runtime

  3. More flexible for dynamic theming scenarios

  4. Typically used for system-level customizations rather than third-party apps

Fabricated RROs provide a powerful tool for system customization, allowing for more dynamic and efficient theming options in Android. They're particularly useful for device manufacturers and system-level customizations where flexibility and performance are crucial.

Last updated