Make sure fields are initialized before access
We initialize mSurfaceControlId and mAttachedFrameNumber in the
constructor to assure they'll always give consistent values
when read.
Test: TreeHugger
Bug: 195699687
Change-Id: I471b402e4654a0c02082109d8828ad6b59085f13
diff --git a/libs/hwui/FrameMetricsObserver.h b/libs/hwui/FrameMetricsObserver.h
index 498ec57..3ea4951 100644
--- a/libs/hwui/FrameMetricsObserver.h
+++ b/libs/hwui/FrameMetricsObserver.h
@@ -45,7 +45,10 @@
* WARNING! This observer may not receive metrics for the last several frames that the app
* produces.
*/
- FrameMetricsObserver(bool waitForPresentTime) : mWaitForPresentTime(waitForPresentTime) {}
+ FrameMetricsObserver(bool waitForPresentTime)
+ : mWaitForPresentTime(waitForPresentTime)
+ , mSurfaceControlId(INT32_MAX)
+ , mAttachedFrameNumber(UINT64_MAX) {}
private:
const bool mWaitForPresentTime;