Skip to content

Commit 56ed070

Browse files
dsn5ftpekingme
authored andcommitted
[Color] Update DynamicColors to use peekDecorView() instead of getDecorView() when applying dynamic color theme overlay
Resolves #2558 PiperOrigin-RevId: 428033173
1 parent 64c6d04 commit 56ed070

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/java/com/google/android/material/color/DynamicColors.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,8 @@ private static void applyDynamicColorThemeOverlay(Activity activity, @StyleRes i
315315
private static Theme getWindowDecorViewTheme(@NonNull Activity activity) {
316316
Window window = activity.getWindow();
317317
if (window != null) {
318-
View decorView = window.getDecorView();
318+
// Use peekDecorView() instead of getDecorView() to avoid locking the Window.
319+
View decorView = window.peekDecorView();
319320
if (decorView != null) {
320321
Context context = decorView.getContext();
321322
if (context != null) {

0 commit comments

Comments
 (0)