Methods Summary |
---|
public static android.printservice.PrintServiceInfo | create(android.content.pm.ResolveInfo resolveInfo, android.content.Context context)Creates a new instance.
String settingsActivityName = null;
String addPrintersActivityName = null;
String advancedPrintOptionsActivityName = null;
XmlResourceParser parser = null;
PackageManager packageManager = context.getPackageManager();
parser = resolveInfo.serviceInfo.loadXmlMetaData(packageManager,
PrintService.SERVICE_META_DATA);
if (parser != null) {
try {
int type = 0;
while (type != XmlPullParser.END_DOCUMENT && type != XmlPullParser.START_TAG) {
type = parser.next();
}
String nodeName = parser.getName();
if (!TAG_PRINT_SERVICE.equals(nodeName)) {
Log.e(LOG_TAG, "Ignoring meta-data that does not start with "
+ TAG_PRINT_SERVICE + " tag");
} else {
Resources resources = packageManager.getResourcesForApplication(
resolveInfo.serviceInfo.applicationInfo);
AttributeSet allAttributes = Xml.asAttributeSet(parser);
TypedArray attributes = resources.obtainAttributes(allAttributes,
com.android.internal.R.styleable.PrintService);
settingsActivityName = attributes.getString(
com.android.internal.R.styleable.PrintService_settingsActivity);
addPrintersActivityName = attributes.getString(
com.android.internal.R.styleable.PrintService_addPrintersActivity);
advancedPrintOptionsActivityName = attributes.getString(com.android.internal
.R.styleable.PrintService_advancedPrintOptionsActivity);
attributes.recycle();
}
} catch (IOException ioe) {
Log.w(LOG_TAG, "Error reading meta-data:" + ioe);
} catch (XmlPullParserException xppe) {
Log.w(LOG_TAG, "Error reading meta-data:" + xppe);
} catch (NameNotFoundException e) {
Log.e(LOG_TAG, "Unable to load resources for: "
+ resolveInfo.serviceInfo.packageName);
} finally {
if (parser != null) {
parser.close();
}
}
}
return new PrintServiceInfo(resolveInfo, settingsActivityName,
addPrintersActivityName, advancedPrintOptionsActivityName);
|
public int | describeContents(){@inheritDoc}
return 0;
|
public boolean | equals(java.lang.Object obj)
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
PrintServiceInfo other = (PrintServiceInfo) obj;
if (mId == null) {
if (other.mId != null) {
return false;
}
} else if (!mId.equals(other.mId)) {
return false;
}
return true;
|
public java.lang.String | getAddPrintersActivityName()The add printers activity name.
Statically set from
{@link PrintService#SERVICE_META_DATA meta-data}.
return mAddPrintersActivityName;
|
public java.lang.String | getAdvancedOptionsActivityName()The advanced print options activity name.
Statically set from
{@link PrintService#SERVICE_META_DATA meta-data}.
return mAdvancedPrintOptionsActivityName;
|
public java.lang.String | getId()The accessibility service id.
Generated by the system.
return mId;
|
public android.content.pm.ResolveInfo | getResolveInfo()The service {@link ResolveInfo}.
return mResolveInfo;
|
public java.lang.String | getSettingsActivityName()The settings activity name.
Statically set from
{@link PrintService#SERVICE_META_DATA meta-data}.
return mSettingsActivityName;
|
public int | hashCode()
return 31 + ((mId == null) ? 0 : mId.hashCode());
|
public java.lang.String | toString()
StringBuilder builder = new StringBuilder();
builder.append("PrintServiceInfo{");
builder.append("id=").append(mId);
builder.append(", resolveInfo=").append(mResolveInfo);
builder.append(", settingsActivityName=").append(mSettingsActivityName);
builder.append(", addPrintersActivityName=").append(mAddPrintersActivityName);
builder.append(", advancedPrintOptionsActivityName=")
.append(mAdvancedPrintOptionsActivityName);
builder.append("}");
return builder.toString();
|
public void | writeToParcel(android.os.Parcel parcel, int flagz)
parcel.writeString(mId);
parcel.writeParcelable(mResolveInfo, 0);
parcel.writeString(mSettingsActivityName);
parcel.writeString(mAddPrintersActivityName);
parcel.writeString(mAdvancedPrintOptionsActivityName);
|