Merge cherrypicks of [2779825, 2780206, 2780207, 2780102, 2780103, 2779826, 2779827, 2779722, 2779723, 2779973, 2780208, 2780209, 2780210, 2780211, 2780212, 2780213, 2779703, 2779704, 2779705, 2779706, 2779707, 2779708, 2779709, 2780214, 2779828, 2779829, 2779454, 2779724] into oc-r3-release

Change-Id: Ic3903f1b98d5c67903378914c731556d3753fb62
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 88a5bd4..2305206 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2682,7 +2682,7 @@
         // for in the transform. We need to mirror this scaling in child surfaces
         // or we will break the contract where WM can treat child surfaces as
         // pixels in the parent surface.
-        if (p->isFixedSize()) {
+        if (p->isFixedSize() && p->mActiveBuffer != nullptr) {
             int bufferWidth;
             int bufferHeight;
             if ((p->mCurrentTransform & NATIVE_WINDOW_TRANSFORM_ROT_90) == 0) {