summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2017-07-25 17:15:42 -0700
committerAdam Lesinski <adamlesinski@google.com>2017-09-14 11:29:34 -0700
commitee0e486d3617bdc31ae6e42414bbf2316dee164c (patch)
tree6158def576b4541debd6062d2cecaf7c69a693c9
parent18fc9f65d040f7b9ff9960217d9e02b1827ecd00 (diff)
AAPT2: Add navigation type
Test: build succeeds Bug: 65645766 Change-Id: I7d49366c7cc4a93c29bad4cb9f13eec23ad05bd2 Merged-In: I7d49366c7cc4a93c29bad4cb9f13eec23ad05bd2
-rw-r--r--tools/aapt2/Resource.cpp3
-rw-r--r--tools/aapt2/Resource.h1
-rw-r--r--tools/aapt2/Resource_test.cpp4
-rw-r--r--tools/aapt2/integration-tests/AppOne/res/navigation/home.xml2
-rw-r--r--tools/aapt2/readme.md3
5 files changed, 13 insertions, 0 deletions
diff --git a/tools/aapt2/Resource.cpp b/tools/aapt2/Resource.cpp
index 35971e7bd99b..a9f5f298e019 100644
--- a/tools/aapt2/Resource.cpp
+++ b/tools/aapt2/Resource.cpp
@@ -61,6 +61,8 @@ StringPiece ToString(ResourceType type) {
return "menu";
case ResourceType::kMipmap:
return "mipmap";
+ case ResourceType::kNavigation:
+ return "navigation";
case ResourceType::kPlurals:
return "plurals";
case ResourceType::kRaw:
@@ -98,6 +100,7 @@ static const std::map<StringPiece, ResourceType> sResourceTypeMap{
{"layout", ResourceType::kLayout},
{"menu", ResourceType::kMenu},
{"mipmap", ResourceType::kMipmap},
+ {"navigation", ResourceType::kNavigation},
{"plurals", ResourceType::kPlurals},
{"raw", ResourceType::kRaw},
{"string", ResourceType::kString},
diff --git a/tools/aapt2/Resource.h b/tools/aapt2/Resource.h
index 0a74c1a0f77d..cbcc8fb805aa 100644
--- a/tools/aapt2/Resource.h
+++ b/tools/aapt2/Resource.h
@@ -59,6 +59,7 @@ enum class ResourceType {
kLayout,
kMenu,
kMipmap,
+ kNavigation,
kPlurals,
kRaw,
kString,
diff --git a/tools/aapt2/Resource_test.cpp b/tools/aapt2/Resource_test.cpp
index ad4e3ce02b32..c557f3c77654 100644
--- a/tools/aapt2/Resource_test.cpp
+++ b/tools/aapt2/Resource_test.cpp
@@ -93,6 +93,10 @@ TEST(ResourceTypeTest, ParseResourceTypes) {
ASSERT_NE(type, nullptr);
EXPECT_EQ(*type, ResourceType::kMipmap);
+ type = ParseResourceType("navigation");
+ ASSERT_NE(type, nullptr);
+ EXPECT_EQ(*type, ResourceType::kNavigation);
+
type = ParseResourceType("plurals");
ASSERT_NE(type, nullptr);
EXPECT_EQ(*type, ResourceType::kPlurals);
diff --git a/tools/aapt2/integration-tests/AppOne/res/navigation/home.xml b/tools/aapt2/integration-tests/AppOne/res/navigation/home.xml
new file mode 100644
index 000000000000..ade271d60ab6
--- /dev/null
+++ b/tools/aapt2/integration-tests/AppOne/res/navigation/home.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?>
+<navigation />
diff --git a/tools/aapt2/readme.md b/tools/aapt2/readme.md
index c8d36177beb4..2645d54867de 100644
--- a/tools/aapt2/readme.md
+++ b/tools/aapt2/readme.md
@@ -1,5 +1,8 @@
# Android Asset Packaging Tool 2.0 (AAPT2) release notes
+## Version 2.19
+- Added navigation resource type.
+
## Version 2.18
### `aapt2 ...`
- Fixed issue where enum values were interpreted as integers and range checked. (bug 62358540)