From c5505418b4a5b61496f3f00ade04e3b008d53332 Mon Sep 17 00:00:00 2001 From: Luca Stefani Date: Mon, 17 Jun 2024 22:44:54 +0200 Subject: [PATCH] aflags: Ensure /aconfig_flags.pb exists before reading In some build targets/combinations aconfig_flags.pb may not be generated. For example in GSI only system/aconfig_flags.pb exists and system-only updates won't have vendor/aconfig_flags.pb. Test: m, aflags Change-Id: I136345a8748bc6d80bd98e673f90e0a2ab380ab1 --- tools/aconfig/aconfig_device_paths/src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/aconfig/aconfig_device_paths/src/lib.rs b/tools/aconfig/aconfig_device_paths/src/lib.rs index 7480b3002c..9ab9cea267 100644 --- a/tools/aconfig/aconfig_device_paths/src/lib.rs +++ b/tools/aconfig/aconfig_device_paths/src/lib.rs @@ -30,9 +30,11 @@ fn read_partition_paths() -> Vec { .collect() } -/// Determine all paths that contain an aconfig protobuf file. +/// Determines all paths that contain an aconfig protobuf file, +/// filtering out nonexistent partition protobuf files. pub fn parsed_flags_proto_paths() -> Result> { - let mut result: Vec = read_partition_paths(); + let mut result: Vec = + read_partition_paths().into_iter().filter(|s| s.exists()).collect(); for dir in fs::read_dir("/apex")? { let dir = dir?;