Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9f2ea2ec authored by Dennis Shen's avatar Dennis Shen Committed by Gerrit Code Review
Browse files

Merge "aconfig: update c++/rust codegen" into main

parents 3a25e819 f3540005
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -297,7 +297,7 @@ static CACHED_disabled_rw: LazyLock<bool> = LazyLock::new(|| {
                            },
                            None => {
                                log!(Level::Error, "no context found for package com.android.aconfig.test");
                                Ok(false)
                                Err(format!("failed to flag package com.android.aconfig.test"))
                            }
                        }
                    })
@@ -309,7 +309,7 @@ static CACHED_disabled_rw: LazyLock<bool> = LazyLock::new(|| {
            },
            Err(err) => {
                log!(Level::Error, "aconfig_rust_codegen: error: {err}");
                panic!("failed to read flag value: {err}");
                return false;
            }
        }
    } else {
@@ -344,7 +344,7 @@ static CACHED_disabled_rw_exported: LazyLock<bool> = LazyLock::new(|| {
                            },
                            None => {
                                log!(Level::Error, "no context found for package com.android.aconfig.test");
                                Ok(false)
                                Err(format!("failed to flag package com.android.aconfig.test"))
                            }
                        }
                    })
@@ -356,7 +356,7 @@ static CACHED_disabled_rw_exported: LazyLock<bool> = LazyLock::new(|| {
            },
            Err(err) => {
                log!(Level::Error, "aconfig_rust_codegen: error: {err}");
                panic!("failed to read flag value: {err}");
                return false;
            }
        }
    } else {
@@ -391,7 +391,7 @@ static CACHED_disabled_rw_in_other_namespace: LazyLock<bool> = LazyLock::new(||
                            },
                            None => {
                                log!(Level::Error, "no context found for package com.android.aconfig.test");
                                Ok(false)
                                Err(format!("failed to flag package com.android.aconfig.test"))
                            }
                        }
                    })
@@ -403,7 +403,7 @@ static CACHED_disabled_rw_in_other_namespace: LazyLock<bool> = LazyLock::new(||
            },
            Err(err) => {
                log!(Level::Error, "aconfig_rust_codegen: error: {err}");
                panic!("failed to read flag value: {err}");
                return false;
            }
        }
    } else {
@@ -439,7 +439,7 @@ static CACHED_enabled_rw: LazyLock<bool> = LazyLock::new(|| {
                            },
                            None => {
                                log!(Level::Error, "no context found for package com.android.aconfig.test");
                                Ok(true)
                                Err(format!("failed to flag package com.android.aconfig.test"))
                            }
                        }
                    })
@@ -451,7 +451,7 @@ static CACHED_enabled_rw: LazyLock<bool> = LazyLock::new(|| {
            },
            Err(err) => {
                log!(Level::Error, "aconfig_rust_codegen: error: {err}");
                panic!("failed to read flag value: {err}");
                return true;
            }
        }
    } else {
+8 −2
Original line number Diff line number Diff line
@@ -92,12 +92,16 @@ namespace {cpp_namespace} \{
                 aconfig_storage::StorageFileType::package_map);
            if (!package_map_file.ok()) \{
                ALOGE("error: failed to get package map file: %s", package_map_file.error().c_str());
                package_exists_in_storage_ = false;
                return;
            }

            auto context = aconfig_storage::get_package_read_context(
                **package_map_file, "{package}");
            if (!context.ok()) \{
                ALOGE("error: failed to get package read context: %s", context.error().c_str());
                package_exists_in_storage_ = false;
                return;
            }

            if (!(context->package_exists)) \{
@@ -116,6 +120,8 @@ namespace {cpp_namespace} \{
                aconfig_storage::StorageFileType::flag_val);
            if (!flag_value_file.ok()) \{
                ALOGE("error: failed to get flag value file: %s", flag_value_file.error().c_str());
                package_exists_in_storage_ = false;
                return;
            }

            // cache flag value file
+2 −2
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ static CACHED_{flag.name}: LazyLock<bool> = LazyLock::new(|| \{
                            },
                            None => \{
                                 log!(Level::Error, "no context found for package {package}");
                                 Ok({flag.default_value})
                                 Err(format!("failed to flag package {package}"))
                            }
                        }
                    })
@@ -65,7 +65,7 @@ static CACHED_{flag.name}: LazyLock<bool> = LazyLock::new(|| \{
            },
            Err(err) => \{
                log!(Level::Error, "aconfig_rust_codegen: error: \{err}");
                panic!("failed to read flag value: \{err}");
                return {flag.default_value};
            }
        }
    } else \{