OSDN Git Service

Do not draw background if the background drawable is null
authorChong Zhang <chz@google.com>
Tue, 2 Feb 2016 00:08:21 +0000 (16:08 -0800)
committerChong Zhang <chz@google.com>
Tue, 2 Feb 2016 00:09:55 +0000 (16:09 -0800)
Some apps may not have background drawables.

bug: 26729953
Change-Id: I1e93013bb91ba376449bc580646fc733ca4dd072

core/java/com/android/internal/policy/BackdropFrameRenderer.java

index de54d96..5047c4c 100644 (file)
@@ -289,12 +289,17 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
         DisplayListCanvas canvas = mFrameAndBackdropNode.start(width, height);
         final Drawable drawable = mUserCaptionBackgroundDrawable != null
                 ? mUserCaptionBackgroundDrawable : mCaptionBackgroundDrawable;
-        drawable.setBounds(0, 0, left + width, top + mLastCaptionHeight);
-        drawable.draw(canvas);
+
+        if (drawable != null) {
+            drawable.setBounds(0, 0, left + width, top + mLastCaptionHeight);
+            drawable.draw(canvas);
+        }
 
         // The backdrop: clear everything with the background. Clipping is done elsewhere.
-        mResizingBackgroundDrawable.setBounds(0, mLastCaptionHeight, left + width, top + height);
-        mResizingBackgroundDrawable.draw(canvas);
+        if (mResizingBackgroundDrawable != null) {
+            mResizingBackgroundDrawable.setBounds(0, mLastCaptionHeight, left + width, top + height);
+            mResizingBackgroundDrawable.draw(canvas);
+        }
         mFrameAndBackdropNode.end(canvas);
 
         if (mSystemBarBackgroundNode != null && mStatusBarColor != null) {