summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Wenbo Jie <wenbojie@google.com> 2025-03-23 23:38:37 +0000
committer Wenbo Jie <wenbojie@google.com> 2025-03-23 23:55:16 +0000
commit8df10b7cb0b244fd0dea247a4fd1cd2266b7ff14 (patch)
tree5d16d77c024fadce07c043baa8cbbc7b60b350da
parent343bf4b4eafc3c91e82afc6f5ff0847e2ba97b2f (diff)
[DocsUI M3] Fix "failed to resolve attribute" crash on SDK 30
On SDK 30 and also some other devices, DocsUI crashes when it's open because it can't resolve "@color/primary" resource, whose value points to a material color attribute. To fix it, this CL stops using the color attribute as the value: * It uses a static color for SDK 30 (this static color is from the same color attribute when dynamic color is OFF). * It uses the mapped system tokens from the color attribute for SDK 31+. Check the attached bug for the demo. Bug: 398973028 Test: m DocumentsUIGoogle && manual inspection Flag: com.android.documentsui.flags.use_material3 Change-Id: I139d623f3c36f63abef9e7421c38691dfc50265f
-rw-r--r--res/flag(com.android.documentsui.flags.use_material3)/values-night-v31/colors.xml2
-rw-r--r--res/flag(com.android.documentsui.flags.use_material3)/values-night/colors.xml2
-rw-r--r--res/flag(com.android.documentsui.flags.use_material3)/values-v31/colors.xml2
-rw-r--r--res/flag(com.android.documentsui.flags.use_material3)/values/colors.xml3
4 files changed, 8 insertions, 1 deletions
diff --git a/res/flag(com.android.documentsui.flags.use_material3)/values-night-v31/colors.xml b/res/flag(com.android.documentsui.flags.use_material3)/values-night-v31/colors.xml
index b75afa868..72dd819bb 100644
--- a/res/flag(com.android.documentsui.flags.use_material3)/values-night-v31/colors.xml
+++ b/res/flag(com.android.documentsui.flags.use_material3)/values-night-v31/colors.xml
@@ -14,6 +14,8 @@
-->
<resources>
+ <!-- ?attr/colorPrimary -->
+ <color name="primary">@android:color/system_accent1_200</color>
<color name="work_profile_button_stroke_color">
@*android:color/system_accent1_200
</color> <!-- accent 200 -->
diff --git a/res/flag(com.android.documentsui.flags.use_material3)/values-night/colors.xml b/res/flag(com.android.documentsui.flags.use_material3)/values-night/colors.xml
index ef4f5a902..b3cd1dae3 100644
--- a/res/flag(com.android.documentsui.flags.use_material3)/values-night/colors.xml
+++ b/res/flag(com.android.documentsui.flags.use_material3)/values-night/colors.xml
@@ -18,6 +18,8 @@
<color name="background_floating">#3C4043</color>
<color name="nav_bar_translucent">#52000000</color>
+ <!-- ?attr/colorPrimary -->
+ <color name="primary">#D0BCFF</color>
<color name="secondary">#3D8AB4F8</color>
<color name="hairline">#5F6368</color>
diff --git a/res/flag(com.android.documentsui.flags.use_material3)/values-v31/colors.xml b/res/flag(com.android.documentsui.flags.use_material3)/values-v31/colors.xml
index b7e11e885..27b636fe1 100644
--- a/res/flag(com.android.documentsui.flags.use_material3)/values-v31/colors.xml
+++ b/res/flag(com.android.documentsui.flags.use_material3)/values-v31/colors.xml
@@ -14,6 +14,8 @@
-->
<resources>
+ <!-- ?attr/colorPrimary -->
+ <color name="primary">@android:color/system_accent1_600</color>
<!-- neutral variant 700-->
<color name="work_profile_button_stroke_color">
@*android:color/system_accent1_600
diff --git a/res/flag(com.android.documentsui.flags.use_material3)/values/colors.xml b/res/flag(com.android.documentsui.flags.use_material3)/values/colors.xml
index 5696288e6..fed5a018a 100644
--- a/res/flag(com.android.documentsui.flags.use_material3)/values/colors.xml
+++ b/res/flag(com.android.documentsui.flags.use_material3)/values/colors.xml
@@ -22,7 +22,8 @@
<color name="background_floating">@android:color/white</color>
<color name="nav_bar_translucent">#99FFFFFF</color>
- <color name="primary">?attr/colorPrimary</color>
+ <!-- ?attr/colorPrimary -->
+ <color name="primary">#6750A4</color>
<color name="secondary">#E3F2FD</color> <!-- Blue 50 -->
<color name="hairline">#E0E0E0</color> <!-- Gray 300 -->