FRRO Example
here is a code example demonstrating how to create and use a Fabricated RRO in Android. This example will show how to create a Fabricated Overlay that changes some system UI colors and dimensions.
This example demonstrates several key aspects of working with Fabricated RROs:
Creating a Fabricated Overlay:
We use
FabricatedOverlay.Builder
to create the overlay.We specify the target package (SystemUI in this case), a name for the overlay, and a unique package name for the overlay.
Setting Resources:
We set various types of resources: colors, dimensions, booleans, and strings.
Each resource is set using the
setResourceValue()
method, specifying the resource type, name, and value.
Registering the Overlay:
We use the
OverlayManager.registerFabricatedOverlay()
method to register our created overlay with the system.
Enabling the Overlay:
After registration, we enable the overlay using
OverlayManager.setEnabled()
.
Removing the Overlay:
We provide a method to disable and unregister the overlay when it's no longer needed.
To use this in your Android system application or service, you would typically:
Obtain an instance of
OverlayManager
:Call the methods:
And when you want to remove it:
Remember that working with Fabricated RROs typically requires system-level permissions. This code would usually be run in a system service or a privileged app, not in a regular third-party app.
Also, note that changes may not be immediately visible in all cases. Some changes might require a UI refresh or even a system reboot to take full effect, depending on how the target app handles resource updates.
Last updated