@@ -11932,9 +11932,24 @@ HardwareLayer getHardwareLayer() {
1193211932 mHardwareLayer = mAttachInfo.mHardwareRenderer.createHardwareLayer(
1193311933 width, height, isOpaque());
1193411934 mLocalDirtyRect.set(0, 0, width, height);
11935- } else if (mHardwareLayer.getWidth() != width || mHardwareLayer.getHeight() != height) {
11936- mHardwareLayer.resize(width, height);
11937- mLocalDirtyRect.set(0, 0, width, height);
11935+ } else {
11936+ if (mHardwareLayer.getWidth() != width || mHardwareLayer.getHeight() != height) {
11937+ mHardwareLayer.resize(width, height);
11938+ mLocalDirtyRect.set(0, 0, width, height);
11939+ }
11940+
11941+ // This should not be necessary but applications that change
11942+ // the parameters of their background drawable without calling
11943+ // this.setBackground(Drawable) can leave the view in a bad state
11944+ // (for instance isOpaque() returns true, but the background is
11945+ // not opaque.)
11946+ computeOpaqueFlags();
11947+
11948+ final boolean opaque = isOpaque();
11949+ if (mHardwareLayer.isOpaque() != opaque) {
11950+ mHardwareLayer.setOpaque(opaque);
11951+ mLocalDirtyRect.set(0, 0, width, height);
11952+ }
1193811953 }
1193911954
1194011955 // The layer is not valid if the underlying GPU resources cannot be allocated
@@ -13993,6 +14008,8 @@ public void setBackground(Drawable background) {
1399314008 */
1399414009 @Deprecated
1399514010 public void setBackgroundDrawable(Drawable background) {
14011+ computeOpaqueFlags();
14012+
1399614013 if (background == mBackground) {
1399714014 return;
1399814015 }
0 commit comments