diff --git a/api/current.txt b/api/current.txt index b39fcf8254a3a..961fd07de8ce3 100644 --- a/api/current.txt +++ b/api/current.txt @@ -577,8 +577,11 @@ package android { field public static final int focusable = 16842970; // 0x10100da field public static final int focusableInTouchMode = 16842971; // 0x10100db field public static final deprecated int focusedMonthDateColor = 16843587; // 0x1010343 + field public static final int font = 16844082; // 0x1010532 field public static final int fontFamily = 16843692; // 0x10103ac field public static final int fontFeatureSettings = 16843959; // 0x10104b7 + field public static final int fontStyle = 16844081; // 0x1010531 + field public static final int fontWeight = 16844083; // 0x1010533 field public static final int footerDividersEnabled = 16843311; // 0x101022f field public static final int forceHasOverlappingRendering = 16844065; // 0x1010521 field public static final int foreground = 16843017; // 0x1010109 diff --git a/api/system-current.txt b/api/system-current.txt index d73dbe9f7731e..1577b7c97838f 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -683,8 +683,11 @@ package android { field public static final int focusable = 16842970; // 0x10100da field public static final int focusableInTouchMode = 16842971; // 0x10100db field public static final deprecated int focusedMonthDateColor = 16843587; // 0x1010343 + field public static final int font = 16844082; // 0x1010532 field public static final int fontFamily = 16843692; // 0x10103ac field public static final int fontFeatureSettings = 16843959; // 0x10104b7 + field public static final int fontStyle = 16844081; // 0x1010531 + field public static final int fontWeight = 16844083; // 0x1010533 field public static final int footerDividersEnabled = 16843311; // 0x101022f field public static final int forceHasOverlappingRendering = 16844065; // 0x1010521 field public static final int foreground = 16843017; // 0x1010109 diff --git a/api/test-current.txt b/api/test-current.txt index fbd1315397e34..22c08a277dde0 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -577,8 +577,11 @@ package android { field public static final int focusable = 16842970; // 0x10100da field public static final int focusableInTouchMode = 16842971; // 0x10100db field public static final deprecated int focusedMonthDateColor = 16843587; // 0x1010343 + field public static final int font = 16844082; // 0x1010532 field public static final int fontFamily = 16843692; // 0x10103ac field public static final int fontFeatureSettings = 16843959; // 0x10104b7 + field public static final int fontStyle = 16844081; // 0x1010531 + field public static final int fontWeight = 16844083; // 0x1010533 field public static final int footerDividersEnabled = 16843311; // 0x101022f field public static final int forceHasOverlappingRendering = 16844065; // 0x1010521 field public static final int foreground = 16843017; // 0x1010109 diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index c3967e46c3e9e..2d61e6ec3bc5d 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -8335,4 +8335,15 @@ i + + + + + + + + + + diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 7999e7e483650..66683471f43fd 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2756,6 +2756,9 @@ + + + diff --git a/tools/aapt2/Main.cpp b/tools/aapt2/Main.cpp index 8dd176d273459..a3404e5db21cf 100644 --- a/tools/aapt2/Main.cpp +++ b/tools/aapt2/Main.cpp @@ -25,7 +25,7 @@ namespace aapt { static const char* sMajorVersion = "2"; // Update minor version whenever a feature or flag is added. -static const char* sMinorVersion = "2"; +static const char* sMinorVersion = "3"; int PrintVersion() { std::cerr << "Android Asset Packaging Tool (aapt) " << sMajorVersion << "." diff --git a/tools/aapt2/Resource.cpp b/tools/aapt2/Resource.cpp index 1d414743de71d..3eef7aa71a925 100644 --- a/tools/aapt2/Resource.cpp +++ b/tools/aapt2/Resource.cpp @@ -41,6 +41,8 @@ StringPiece ToString(ResourceType type) { return "dimen"; case ResourceType::kDrawable: return "drawable"; + case ResourceType::kFont: + return "font"; case ResourceType::kFraction: return "fraction"; case ResourceType::kId: @@ -83,6 +85,7 @@ static const std::map sResourceTypeMap{ {"color", ResourceType::kColor}, {"dimen", ResourceType::kDimen}, {"drawable", ResourceType::kDrawable}, + {"font", ResourceType::kFont}, {"fraction", ResourceType::kFraction}, {"id", ResourceType::kId}, {"integer", ResourceType::kInteger}, diff --git a/tools/aapt2/Resource.h b/tools/aapt2/Resource.h index 78acb700c7c09..13330b548d2c9 100644 --- a/tools/aapt2/Resource.h +++ b/tools/aapt2/Resource.h @@ -46,6 +46,7 @@ enum class ResourceType { kColor, kDimen, kDrawable, + kFont, kFraction, kId, kInteger, diff --git a/tools/aapt2/Resource_test.cpp b/tools/aapt2/Resource_test.cpp index 720ab91c57408..6acb4d3eb8505 100644 --- a/tools/aapt2/Resource_test.cpp +++ b/tools/aapt2/Resource_test.cpp @@ -57,6 +57,10 @@ TEST(ResourceTypeTest, ParseResourceTypes) { ASSERT_NE(type, nullptr); EXPECT_EQ(*type, ResourceType::kDrawable); + type = ParseResourceType("font"); + ASSERT_NE(type, nullptr); + EXPECT_EQ(*type, ResourceType::kFont); + type = ParseResourceType("fraction"); ASSERT_NE(type, nullptr); EXPECT_EQ(*type, ResourceType::kFraction); diff --git a/tools/aapt2/integration-tests/AppOne/res/font/myfont-italic.ttf b/tools/aapt2/integration-tests/AppOne/res/font/myfont-italic.ttf new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/tools/aapt2/integration-tests/AppOne/res/font/myfont-normal.ttf b/tools/aapt2/integration-tests/AppOne/res/font/myfont-normal.ttf new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/tools/aapt2/integration-tests/AppOne/res/font/myfont.xml b/tools/aapt2/integration-tests/AppOne/res/font/myfont.xml new file mode 100644 index 0000000000000..1fb67914894e0 --- /dev/null +++ b/tools/aapt2/integration-tests/AppOne/res/font/myfont.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/tools/aapt2/readme.md b/tools/aapt2/readme.md index 93c790d80c4c5..ac411b15ae830 100644 --- a/tools/aapt2/readme.md +++ b/tools/aapt2/readme.md @@ -1,5 +1,9 @@ # Android Asset Packaging Tool 2.0 (AAPT2) release notes +## Version 2.3 +### `aapt2` +- Support new `font` resource type. + ## Version 2.2 ### `aapt2 compile ...` - Added support for inline complex XML resources. See