Example usage for android.os PatternMatcher PATTERN_PREFIX

List of usage examples for android.os PatternMatcher PATTERN_PREFIX

Introduction

In this page you can find the example usage for android.os PatternMatcher PATTERN_PREFIX.

Prototype

int PATTERN_PREFIX

To view the source code for android.os PatternMatcher PATTERN_PREFIX.

Click Source Link

Document

Pattern type: the given pattern must match the beginning of the string it is tested against.

Usage

From source file:Main.java

private static final boolean initIntentFilterFromXml(IntentFilter inf, XmlPullParser xpp) {
    try {//from w  ww.java  2  s .  c o  m
        int outerDepth = xpp.getDepth();
        int type;
        final String NAME = "name";
        while ((type = xpp.next()) != XmlPullParser.END_DOCUMENT
                && (type != XmlPullParser.END_TAG || xpp.getDepth() > outerDepth)) {
            if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT)
                continue;
            String tag = xpp.getName();
            if (tag.equals("action")) {
                String name = xpp.getAttributeValue(null, NAME);
                if (name != null)
                    inf.addAction(name);
            } else if (tag.equals("category")) {
                String name = xpp.getAttributeValue(null, NAME);
                if (name != null)
                    inf.addCategory(name);
            } else if (tag.equals("data")) {
                int na = xpp.getAttributeCount();
                for (int i = 0; i < na; i++) {
                    String port = null;
                    String an = xpp.getAttributeName(i);
                    String av = xpp.getAttributeValue(i);
                    if ("mimeType".equals(an)) {
                        try {
                            inf.addDataType(av);
                        } catch (MalformedMimeTypeException e) {
                        }
                    } else if ("scheme".equals(an)) {
                        inf.addDataScheme(av);
                    } else if ("host".equals(an)) {
                        inf.addDataAuthority(av, port);
                    } else if ("port".equals(an)) {
                        port = av;
                    } else if ("path".equals(an)) {
                        inf.addDataPath(av, PatternMatcher.PATTERN_LITERAL);
                    } else if ("pathPrefix".equals(an)) {
                        inf.addDataPath(av, PatternMatcher.PATTERN_PREFIX);
                    } else if ("pathPattern".equals(an)) {
                        inf.addDataPath(av, PatternMatcher.PATTERN_SIMPLE_GLOB);
                    }
                }
            }
        }
        return true;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return false;
}

From source file:com.github.michalbednarski.intentslab.browser.ComponentInfoFragment.java

static CharSequence dumpIntentFilter(IntentFilter filter, Resources res, boolean isBroadcast) {
    FormattedTextBuilder ftb = new FormattedTextBuilder();
    int tagColor = res.getColor(R.color.xml_tag);
    int attributeNameColor = res.getColor(R.color.xml_attr_name);
    int attributeValueColor = res.getColor(R.color.xml_attr_value);
    int commentColor = res.getColor(R.color.xml_comment);
    final String protectedComment = " <!-- " + res.getString(R.string.broadcast_action_protected_comment)
            + " -->";

    ftb.appendColoured("\n<intent-filter>", tagColor);

    for (int i = 0, j = filter.countActions(); i < j; i++) {
        final String action = filter.getAction(i);
        ftb.appendColoured("\n  <action", tagColor);
        ftb.appendColoured(" a:name=", attributeNameColor);
        ftb.appendColoured("\"" + action + "\"", attributeValueColor);
        ftb.appendColoured(">", tagColor);

        if (isBroadcast && Utils.isProtectedBroadcast(action)) {
            ftb.appendColoured(protectedComment, commentColor);
        }//from   w  ww . j av  a 2 s.  c o m
    }

    for (int i = 0, j = filter.countCategories(); i < j; i++) {
        ftb.appendColoured("\n  <category", tagColor);
        ftb.appendColoured(" a:name=", attributeNameColor);
        ftb.appendColoured("\"" + filter.getCategory(i) + "\"", attributeValueColor);
        ftb.appendColoured(">", tagColor);
    }

    for (int i = 0, j = filter.countDataSchemes(); i < j; i++) {
        ftb.appendColoured("\n  <data", tagColor);
        ftb.appendColoured(" a:scheme=", attributeNameColor);
        ftb.appendColoured("\"" + filter.getDataScheme(i) + "\"", attributeValueColor);
        ftb.appendColoured(">", tagColor);
    }

    for (int i = 0, j = filter.countDataAuthorities(); i < j; i++) {
        IntentFilter.AuthorityEntry authority = filter.getDataAuthority(i);
        ftb.appendColoured("\n  <data", tagColor);
        ftb.appendColoured(" a:host=", attributeNameColor);
        ftb.appendColoured("\"" + authority.getHost() + "\"", attributeValueColor);
        if (authority.getPort() != -1) {
            ftb.appendColoured(" a:port=", attributeNameColor);
            ftb.appendColoured("\"" + authority.getPort() + "\"", attributeValueColor);
        }
        ftb.appendColoured(">", tagColor);
    }

    for (int i = 0, j = filter.countDataPaths(); i < j; i++) {
        PatternMatcher pathMatcher = filter.getDataPath(i);
        int type = pathMatcher.getType();
        ftb.appendColoured("\n  <data", tagColor);
        ftb.appendColoured(
                " a:path"
                        + (type == PatternMatcher.PATTERN_LITERAL ? ""
                                : type == PatternMatcher.PATTERN_PREFIX ? "Prefix"
                                        : type == PatternMatcher.PATTERN_SIMPLE_GLOB ? "Pattern" : "[unknown]")
                        + "=",
                attributeNameColor);
        ftb.appendColoured("\"" + pathMatcher.getPath() + "\"", attributeValueColor);
        ftb.appendColoured(">", tagColor);
    }

    for (int i = 0, j = filter.countDataTypes(); i < j; i++) {
        String dataType = filter.getDataType(i);
        if (!dataType.contains("/")) {
            // IntentFilter for partial types don't store "/*" at end
            // e.g. "image" instead of "image/*".
            // We display it in full form here
            dataType += "/*";
        }
        ftb.appendColoured("\n  <data", tagColor);
        ftb.appendColoured(" a:mimeType=", attributeNameColor);
        ftb.appendColoured("\"" + dataType + "\"", attributeValueColor);
        ftb.appendColoured(">", tagColor);
    }

    ftb.appendColoured("\n</intent-filter>", tagColor);
    return ftb.getText();
}

From source file:com.github.michalbednarski.intentslab.providerlab.ProviderInfoFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.activity_provider_info, container, false);

    mPackageName = getArguments().getString(ComponentInfoFragment.ARG_PACKAGE_NAME);
    mComponentName = getArguments().getString(ComponentInfoFragment.ARG_COMPONENT_NAME);

    // Fill mProviderInfo
    try {// w w w.java  2s .  c o  m
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
            fillProviderInfo();
        } else {
            fillProviderInfoLegacy();
        }
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
        Toast.makeText(getActivity(), R.string.component_not_found, Toast.LENGTH_SHORT).show();
        //finish();
        return null;
    }

    PackageManager packageManager = getActivity().getPackageManager();

    // Header icon and text
    ((TextView) view.findViewById(R.id.title)).setText(mProviderInfo.loadLabel(packageManager));
    ((TextView) view.findViewById(R.id.component))
            .setText(new ComponentName(mPackageName, mComponentName).flattenToShortString());
    ((ImageView) view.findViewById(R.id.icon)).setImageDrawable(mProviderInfo.loadIcon(packageManager));

    // Start building description
    FormattedTextBuilder text = new FormattedTextBuilder();

    // Authority
    if (mProviderInfo.authority != null) {
        text.appendValue("Authority", mProviderInfo.authority);
    }

    // Permission/exported
    if (!mProviderInfo.exported) {
        text.appendHeader(getString(R.string.component_not_exported));
    } else {
        if (mProviderInfo.readPermission == null) {
            if (mProviderInfo.writePermission == null) {
                text.appendHeader(getString(R.string.provider_rw_world_accessible));
            } else {
                text.appendValue(getString(R.string.provider_w_only_permission), mProviderInfo.writePermission,
                        true, FormattedTextBuilder.ValueSemantic.PERMISSION);
            }
        } else if (mProviderInfo.readPermission.equals(mProviderInfo.writePermission)) {
            text.appendValue(getString(R.string.provider_rw_permission), mProviderInfo.readPermission, true,
                    FormattedTextBuilder.ValueSemantic.PERMISSION);
        } else {
            text.appendValue(getString(R.string.provider_r_permission), mProviderInfo.readPermission, true,
                    FormattedTextBuilder.ValueSemantic.PERMISSION);
            if (mProviderInfo.writePermission == null) {
                text.appendValuelessKeyContinuingGroup(
                        getResources().getText(R.string.provider_no_w_permission));
            } else {
                text.appendValue(getString(R.string.provider_w_permission), mProviderInfo.writePermission,
                        false, FormattedTextBuilder.ValueSemantic.PERMISSION);
            }
        }
    }

    // Permission granting
    if (mProviderInfo.grantUriPermissions) {
        if (mProviderInfo.uriPermissionPatterns != null) {
            PatternMatcher[] uriPermissionPatterns = mProviderInfo.uriPermissionPatterns;
            String[] listItems = new String[uriPermissionPatterns.length];
            for (int i = 0; i < uriPermissionPatterns.length; i++) {
                PatternMatcher pattern = uriPermissionPatterns[i];
                listItems[i] = pattern.getPath()
                        + (pattern.getType() == PatternMatcher.PATTERN_PREFIX ? "*" : "");
            }
            text.appendList(getString(R.string.provider_grant_uri_permission_for), listItems);
        } else {
            text.appendHeader(getString(R.string.provider_grant_uri_permission_for_all_paths));
        }
    }

    // <meta-data>
    text.appendFormattedText(
            ComponentInfoFragment.dumpMetaData(getActivity(), mPackageName, mProviderInfo.metaData));

    // Put description in TextView
    TextView textView = (TextView) view.findViewById(R.id.description);
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    textView.setText(text.getText());

    // Set button action
    view.findViewById(R.id.go_to_provider_lab).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            goToProviderLab();
        }
    });

    // Return view
    return view;
}

From source file:com.java2s.intents4.IntentsDemo4Activity.java

private IntentFilter createFilterFromEditTextFields() {
    IntentFilter filter = new IntentFilter();

    if (filterActionsLayout != null) {
        int count = filterActionsLayout.getChildCount();
        for (int i = 0; i < count; i++) {
            String action = ((EditText) ((ViewGroup) filterActionsLayout.getChildAt(i)).getChildAt(1)).getText()
                    .toString().trim();//from  w  ww .ja  v  a 2 s  . c o  m
            if (action.length() != 0) {
                filter.addAction(action);
            }
        }
    }

    if (filterSchemeLayout != null) {
        int count = filterSchemeLayout.getChildCount();
        for (int i = 0; i < count; i++) {
            String scheme = ((EditText) ((ViewGroup) filterSchemeLayout.getChildAt(i)).getChildAt(1)).getText()
                    .toString().trim();
            if (scheme.length() != 0) {
                filter.addDataScheme(scheme);
            }
        }
    }

    if (filterAuthLayout != null) {
        int count = filterAuthLayout.getChildCount();
        for (int i = 0; i < count; i++) {
            String auth = ((EditText) ((ViewGroup) filterAuthLayout.getChildAt(i)).getChildAt(1)).getText()
                    .toString().trim();
            if (auth.length() != 0) {
                Scanner scanner = new Scanner(auth);
                scanner.useDelimiter(":");
                String host = null;
                String port = null;
                if (scanner.hasNext()) {
                    host = scanner.next();
                }
                if (scanner.hasNext()) {
                    port = scanner.next();
                }
                filter.addDataAuthority(host, port);
            }
        }
    }

    if (filterPathLayout != null) {
        int count = filterPathLayout.getChildCount();
        for (int i = 0; i < count; i++) {

            ViewGroup group = (ViewGroup) filterPathLayout.getChildAt(i);
            String path = ((EditText) group.getChildAt(1)).getText().toString().trim();
            String pattern = ((TextView) ((ViewGroup) group.getChildAt(2)).getChildAt(0)).getText().toString()
                    .trim(); // ((TextView)

            int patternInt = 0;
            if (pattern.equals(pathPatterns[0])) {
                patternInt = PatternMatcher.PATTERN_LITERAL;
            }
            if (pattern.equals(pathPatterns[1])) {
                patternInt = PatternMatcher.PATTERN_PREFIX;
            }
            if (pattern.equals(pathPatterns[2])) {
                patternInt = PatternMatcher.PATTERN_SIMPLE_GLOB;
            }
            if (path.length() != 0) {
                filter.addDataPath(path, patternInt);
            }
        }
    }

    if (filterTypeLayout != null) {
        int count = filterTypeLayout.getChildCount();
        for (int i = 0; i < count; i++) {
            String aType = ((EditText) ((ViewGroup) filterTypeLayout.getChildAt(i)).getChildAt(1)).getText()
                    .toString().trim();
            if (aType.length() != 0) {
                try {
                    filter.addDataType(aType);
                } catch (MalformedMimeTypeException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    if (filterCategoriesLayout != null) {
        int count = filterCategoriesLayout.getChildCount();
        for (int i = 0; i < count; i++) {
            String cat = ((EditText) ((ViewGroup) filterCategoriesLayout.getChildAt(i)).getChildAt(1)).getText()
                    .toString().trim();
            if (cat.length() != 0) {
                filter.addCategory(cat);
            }
        }
    }
    return filter;
}

From source file:android.content.pm.PackageParser.java

private boolean parseProviderTags(Resources res, XmlPullParser parser, AttributeSet attrs, Provider outInfo,
        String[] outError) throws XmlPullParserException, IOException {
    int outerDepth = parser.getDepth();
    int type;/*from  w w w .j  a  va 2  s  . c  om*/
    while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
            && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
        if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
            continue;
        }

        if (parser.getName().equals("intent-filter")) {
            ProviderIntentInfo intent = new ProviderIntentInfo(outInfo);
            if (!parseIntent(res, parser, attrs, true, false, intent, outError)) {
                return false;
            }
            outInfo.intents.add(intent);

        } else if (parser.getName().equals("meta-data")) {
            if ((outInfo.metaData = parseMetaData(res, parser, attrs, outInfo.metaData, outError)) == null) {
                return false;
            }

        } else if (parser.getName().equals("grant-uri-permission")) {
            TypedArray sa = res.obtainAttributes(attrs,
                    com.android.internal.R.styleable.AndroidManifestGrantUriPermission);

            PatternMatcher pa = null;

            String str = sa.getNonConfigurationString(
                    com.android.internal.R.styleable.AndroidManifestGrantUriPermission_path, 0);
            if (str != null) {
                pa = new PatternMatcher(str, PatternMatcher.PATTERN_LITERAL);
            }

            str = sa.getNonConfigurationString(
                    com.android.internal.R.styleable.AndroidManifestGrantUriPermission_pathPrefix, 0);
            if (str != null) {
                pa = new PatternMatcher(str, PatternMatcher.PATTERN_PREFIX);
            }

            str = sa.getNonConfigurationString(
                    com.android.internal.R.styleable.AndroidManifestGrantUriPermission_pathPattern, 0);
            if (str != null) {
                pa = new PatternMatcher(str, PatternMatcher.PATTERN_SIMPLE_GLOB);
            }

            sa.recycle();

            if (pa != null) {
                if (outInfo.info.uriPermissionPatterns == null) {
                    outInfo.info.uriPermissionPatterns = new PatternMatcher[1];
                    outInfo.info.uriPermissionPatterns[0] = pa;
                } else {
                    final int N = outInfo.info.uriPermissionPatterns.length;
                    PatternMatcher[] newp = new PatternMatcher[N + 1];
                    System.arraycopy(outInfo.info.uriPermissionPatterns, 0, newp, 0, N);
                    newp[N] = pa;
                    outInfo.info.uriPermissionPatterns = newp;
                }
                outInfo.info.grantUriPermissions = true;
            } else {
                if (!RIGID_PARSER) {
                    Slog.w(TAG, "Unknown element under <path-permission>: " + parser.getName() + " at "
                            + mArchiveSourcePath + " " + parser.getPositionDescription());
                    XmlUtils.skipCurrentTag(parser);
                    continue;
                } else {
                    outError[0] = "No path, pathPrefix, or pathPattern for <path-permission>";
                    return false;
                }
            }
            XmlUtils.skipCurrentTag(parser);

        } else if (parser.getName().equals("path-permission")) {
            TypedArray sa = res.obtainAttributes(attrs,
                    com.android.internal.R.styleable.AndroidManifestPathPermission);

            PathPermission pa = null;

            String permission = sa.getNonConfigurationString(
                    com.android.internal.R.styleable.AndroidManifestPathPermission_permission, 0);
            String readPermission = sa.getNonConfigurationString(
                    com.android.internal.R.styleable.AndroidManifestPathPermission_readPermission, 0);
            if (readPermission == null) {
                readPermission = permission;
            }
            String writePermission = sa.getNonConfigurationString(
                    com.android.internal.R.styleable.AndroidManifestPathPermission_writePermission, 0);
            if (writePermission == null) {
                writePermission = permission;
            }

            boolean havePerm = false;
            if (readPermission != null) {
                readPermission = readPermission.intern();
                havePerm = true;
            }
            if (writePermission != null) {
                writePermission = writePermission.intern();
                havePerm = true;
            }

            if (!havePerm) {
                if (!RIGID_PARSER) {
                    Slog.w(TAG, "No readPermission or writePermssion for <path-permission>: " + parser.getName()
                            + " at " + mArchiveSourcePath + " " + parser.getPositionDescription());
                    XmlUtils.skipCurrentTag(parser);
                    continue;
                } else {
                    outError[0] = "No readPermission or writePermssion for <path-permission>";
                    return false;
                }
            }

            String path = sa.getNonConfigurationString(
                    com.android.internal.R.styleable.AndroidManifestPathPermission_path, 0);
            if (path != null) {
                pa = new PathPermission(path, PatternMatcher.PATTERN_LITERAL, readPermission, writePermission);
            }

            path = sa.getNonConfigurationString(
                    com.android.internal.R.styleable.AndroidManifestPathPermission_pathPrefix, 0);
            if (path != null) {
                pa = new PathPermission(path, PatternMatcher.PATTERN_PREFIX, readPermission, writePermission);
            }

            path = sa.getNonConfigurationString(
                    com.android.internal.R.styleable.AndroidManifestPathPermission_pathPattern, 0);
            if (path != null) {
                pa = new PathPermission(path, PatternMatcher.PATTERN_SIMPLE_GLOB, readPermission,
                        writePermission);
            }

            sa.recycle();

            if (pa != null) {
                if (outInfo.info.pathPermissions == null) {
                    outInfo.info.pathPermissions = new PathPermission[1];
                    outInfo.info.pathPermissions[0] = pa;
                } else {
                    final int N = outInfo.info.pathPermissions.length;
                    PathPermission[] newp = new PathPermission[N + 1];
                    System.arraycopy(outInfo.info.pathPermissions, 0, newp, 0, N);
                    newp[N] = pa;
                    outInfo.info.pathPermissions = newp;
                }
            } else {
                if (!RIGID_PARSER) {
                    Slog.w(TAG, "No path, pathPrefix, or pathPattern for <path-permission>: " + parser.getName()
                            + " at " + mArchiveSourcePath + " " + parser.getPositionDescription());
                    XmlUtils.skipCurrentTag(parser);
                    continue;
                }
                outError[0] = "No path, pathPrefix, or pathPattern for <path-permission>";
                return false;
            }
            XmlUtils.skipCurrentTag(parser);

        } else {
            if (!RIGID_PARSER) {
                Slog.w(TAG, "Unknown element under <provider>: " + parser.getName() + " at "
                        + mArchiveSourcePath + " " + parser.getPositionDescription());
                XmlUtils.skipCurrentTag(parser);
                continue;
            } else {
                outError[0] = "Bad element under <provider>: " + parser.getName();
                return false;
            }
        }
    }
    return true;
}

From source file:android.content.pm.PackageParser.java

private boolean parseIntent(Resources res, XmlPullParser parser, AttributeSet attrs, boolean allowGlobs,
        boolean allowAutoVerify, IntentInfo outInfo, String[] outError)
        throws XmlPullParserException, IOException {

    TypedArray sa = res.obtainAttributes(attrs, com.android.internal.R.styleable.AndroidManifestIntentFilter);

    int priority = sa.getInt(com.android.internal.R.styleable.AndroidManifestIntentFilter_priority, 0);
    outInfo.setPriority(priority);/*from  w w  w.  j  ava  2  s. c o m*/

    TypedValue v = sa.peekValue(com.android.internal.R.styleable.AndroidManifestIntentFilter_label);
    if (v != null && (outInfo.labelRes = v.resourceId) == 0) {
        outInfo.nonLocalizedLabel = v.coerceToString();
    }

    outInfo.icon = sa.getResourceId(com.android.internal.R.styleable.AndroidManifestIntentFilter_icon, 0);

    outInfo.logo = sa.getResourceId(com.android.internal.R.styleable.AndroidManifestIntentFilter_logo, 0);

    outInfo.banner = sa.getResourceId(com.android.internal.R.styleable.AndroidManifestIntentFilter_banner, 0);

    if (allowAutoVerify) {
        outInfo.setAutoVerify(
                sa.getBoolean(com.android.internal.R.styleable.AndroidManifestIntentFilter_autoVerify, false));
    }

    sa.recycle();

    int outerDepth = parser.getDepth();
    int type;
    while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
            && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
        if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
            continue;
        }

        String nodeName = parser.getName();
        if (nodeName.equals("action")) {
            String value = attrs.getAttributeValue(ANDROID_RESOURCES, "name");
            if (value == null || value == "") {
                outError[0] = "No value supplied for <android:name>";
                return false;
            }
            XmlUtils.skipCurrentTag(parser);

            outInfo.addAction(value);
        } else if (nodeName.equals("category")) {
            String value = attrs.getAttributeValue(ANDROID_RESOURCES, "name");
            if (value == null || value == "") {
                outError[0] = "No value supplied for <android:name>";
                return false;
            }
            XmlUtils.skipCurrentTag(parser);

            outInfo.addCategory(value);

        } else if (nodeName.equals("data")) {
            sa = res.obtainAttributes(attrs, com.android.internal.R.styleable.AndroidManifestData);

            String str = sa.getNonConfigurationString(
                    com.android.internal.R.styleable.AndroidManifestData_mimeType, 0);
            if (str != null) {
                try {
                    outInfo.addDataType(str);
                } catch (IntentFilter.MalformedMimeTypeException e) {
                    outError[0] = e.toString();
                    sa.recycle();
                    return false;
                }
            }

            str = sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestData_scheme, 0);
            if (str != null) {
                outInfo.addDataScheme(str);
            }

            str = sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestData_ssp, 0);
            if (str != null) {
                outInfo.addDataSchemeSpecificPart(str, PatternMatcher.PATTERN_LITERAL);
            }

            str = sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestData_sspPrefix,
                    0);
            if (str != null) {
                outInfo.addDataSchemeSpecificPart(str, PatternMatcher.PATTERN_PREFIX);
            }

            str = sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestData_sspPattern,
                    0);
            if (str != null) {
                if (!allowGlobs) {
                    outError[0] = "sspPattern not allowed here; ssp must be literal";
                    return false;
                }
                outInfo.addDataSchemeSpecificPart(str, PatternMatcher.PATTERN_SIMPLE_GLOB);
            }

            String host = sa
                    .getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestData_host, 0);
            String port = sa
                    .getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestData_port, 0);
            if (host != null) {
                outInfo.addDataAuthority(host, port);
            }

            str = sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestData_path, 0);
            if (str != null) {
                outInfo.addDataPath(str, PatternMatcher.PATTERN_LITERAL);
            }

            str = sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestData_pathPrefix,
                    0);
            if (str != null) {
                outInfo.addDataPath(str, PatternMatcher.PATTERN_PREFIX);
            }

            str = sa.getNonConfigurationString(com.android.internal.R.styleable.AndroidManifestData_pathPattern,
                    0);
            if (str != null) {
                if (!allowGlobs) {
                    outError[0] = "pathPattern not allowed here; path must be literal";
                    return false;
                }
                outInfo.addDataPath(str, PatternMatcher.PATTERN_SIMPLE_GLOB);
            }

            sa.recycle();
            XmlUtils.skipCurrentTag(parser);
        } else if (!RIGID_PARSER) {
            Slog.w(TAG, "Unknown element under <intent-filter>: " + parser.getName() + " at "
                    + mArchiveSourcePath + " " + parser.getPositionDescription());
            XmlUtils.skipCurrentTag(parser);
        } else {
            outError[0] = "Bad element under <intent-filter>: " + parser.getName();
            return false;
        }
    }

    outInfo.hasDefault = outInfo.hasCategory(Intent.CATEGORY_DEFAULT);

    if (DEBUG_PARSER) {
        final StringBuilder cats = new StringBuilder("Intent d=");
        cats.append(outInfo.hasDefault);
        cats.append(", cat=");

        final Iterator<String> it = outInfo.categoriesIterator();
        if (it != null) {
            while (it.hasNext()) {
                cats.append(' ');
                cats.append(it.next());
            }
        }
        Slog.d(TAG, cats.toString());
    }

    return true;
}