Fix getAttributeSetSourceResId to AttributeSet created from null.

Xml.asAttributeSet with a null returns non XmlBlock.Parser type
object.
This fixes the existing test that broke due to my changes to
LayoutInflater.

Test: atest CtsViewTestCases:LayoutInflaterTest
Change-Id: Ib10e07ef3814c5570a6d2bd334481f2e26bb3d3e
This commit is contained in:
Aurimas Liutikas
2019-03-08 15:29:09 -08:00
parent a091cc2d8b
commit 02d7f45afa

View File

@@ -1303,7 +1303,7 @@ public class ResourcesImpl {
@AnyRes
static int getAttributeSetSourceResId(@Nullable AttributeSet set) {
if (set == null) {
if (set == null || !(set instanceof XmlBlock.Parser)) {
return ID_NULL;
}
return ((XmlBlock.Parser) set).getSourceResId();