aboutsummaryrefslogtreecommitdiff
path: root/tools/aconfig/aflags/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tools/aconfig/aflags/src/main.rs')
-rw-r--r--tools/aconfig/aflags/src/main.rs35
1 files changed, 5 insertions, 30 deletions
diff --git a/tools/aconfig/aflags/src/main.rs b/tools/aconfig/aflags/src/main.rs
index 568ad999e0..dd1a48bf9f 100644
--- a/tools/aconfig/aflags/src/main.rs
+++ b/tools/aconfig/aflags/src/main.rs
@@ -132,11 +132,6 @@ trait FlagSource {
fn override_flag(namespace: &str, qualified_name: &str, value: &str) -> Result<()>;
}
-enum FlagSourceType {
- DeviceConfig,
- AconfigStorage,
-}
-
const ABOUT_TEXT: &str = "Tool for reading and writing flags.
Rows in the table from the `list` command follow this format:
@@ -184,9 +179,6 @@ enum Command {
/// <package>.<flag_name>
qualified_name: String,
},
-
- /// Display which flag storage backs aconfig flags.
- WhichBacking,
}
struct PaddingInfo {
@@ -251,11 +243,8 @@ fn set_flag(qualified_name: &str, value: &str) -> Result<()> {
Ok(())
}
-fn list(source_type: FlagSourceType, container: Option<String>) -> Result<String> {
- let flags_unfiltered = match source_type {
- FlagSourceType::DeviceConfig => DeviceConfigSource::list_flags()?,
- FlagSourceType::AconfigStorage => AconfigStorageSource::list_flags()?,
- };
+fn list(container: Option<String>) -> Result<String> {
+ let flags_unfiltered = AconfigStorageSource::list_flags()?;
if let Some(ref c) = container {
ensure!(
@@ -293,19 +282,12 @@ fn list(source_type: FlagSourceType, container: Option<String>) -> Result<String
Ok(result)
}
-fn display_which_backing() -> String {
- if aconfig_flags::auto_generated::enable_only_new_storage() {
- "aconfig_storage".to_string()
- } else {
- "device_config".to_string()
- }
-}
-
fn invoke_updatable_aflags() {
let updatable_command = "/apex/com.android.configinfrastructure/bin/aflags_updatable";
let args: Vec<String> = env::args().collect();
- let command_args = if args.len() >= 2 { &args[1..] } else { &["--help".to_string()] };
+ let default_command_args = ["--help".to_string()];
+ let command_args = if args.len() >= 2 { &args[1..] } else { &default_command_args };
let mut child = OsCommand::new(updatable_command);
for arg in command_args {
@@ -337,17 +319,10 @@ fn main() -> Result<()> {
let cli = Cli::parse();
let output = match cli.command {
Command::List { container } => {
- if aconfig_flags::auto_generated::enable_only_new_storage() {
- list(FlagSourceType::AconfigStorage, container)
- .map_err(|err| anyhow!("could not list flags: {err}"))
- .map(Some)
- } else {
- list(FlagSourceType::DeviceConfig, container).map(Some)
- }
+ list(container).map_err(|err| anyhow!("could not list flags: {err}")).map(Some)
}
Command::Enable { qualified_name } => set_flag(&qualified_name, "true").map(|_| None),
Command::Disable { qualified_name } => set_flag(&qualified_name, "false").map(|_| None),
- Command::WhichBacking => Ok(Some(display_which_backing())),
};
match output {
Ok(Some(text)) => println!("{text}"),