mirror of
https://github.com/revanced/Apktool.git
synced 2025-04-30 14:14:25 +02:00
Adapt null resource to be treated as reference instead of empty string. (#3417)
* fix: handle null resolved items as references * test: add color null test for aapt2
This commit is contained in:
parent
63b1976448
commit
eec0288e69
@ -32,9 +32,7 @@ public class ResValueFactory {
|
|||||||
public ResScalarValue factory(int type, int value, String rawValue) throws AndrolibException {
|
public ResScalarValue factory(int type, int value, String rawValue) throws AndrolibException {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TypedValue.TYPE_NULL:
|
case TypedValue.TYPE_NULL:
|
||||||
if (value == TypedValue.DATA_NULL_UNDEFINED) { // Special case $empty as explicitly defined empty value
|
if (value == TypedValue.DATA_NULL_EMPTY) {
|
||||||
return new ResStringValue(null, value);
|
|
||||||
} else if (value == TypedValue.DATA_NULL_EMPTY) {
|
|
||||||
return new ResEmptyValue(value, rawValue, type);
|
return new ResEmptyValue(value, rawValue, type);
|
||||||
}
|
}
|
||||||
return new ResReferenceValue(mPackage, 0, null);
|
return new ResReferenceValue(mPackage, 0, null);
|
||||||
|
@ -71,6 +71,11 @@ public class BuildAndDecodeTest extends BaseTest {
|
|||||||
assertTrue(sTestNewDir.isDirectory());
|
assertTrue(sTestNewDir.isDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void valuesColorsTest() throws BrutException {
|
||||||
|
compareValuesFiles("values/colors.xml");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void valuesStringsTest() throws BrutException {
|
public void valuesStringsTest() throws BrutException {
|
||||||
compareValuesFiles("values/strings.xml");
|
compareValuesFiles("values/strings.xml");
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="test_color1">#ff123456</color>
|
||||||
|
<color name="test_color2">@android:color/white</color>
|
||||||
|
<color name="test_color3">#00000000</color>
|
||||||
|
<color name="issue_3416">@null</color>
|
||||||
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user