AOSP customize aapt2

248 views
Skip to first unread message

Jonny Peng

unread,
Nov 10, 2020, 3:10:26 PM11/10/20
to android-platform
I want to add a new resource configuration in my app, such as values-xxx-zh-rCN, but aapt2 don't support it, how can I customize it? I find that aapt2 support mcc mnc type values

Arne-Christian Blystad

unread,
Nov 11, 2020, 11:03:38 AM11/11/20
to android-platform
You'll probably need to modify a lot of places to get that to work... Have you considered just using Runtime Resource Overlays instead?

You can make resource overlays automatically enable for a specific device variant by, for example, doing this:

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

package="app.i.want.to.overlay.mydevice">

<overlay android:targetPackage="app.i.want.to.overlay"

android:requiredSystemPropertyName="ro.boot.product.hardware.sku"

android:requiredSystemPropertyValue="MyDevice"

android:isStatic="true" />
</manifest>

You can also overlay framework resources if necessary, by declaring the overlay as

<overlay android:targetPackage="android" android:priority="1" android:category="android.theme" />

and setting

ro.boot.vendor.overlay.theme=overlay.package.name

Best regards,
Arne Christian
Reply all
Reply to author
Forward
0 new messages