CameraService: Initialize two fields in constructor
isIndividual was potentially being read uninitialized in
onSensorPrivacyChanged(). In theory, userId wasn't being read
uninitialized with the current logic, but we choose to
future-proof by initializing it to a known value.
Bug: 170156750
Bug: 162549680
Test: TreeHugger
Change-Id: I7672fe90556ab71bc3d9021d5adc91b9f4e0a5c3
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index f455cbb..5f16d41 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -637,7 +637,8 @@
public virtual IBinder::DeathRecipient {
public:
explicit SensorPrivacyPolicy(wp<CameraService> service)
- : mService(service), mSensorPrivacyEnabled(false), mRegistered(false) {}
+ : mService(service), mSensorPrivacyEnabled(false), mRegistered(false),
+ isIndividual(false), userId(0) {}
void registerSelf();
status_t registerSelfForIndividual(int userId);