Merge "Expose DeviceProtos' paths to parse in Framework" into main

This commit is contained in:
Treehugger Robot
2024-09-12 21:33:17 +00:00
committed by Gerrit Code Review
2 changed files with 11 additions and 6 deletions

View File

@@ -51,4 +51,8 @@ java_library {
static_libs: [
"libaconfig_java_proto_nano",
],
sdk_version: "core_platform",
apex_available: [
"//apex_available:platform",
],
}

View File

@@ -29,7 +29,7 @@ import java.util.List;
* @hide
*/
public class DeviceProtos {
static final String[] PATHS = {
public static final String[] PATHS = {
TEMPLATE
};
@@ -50,12 +50,13 @@ public class DeviceProtos {
ArrayList<parsed_flag> result = new ArrayList();
for (String path : parsedFlagsProtoPaths()) {
FileInputStream inputStream = new FileInputStream(path);
try (FileInputStream inputStream = new FileInputStream(path)) {
parsed_flags parsedFlags = parsed_flags.parseFrom(inputStream.readAllBytes());
for (parsed_flag flag : parsedFlags.parsedFlag) {
result.add(flag);
}
}
}
return result;
}
@@ -64,7 +65,7 @@ public class DeviceProtos {
* Returns the list of all on-device aconfig protos paths.
* @hide
*/
private static List<String> parsedFlagsProtoPaths() {
public static List<String> parsedFlagsProtoPaths() {
ArrayList<String> paths = new ArrayList(Arrays.asList(PATHS));
File apexDirectory = new File(APEX_DIR);