system_test: Remove stack capture for mock_osi_property

The global mocks should not capture anything in the lambda function else it may corrupt stack.

Bug: 321390259
Test: m a
Flag: EXEMPT TEST_ONLY
Change-Id: I621c26003f286ec5ac474855dd7f55a92d8337b4
diff --git a/system/test/mock/mock_osi_properties.cc b/system/test/mock/mock_osi_properties.cc
index 28c0891..35e00c6 100644
--- a/system/test/mock/mock_osi_properties.cc
+++ b/system/test/mock/mock_osi_properties.cc
@@ -46,14 +46,17 @@
 }  // namespace test
 
 // Mocked functions, if any
+int test::mock::osi_properties::osi_property_get::return_value{0};
 int osi_property_get(const char* key, char* value, const char* default_value) {
   inc_func_call_count(__func__);
   return test::mock::osi_properties::osi_property_get(key, value, default_value);
 }
+bool test::mock::osi_properties::osi_property_get_bool::return_value{false};
 bool osi_property_get_bool(const char* key, bool default_value) {
   inc_func_call_count(__func__);
   return test::mock::osi_properties::osi_property_get_bool(key, default_value);
 }
+int32_t test::mock::osi_properties::osi_property_get_int32::return_value{0};
 int32_t osi_property_get_int32(const char* key, int32_t default_value) {
   inc_func_call_count(__func__);
   return test::mock::osi_properties::osi_property_get_int32(key, default_value);
@@ -63,6 +66,7 @@
   inc_func_call_count(__func__);
   return default_value;
 }
+int test::mock::osi_properties::osi_property_set::return_value{0};
 int osi_property_set(const char* key, const char* value) {
   inc_func_call_count(__func__);
   return test::mock::osi_properties::osi_property_set(key, value);
diff --git a/system/test/mock/mock_osi_properties.h b/system/test/mock/mock_osi_properties.h
index bbdeb61..8957cc1 100644
--- a/system/test/mock/mock_osi_properties.h
+++ b/system/test/mock/mock_osi_properties.h
@@ -35,9 +35,9 @@
 // Params: const char* key, char* value, const char* default_value
 // Return: int
 struct osi_property_get {
-  int return_value{0};
+  static int return_value;
   std::function<int(const char* key, char* value, const char* default_value)> body{
-          [this](const char* /* key */, char* /* value */, const char* /* default_value */) {
+          [](const char* /* key */, char* /* value */, const char* /* default_value */) {
             return return_value;
           }};
   int operator()(const char* key, char* value, const char* default_value) {
@@ -50,9 +50,9 @@
 // Params: const char* key, bool default_value
 // Return: bool
 struct osi_property_get_bool {
-  bool return_value{false};
+  static bool return_value;
   std::function<bool(const char* key, bool default_value)> body{
-          [this](const char* /* key */, bool /* default_value */) { return return_value; }};
+          [](const char* /* key */, bool /* default_value */) { return return_value; }};
   bool operator()(const char* key, bool default_value) { return body(key, default_value); }
 };
 extern struct osi_property_get_bool osi_property_get_bool;
@@ -61,9 +61,9 @@
 // Params: const char* key, int32_t default_value
 // Return: int32_t
 struct osi_property_get_int32 {
-  int32_t return_value{0};
+  static int32_t return_value;
   std::function<int32_t(const char* key, int32_t default_value)> body{
-          [this](const char* /* key */, int32_t /* default_value */) { return return_value; }};
+          [](const char* /* key */, int32_t /* default_value */) { return return_value; }};
   int32_t operator()(const char* key, int32_t default_value) { return body(key, default_value); }
 };
 extern struct osi_property_get_int32 osi_property_get_int32;
@@ -72,9 +72,9 @@
 // Params: const char* key, const char* value
 // Return: int
 struct osi_property_set {
-  int return_value{0};
+  static int return_value;
   std::function<int(const char* key, const char* value)> body{
-          [this](const char* /* key */, const char* /* value */) { return return_value; }};
+          [](const char* /* key */, const char* /* value */) { return return_value; }};
   int operator()(const char* key, const char* value) { return body(key, value); }
 };
 extern struct osi_property_set osi_property_set;