From 7f1a8957cca420d525719836069b7f6d5ee04718 Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Tue, 10 Feb 2015 16:11:55 +0000 Subject: Parse res-car as resources for UI_MODE_TYPE_CAR.. .. and not a 3 letter language code. bug: 19291216 Change-Id: I01bf76d89880693dcdb4384d5c239902fa3defa8 --- tools/aapt/AaptAssets.cpp | 3 ++- tools/aapt/tests/AaptConfig_test.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'tools/aapt') diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp index 2d35129..871e04f 100644 --- a/tools/aapt/AaptAssets.cpp +++ b/tools/aapt/AaptAssets.cpp @@ -345,7 +345,8 @@ int AaptLocaleValue::initFromDirName(const Vector& parts, const int sta return ++currentIndex; } else { - if ((part.length() == 2 || part.length() == 3) && isAlpha(part)) { + if ((part.length() == 2 || part.length() == 3) + && isAlpha(part) && strcmp("car", part.string())) { setLanguage(part); if (++currentIndex == size) { return size; diff --git a/tools/aapt/tests/AaptConfig_test.cpp b/tools/aapt/tests/AaptConfig_test.cpp index e795d81..ef3860c 100644 --- a/tools/aapt/tests/AaptConfig_test.cpp +++ b/tools/aapt/tests/AaptConfig_test.cpp @@ -76,3 +76,9 @@ TEST(AaptConfigTest, ParseQualifierAddedInApi13) { EXPECT_TRUE(TestParse("sw600dp-v8", &config)); EXPECT_EQ(String8("sw600dp-v13"), config.toString()); } + +TEST(AaptConfigTest, TestParsingOfCarAttribute) { + ConfigDescription config; + EXPECT_TRUE(TestParse("car", &config)); + EXPECT_EQ(android::ResTable_config::UI_MODE_TYPE_CAR, config.uiMode); +} -- cgit v1.1