Lazy load Properties::isDrawingEnabled.
Properties::isDrawingEnabled can unexpectedly return true
even if the system property debug.hwui.drawing_enabled is false,
if its called before RenderThread is created.
This commit changes the underlying logic to lazy load the
debug.hwui.drawing_enabled prop value.
Bug: 201691826
Test: m
Change-Id: I599426c8734d418f073fd0456c2b1149fb69d80c
diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h
index 73fccb6..7f9782b 100644
--- a/libs/hwui/Properties.h
+++ b/libs/hwui/Properties.h
@@ -214,7 +214,7 @@
UniformScale // Uniform scale stretch everywhere
};
-enum class OverrideDrawingEnabled { Default, On, Off };
+enum class DrawingEnabled { NotInitialized, On, Off };
/**
* Renderthread-only singleton which manages several static rendering properties. Most of these
@@ -309,9 +309,8 @@
stretchEffectBehavior = behavior;
}
- // Represents if GL drawing is enabled. Should only be false in headless testing environments
- static bool drawingEnabled;
- static OverrideDrawingEnabled overrideDrawingEnabled;
+ // Represents if drawing is enabled. Should only be Off in headless testing environments
+ static DrawingEnabled drawingEnabled;
static bool isDrawingEnabled();
static void setDrawingEnabled(bool enable);