Merge "Rename linkerconfig to linker_config" into main
diff --git a/core/Makefile b/core/Makefile
index 43618e3..eaa3190 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1267,6 +1267,37 @@
endif
+# Returns a list of EXTRA_INSTALL_ZIPS trios whose primary file is contained within $(1)
+# The trios will contain the primary installed file : the directory to unzip the zip to : the zip
+define relevant-extra-install-zips
+$(strip $(foreach p,$(EXTRA_INSTALL_ZIPS), \
+ $(if $(filter $(call word-colon,1,$(p)),$(1)), \
+ $(p))))
+endef
+
+# Writes a text file that contains all of the files that will be inside a partition.
+# All the file paths will be relative to the partition's staging directory.
+# It will also take into account files inside zips listed in EXTRA_INSTALL_ZIPS.
+#
+# Arguments:
+# $(1): Output file
+# $(2): The partition's staging directory
+# $(3): Files to include in the partition
+define write-partition-file-list
+$(1): PRIVATE_FILES := $(subst $(2)/,,$(filter $(2)/%,$(3)))
+$(1): PRIVATE_EXTRA_INSTALL_ZIPS := $(call relevant-extra-install-zips,$(filter $(2)/%,$(3)))
+$(1): $$(HOST_OUT_EXECUTABLES)/extra_install_zips_file_list $(foreach p,$(call relevant-extra-install-zips,$(filter $(2)/%,$(3))),$(call word-colon,3,$(p)))
+ @echo Writing $$@
+ rm -f $$@
+ echo -n > $$@
+ $$(foreach f,$$(PRIVATE_FILES),echo "$$(f)" >> $$@$$(newline))
+ $$(HOST_OUT_EXECUTABLES)/extra_install_zips_file_list $(2) $$(PRIVATE_EXTRA_INSTALL_ZIPS) >> $$@
+endef
+
+
+ramdisk_intermediates :=$= $(call intermediates-dir-for,PACKAGING,ramdisk)
+$(eval $(call write-partition-file-list,$(ramdisk_intermediates)/file_list.txt,$(TARGET_RAMDISK_OUT),$(INTERNAL_RAMDISK_FILES)))
+
# The value of RAMDISK_NODE_LIST is defined in system/core/rootdir/Android.bp.
# This file contains /dev nodes description added to the generic ramdisk
@@ -3472,33 +3503,6 @@
FULL_SYSTEMIMAGE_DEPS += $(INTERNAL_ROOT_FILES) $(INSTALLED_FILES_FILE_ROOT)
-# Returns a list of EXTRA_INSTALL_ZIPS trios whose primary file is contained within $(1)
-# The trios will contain the primary installed file : the directory to unzip the zip to : the zip
-define relevant-extra-install-zips
-$(strip $(foreach p,$(EXTRA_INSTALL_ZIPS), \
- $(if $(filter $(call word-colon,1,$(p)),$(1)), \
- $(p))))
-endef
-
-# Writes a text file that contains all of the files that will be inside a partition.
-# All the file paths will be relative to the partition's staging directory.
-# It will also take into account files inside zips listed in EXTRA_INSTALL_ZIPS.
-#
-# Arguments:
-# $(1): Output file
-# $(2): The partition's staging directory
-# $(3): Files to include in the partition
-define write-partition-file-list
-$(1): PRIVATE_FILES := $(subst $(2)/,,$(filter $(2)/%,$(3)))
-$(1): PRIVATE_EXTRA_INSTALL_ZIPS := $(call relevant-extra-install-zips,$(filter $(2)/%,$(3)))
-$(1): $$(HOST_OUT_EXECUTABLES)/extra_install_zips_file_list $(foreach p,$(call relevant-extra-install-zips,$(filter $(2)/%,$(3))),$(call word-colon,3,$(p)))
- @echo Writing $$@
- rm -f $$@
- echo -n > $$@
- $$(foreach f,$$(PRIVATE_FILES),echo "$$(f)" >> $$@$$(newline))
- $$(HOST_OUT_EXECUTABLES)/extra_install_zips_file_list $(2) $$(PRIVATE_EXTRA_INSTALL_ZIPS) >> $$@
-endef
-
# -----------------------------------------------------------------
ifdef BUILDING_SYSTEM_IMAGE
diff --git a/core/android_soong_config_vars.mk b/core/android_soong_config_vars.mk
index 26fe1da..6b83535 100644
--- a/core/android_soong_config_vars.mk
+++ b/core/android_soong_config_vars.mk
@@ -39,6 +39,7 @@
$(call add_soong_config_var,ANDROID,TARGET_DYNAMIC_64_32_DRMSERVER)
$(call add_soong_config_var,ANDROID,TARGET_ENABLE_MEDIADRM_64)
$(call add_soong_config_var,ANDROID,TARGET_DYNAMIC_64_32_MEDIASERVER)
+$(call add_soong_config_var,ANDROID,BOARD_GENFS_LABELS_VERSION)
$(call add_soong_config_var,ANDROID,ADDITIONAL_M4DEFS,$(if $(BOARD_SEPOLICY_M4DEFS),$(addprefix -D,$(BOARD_SEPOLICY_M4DEFS))))
diff --git a/core/config.mk b/core/config.mk
index f9ba38c..485e8cc 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -894,6 +894,11 @@
PLATFORM_SEPOLICY_COMPAT_VERSIONS \
PLATFORM_SEPOLICY_VERSION \
+BOARD_GENFS_LABELS_VERSION ?= $(BOARD_API_LEVEL)
+ifeq ($(call math_gt,$(BOARD_API_LEVEL),$(BOARD_GENFS_LABELS_VERSION)),true)
+ $(error BOARD_GENFS_LABELS_VERSION ($(BOARD_GENFS_LABELS_VERSION)) must be greater than or equal to BOARD_API_LEVEL ($(BOARD_API_LEVEL)))
+endif
+
ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
ifneq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
$(error PRODUCT_USE_DYNAMIC_PARTITIONS must be true when PRODUCT_RETROFIT_DYNAMIC_PARTITIONS \
diff --git a/core/main.mk b/core/main.mk
index 214d9a0..5142adc 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -268,9 +268,6 @@
$(error done)
endef
-# Rules to create android-info.txt and device sku manifest files
-include build/make/target/board/android-info.mk
-
subdir_makefiles_inc := .
FULL_BUILD :=
diff --git a/target/board/android-info.mk b/target/board/Android.mk
similarity index 100%
rename from target/board/android-info.mk
rename to target/board/Android.mk
diff --git a/tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/StorageFileProvider.java b/tools/aconfig/aconfig_storage_file/srcs/android/aconfig/storage/StorageFileProvider.java
similarity index 92%
rename from tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/StorageFileProvider.java
rename to tools/aconfig/aconfig_storage_file/srcs/android/aconfig/storage/StorageFileProvider.java
index b28341e..8306cc6 100644
--- a/tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/StorageFileProvider.java
+++ b/tools/aconfig/aconfig_storage_file/srcs/android/aconfig/storage/StorageFileProvider.java
@@ -21,6 +21,7 @@
import java.nio.channels.FileChannel;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
@@ -51,14 +52,6 @@
}
/** @hide */
- public boolean containerFileExists(String container) {
- if (container == null) {
- return Files.exists(Paths.get(mMapPath));
- }
- return Files.exists(Paths.get(mMapPath, container + PMAP_FILE_EXT));
- }
-
- /** @hide */
public List<Path> listPackageMapFiles() {
List<Path> result = new ArrayList<>();
try {
@@ -66,8 +59,9 @@
Files.newDirectoryStream(Paths.get(mMapPath), "*" + PMAP_FILE_EXT);
for (Path entry : stream) {
result.add(entry);
- // sb.append(entry. toString());
}
+ } catch (NoSuchFileException e) {
+ return result;
} catch (Exception e) {
throw new AconfigStorageException(
String.format("Fail to list map files in path %s", mMapPath), e);
diff --git a/tools/aconfig/aconfig_storage_file/tests/AndroidStorageJaveTest.xml b/tools/aconfig/aconfig_storage_file/tests/AndroidStorageJaveTest.xml
index 20fbfdb..bfc238e 100644
--- a/tools/aconfig/aconfig_storage_file/tests/AndroidStorageJaveTest.xml
+++ b/tools/aconfig/aconfig_storage_file/tests/AndroidStorageJaveTest.xml
@@ -21,14 +21,15 @@
</target_preparer>
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
<option name="cleanup" value="true" />
- <option name="push" value="package_v1.map->/data/local/tmp/aconfig_storage_file_test_java/testdata/package_v1.map" />
- <option name="push" value="flag_v1.map->/data/local/tmp/aconfig_storage_file_test_java/testdata/flag_v1.map" />
- <option name="push" value="flag_v1.val->/data/local/tmp/aconfig_storage_file_test_java/testdata/flag_v1.val" />
- <option name="push" value="flag_v1.info->/data/local/tmp/aconfig_storage_file_test_java/testdata/flag_v1.info" />
- <option name="push" value="package_v2.map->/data/local/tmp/aconfig_storage_file_test_java/testdata/package_v2.map" />
- <option name="push" value="flag_v2.map->/data/local/tmp/aconfig_storage_file_test_java/testdata/flag_v2.map" />
- <option name="push" value="flag_v2.val->/data/local/tmp/aconfig_storage_file_test_java/testdata/flag_v2.val" />
- <option name="push" value="flag_v2.info->/data/local/tmp/aconfig_storage_file_test_java/testdata/flag_v2.info" />
+ <option name="push" value="package_v1.map->/data/local/tmp/aconfig_storage_file_test_java/testdata/mock.v1.package.map" />
+ <option name="push" value="flag_v1.map->/data/local/tmp/aconfig_storage_file_test_java/testdata/mock.v1.flag.map" />
+ <option name="push" value="flag_v1.val->/data/local/tmp/aconfig_storage_file_test_java/testdata/mock.v1.val" />
+ <option name="push" value="flag_v1.info->/data/local/tmp/aconfig_storage_file_test_java/testdata/mock.v1.info" />
+ <option name="push" value="package_v2.map->/data/local/tmp/aconfig_storage_file_test_java/testdata/mock.v2.package.map" />
+ <option name="push" value="flag_v2.map->/data/local/tmp/aconfig_storage_file_test_java/testdata/mock.v2.flag.map" />
+ <option name="push" value="flag_v2.val->/data/local/tmp/aconfig_storage_file_test_java/testdata/mock.v2.val" />
+ <option name="push" value="flag_v2.info->/data/local/tmp/aconfig_storage_file_test_java/testdata/mock.v2.info" />
+ <option name="post-push" value="chmod +r /data/local/tmp/aconfig_storage_file_test_java/testdata/" />
</target_preparer>
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
<option name="package" value="android.aconfig.storage.test" />
diff --git a/tools/aconfig/aconfig_storage_file/tests/jarjar.txt b/tools/aconfig/aconfig_storage_file/tests/jarjar.txt
index a6c17fa..24952ec 100644
--- a/tools/aconfig/aconfig_storage_file/tests/jarjar.txt
+++ b/tools/aconfig/aconfig_storage_file/tests/jarjar.txt
@@ -7,6 +7,8 @@
rule android.aconfig.storage.FileType android.aconfig.storage.test.FileType
rule android.aconfig.storage.FlagValueList android.aconfig.storage.test.FlagValueList
rule android.aconfig.storage.TableUtils android.aconfig.storage.test.TableUtils
+rule android.aconfig.storage.AconfigPackageImpl android.aconfig.storage.test.AconfigPackageImpl
+rule android.aconfig.storage.StorageFileProvider android.aconfig.storage.test.StorageFileProvider
rule android.aconfig.storage.FlagTable$* android.aconfig.storage.test.FlagTable$@1
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/java/StorageFileProviderTest.java b/tools/aconfig/aconfig_storage_file/tests/srcs/StorageFileProviderTest.java
similarity index 63%
rename from tools/aconfig/aconfig_storage_read_api/tests/java/StorageFileProviderTest.java
rename to tools/aconfig/aconfig_storage_file/tests/srcs/StorageFileProviderTest.java
index ba1ae9e..4e90e6c 100644
--- a/tools/aconfig/aconfig_storage_read_api/tests/java/StorageFileProviderTest.java
+++ b/tools/aconfig/aconfig_storage_file/tests/srcs/StorageFileProviderTest.java
@@ -17,7 +17,6 @@
package android.aconfig.storage.test;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -38,43 +37,31 @@
public class StorageFileProviderTest {
@Test
- public void testContainerFileExists() throws Exception {
- StorageFileProvider p =
- new StorageFileProvider(TestDataUtils.TESTDATA_PATH, TestDataUtils.TESTDATA_PATH);
- assertTrue(p.containerFileExists(null));
- assertTrue(p.containerFileExists("mockup"));
- assertFalse(p.containerFileExists("fake"));
- }
-
- @Test
public void testListpackageMapFiles() throws Exception {
StorageFileProvider p =
new StorageFileProvider(TestDataUtils.TESTDATA_PATH, TestDataUtils.TESTDATA_PATH);
- // throw new Exception(Environment.getExternalStorageDirectory().getAbsolutePath());
List<Path> file = p.listPackageMapFiles();
- assertEquals(1, file.size());
- assertTrue(
- file.get(0)
- .equals(
- Paths.get(
- TestDataUtils.TESTDATA_PATH,
- TestDataUtils.TEST_PACKAGE_MAP_PATH)));
+ assertEquals(2, file.size());
+
+ p = new StorageFileProvider("fake/path/", "fake/path/");
+ file = p.listPackageMapFiles();
+ assertTrue(file.isEmpty());
}
@Test
public void testLoadFiles() throws Exception {
StorageFileProvider p =
new StorageFileProvider(TestDataUtils.TESTDATA_PATH, TestDataUtils.TESTDATA_PATH);
- PackageTable pt = p.getPackageTable("mockup");
+ PackageTable pt = p.getPackageTable("mock.v1");
assertNotNull(pt);
pt =
StorageFileProvider.getPackageTable(
Paths.get(
- TestDataUtils.TESTDATA_PATH, TestDataUtils.TEST_PACKAGE_MAP_PATH));
+ TestDataUtils.TESTDATA_PATH, "mock.v1.package.map"));
assertNotNull(pt);
- FlagTable f = p.getFlagTable("mockup");
+ FlagTable f = p.getFlagTable("mock.v1");
assertNotNull(f);
- FlagValueList v = p.getFlagValueList("mockup");
+ FlagValueList v = p.getFlagValueList("mock.v1");
assertNotNull(v);
}
}
diff --git a/tools/aconfig/aconfig_storage_file/tests/srcs/TestDataUtils.java b/tools/aconfig/aconfig_storage_file/tests/srcs/TestDataUtils.java
index 0643154..388971e 100644
--- a/tools/aconfig/aconfig_storage_file/tests/srcs/TestDataUtils.java
+++ b/tools/aconfig/aconfig_storage_file/tests/srcs/TestDataUtils.java
@@ -21,13 +21,12 @@
import java.nio.ByteBuffer;
public final class TestDataUtils {
- private static final String TEST_PACKAGE_MAP_PATH = "package_v%d.map";
- private static final String TEST_FLAG_MAP_PATH = "flag_v%d.map";
- private static final String TEST_FLAG_VAL_PATH = "flag_v%d.val";
- private static final String TEST_FLAG_INFO_PATH = "flag_v%d.info";
+ private static final String TEST_PACKAGE_MAP_PATH = "mock.v%d.package.map";
+ private static final String TEST_FLAG_MAP_PATH = "mock.v%d.flag.map";
+ private static final String TEST_FLAG_VAL_PATH = "mock.v%d.val";
+ private static final String TEST_FLAG_INFO_PATH = "mock.v%d.info";
- private static final String TESTDATA_PATH =
- "/data/local/tmp/aconfig_storage_file_test_java/testdata/";
+ public static final String TESTDATA_PATH = "/data/local/tmp/aconfig_storage_file_test_java/testdata/";
public static ByteBuffer getTestPackageMapByteBuffer(int version) throws Exception {
return readFile(TESTDATA_PATH + String.format(TEST_PACKAGE_MAP_PATH, version));
diff --git a/tools/aconfig/aconfig_storage_read_api/Android.bp b/tools/aconfig/aconfig_storage_read_api/Android.bp
index 7f7dd5a..3238d79 100644
--- a/tools/aconfig/aconfig_storage_read_api/Android.bp
+++ b/tools/aconfig/aconfig_storage_read_api/Android.bp
@@ -155,7 +155,6 @@
name: "aconfig_storage_reader_java",
srcs: [
"srcs/android/aconfig/storage/AconfigPackageImpl.java",
- "srcs/android/aconfig/storage/StorageFileProvider.java",
"srcs/android/aconfig/storage/StorageInternalReader.java",
],
libs: [
@@ -178,7 +177,6 @@
name: "aconfig_storage_reader_java_none",
srcs: [
"srcs/android/aconfig/storage/AconfigPackageImpl.java",
- "srcs/android/aconfig/storage/StorageFileProvider.java",
"srcs/android/aconfig/storage/StorageInternalReader.java",
],
libs: [
diff --git a/tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/AconfigPackageImpl.java b/tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/AconfigPackageImpl.java
index c2bef31..6bf4e05 100644
--- a/tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/AconfigPackageImpl.java
+++ b/tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/AconfigPackageImpl.java
@@ -25,113 +25,98 @@
private FlagTable mFlagTable;
private FlagValueList mFlagValueList;
private PackageTable.Node mPNode;
+ private final int mPackageId;
+ private final int mBooleanStartIndex;
- /** @hide */
- private AconfigPackageImpl() {}
+ private AconfigPackageImpl(
+ FlagTable flagTable,
+ FlagValueList flagValueList,
+ int packageId,
+ int booleanStartIndex) {
+ this.mFlagTable = flagTable;
+ this.mFlagValueList = flagValueList;
+ this.mPackageId = packageId;
+ this.mBooleanStartIndex = booleanStartIndex;
+ }
- /** @hide */
public static AconfigPackageImpl load(String packageName, StorageFileProvider fileProvider) {
- AconfigPackageImpl impl = new AconfigPackageImpl();
- impl.init(null, packageName, fileProvider);
- return impl;
- }
-
- /** @hide */
- public static AconfigPackageImpl load(
- String container, String packageName, StorageFileProvider fileProvider) {
- if (container == null) {
- throw new AconfigStorageException(
- AconfigStorageException.ERROR_CONTAINER_NOT_FOUND,
- "container null cannot be found on the device");
- }
- AconfigPackageImpl impl = new AconfigPackageImpl();
- impl.init(container, packageName, fileProvider);
- return impl;
- }
-
- /** @hide */
- public boolean getBooleanFlagValue(String flagName, boolean defaultValue) {
- FlagTable.Node fNode = mFlagTable.get(mPNode.getPackageId(), flagName);
- // no such flag in this package
- if (fNode == null) return defaultValue;
- int index = fNode.getFlagIndex() + mPNode.getBooleanStartIndex();
- return mFlagValueList.getBoolean(index);
- }
-
- /** @hide */
- public boolean getBooleanFlagValue(int index) {
- return mFlagValueList.getBoolean(index + mPNode.getBooleanStartIndex());
- }
-
- /** @hide */
- public long getPackageFingerprint() {
- return mPNode.getPackageFingerprint();
- }
-
- /** @hide */
- public boolean hasPackageFingerprint() {
- return mPNode.hasPackageFingerprint();
- }
-
- private void init(String containerName, String packageName, StorageFileProvider fileProvider) {
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
- String container = containerName;
+ PackageTable.Node pNode = null;
try {
- // for devices don't have new storage directly return
- if (!fileProvider.containerFileExists(null)) {
- throw new AconfigStorageException(
- AconfigStorageException.ERROR_STORAGE_SYSTEM_NOT_FOUND,
- "aconfig storage cannot be found on the device");
- }
- PackageTable.Node pNode = null;
-
- if (container == null) {
- // Check if the device has flag files on the system partition.
- // If the device does, search the system partition first.
- container = "system";
- if (fileProvider.containerFileExists(container)) {
- pNode = fileProvider.getPackageTable(container).get(packageName);
- }
-
- if (pNode == null) {
- // Search all package map files if not found in the system partition.
- for (Path p : fileProvider.listPackageMapFiles()) {
- PackageTable pTable = StorageFileProvider.getPackageTable(p);
- pNode = pTable.get(packageName);
- if (pNode != null) {
- container = pTable.getHeader().getContainer();
- break;
- }
- }
- }
- } else {
- if (!fileProvider.containerFileExists(container)) {
- throw new AconfigStorageException(
- AconfigStorageException.ERROR_CONTAINER_NOT_FOUND,
- "container " + container + " cannot be found on the device");
- }
- pNode = fileProvider.getPackageTable(container).get(packageName);
- }
-
- if (pNode == null) {
- // for the case package is not found in all container, return instead of throwing
- // error
- throw new AconfigStorageException(
- AconfigStorageException.ERROR_PACKAGE_NOT_FOUND,
- "package "
- + packageName
- + " in container "
- + container
- + " cannot be found on the device");
- }
-
- mFlagTable = fileProvider.getFlagTable(container);
- mFlagValueList = fileProvider.getFlagValueList(container);
- mPNode = pNode;
+ // First try to find the package in the "system" container.
+ pNode = fileProvider.getPackageTable("system").get(packageName);
} catch (Exception e) {
+ //
+ }
+ try {
+ if (pNode != null) {
+ return new AconfigPackageImpl(
+ fileProvider.getFlagTable("system"),
+ fileProvider.getFlagValueList("system"),
+ pNode.getPackageId(),
+ pNode.getBooleanStartIndex());
+ }
+
+ // If not found in "system", search all package map files.
+ for (Path p : fileProvider.listPackageMapFiles()) {
+ PackageTable pTable = fileProvider.getPackageTable(p);
+ pNode = pTable.get(packageName);
+ if (pNode != null) {
+ return new AconfigPackageImpl(
+ fileProvider.getFlagTable(pTable.getHeader().getContainer()),
+ fileProvider.getFlagValueList(pTable.getHeader().getContainer()),
+ pNode.getPackageId(),
+ pNode.getBooleanStartIndex());
+ }
+ }
+ } catch (AconfigStorageException e) {
+ // Consider logging the exception.
throw e;
} finally {
StrictMode.setThreadPolicy(oldPolicy);
}
+ // Package not found.
+ throw new AconfigStorageException(
+ AconfigStorageException.ERROR_PACKAGE_NOT_FOUND,
+ "Package " + packageName + " not found.");
+ }
+
+ public static AconfigPackageImpl load(
+ String container, String packageName, StorageFileProvider fileProvider) {
+
+ StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
+ try {
+ PackageTable.Node pNode = fileProvider.getPackageTable(container).get(packageName);
+ if (pNode != null) {
+ return new AconfigPackageImpl(
+ fileProvider.getFlagTable(container),
+ fileProvider.getFlagValueList(container),
+ pNode.getPackageId(),
+ pNode.getBooleanStartIndex());
+ }
+ } catch (AconfigStorageException e) {
+ // Consider logging the exception.
+ throw e;
+ } finally {
+ StrictMode.setThreadPolicy(oldPolicy);
+ }
+
+ throw new AconfigStorageException(
+ AconfigStorageException.ERROR_PACKAGE_NOT_FOUND,
+ "package "
+ + packageName
+ + " in container "
+ + container
+ + " cannot be found on the device");
+ }
+
+ public boolean getBooleanFlagValue(String flagName, boolean defaultValue) {
+ FlagTable.Node fNode = mFlagTable.get(mPackageId, flagName);
+ if (fNode == null) return defaultValue;
+ return mFlagValueList.getBoolean(fNode.getFlagIndex() + mBooleanStartIndex);
+ }
+
+ public boolean getBooleanFlagValue(int index) {
+ return mFlagValueList.getBoolean(index + mBooleanStartIndex);
}
}
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/java/AconfigPackageImplTest.java b/tools/aconfig/aconfig_storage_read_api/tests/java/AconfigPackageImplTest.java
index 18f70e8..80c0994 100644
--- a/tools/aconfig/aconfig_storage_read_api/tests/java/AconfigPackageImplTest.java
+++ b/tools/aconfig/aconfig_storage_read_api/tests/java/AconfigPackageImplTest.java
@@ -57,13 +57,13 @@
@Test
public void testLoad_error() throws Exception {
AconfigPackageImpl p;
+ // cannot find package
AconfigStorageException e =
assertThrows(
AconfigStorageException.class,
() ->
AconfigPackageImpl.load(
"mockup", "com.android.aconfig.storage.test_10", pr));
- // cannot find package
assertEquals(AconfigStorageException.ERROR_PACKAGE_NOT_FOUND, e.getErrorCode());
// cannot find package
e =
@@ -78,14 +78,14 @@
() ->
AconfigPackageImpl.load(
null, "com.android.aconfig.storage.test_1", pr));
- assertEquals(AconfigStorageException.ERROR_CONTAINER_NOT_FOUND, e.getErrorCode());
+ assertEquals(AconfigStorageException.ERROR_CANNOT_READ_STORAGE_FILE, e.getErrorCode());
e =
assertThrows(
AconfigStorageException.class,
() ->
AconfigPackageImpl.load(
"test", "com.android.aconfig.storage.test_1", pr));
- assertEquals(AconfigStorageException.ERROR_CONTAINER_NOT_FOUND, e.getErrorCode());
+ assertEquals(AconfigStorageException.ERROR_CANNOT_READ_STORAGE_FILE, e.getErrorCode());
// new storage doesn't exist
pr = new StorageFileProvider("fake/path/", "fake/path/");
@@ -93,7 +93,7 @@
assertThrows(
AconfigStorageException.class,
() -> AconfigPackageImpl.load("fake_package", pr));
- assertEquals(AconfigStorageException.ERROR_STORAGE_SYSTEM_NOT_FOUND, e.getErrorCode());
+ assertEquals(AconfigStorageException.ERROR_PACKAGE_NOT_FOUND, e.getErrorCode());
// file read issue
pr = new StorageFileProvider(TestDataUtils.TESTDATA_PATH, "fake/path/");
@@ -124,11 +124,4 @@
assertTrue(p.getBooleanFlagValue(1));
assertTrue(p.getBooleanFlagValue(2));
}
-
- @Test
- public void testHasPackageFingerprint() throws Exception {
- AconfigPackageImpl p =
- AconfigPackageImpl.load("mockup", "com.android.aconfig.storage.test_1", pr);
- assertFalse(p.hasPackageFingerprint());
- }
}
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/java/Android.bp b/tools/aconfig/aconfig_storage_read_api/tests/java/Android.bp
index 9c88122..0de34a6 100644
--- a/tools/aconfig/aconfig_storage_read_api/tests/java/Android.bp
+++ b/tools/aconfig/aconfig_storage_read_api/tests/java/Android.bp
@@ -28,7 +28,6 @@
team: "trendy_team_android_core_experiments",
srcs: [
"AconfigPackageImplTest.java",
- "StorageFileProviderTest.java",
"TestDataUtils.java",
],
static_libs: [