Starting March 27, 2025, we recommend using android-latest-release instead of aosp-main to build and contribute to AOSP. For more information, see Changes to AOSP.
Troubleshoot runtime resource overlays
Stay organized with collections
Save and categorize content based on your preferences.
Use this content to troubleshoot why a runtime resource overlay (RRO) might not be functioning as intended in an Android Automotive implementation.
Related documentation
To learn more about RROs in Android, see
Change the value of an app's resources at runtime.
Be sure to maintain a constant vigilance on logcat output, which can provide
good information about what is happening throughout the process.
Step 1: List the RROs
To list the RROs:
Run the following command:
adbshellcmdoverlaylist--usercurrentOutput like this appears:
com.android.systemui [ ] com.android.theme.icon_pack.rounded.systemui [ ] com.android.theme.icon_pack.filled.systemui [ ] com.android.theme.icon_pack.circular.systemui com.android.permissioncontroller --- com.android.permissioncontroller.googlecarui.rroVerify that your RRO appears in the list. The following indicators denote RRO status:
Indicator RRO status [ ]Installed and ready to be activated. [X]Installed and activated. ---Installed but contains errors. If your RRO isn't listed under the package name of the target you want to overlay, your RRO isn't installed.
Step 2: Enable and disable an RRO
If an RRO is installed:
Use the following command to enable (or disable) the RRO:
adbshellcmdoverlay[enable/disable]--usercurrent[yourRROpackagename]
Step 3: Confirm RRO is installed
To confirm an RRO is installed on a device or troubleshoot why the RRO wasn't enabled:
Run the following command:
adbshellcmdoverlaydump[yourRROpackagename]Output such as the following appears:
com.android.car.rotaryplayground.googlecarui.rro:0 { mPackageName...........: com.android.car.rotaryplayground.googlecarui.rro mUserId................: 0 mTargetPackageName.....: com.android.car.rotaryplayground mTargetOverlayableName.: car-ui-lib mBaseCodePath..........: /product/overlay/googlecarui-com-android-car-rotaryplayground/googlecarui-com-android-car-rotaryplayground.apk mState.................: STATE_MISSING_TARGET mIsEnabled.............: true mIsMutable.............: true mPriority..............: 10 mCategory..............: BypassIdMapV1 } com.android.car.rotaryplayground.googlecarui.rro:10 { mPackageName...........: com.android.car.rotaryplayground.googlecarui.rro mUserId................: 10 mTargetPackageName.....: com.android.car.rotaryplayground mTargetOverlayableName.: car-ui-lib mBaseCodePath..........: /product/overlay/googlecarui-com-android-car-rotaryplayground/googlecarui-com-android-car-rotaryplayground.apk mState.................: STATE_MISSING_TARGET mIsEnabled.............: true mIsMutable.............: true mPriority..............: 10 mCategory..............: BypassIdMapV1 }Identify the user (or users) who installed the RRO. In the previous example, the RRO is available for user
0and user10(see the values formUserIdin the top code block).To enable (or disable) the RRO for a user, go to Step 2.
To check the value of
mState:STATE_ENABLEDandSTATE_ENABLED_IMMUTABLE. The RRO is enabled and applied to your target.STATE_MISSING_TARGET. Your target isn't installed.STATE_NO_IDMAP. Something is wrong with the way theAndroidManifest.xml,overlays.xml, oroverlayable.xmlfiles are set up. Useadb logcatto run the logs and search for the keywordidmapto identify the error. See steps 4 & 5.STATE_UNKNOWN. Something is wrong withOverlayManagerService.
Step 4: Check AndroidManifest.xml
To verify AndroidManifest.xml:
Check
targetNameandtargetPackage.android:targetNameshould have the same value of the overlayable group defined in the target app. This is required only when targeting an overlay.android:targetPackageis always required and should contain the package name of the target app.Check that your RRO is static (or not). Static RROs are enabled by default at boot time. Dynamic RROs aren't enabled by default at boot. Additional ways of enabling dynamic RROs are provided in Change the value of an app's resources at runtime.
Check the priority of your static RRO (dynamic RRO priority is always set to
Integer.MAX_VALUEand the order in which they're applied is based on when they're enabled).Multiple RROs can apply to the same target. RROs with a higher priority are applied last. On a scale of 0 to 10, 10 is highest and 0 is lowest.
Step 5: Check overlays.xml
Check
overlays.xmlto confirm all resources you intend to overlay are defined in this file. For example, consider the followingoverlays.xml:<overlay> <itemtarget="string/app_name"value="@string/overlaid_app_name"/> </overlay>You must ensure that a:
stringresource with the nameapp_nameexists in the target app.stringresource with the nameoverlaid_app_nameexists in your RRO.
If your target has an
overlayable.xmlfile, make sureapp_nameis contained in that file. Make sure you use the correcttargetNamein yourAndroidManifest.xmlfile (Step 4).For example:
<overlay> <itemtarget="layout/car_ui_base_layout_toolbar"value="@layout/car_ui_base_layout_toolbar"/> <itemtarget="id/car_ui_toolbar_background"value="@id/car_ui_toolbar_background"/> <itemtarget="attr/layout_constraintTop_toBottomOf"value="@attr/layout_constraintTop_toBottomOf"/> </overlay>
Step 6: Dump the idmap
At this stage, all issues with your RRO should be resolved. Next, dump the
idmap of your RRO to learn how a resource is being resolved and why it's
resolving to a different value than you expect.
To find the path to the
idmapon your device:adbshell su lsdata/resource-cacheTo dump the contents of that file:
adbroot adbshellidmap2dump--idmap-path[pathtoyourRROidmapfile]Example:
adbshellidmap2dump--idmap-pathdata/resource-cache/system@app@CarUiPortraitLauncherReferenceRRO@CarUiPortraitLauncherReferenceRRO.apk@idmapThe output appears similar to the following. The output displays which ID from your RRO is mapped to which ID in your target as well as the name of the overlaid resource.
targetapkpath:/system/priv-app/CarMediaApp/CarMediaApp.apk overlayapkpath:/product/overlay/googlecarui-com-android-car-media/googlecarui-com-android-car-media.apk 0x7f040008->0x7f010000bool/car_ui_toolbar_logo_fills_nav_icon_space 0x7f040009->0x7f010001bool/car_ui_toolbar_nav_icon_reserve_space 0x7f04000b->0x7f010002bool/car_ui_toolbar_tab_flexible_layout 0x7f04000c->0x7f010003bool/car_ui_toolbar_tabs_on_second_row 0x7f09006c->0x7f020000id/car_ui_base_layout_content_container 0x7f090073->0x7f020001id/car_ui_recycler_view 0x7f090074->0x7f020002id/car_ui_scroll_bar 0x7f090075->0x7f020003id/car_ui_scrollbar_page_down 0x7f090076->0x7f020004id/car_ui_scrollbar_page_up 0x7f090077->0x7f020005id/car_ui_scrollbar_thumb 0x7f090078->0x7f020006id/car_ui_scrollbar_track 0x7f09007a->0x7f020007id/car_ui_toolbar_background 0x7f09007e->0x7f020008id/car_ui_toolbar_logo 0x7f090084->0x7f020009id/car_ui_toolbar_menu_items_container 0x7f090085->0x7f02000aid/car_ui_toolbar_nav_icon 0x7f090086->0x7f02000bid/car_ui_toolbar_nav_icon_container 0x7f090087->0x7f02000cid/car_ui_toolbar_progress_bar 0x7f090089->0x7f02000did/car_ui_toolbar_row_separator_guideline 0x7f09008d->0x7f02000eid/car_ui_toolbar_search_view_container 0x7f09008f->0x7f02000fid/car_ui_toolbar_subtitle 0x7f090092->0x7f020010id/car_ui_toolbar_tabs 0x7f090093->0x7f020011id/car_ui_toolbar_title 0x7f090094->0x7f020012id/car_ui_toolbar_title_container 0x7f090095->0x7f020013id/car_ui_toolbar_title_logo 0x7f090096->0x7f020014id/car_ui_toolbar_title_logo_container 0x7f0c0024->0x7f030000layout/car_ui_base_layout_toolbar 0x7f0c0035->0x7f030001layout/car_ui_recycler_view 0x7f0c0038->0x7f030002layout/car_ui_toolbar 0x7f0c003f->0x7f030003layout/car_ui_toolbar_two_row
Use the following command to look up a specific resource to see how they're mapped:
adbshellcmdoverlaylookup--verbose--user10com.android.car.ui.paintboothcom.android.car.ui.paintbooth:color/widget_backgroundThe output is the final value of the resource:
#ff7986cb
You can also dump your layout files from your apks to view the resolved IDs to match the above output:
aapt2dumpxmltree$OUT/system/priv-app/sharedlibraryclient/sharedlibraryclient.apk--fileres/layout/activity_main.xmlOutput such as the following is returned:
N:android=http://schemas.android.com/apk/res/android (line=2)
N:app=http://schemas.android.com/apk/res-auto (line=2)
N:lib=http://schemas.android.com/apk/com.android.car.ui.sharedlibrary.test (line=2)
E:androidx.constraintlayout.widget.ConstraintLayout(line=2)
A:http://schemas.android.com/apk/res/android:layout_width(0x010100f4)=-1
A:http://schemas.android.com/apk/res/android:layout_height(0x010100f5)=-1
E:TextView(line=19)
A:http://schemas.android.com/apk/res/android:layout_width(0x010100f4)=-2
A:http://schemas.android.com/apk/res/android:layout_height(0x010100f5)=-2
A:http://schemas.android.com/apk/res/android:text(0x0101014f)=@0x020f0000
A:http://schemas.android.com/apk/res-auto:layout_constraintBottom_toBottomOf(0x7f0200fb)=0
A:http://schemas.android.com/apk/res-auto:layout_constraintLeft_toLeftOf(0x7f02010e)=0
A:http://schemas.android.com/apk/res-auto:layout_constraintRight_toRightOf(0x7f020112)=0
A:http://schemas.android.com/apk/res-auto:layout_constraintTop_toTopOf(0x7f020118)=0
E:com.android.car.ui.sharedlibrary.test.MyRecyclerView(line=28)
A:http://schemas.android.com/apk/res/android:layout_width(0x010100f4)=-2
A:http://schemas.android.com/apk/res/android:layout_height(0x010100f5)=-2
A:http://schemas.android.com/apk/com.android.car.ui.sharedlibrary.test:implClass="HelloWorld!" (Raw: "HelloWorld!")
E:com.android.car.ui.sharedlibraryclient.CustomView(line=34)
A:http://schemas.android.com/apk/res/android:layout_width(0x010100f4)=-2
A:http://schemas.android.com/apk/res/android:layout_height(0x010100f5)=-2
A:http://schemas.android.com/apk/res-auto:implClass2(0x7f0200e8)="HelloWorld!!" (Raw: "HelloWorld!!")
Failures to resolve mappings are indicated by idmap2 through three
question marks (???).
In this example, the RRO has a hard-coded color value overlaid on top of a public resource:
$idmap2dump--idmap-path[file]
0x00010402->color0xff00ff00(???)In this example, the RRO overlays a public resource by pointing it to an internal (private) color resource inside the same shared library:
$idmap2dump--idmap-path[file]
0x00010402->0x7f010000(???->color/item_background_new)