camera 2.4: conditionally disable memory init

This needs to be disabled on Pixel 3, but this is the only place w/
source code visible in AOSP. So, it is implemented as a mechanism.

Bug: 166675194
Test: atest android.hardware.camera2.cts.PerformanceTest
Change-Id: I0d91389432906a917696d27d27b4d6d96e64d09f
diff --git a/camera/provider/2.4/default/service.cpp b/camera/provider/2.4/default/service.cpp
index 4475f7d..84f4839 100644
--- a/camera/provider/2.4/default/service.cpp
+++ b/camera/provider/2.4/default/service.cpp
@@ -22,6 +22,8 @@
 
 #include <android/hardware/camera/provider/2.4/ICameraProvider.h>
 #include <binder/ProcessState.h>
+#include <cutils/memory.h>
+#include <cutils/properties.h>
 #include <hidl/LegacySupport.h>
 
 using android::status_t;
@@ -41,6 +43,12 @@
     // The camera HAL may communicate to other vendor components via
     // /dev/vndbinder
     android::ProcessState::initWithDriver("/dev/vndbinder");
+
+    // b/166675194
+    if (property_get_bool("ro.vendor.camera.provider24.disable_mem_init", false)) {
+        process_disable_memory_mitigations();
+    }
+
     status_t status;
     if (kLazyService) {
         status = defaultLazyPassthroughServiceImplementation<ICameraProvider>("legacy/0",