Referencing `systemui` resources for building RRO/overlay themes in Oreo

2k views Asked by At

I'm trying to build an RRO/overlay theme for my device running Oreo to change status-bar icons/indicators.

I pulled AOSP's status-bar icons and included them in the package with a single modification: changing references to internal systemui package from ?attr/XXX to ?*com.android.systemui:attr/XXX. Every time I build, the following errors are thrown:

\thm\res\drawable\stat_sys_wifi_signal_0.xml:24: error: Error: No resource found that matches the given name (at 'fillColor' with value '?*com.android.systemui:attr/fillColor').

\thm\res\drawable\stat_sys_wifi_signal_0.xml:27: error: Error: No resource found that matches the given name (at 'fillColor' with value '?*com.android.systemui:attr/backgroundColor').

I'm using command-line to build my APK, and this is my file setup:

./AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="test.theme.aospstatusbar">

    <overlay
        android:priority="1"
        android:targetPackage="com.android.systemui"
</manifest>

The following file is a sample of the drawables I included in the package, and in which the error samples above are referring to:

./res/drawable/stat_sys_wifi_signal_0.xml

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="18.41dp"
        android:height="18.41dp"
        android:viewportWidth="21.2"
        android:viewportHeight="21.2">
      <group
          android:translateX="0.5"
          android:translateY="2.0">
        <path
            android:pathData="M18.79,9.79c-0.32,-0.32 -0.83,-0.32 -1.15,0L16.43,11l-1.21,-1.21c-0.32,-0.32 -0.83,-0.32 -1.15,0L14.06,9.8l0,0c-0.32,0.32 -0.32,0.83 0,1.15l1.21,1.21l-1.21,1.21l0,0c-0.32,0.32 -0.32,0.83 0,1.15l0.01,0.01c0.32,0.32 0.83,0.32 1.15,0l1.21,-1.21l1.21,1.21c0.32,0.32 0.83,0.32 1.15,0c0.32,-0.32 0.32,-0.83 0,-1.15l-1.21,-1.21l1.21,-1.21C19.1,10.64 19.1,10.13 18.79,9.79z"
            android:fillColor="?*com.android.systemui:attr/fillColor"/>
        <path
            android:pathData="M11.69,7.44h6.27L19.95,5c0.4,-0.49 0.3,-1.22 -0.23,-1.56c-1.6,-1.05 -5.04,-2.9 -9.62,-2.9c-4.59,0 -8.03,1.85 -9.62,2.9C-0.05,3.78 -0.16,4.51 0.24,5l9.02,11.08c0.42,0.52 1.22,0.52 1.64,0l0.78,-0.96V7.44z"
            android:fillColor="?*com.android.systemui:attr/backgroundColor"/>
      </group>
</vector>

I build using the following command (aapt being in build-tools\26.0.3):

aapt package -M \thm\AndroidManifest.xml -S \thm\res -I %sdk%\platforms\android-26\android.jar -F \thm\build\overlay.apk -f

I believe the problem is in referencing from the systemui package? Am I doing something wrong?

2

There are 2 answers

3
MaFancy On

I don't know if the answer is still relevant but I was trying to do the same thing and I have found a solution. Just put -I systemui.apk into the aapt command and it should compile. Assuming you have the pulled systemui package in the same folder. This should work for any package.

0
khetanrajesh On

You cannot do that .You said you have pulled the AOSP resource for System UI , you can directly use them in your build.

Detail explanation :

The resource you are trying to access is part of com.android.systemui package which is not present in the android.jar you have passed to your aapt command . The only resources present in android.jar accessible to 3rd party are the ones listed in the public.xml file of android framework :

http://androidxref.com/8.0.0_r4/xref/frameworks/base/core/res/res/values/public.xml

The aapt when trying to processDebugResources looks for the resource in android.jar and \thm\res . Since it could not find the resource into both , it throws the no resource found error .

Solution :

Create similar resource as present here and use them in your theme. You have to resolve every dependency , such that your apk can run independently on any android device .

http://androidxref.com/8.0.0_r4/xref/frameworks/base/packages/SystemUI/res/