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

Commit a290039e authored by Patrick Baumann's avatar Patrick Baumann
Browse files

Removes instant app visibility metadata check

Change-Id: I94c0ba08a429a60b3f7149e60f6e94f5c8e5617d
Fixes: 36551762
Test: atest EphemeralTest succeeds
parent df7f3705
Loading
Loading
Loading
Loading
+2 −46
Original line number Diff line number Diff line
@@ -196,10 +196,6 @@ public class PackageParser {
    private static final String TAG_RESTRICT_UPDATE = "restrict-update";
    private static final String TAG_USES_SPLIT = "uses-split";

    // [b/36551762] STOPSHIP remove the ability to expose components via meta-data
    // Temporary workaround; allow meta-data to expose components to instant apps
    private static final String META_DATA_INSTANT_APPS = "instantapps.clients.allowed";

    private static final String METADATA_MAX_ASPECT_RATIO = "android.max_aspect";

    /**
@@ -4430,24 +4426,6 @@ public class PackageParser {
                        outError)) == null) {
                    return null;
                }
                // we don't have an attribute [or it's false], but, we have meta-data
                if (!visibleToEphemeral && a.metaData.getBoolean(META_DATA_INSTANT_APPS)) {
                    visibleToEphemeral = true; // set in case there are more intent filters
                    a.info.flags |= ActivityInfo.FLAG_VISIBLE_TO_INSTANT_APP;
                    a.info.flags &= ~ActivityInfo.FLAG_IMPLICITLY_VISIBLE_TO_INSTANT_APP;
                    owner.visibleToInstantApps = true;
                    // cycle through any filters already seen
                    for (int i = a.intents.size() - 1; i >= 0; --i) {
                        a.intents.get(i)
                                .setVisibilityToInstantApp(IntentFilter.VISIBILITY_EXPLICIT);
                    }
                    if (owner.preferredActivityFilters != null) {
                        for (int i = owner.preferredActivityFilters.size() - 1; i >= 0; --i) {
                            owner.preferredActivityFilters.get(i)
                                    .setVisibilityToInstantApp(IntentFilter.VISIBILITY_EXPLICIT);
                        }
                    }
                }
            } else if (!receiver && parser.getName().equals("layout")) {
                parseLayout(res, parser, a);
            } else {
@@ -4942,7 +4920,7 @@ public class PackageParser {
        p.info.authority = cpname.intern();

        if (!parseProviderTags(
                res, parser, visibleToEphemeral, owner, p, outError)) {
                res, parser, visibleToEphemeral, p, outError)) {
            return null;
        }

@@ -4950,7 +4928,7 @@ public class PackageParser {
    }

    private boolean parseProviderTags(Resources res, XmlResourceParser parser,
            boolean visibleToEphemeral, Package owner, Provider outInfo, String[] outError)
            boolean visibleToEphemeral, Provider outInfo, String[] outError)
                    throws XmlPullParserException, IOException {
        int outerDepth = parser.getDepth();
        int type;
@@ -4978,17 +4956,6 @@ public class PackageParser {
                        outInfo.metaData, outError)) == null) {
                    return false;
                }
                // we don't have an attribute [or it's false], but, we have meta-data
                if (!visibleToEphemeral && outInfo.metaData.getBoolean(META_DATA_INSTANT_APPS)) {
                    visibleToEphemeral = true; // set in case there are more intent filters
                    outInfo.info.flags |= ProviderInfo.FLAG_VISIBLE_TO_INSTANT_APP;
                    owner.visibleToInstantApps = true;
                    // cycle through any filters already seen
                    for (int i = outInfo.intents.size() - 1; i >= 0; --i) {
                        outInfo.intents.get(i)
                                .setVisibilityToInstantApp(IntentFilter.VISIBILITY_EXPLICIT);
                    }
                }

            } else if (parser.getName().equals("grant-uri-permission")) {
                TypedArray sa = res.obtainAttributes(parser,
@@ -5277,17 +5244,6 @@ public class PackageParser {
                        outError)) == null) {
                    return null;
                }
                // we don't have an attribute [or it's false], but, we have meta-data
                if (!visibleToEphemeral && s.metaData.getBoolean(META_DATA_INSTANT_APPS)) {
                    visibleToEphemeral = true; // set in case there are more intent filters
                    s.info.flags |= ServiceInfo.FLAG_VISIBLE_TO_INSTANT_APP;
                    owner.visibleToInstantApps = true;
                    // cycle through any filters already seen
                    for (int i = s.intents.size() - 1; i >= 0; --i) {
                        s.intents.get(i)
                                .setVisibilityToInstantApp(IntentFilter.VISIBILITY_EXPLICIT);
                    }
                }
            } else {
                if (!RIGID_PARSER) {
                    Slog.w(TAG, "Unknown element under <service>: "