FileDocCategorySizeDatePackage
CrossProfileIntentFilter.javaAPI DocAndroid 5.1 API6029Thu Mar 12 22:22:42 GMT 2015com.android.server.pm

CrossProfileIntentFilter

public class CrossProfileIntentFilter extends android.content.IntentFilter
The {@link PackageManagerService} maintains some {@link CrossProfileIntentFilter}s for each user. If an {@link Intent} matches the {@link CrossProfileIntentFilter}, then activities in the user {@link #mTargetUserId} can access it.

Fields Summary
private static final String
ATTR_TARGET_USER_ID
private static final String
ATTR_FLAGS
private static final String
ATTR_OWNER_USER_ID
private static final String
ATTR_OWNER_PACKAGE
private static final String
ATTR_FILTER
private static final String
TAG
final int
mTargetUserId
final int
mOwnerUserId
final String
mOwnerPackage
final int
mFlags
Constructors Summary
CrossProfileIntentFilter(android.content.IntentFilter filter, String ownerPackage, int ownerUserId, int targetUserId, int flags)


         
                
        super(filter);
        mTargetUserId = targetUserId;
        mOwnerUserId = ownerUserId;
        mOwnerPackage = ownerPackage;
        mFlags = flags;
    
CrossProfileIntentFilter(XmlPullParser parser)

        mTargetUserId = getIntFromXml(parser, ATTR_TARGET_USER_ID, UserHandle.USER_NULL);
        mOwnerUserId = getIntFromXml(parser, ATTR_OWNER_USER_ID, UserHandle.USER_NULL);
        mOwnerPackage = getStringFromXml(parser, ATTR_OWNER_PACKAGE, "");
        mFlags = getIntFromXml(parser, ATTR_FLAGS, 0);

        int outerDepth = parser.getDepth();
        String tagName = parser.getName();
        int type;
        while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
                && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
            tagName = parser.getName();
            if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
                continue;
            } else if (type == XmlPullParser.START_TAG) {
                if (tagName.equals(ATTR_FILTER)) {
                    break;
                } else {
                    String msg = "Unknown element under "
                            + Settings.TAG_CROSS_PROFILE_INTENT_FILTERS + ": " + tagName + " at "
                            + parser.getPositionDescription();
                    PackageManagerService.reportSettingsProblem(Log.WARN, msg);
                    XmlUtils.skipCurrentTag(parser);
                }
            }
        }
        if (tagName.equals(ATTR_FILTER)) {
            readFromXml(parser);
        } else {
            String msg = "Missing element under " + TAG + ": " + ATTR_FILTER +
                    " at " + parser.getPositionDescription();
            PackageManagerService.reportSettingsProblem(Log.WARN, msg);
            XmlUtils.skipCurrentTag(parser);
        }
    
Methods Summary
booleanequalsIgnoreFilter(com.android.server.pm.CrossProfileIntentFilter other)

        return mTargetUserId == other.mTargetUserId
                && mOwnerUserId == other.mOwnerUserId
                && mOwnerPackage.equals(other.mOwnerPackage)
                && mFlags == other.mFlags;
    
public intgetFlags()

        return mFlags;
    
intgetIntFromXml(org.xmlpull.v1.XmlPullParser parser, java.lang.String attribute, int defaultValue)

        String stringValue = getStringFromXml(parser, attribute, null);
        if (stringValue != null) {
            return Integer.parseInt(stringValue);
        }
        return defaultValue;
    
public java.lang.StringgetOwnerPackage()

        return mOwnerPackage;
    
public intgetOwnerUserId()

        return mOwnerUserId;
    
java.lang.StringgetStringFromXml(org.xmlpull.v1.XmlPullParser parser, java.lang.String attribute, java.lang.String defaultValue)

        String value = parser.getAttributeValue(null, attribute);
        if (value == null) {
            String msg = "Missing element under " + TAG +": " + attribute + " at " +
                    parser.getPositionDescription();
            PackageManagerService.reportSettingsProblem(Log.WARN, msg);
            return defaultValue;
        } else {
            return value;
        }
    
public intgetTargetUserId()

        return mTargetUserId;
    
public java.lang.StringtoString()

        return "CrossProfileIntentFilter{0x" + Integer.toHexString(System.identityHashCode(this))
                + " " + Integer.toString(mTargetUserId) + "}";
    
public voidwriteToXml(org.xmlpull.v1.XmlSerializer serializer)

        serializer.attribute(null, ATTR_TARGET_USER_ID, Integer.toString(mTargetUserId));
        serializer.attribute(null, ATTR_FLAGS, Integer.toString(mFlags));
        serializer.attribute(null, ATTR_OWNER_USER_ID, Integer.toString(mOwnerUserId));
        serializer.attribute(null, ATTR_OWNER_PACKAGE, mOwnerPackage);
        serializer.startTag(null, ATTR_FILTER);
            super.writeToXml(serializer);
        serializer.endTag(null, ATTR_FILTER);