Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8df10b7c authored by Wenbo Jie's avatar Wenbo Jie
Browse files

[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
parent 343bf4b4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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 -->
+2 −0
Original line number Diff line number Diff line
@@ -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>

+2 −0
Original line number Diff line number Diff line
@@ -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
+2 −1
Original line number Diff line number Diff line
@@ -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 -->