From 26c29adc67cf08b74d02581e4e7d0dfd48601bc4 Mon Sep 17 00:00:00 2001 From: Ted Bauer Date: Fri, 19 Jul 2024 14:23:50 +0000 Subject: [PATCH] Return legacy value if error in new storage Bug: 312235596 Test: m Change-Id: I46f670e565a2133e0e5eb2c157eb21a12a5ae7aa Ignore-AOSP-First: will test internally first then CP to AOSP --- tools/aconfig/aconfig/templates/cpp_source_file.template | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/aconfig/aconfig/templates/cpp_source_file.template b/tools/aconfig/aconfig/templates/cpp_source_file.template index 6859388ad0..e94195ddbc 100644 --- a/tools/aconfig/aconfig/templates/cpp_source_file.template +++ b/tools/aconfig/aconfig/templates/cpp_source_file.template @@ -133,7 +133,8 @@ namespace {cpp_namespace} \{ {{ if allow_instrumentation- }} if (read_from_new_storage_) \{ if (!flag_value_file_) \{ - ALOGI("error: failed to get flag {item.flag_name}: flag value file is null"); + ALOGI("error: failed to get flag {item.flag_name}: flag value file is null"); + return cache_[{item.readwrite_idx}]; } auto value = aconfig_storage::get_boolean_flag_value( @@ -142,6 +143,7 @@ namespace {cpp_namespace} \{ if (!value.ok()) \{ ALOGI("error: failed to read flag value: %s", value.error().c_str()); + return cache_[{item.readwrite_idx}]; } bool expected_value = cache_[{item.readwrite_idx}];