From ca0cf0f52985dd483fe7f59c6b522cfe7c9281e7 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Tue, 17 May 2016 14:35:42 -0700 Subject: [PATCH] Fix threading problems with drawables We can't use the same instance on both the main and the background thread, as this will lead to problems. Change-Id: Ieec525f028df2d0596667126d8f5004773461517 Fixes: 28745682 --- .../internal/policy/BackdropFrameRenderer.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/java/com/android/internal/policy/BackdropFrameRenderer.java b/core/java/com/android/internal/policy/BackdropFrameRenderer.java index b781fd47b1bdf..28281b3ce7400 100644 --- a/core/java/com/android/internal/policy/BackdropFrameRenderer.java +++ b/core/java/com/android/internal/policy/BackdropFrameRenderer.java @@ -109,9 +109,15 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame Drawable captionBackgroundDrawableDrawable, Drawable userCaptionBackgroundDrawable, int statusBarColor, int navigationBarColor) { mDecorView = decorView; - mResizingBackgroundDrawable = resizingBackgroundDrawable; - mCaptionBackgroundDrawable = captionBackgroundDrawableDrawable; - mUserCaptionBackgroundDrawable = userCaptionBackgroundDrawable; + mResizingBackgroundDrawable = resizingBackgroundDrawable != null + ? resizingBackgroundDrawable.getConstantState().newDrawable() + : null; + mCaptionBackgroundDrawable = captionBackgroundDrawableDrawable != null + ? captionBackgroundDrawableDrawable.getConstantState().newDrawable() + : null; + mUserCaptionBackgroundDrawable = userCaptionBackgroundDrawable != null + ? userCaptionBackgroundDrawable.getConstantState().newDrawable() + : null; if (mCaptionBackgroundDrawable == null) { mCaptionBackgroundDrawable = mResizingBackgroundDrawable; }