Merge "Revert "Add system staging dir stamp file for bazel sandwich"" into main
diff --git a/core/config.mk b/core/config.mk
index 920e457..e919be3 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -436,11 +436,25 @@
TARGET_MAX_PAGE_SIZE_SUPPORTED := 4096
# When VSR vendor API level >= 34, binary alignment will be 65536.
ifeq ($(call math_gt_or_eq,$(vsr_vendor_api_level),34),true)
+ ifeq ($(TARGET_ARCH),arm64)
TARGET_MAX_PAGE_SIZE_SUPPORTED := 65536
+ endif
+ ifeq ($(TARGET_ARCH),arm)
+ TARGET_MAX_PAGE_SIZE_SUPPORTED := 65536
+ endif
endif
endif
.KATI_READONLY := TARGET_MAX_PAGE_SIZE_SUPPORTED
+# Check that TARGET_MAX_PAGE_SIZE_SUPPORTED is greater than 4096 only for ARM arch.
+ifneq ($(TARGET_MAX_PAGE_SIZE_SUPPORTED),4096)
+ ifneq ($(TARGET_ARCH),arm64)
+ ifneq ($(TARGET_ARCH),arm)
+ $(error TARGET_MAX_PAGE_SIZE_SUPPORTED=$(TARGET_MAX_PAGE_SIZE_SUPPORTED) is greater than 4096. Only supported in ARM arch)
+ endif
+ endif
+endif
+
# Boolean variable determining if AOSP is page size agnostic. This means
# that AOSP can use a kernel configured with 4k/16k/64k PAGE SIZES.
TARGET_PAGE_SIZE_AGNOSTIC := false
diff --git a/core/soong_config.mk b/core/soong_config.mk
index f150660..bd6cfbb 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -40,6 +40,7 @@
$(call add_json_str, Platform_base_os, $(PLATFORM_BASE_OS))
$(call add_json_str, Platform_version_last_stable, $(PLATFORM_VERSION_LAST_STABLE))
$(call add_json_str, Platform_version_known_codenames, $(PLATFORM_VERSION_KNOWN_CODENAMES))
+$(call add_json_bool, Release_aidl_use_unfrozen, $(RELEASE_AIDL_USE_UNFROZEN))
$(call add_json_str, Platform_min_supported_target_sdk_version, $(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION))
diff --git a/tools/aconfig/src/commands.rs b/tools/aconfig/src/commands.rs
index 4f0a706..bd09e24 100644
--- a/tools/aconfig/src/commands.rs
+++ b/tools/aconfig/src/commands.rs
@@ -35,8 +35,15 @@
impl Input {
fn try_parse_flags(&mut self) -> Result<ProtoParsedFlags> {
let mut buffer = Vec::new();
- self.reader.read_to_end(&mut buffer)?;
+ self.reader
+ .read_to_end(&mut buffer)
+ .with_context(|| format!("failed to read {}", self.source))?;
crate::protos::parsed_flags::try_from_binary_proto(&buffer)
+ .with_context(|| self.error_context())
+ }
+
+ fn error_context(&self) -> String {
+ format!("failed to parse {}", self.source)
}
}
@@ -53,20 +60,23 @@
for mut input in declarations {
let mut contents = String::new();
- input.reader.read_to_string(&mut contents)?;
+ input
+ .reader
+ .read_to_string(&mut contents)
+ .with_context(|| format!("failed to read {}", input.source))?;
let flag_declarations = crate::protos::flag_declarations::try_from_text_proto(&contents)
- .with_context(|| format!("Failed to parse {}", input.source))?;
+ .with_context(|| input.error_context())?;
ensure!(
package == flag_declarations.package(),
- "Failed to parse {}: expected package {}, got {}",
+ "failed to parse {}: expected package {}, got {}",
input.source,
package,
flag_declarations.package()
);
for mut flag_declaration in flag_declarations.flag.into_iter() {
crate::protos::flag_declaration::verify_fields(&flag_declaration)
- .with_context(|| format!("Failed to parse {}", input.source))?;
+ .with_context(|| input.error_context())?;
// create ParsedFlag using FlagDeclaration and default values
let mut parsed_flag = ProtoParsedFlag::new();
@@ -101,12 +111,15 @@
for mut input in values {
let mut contents = String::new();
- input.reader.read_to_string(&mut contents)?;
+ input
+ .reader
+ .read_to_string(&mut contents)
+ .with_context(|| format!("failed to read {}", input.source))?;
let flag_values = crate::protos::flag_values::try_from_text_proto(&contents)
- .with_context(|| format!("Failed to parse {}", input.source))?;
+ .with_context(|| input.error_context())?;
for flag_value in flag_values.flag_value.into_iter() {
crate::protos::flag_value::verify_fields(&flag_value)
- .with_context(|| format!("Failed to parse {}", input.source))?;
+ .with_context(|| input.error_context())?;
let Some(parsed_flag) = parsed_flags
.parsed_flag
diff --git a/tools/aconfig/src/main.rs b/tools/aconfig/src/main.rs
index 151cbe8..920b761 100644
--- a/tools/aconfig/src/main.rs
+++ b/tools/aconfig/src/main.rs
@@ -16,7 +16,7 @@
//! `aconfig` is a build time tool to manage build time configurations, such as feature flags.
-use anyhow::{anyhow, bail, ensure, Result};
+use anyhow::{anyhow, bail, Context, Result};
use clap::{builder::ArgAction, builder::EnumValueParser, Arg, ArgMatches, Command};
use core::any::Any;
use std::fs;
@@ -129,26 +129,27 @@
}
fn write_output_file_realtive_to_dir(root: &Path, output_file: &OutputFile) -> Result<()> {
- ensure!(
- root.is_dir(),
- "output directory {} does not exist or is not a directory",
- root.display()
- );
let path = root.join(output_file.path.clone());
let parent = path
.parent()
.ok_or(anyhow!("unable to locate parent of output file {}", path.display()))?;
- fs::create_dir_all(parent)?;
- let mut file = fs::File::create(path)?;
- file.write_all(&output_file.contents)?;
+ fs::create_dir_all(parent)
+ .with_context(|| format!("failed to create directory {}", parent.display()))?;
+ let mut file = fs::File::create(path.clone())
+ .with_context(|| format!("failed to open {}", path.display()))?;
+ file.write_all(&output_file.contents)
+ .with_context(|| format!("failed to write to {}", path.display()))?;
Ok(())
}
fn write_output_to_file_or_stdout(path: &str, data: &[u8]) -> Result<()> {
if path == "-" {
- io::stdout().write_all(data)?;
+ io::stdout().write_all(data).context("failed to write to stdout")?;
} else {
- fs::File::create(path)?.write_all(data)?;
+ fs::File::create(path)
+ .with_context(|| format!("failed to open {}", path))?
+ .write_all(data)
+ .with_context(|| format!("failed to write to {}", path))?;
}
Ok(())
}
@@ -160,14 +161,16 @@
let package = get_required_arg::<String>(sub_matches, "package")?;
let declarations = open_zero_or_more_files(sub_matches, "declarations")?;
let values = open_zero_or_more_files(sub_matches, "values")?;
- let output = commands::parse_flags(package, declarations, values)?;
+ let output = commands::parse_flags(package, declarations, values)
+ .context("failed to create cache")?;
let path = get_required_arg::<String>(sub_matches, "cache")?;
write_output_to_file_or_stdout(path, &output)?;
}
Some(("create-java-lib", sub_matches)) => {
let cache = open_single_file(sub_matches, "cache")?;
let mode = get_required_arg::<CodegenMode>(sub_matches, "mode")?;
- let generated_files = commands::create_java_lib(cache, *mode)?;
+ let generated_files =
+ commands::create_java_lib(cache, *mode).context("failed to create java lib")?;
let dir = PathBuf::from(get_required_arg::<String>(sub_matches, "out")?);
generated_files
.iter()
@@ -176,7 +179,8 @@
Some(("create-cpp-lib", sub_matches)) => {
let cache = open_single_file(sub_matches, "cache")?;
let mode = get_required_arg::<CodegenMode>(sub_matches, "mode")?;
- let generated_files = commands::create_cpp_lib(cache, *mode)?;
+ let generated_files =
+ commands::create_cpp_lib(cache, *mode).context("failed to create cpp lib")?;
let dir = PathBuf::from(get_required_arg::<String>(sub_matches, "out")?);
generated_files
.iter()
@@ -185,25 +189,29 @@
Some(("create-rust-lib", sub_matches)) => {
let cache = open_single_file(sub_matches, "cache")?;
let mode = get_required_arg::<CodegenMode>(sub_matches, "mode")?;
- let generated_file = commands::create_rust_lib(cache, *mode)?;
+ let generated_file =
+ commands::create_rust_lib(cache, *mode).context("failed to create rust lib")?;
let dir = PathBuf::from(get_required_arg::<String>(sub_matches, "out")?);
write_output_file_realtive_to_dir(&dir, &generated_file)?;
}
Some(("create-device-config-defaults", sub_matches)) => {
let cache = open_single_file(sub_matches, "cache")?;
- let output = commands::create_device_config_defaults(cache)?;
+ let output = commands::create_device_config_defaults(cache)
+ .context("failed to create device config defaults")?;
let path = get_required_arg::<String>(sub_matches, "out")?;
write_output_to_file_or_stdout(path, &output)?;
}
Some(("create-device-config-sysprops", sub_matches)) => {
let cache = open_single_file(sub_matches, "cache")?;
- let output = commands::create_device_config_sysprops(cache)?;
+ let output = commands::create_device_config_sysprops(cache)
+ .context("failed to create device config sysprops")?;
let path = get_required_arg::<String>(sub_matches, "out")?;
write_output_to_file_or_stdout(path, &output)?;
}
Some(("dump", sub_matches)) => {
let input = open_zero_or_more_files(sub_matches, "cache")?;
- let format = get_required_arg::<DumpFormat>(sub_matches, "format")?;
+ let format = get_required_arg::<DumpFormat>(sub_matches, "format")
+ .context("failed to dump previously parsed flags")?;
let output = commands::dump_parsed_flags(input, *format)?;
let path = get_required_arg::<String>(sub_matches, "out")?;
write_output_to_file_or_stdout(path, &output)?;
diff --git a/tools/aconfig/src/protos.rs b/tools/aconfig/src/protos.rs
index 4ddada7..2ab6e05 100644
--- a/tools/aconfig/src/protos.rs
+++ b/tools/aconfig/src/protos.rs
@@ -92,8 +92,7 @@
ensure!(codegen::is_valid_name_ident(pdf.name()), "bad flag declaration: bad name");
ensure!(codegen::is_valid_name_ident(pdf.namespace()), "bad flag declaration: bad name");
ensure!(!pdf.description().is_empty(), "bad flag declaration: empty description");
-
- // ProtoFlagDeclaration.bug: Vec<String>: may be empty, no checks needed
+ ensure!(pdf.bug.len() == 1, "bad flag declaration: exactly one bug required");
Ok(())
}
@@ -195,8 +194,7 @@
for tp in pf.trace.iter() {
super::tracepoint::verify_fields(tp)?;
}
-
- // ProtoParsedFlag.bug: Vec<String>: may be empty, no checks needed
+ ensure!(pf.bug.len() == 1, "bad flag declaration: exactly one bug required");
Ok(())
}
@@ -279,12 +277,12 @@
namespace: "first_ns"
description: "This is the description of the first flag."
bug: "123"
- bug: "abc"
}
flag {
name: "second"
namespace: "second_ns"
description: "This is the description of the second flag."
+ bug: "abc"
}
"#,
)
@@ -294,14 +292,12 @@
assert_eq!(first.name(), "first");
assert_eq!(first.namespace(), "first_ns");
assert_eq!(first.description(), "This is the description of the first flag.");
- assert_eq!(first.bug.len(), 2);
- assert_eq!(first.bug[0], "123");
- assert_eq!(first.bug[1], "abc");
+ assert_eq!(first.bug, vec!["123"]);
let second = flag_declarations.flag.iter().find(|pf| pf.name() == "second").unwrap();
assert_eq!(second.name(), "second");
assert_eq!(second.namespace(), "second_ns");
assert_eq!(second.description(), "This is the description of the second flag.");
- assert_eq!(second.bug.len(), 0);
+ assert_eq!(second.bug, vec!["abc"]);
// bad input: missing package in flag declarations
let error = flag_declarations::try_from_text_proto(
@@ -376,6 +372,36 @@
)
.unwrap_err();
assert!(format!("{:?}", error).contains("bad flag declaration: bad name"));
+
+ // bad input: no bug entries in flag declaration
+ let error = flag_declarations::try_from_text_proto(
+ r#"
+package: "com.foo.bar"
+flag {
+ name: "first"
+ namespace: "first_ns"
+ description: "This is the description of the first flag."
+}
+"#,
+ )
+ .unwrap_err();
+ assert!(format!("{:?}", error).contains("bad flag declaration: exactly one bug required"));
+
+ // bad input: multiple bug entries in flag declaration
+ let error = flag_declarations::try_from_text_proto(
+ r#"
+package: "com.foo.bar"
+flag {
+ name: "first"
+ namespace: "first_ns"
+ description: "This is the description of the first flag."
+ bug: "123"
+ bug: "abc"
+}
+"#,
+ )
+ .unwrap_err();
+ assert!(format!("{:?}", error).contains("bad flag declaration: exactly one bug required"));
}
#[test]
@@ -482,6 +508,7 @@
name: "first"
namespace: "first_ns"
description: "This is the description of the first flag."
+ bug: "SOME_BUG"
state: DISABLED
permission: READ_ONLY
trace {
@@ -495,6 +522,7 @@
name: "second"
namespace: "second_ns"
description: "This is the description of the second flag."
+ bug: "SOME_BUG"
state: ENABLED
permission: READ_WRITE
trace {
@@ -516,6 +544,7 @@
assert_eq!(second.name(), "second");
assert_eq!(second.namespace(), "second_ns");
assert_eq!(second.description(), "This is the description of the second flag.");
+ assert_eq!(second.bug, vec!["SOME_BUG"]);
assert_eq!(second.state(), ProtoFlagState::ENABLED);
assert_eq!(second.permission(), ProtoFlagPermission::READ_WRITE);
assert_eq!(2, second.trace.len());
@@ -569,6 +598,7 @@
name: "first"
namespace: "first_ns"
description: "This is the description of the first flag."
+ bug: ""
state: DISABLED
permission: READ_ONLY
trace {
@@ -582,6 +612,7 @@
name: "second"
namespace: "second_ns"
description: "This is the description of the second flag."
+ bug: ""
state: ENABLED
permission: READ_WRITE
trace {
@@ -604,6 +635,7 @@
name: "bbb"
namespace: "first_ns"
description: "This is the description of the first flag."
+ bug: ""
state: DISABLED
permission: READ_ONLY
trace {
@@ -617,6 +649,7 @@
name: "aaa"
namespace: "second_ns"
description: "This is the description of the second flag."
+ bug: ""
state: ENABLED
permission: READ_WRITE
trace {
@@ -639,6 +672,7 @@
name: "bar"
namespace: "first_ns"
description: "This is the description of the first flag."
+ bug: ""
state: DISABLED
permission: READ_ONLY
trace {
@@ -652,6 +686,7 @@
name: "bar"
namespace: "second_ns"
description: "This is the description of the second flag."
+ bug: ""
state: ENABLED
permission: READ_WRITE
trace {
@@ -673,6 +708,7 @@
name: "bar"
namespace: "first_ns"
description: "This is the description of the first flag."
+ bug: "b/12345678"
state: DISABLED
permission: READ_ONLY
trace {
@@ -703,6 +739,7 @@
name: "first"
namespace: "first_ns"
description: "This is the description of the first flag."
+ bug: "a"
state: DISABLED
permission: READ_ONLY
trace {
@@ -716,6 +753,7 @@
name: "second"
namespace: "second_ns"
description: "This is the description of the second flag."
+ bug: "b"
state: ENABLED
permission: READ_WRITE
trace {
@@ -733,6 +771,7 @@
name: "first"
namespace: "first_ns"
description: "This is the description of the first flag."
+ bug: "a"
state: DISABLED
permission: READ_ONLY
trace {
@@ -749,6 +788,7 @@
package: "com.second"
name: "second"
namespace: "second_ns"
+ bug: "b"
description: "This is the description of the second flag."
state: ENABLED
permission: READ_WRITE
diff --git a/tools/aconfig/src/test.rs b/tools/aconfig/src/test.rs
index 04bbe28..14beb93 100644
--- a/tools/aconfig/src/test.rs
+++ b/tools/aconfig/src/test.rs
@@ -61,7 +61,6 @@
name: "enabled_ro"
namespace: "aconfig_test"
description: "This flag is ENABLED + READ_ONLY"
- bug: "789"
bug: "abc"
state: ENABLED
permission: READ_ONLY
@@ -86,6 +85,7 @@
name: "enabled_rw"
namespace: "aconfig_test"
description: "This flag is ENABLED + READ_WRITE"
+ bug: ""
state: ENABLED
permission: READ_WRITE
trace {
diff --git a/tools/aconfig/tests/test.aconfig b/tools/aconfig/tests/test.aconfig
index d7ac919..46cf1e9 100644
--- a/tools/aconfig/tests/test.aconfig
+++ b/tools/aconfig/tests/test.aconfig
@@ -8,7 +8,6 @@
name: "enabled_ro"
namespace: "aconfig_test"
description: "This flag is ENABLED + READ_ONLY"
- bug: "789"
bug: "abc"
}
@@ -19,7 +18,8 @@
name: "enabled_rw"
namespace: "aconfig_test"
description: "This flag is ENABLED + READ_WRITE"
- # no bug field: bug is not mandatory
+ # for bug fields, the empty string is a discouraged but valid value
+ bug: ""
}
# This flag's final value is calculated from:
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 1f021e0..732b5e9 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -1429,7 +1429,7 @@
if os.path.exists(new_path):
return new_path
raise ExternalError(
- "Failed to find {}".format(new_path))
+ "Failed to find {}".format(path))
if not split_args:
return split_args