Add color parsing method.
Bug: 181110703
Test: manual
Change-Id: I5ffecf861d4b2c7be0949780c6d0faf486a7daab
diff --git a/Android.bp b/Android.bp
index 7aa7a98..755ba1d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -73,7 +73,7 @@
optimize: {
enabled: false,
},
-
+ kotlincflags: ["-Xjvm-default=enable"],
certificate: "",
privileged: true,
diff --git a/src/com/android/customization/model/ResourcesApkProvider.java b/src/com/android/customization/model/ResourcesApkProvider.java
index 92e03b9..538d4f8 100644
--- a/src/com/android/customization/model/ResourcesApkProvider.java
+++ b/src/com/android/customization/model/ResourcesApkProvider.java
@@ -9,6 +9,8 @@
import android.text.TextUtils;
import android.util.Log;
+import androidx.annotation.ColorInt;
+
public abstract class ResourcesApkProvider {
private static final String TAG = "ResourcesApkProvider";
@@ -55,6 +57,13 @@
return mStubApkResources.getDrawable(resourceId, null);
}
+ @ColorInt
+ protected int getItemColorFromStub(String prefix, String itemName) {
+ int resourceId = mStubApkResources.getIdentifier(String.format("%s%s", prefix, itemName),
+ "color", mStubPackageName);
+ return mStubApkResources.getColor(resourceId, null);
+ }
+
public boolean isAvailable() {
return mStubApkResources != null;
}