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:
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.
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.
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.
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
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.Registration: Once created, Fabricated Overlays are registered with the OverlayManagerService using the
registerFabricatedOverlay()
method.Overlay Application: After registration, Fabricated Overlays are treated similarly to traditional RROs in terms of application and priority.
Performance Considerations: Fabricated RROs are designed to be lightweight and efficient, as they don't require loading entire APKs.
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:
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:
No separate APK file
Can be created and modified at runtime
More flexible for dynamic theming scenarios
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