CrossProfileIntentFilterpublic 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 |
---|
boolean | equalsIgnoreFilter(com.android.server.pm.CrossProfileIntentFilter other)
return mTargetUserId == other.mTargetUserId
&& mOwnerUserId == other.mOwnerUserId
&& mOwnerPackage.equals(other.mOwnerPackage)
&& mFlags == other.mFlags;
| public int | getFlags()
return mFlags;
| int | getIntFromXml(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.String | getOwnerPackage()
return mOwnerPackage;
| public int | getOwnerUserId()
return mOwnerUserId;
| java.lang.String | getStringFromXml(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 int | getTargetUserId()
return mTargetUserId;
| public java.lang.String | toString()
return "CrossProfileIntentFilter{0x" + Integer.toHexString(System.identityHashCode(this))
+ " " + Integer.toString(mTargetUserId) + "}";
| public void | writeToXml(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);
|
|