summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataCategoryFactory.java4
-rw-r--r--tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataLabelsFactory.java4
-rw-r--r--tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataType.java14
-rw-r--r--tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataTypeFactory.java6
-rw-r--r--tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/contacts/hr.xml2
-rw-r--r--tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/contacts/od.xml4
-rw-r--r--tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/location/hr.xml2
-rw-r--r--tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/location/od.xml4
8 files changed, 22 insertions, 18 deletions
diff --git a/tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataCategoryFactory.java b/tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataCategoryFactory.java
index ae7b603c87f6..d2b671271561 100644
--- a/tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataCategoryFactory.java
+++ b/tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataCategoryFactory.java
@@ -20,7 +20,7 @@ import com.android.asllib.util.MalformedXmlException;
import org.w3c.dom.Element;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -28,7 +28,7 @@ public class DataCategoryFactory implements AslMarshallableFactory<DataCategory>
@Override
public DataCategory createFromHrElements(List<Element> elements) throws MalformedXmlException {
String categoryName = null;
- Map<String, DataType> dataTypeMap = new HashMap<String, DataType>();
+ Map<String, DataType> dataTypeMap = new LinkedHashMap<String, DataType>();
for (Element ele : elements) {
categoryName = ele.getAttribute(XmlUtils.HR_ATTR_DATA_CATEGORY);
String dataTypeName = ele.getAttribute(XmlUtils.HR_ATTR_DATA_TYPE);
diff --git a/tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataLabelsFactory.java b/tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataLabelsFactory.java
index 0e14ebf4eab9..79edab7631f0 100644
--- a/tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataLabelsFactory.java
+++ b/tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataLabelsFactory.java
@@ -22,8 +22,8 @@ import com.android.asllib.util.MalformedXmlException;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
-import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -93,7 +93,7 @@ public class DataLabelsFactory implements AslMarshallableFactory<DataLabels> {
private static Map<String, DataCategory> getDataCategoriesWithTag(
Element dataLabelsEle, String dataCategoryUsageTypeTag) throws MalformedXmlException {
NodeList dataUsedNodeList = dataLabelsEle.getElementsByTagName(dataCategoryUsageTypeTag);
- Map<String, DataCategory> dataCategoryMap = new HashMap<String, DataCategory>();
+ Map<String, DataCategory> dataCategoryMap = new LinkedHashMap<String, DataCategory>();
Set<String> dataCategoryNames = new HashSet<String>();
for (int i = 0; i < dataUsedNodeList.getLength(); i++) {
diff --git a/tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataType.java b/tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataType.java
index cecee39cbb12..d011cfeef363 100644
--- a/tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataType.java
+++ b/tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataType.java
@@ -76,19 +76,19 @@ public class DataType implements AslMarshallable {
private final String mDataTypeName;
- private final Set<Purpose> mPurposeSet;
+ private final List<Purpose> mPurposes;
private final Boolean mIsCollectionOptional;
private final Boolean mIsSharingOptional;
private final Boolean mEphemeral;
public DataType(
String dataTypeName,
- Set<Purpose> purposeSet,
+ List<Purpose> purposes,
Boolean isCollectionOptional,
Boolean isSharingOptional,
Boolean ephemeral) {
this.mDataTypeName = dataTypeName;
- this.mPurposeSet = purposeSet;
+ this.mPurposes = purposes;
this.mIsCollectionOptional = isCollectionOptional;
this.mIsSharingOptional = isSharingOptional;
this.mEphemeral = ephemeral;
@@ -102,8 +102,8 @@ public class DataType implements AslMarshallable {
* Returns {@link Set} of valid {@link Integer} purposes for using the associated data category
* and type
*/
- public Set<Purpose> getPurposeSet() {
- return mPurposeSet;
+ public List<Purpose> getPurposes() {
+ return mPurposes;
}
/**
@@ -133,13 +133,13 @@ public class DataType implements AslMarshallable {
@Override
public List<Element> toOdDomElements(Document doc) {
Element dataTypeEle = XmlUtils.createPbundleEleWithName(doc, this.getDataTypeName());
- if (!this.getPurposeSet().isEmpty()) {
+ if (!this.getPurposes().isEmpty()) {
dataTypeEle.appendChild(
XmlUtils.createOdArray(
doc,
XmlUtils.OD_TAG_INT_ARRAY,
XmlUtils.OD_NAME_PURPOSES,
- this.getPurposeSet().stream()
+ this.getPurposes().stream()
.map(p -> String.valueOf(p.getValue()))
.toList()));
}
diff --git a/tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataTypeFactory.java b/tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataTypeFactory.java
index bfa330334487..27c1b599fec7 100644
--- a/tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataTypeFactory.java
+++ b/tools/app_metadata_bundles/src/lib/java/com/android/asllib/DataTypeFactory.java
@@ -29,16 +29,16 @@ public class DataTypeFactory implements AslMarshallableFactory<DataType> {
public DataType createFromHrElements(List<Element> elements) {
Element hrDataTypeEle = XmlUtils.getSingleElement(elements);
String dataTypeName = hrDataTypeEle.getAttribute(XmlUtils.HR_ATTR_DATA_TYPE);
- Set<DataType.Purpose> purposeSet =
+ List<DataType.Purpose> purposes =
Arrays.stream(hrDataTypeEle.getAttribute(XmlUtils.HR_ATTR_PURPOSES).split("\\|"))
.map(DataType.Purpose::forString)
- .collect(Collectors.toUnmodifiableSet());
+ .collect(Collectors.toList());
Boolean isCollectionOptional =
XmlUtils.getBoolAttr(hrDataTypeEle, XmlUtils.HR_ATTR_IS_COLLECTION_OPTIONAL);
Boolean isSharingOptional =
XmlUtils.getBoolAttr(hrDataTypeEle, XmlUtils.HR_ATTR_IS_SHARING_OPTIONAL);
Boolean ephemeral = XmlUtils.getBoolAttr(hrDataTypeEle, XmlUtils.HR_ATTR_EPHEMERAL);
return new DataType(
- dataTypeName, purposeSet, isCollectionOptional, isSharingOptional, ephemeral);
+ dataTypeName, purposes, isCollectionOptional, isSharingOptional, ephemeral);
}
}
diff --git a/tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/contacts/hr.xml b/tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/contacts/hr.xml
index fe020558074d..b2ff4495a6d2 100644
--- a/tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/contacts/hr.xml
+++ b/tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/contacts/hr.xml
@@ -1,4 +1,4 @@
-<app-metadata-bundles>
+<app-metadata-bundles version="123">
<safety-labels version="12345">
<data-labels>
<data-shared dataCategory="contacts"
diff --git a/tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/contacts/od.xml b/tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/contacts/od.xml
index ba6327e9b200..81277bf456a4 100644
--- a/tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/contacts/od.xml
+++ b/tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/contacts/od.xml
@@ -1,5 +1,7 @@
<bundle>
+ <long name="version" value="123"/>
<pbundle_as_map name="safety_labels">
+ <long name="version" value="12345"/>
<pbundle_as_map name="data_labels">
<pbundle_as_map name="data_shared">
<pbundle_as_map name="contacts">
@@ -14,4 +16,4 @@
</pbundle_as_map>
</pbundle_as_map>
</pbundle_as_map>
-</bundle>
+</bundle> \ No newline at end of file
diff --git a/tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/location/hr.xml b/tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/location/hr.xml
index 202cc1e1c526..ac844b3b2767 100644
--- a/tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/location/hr.xml
+++ b/tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/location/hr.xml
@@ -1,4 +1,4 @@
-<app-metadata-bundles>
+<app-metadata-bundles version="123">
<safety-labels version="12345">
<data-labels>
<data-shared dataCategory="location"
diff --git a/tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/location/od.xml b/tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/location/od.xml
index fbcb4fb2f1a4..d0a3bfa7e64f 100644
--- a/tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/location/od.xml
+++ b/tools/app_metadata_bundles/src/test/resources/com/android/aslgen/validmappings/location/od.xml
@@ -1,12 +1,14 @@
<bundle>
+ <long name="version" value="123"/>
<pbundle_as_map name="safety_labels">
+ <long name="version" value="12345"/>
<pbundle_as_map name="data_labels">
<pbundle_as_map name="data_shared">
<pbundle_as_map name="location">
<pbundle_as_map name="precise_location">
<int-array name="purposes" num="2">
- <item value="2"/>
<item value="1"/>
+ <item value="2"/>
</int-array>
<boolean name="is_sharing_optional" value="true"/>
<boolean name="ephemeral" value="true"/>