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

Commit b5fb50a1 authored by Ying Wang's avatar Ying Wang Committed by Android (Google) Code Review
Browse files

Merge "Add instrumentation as a source tag for proguard keep options." into eclair

parents ccec75e7 46f4b982
Loading
Loading
Loading
Loading
+44 −36
Original line number Diff line number Diff line
@@ -1727,18 +1727,27 @@ writeProguardForAndroidManifest(ProguardKeepSet* keep, const sp<AaptAssets>& ass
        depth++;
        String8 tag(tree.getElementName(&len));
        // printf("Depth %d tag %s\n", depth, tag.string());
        bool keepTag = false;
        if (depth == 1) {
            if (tag != "manifest") {
                fprintf(stderr, "ERROR: manifest does not start with <manifest> tag\n");
                return -1;
            }
            pkg = getAttribute(tree, NULL, "package", NULL);
        } else if (depth == 2 && tag == "application") {
        } else if (depth == 2) {
            if (tag == "application") {
                inApplication = true;
                keepTag = true;
            } else if (tag == "instrumentation") {
                keepTag = true;
            }
        if (inApplication) {
            if (tag == "application" || tag == "activity" || tag == "service" || tag == "receiver"
                    || tag == "provider") {
        }
        if (!keepTag && inApplication && depth == 3) {
            if (tag == "activity" || tag == "service" || tag == "receiver" || tag == "provider") {
                keepTag = true;
            }
        }
        if (keepTag) {
            String8 name = getAttribute(tree, "http://schemas.android.com/apk/res/android",
                    "name", &error);
            if (error != "") {
@@ -1774,7 +1783,6 @@ writeProguardForAndroidManifest(ProguardKeepSet* keep, const sp<AaptAssets>& ass
            }
        }
    }
    }

    return NO_ERROR;
}