Loading core/res/res/values/attrs.xml +12 −4 Original line number Diff line number Diff line Loading @@ -2380,6 +2380,12 @@ <!-- ============================= --> <eat-comment /> <!-- Removed View attributes without a specified format (b/131100106) --> <attr name="__removed3" /> <attr name="__removed4" /> <attr name="__removed5" /> <attr name="__removed6" /> <!-- Attributes that can be used with {@link android.view.View} or any of its subclasses. Also see {@link #ViewGroup_Layout} for attributes that are processed by the view's parent. --> Loading Loading @@ -4742,7 +4748,7 @@ <!-- Style (normal, bold, italic, bold|italic) for the text. --> <attr name="textStyle" /> <!-- Weight for the font used in the TextView. --> <attr name="textFontWeight" /> <attr name="textFontWeight" format="integer"/> <!-- Font family (named by string or as a font resource reference) for the text. --> <attr name="fontFamily" /> <!-- Specifies the {@link android.os.LocaleList} for the text in this TextView. Loading Loading @@ -8038,7 +8044,7 @@ <attr name="supportsAmbientMode" format="boolean" /> <!-- Uri that specifies a settings Slice for this wallpaper. --> <attr name="settingsSliceUri" /> <attr name="settingsSliceUri" format="string"/> <!-- Indicates that this wallpaper service can support multiple engines to render on each surface independently. An example use case is a multi-display set-up where the Loading Loading @@ -8262,7 +8268,7 @@ <!-- The activity to launch when the setting is clicked on. --> <attr name="settingsActivity"/> <!-- The user restriction for this preference. --> <attr name="userRestriction"/> <attr name="userRestriction" format="string"/> </declare-styleable> <!-- =============================== --> Loading Loading @@ -8920,7 +8926,7 @@ <attr name="layout_ignoreOffset" format="boolean" /> <attr name="layout_gravity" /> <attr name="layout_hasNestedScrollIndicator" format="boolean" /> <attr name="layout_maxHeight" /> <attr name="layout_maxHeight" format="dimension"/> </declare-styleable> <!-- @hide --> Loading Loading @@ -9130,4 +9136,6 @@ <attr name="magnifierHorizontalOffset" format="dimension" /> <attr name="magnifierColorOverlay" format="color" /> </declare-styleable> <attr name="autoSizePresetSizes" /> </resources> core/res/res/values/attrs_manifest.xml +8 −8 Original line number Diff line number Diff line Loading @@ -1690,14 +1690,14 @@ <attr name="usesNonSdkApi" /> <!-- If {@code true} the user is prompted to keep the app's data on uninstall --> <attr name="hasFragileUserData" /> <attr name="hasFragileUserData" format="boolean"/> <attr name="zygotePreloadName" /> <!-- If {@code true} the system will clear app's data if a restore operation fails. This flag is turned on by default. <em>This attribute is usable only by system apps. </em> --> <attr name="allowClearUserDataOnFailedRestore"/> <attr name="allowClearUserDataOnFailedRestore" format="boolean"/> <!-- If {@code true} the app's non sensitive audio can be captured by other apps with {@link android.media.AudioPlaybackCaptureConfiguration} and a {@link android.media.projection.MediaProjection}. Loading Loading @@ -1755,7 +1755,7 @@ <attr name="banner" /> <attr name="logo" /> <attr name="permissionGroup" /> <attr name="backgroundPermission" /> <attr name="backgroundPermission" format="string"/> <attr name="description" /> <attr name="request" /> <attr name="protectionLevel" /> Loading Loading @@ -1785,10 +1785,10 @@ <attr name="banner" /> <attr name="logo" /> <attr name="description" /> <attr name="request" /> <attr name="requestDetail" /> <attr name="backgroundRequest" /> <attr name="backgroundRequestDetail" /> <attr name="request" format="string"/> <attr name="requestDetail" format="string"/> <attr name="backgroundRequest" format="string"/> <attr name="backgroundRequestDetail" format="string"/> <attr name="permissionGroupFlags" /> <attr name="priority" /> </declare-styleable> Loading Loading @@ -2254,7 +2254,7 @@ <attr name="path" /> <attr name="pathPrefix" /> <attr name="pathPattern" /> <attr name="pathAdvancedPattern" /> <attr name="pathAdvancedPattern" format="string"/> <attr name="permission" /> <attr name="readPermission" /> <attr name="writePermission" /> Loading tools/aapt2/ResourceParser.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -1712,7 +1712,14 @@ bool ResourceParser::ParseDeclareStyleable(xml::XmlPullParser* parser, child_ref.SetSource(item_source); styleable->entries.push_back(std::move(child_ref)); // Do not add referenced attributes that do not define a format to the table. CHECK(child_resource.value != nullptr); Attribute* attr = ValueCast<Attribute>(child_resource.value.get()); CHECK(attr != nullptr); if (attr->type_mask != android::ResTable_map::TYPE_ANY) { out_resource->child_resources.push_back(std::move(child_resource)); } } else if (!ShouldIgnoreElement(element_namespace, element_name)) { diag_->Error(DiagMessage(item_source) << "unknown tag <" Loading tools/aapt2/ResourceParser_test.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -341,7 +341,7 @@ TEST_F(ResourceParserTest, ParseAttrAndDeclareStyleableUnderConfigButRecordAsNoC std::string input = R"( <attr name="foo" /> <declare-styleable name="bar"> <attr name="baz" /> <attr name="baz" format="reference"/> </declare-styleable>)"; ASSERT_TRUE(TestParse(input, watch_config)); Loading Loading @@ -589,8 +589,7 @@ TEST_F(ResourceParserTest, ParseAttributesDeclareStyleable) { EXPECT_THAT(result.value().entry->visibility.level, Eq(Visibility::Level::kPublic)); Attribute* attr = test::GetValue<Attribute>(&table_, "attr/bar"); ASSERT_THAT(attr, NotNull()); EXPECT_TRUE(attr->IsWeak()); ASSERT_THAT(attr, IsNull()); attr = test::GetValue<Attribute>(&table_, "attr/bat"); ASSERT_THAT(attr, NotNull()); Loading Loading
core/res/res/values/attrs.xml +12 −4 Original line number Diff line number Diff line Loading @@ -2380,6 +2380,12 @@ <!-- ============================= --> <eat-comment /> <!-- Removed View attributes without a specified format (b/131100106) --> <attr name="__removed3" /> <attr name="__removed4" /> <attr name="__removed5" /> <attr name="__removed6" /> <!-- Attributes that can be used with {@link android.view.View} or any of its subclasses. Also see {@link #ViewGroup_Layout} for attributes that are processed by the view's parent. --> Loading Loading @@ -4742,7 +4748,7 @@ <!-- Style (normal, bold, italic, bold|italic) for the text. --> <attr name="textStyle" /> <!-- Weight for the font used in the TextView. --> <attr name="textFontWeight" /> <attr name="textFontWeight" format="integer"/> <!-- Font family (named by string or as a font resource reference) for the text. --> <attr name="fontFamily" /> <!-- Specifies the {@link android.os.LocaleList} for the text in this TextView. Loading Loading @@ -8038,7 +8044,7 @@ <attr name="supportsAmbientMode" format="boolean" /> <!-- Uri that specifies a settings Slice for this wallpaper. --> <attr name="settingsSliceUri" /> <attr name="settingsSliceUri" format="string"/> <!-- Indicates that this wallpaper service can support multiple engines to render on each surface independently. An example use case is a multi-display set-up where the Loading Loading @@ -8262,7 +8268,7 @@ <!-- The activity to launch when the setting is clicked on. --> <attr name="settingsActivity"/> <!-- The user restriction for this preference. --> <attr name="userRestriction"/> <attr name="userRestriction" format="string"/> </declare-styleable> <!-- =============================== --> Loading Loading @@ -8920,7 +8926,7 @@ <attr name="layout_ignoreOffset" format="boolean" /> <attr name="layout_gravity" /> <attr name="layout_hasNestedScrollIndicator" format="boolean" /> <attr name="layout_maxHeight" /> <attr name="layout_maxHeight" format="dimension"/> </declare-styleable> <!-- @hide --> Loading Loading @@ -9130,4 +9136,6 @@ <attr name="magnifierHorizontalOffset" format="dimension" /> <attr name="magnifierColorOverlay" format="color" /> </declare-styleable> <attr name="autoSizePresetSizes" /> </resources>
core/res/res/values/attrs_manifest.xml +8 −8 Original line number Diff line number Diff line Loading @@ -1690,14 +1690,14 @@ <attr name="usesNonSdkApi" /> <!-- If {@code true} the user is prompted to keep the app's data on uninstall --> <attr name="hasFragileUserData" /> <attr name="hasFragileUserData" format="boolean"/> <attr name="zygotePreloadName" /> <!-- If {@code true} the system will clear app's data if a restore operation fails. This flag is turned on by default. <em>This attribute is usable only by system apps. </em> --> <attr name="allowClearUserDataOnFailedRestore"/> <attr name="allowClearUserDataOnFailedRestore" format="boolean"/> <!-- If {@code true} the app's non sensitive audio can be captured by other apps with {@link android.media.AudioPlaybackCaptureConfiguration} and a {@link android.media.projection.MediaProjection}. Loading Loading @@ -1755,7 +1755,7 @@ <attr name="banner" /> <attr name="logo" /> <attr name="permissionGroup" /> <attr name="backgroundPermission" /> <attr name="backgroundPermission" format="string"/> <attr name="description" /> <attr name="request" /> <attr name="protectionLevel" /> Loading Loading @@ -1785,10 +1785,10 @@ <attr name="banner" /> <attr name="logo" /> <attr name="description" /> <attr name="request" /> <attr name="requestDetail" /> <attr name="backgroundRequest" /> <attr name="backgroundRequestDetail" /> <attr name="request" format="string"/> <attr name="requestDetail" format="string"/> <attr name="backgroundRequest" format="string"/> <attr name="backgroundRequestDetail" format="string"/> <attr name="permissionGroupFlags" /> <attr name="priority" /> </declare-styleable> Loading Loading @@ -2254,7 +2254,7 @@ <attr name="path" /> <attr name="pathPrefix" /> <attr name="pathPattern" /> <attr name="pathAdvancedPattern" /> <attr name="pathAdvancedPattern" format="string"/> <attr name="permission" /> <attr name="readPermission" /> <attr name="writePermission" /> Loading
tools/aapt2/ResourceParser.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -1712,7 +1712,14 @@ bool ResourceParser::ParseDeclareStyleable(xml::XmlPullParser* parser, child_ref.SetSource(item_source); styleable->entries.push_back(std::move(child_ref)); // Do not add referenced attributes that do not define a format to the table. CHECK(child_resource.value != nullptr); Attribute* attr = ValueCast<Attribute>(child_resource.value.get()); CHECK(attr != nullptr); if (attr->type_mask != android::ResTable_map::TYPE_ANY) { out_resource->child_resources.push_back(std::move(child_resource)); } } else if (!ShouldIgnoreElement(element_namespace, element_name)) { diag_->Error(DiagMessage(item_source) << "unknown tag <" Loading
tools/aapt2/ResourceParser_test.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -341,7 +341,7 @@ TEST_F(ResourceParserTest, ParseAttrAndDeclareStyleableUnderConfigButRecordAsNoC std::string input = R"( <attr name="foo" /> <declare-styleable name="bar"> <attr name="baz" /> <attr name="baz" format="reference"/> </declare-styleable>)"; ASSERT_TRUE(TestParse(input, watch_config)); Loading Loading @@ -589,8 +589,7 @@ TEST_F(ResourceParserTest, ParseAttributesDeclareStyleable) { EXPECT_THAT(result.value().entry->visibility.level, Eq(Visibility::Level::kPublic)); Attribute* attr = test::GetValue<Attribute>(&table_, "attr/bar"); ASSERT_THAT(attr, NotNull()); EXPECT_TRUE(attr->IsWeak()); ASSERT_THAT(attr, IsNull()); attr = test::GetValue<Attribute>(&table_, "attr/bat"); ASSERT_THAT(attr, NotNull()); Loading