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

Commit 84f5fa0b authored by William Loh's avatar William Loh Committed by Android (Google) Code Review
Browse files

Merge "Add attribute validation for zygotePreloadName" into main

parents d2cf8ef4 ac9bb90a
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -128,6 +128,7 @@ public class Element {
    protected static final String TAG_ATTR_VALUE = "value";
    protected static final String TAG_ATTR_VERSION_NAME = "versionName";
    protected static final String TAG_ATTR_WRITE_PERMISSION = "writePermission";
    protected static final String TAG_ATTR_ZYGOTE_PRELOAD_NAME = "zygotePreloadName";

    // The length of mTagCounters corresponds to the number of tags defined in getCounterIdx. If new
    // tags are added then the size here should be increased to match.
@@ -374,6 +375,7 @@ public class Element {
            case TAG_ATTR_TASK_AFFINITY:
            case TAG_ATTR_WRITE_PERMISSION:
            case TAG_ATTR_VERSION_NAME:
            case TAG_ATTR_ZYGOTE_PRELOAD_NAME:
                return MAX_ATTR_LEN_NAME;
            case TAG_ATTR_PATH:
            case TAG_ATTR_PATH_ADVANCED_PATTERN:
@@ -488,6 +490,7 @@ public class Element {
            case R.styleable.AndroidManifestApplication_requiredAccountType:
            case R.styleable.AndroidManifestApplication_restrictedAccountType:
            case R.styleable.AndroidManifestApplication_taskAffinity:
            case R.styleable.AndroidManifestApplication_zygotePreloadName:
                return MAX_ATTR_LEN_NAME;
            default:
                return DEFAULT_MAX_STRING_ATTR_LENGTH;
@@ -738,6 +741,7 @@ public class Element {
                switch (name) {
                    case TAG_ATTR_BACKUP_AGENT:
                    case TAG_ATTR_NAME:
                    case TAG_ATTR_ZYGOTE_PRELOAD_NAME:
                        return true;
                    default:
                        return false;
@@ -766,7 +770,8 @@ public class Element {
                return index == R.styleable.AndroidManifestActivityAlias_targetActivity;
            case TAG_APPLICATION:
                return index == R.styleable.AndroidManifestApplication_backupAgent
                        || index == R.styleable.AndroidManifestApplication_name;
                        || index == R.styleable.AndroidManifestApplication_name
                        || index == R.styleable.AndroidManifestApplication_zygotePreloadName;
            case TAG_INSTRUMENTATION:
                return index ==  R.styleable.AndroidManifestInstrumentation_name;
            case TAG_PROVIDER:
+11 −0
Original line number Diff line number Diff line
@@ -138,6 +138,17 @@ class AndroidPackageParsingValidationTest {
            R.styleable.AndroidManifestApplication_taskAffinity,
            1024
        )
        validateTagAttr(
            tag,
            "zygotePreloadName",
            R.styleable.AndroidManifestApplication_zygotePreloadName,
            1024
        )
        validateTagAttrComponentName(
            tag,
            "zygotePreloadName",
            R.styleable.AndroidManifestApplication_zygotePreloadName
        )
        validateTagCount("profileable", 100, tag)
        validateTagCount("uses-native-library", 100, tag)
        validateTagCount("receiver", 1000, tag)