0

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 Answers2

2

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.

Amit Joshi
  • 15,448
  • 21
  • 77
  • 141
MaFancy
  • 21
  • 3
  • I used the way you described and `aapt` now recognizes the attributes, but is telling me `Error: Attribute is not public`. (Sorry for the late reply.) – Hazem AbuMostafa Jul 10 '18 at 21:37
  • I'm still using `?*com.android.systemui:attr/XXX` to reference them, but also tried without the asterisk and/or without package name with same results. – Hazem AbuMostafa Jul 10 '18 at 21:37
  • Sorry, my mistake. This solution will probably work for every other type of resource but attribute. Well another solution might be to recreate the attribute in your overlay and reference it with original id in public.xml. But that gives me another error and I am not sure how to solve that. And I am not even sure if it will solve the problem. – MaFancy Jul 12 '18 at 07:55
0

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/

khetanrajesh
  • 300
  • 3
  • 13