Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1897f8b2 authored by William Loh's avatar William Loh
Browse files

Relax length restriction on meta-data values.

Current restrictions on the value attribute of the <meta-data> tag in
the manifest is preventing some legitimate apps from being installed.
Relaxing this restriction fix this. This will be followed up with a new
restriction based on the total size of all meta-data values per
component.

Bug: 309027507
Test: atest AndroidPackageParsingValidationTest
Change-Id: Ic1dfdf10e4b4ec460dc56a762649ccd15235dd63
parent fa0fe0d4
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ public class Element {
    private static final int MAX_ATTR_LEN_MIMETYPE = 512;
    public static final int MAX_ATTR_LEN_NAME = 1024;
    public static final int MAX_ATTR_LEN_PATH = 4000;
    public static final int MAX_ATTR_LEN_DATA_VALUE = 4000;
    public static final int MAX_ATTR_LEN_VALUE = 32_768;

    private static final String BAD_COMPONENT_NAME_CHARS = ";,[](){}:?%^*|/\\";

@@ -386,7 +386,7 @@ public class Element {
            case TAG_ATTR_PATH_SUFFIX:
                return MAX_ATTR_LEN_PATH;
            case TAG_ATTR_VALUE:
                return MAX_ATTR_LEN_DATA_VALUE;
                return MAX_ATTR_LEN_VALUE;
            case TAG_ATTR_REQUIRED_SYSTEM_PROPERTY_VALUE:
                return PROP_VALUE_MAX;
            default:
@@ -566,7 +566,7 @@ public class Element {
            case R.styleable.AndroidManifestMetaData_name:
                return MAX_ATTR_LEN_NAME;
            case R.styleable.AndroidManifestMetaData_value:
                return MAX_ATTR_LEN_DATA_VALUE;
                return MAX_ATTR_LEN_VALUE;
            default:
                return DEFAULT_MAX_STRING_ATTR_LENGTH;
        }
@@ -636,7 +636,7 @@ public class Element {
            case R.styleable.AndroidManifestProperty_name:
                return MAX_ATTR_LEN_NAME;
            case R.styleable.AndroidManifestProperty_value:
                return MAX_ATTR_LEN_DATA_VALUE;
                return MAX_ATTR_LEN_VALUE;
            default:
                return DEFAULT_MAX_STRING_ATTR_LENGTH;
        }
+1 −1
Original line number Diff line number Diff line
@@ -427,7 +427,7 @@ class AndroidPackageParsingValidationTest {
    fun parseMetaDataTag() {
        val tag = "meta-data"
        validateTagAttr(tag, "name", R.styleable.AndroidManifestMetaData_name, 1024)
        validateTagAttr(tag, "value", R.styleable.AndroidManifestMetaData_value, 4000)
        validateTagAttr(tag, "value", R.styleable.AndroidManifestMetaData_value, 32_768)
    }

    @Test