Merge "Print spooler not starting." into klp-dev

This commit is contained in:
Svetoslav
2013-10-11 20:55:00 +00:00
committed by Android (Google) Code Review
4 changed files with 10 additions and 44 deletions

View File

@@ -129,9 +129,6 @@ public final class PrintJobInfo implements Parcelable {
/** The id of the app that created the job. */ /** The id of the app that created the job. */
private int mAppId; private int mAppId;
/** The id of the user that created the job. */
private int mUserId;
/** Optional tag assigned by a print service.*/ /** Optional tag assigned by a print service.*/
private String mTag; private String mTag;
@@ -169,7 +166,6 @@ public final class PrintJobInfo implements Parcelable {
mPrinterName = other.mPrinterName; mPrinterName = other.mPrinterName;
mState = other.mState; mState = other.mState;
mAppId = other.mAppId; mAppId = other.mAppId;
mUserId = other.mUserId;
mTag = other.mTag; mTag = other.mTag;
mCreationTime = other.mCreationTime; mCreationTime = other.mCreationTime;
mCopies = other.mCopies; mCopies = other.mCopies;
@@ -187,7 +183,6 @@ public final class PrintJobInfo implements Parcelable {
mPrinterName = parcel.readString(); mPrinterName = parcel.readString();
mState = parcel.readInt(); mState = parcel.readInt();
mAppId = parcel.readInt(); mAppId = parcel.readInt();
mUserId = parcel.readInt();
mTag = parcel.readString(); mTag = parcel.readString();
mCreationTime = parcel.readLong(); mCreationTime = parcel.readLong();
mCopies = parcel.readInt(); mCopies = parcel.readInt();
@@ -332,28 +327,6 @@ public final class PrintJobInfo implements Parcelable {
mAppId = appId; mAppId = appId;
} }
/**
* Gets the owning user id.
*
* @return The user id.
*
* @hide
*/
public int getUserId() {
return mUserId;
}
/**
* Sets the owning user id.
*
* @param userId The user id.
*
* @hide
*/
public void setUserId(int userId) {
mUserId = userId;
}
/** /**
* Gets the optional tag assigned by a print service. * Gets the optional tag assigned by a print service.
* *
@@ -543,7 +516,6 @@ public final class PrintJobInfo implements Parcelable {
parcel.writeString(mPrinterName); parcel.writeString(mPrinterName);
parcel.writeInt(mState); parcel.writeInt(mState);
parcel.writeInt(mAppId); parcel.writeInt(mAppId);
parcel.writeInt(mUserId);
parcel.writeString(mTag); parcel.writeString(mTag);
parcel.writeLong(mCreationTime); parcel.writeLong(mCreationTime);
parcel.writeInt(mCopies); parcel.writeInt(mCopies);

View File

@@ -45,7 +45,8 @@
android:allowClearUserData="true" android:allowClearUserData="true"
android:label="@string/app_label" android:label="@string/app_label"
android:allowBackup= "false" android:allowBackup= "false"
android:supportsRtl="true"> android:supportsRtl="true"
android:icon="@*android:drawable/ic_print">
<service <service
android:name=".PrintSpoolerService" android:name=".PrintSpoolerService"
@@ -59,7 +60,7 @@
android:permission="android.permission.BIND_PRINT_SPOOLER_SERVICE" android:permission="android.permission.BIND_PRINT_SPOOLER_SERVICE"
android:theme="@style/PrintJobConfigActivityTheme"> android:theme="@style/PrintJobConfigActivityTheme">
<intent-filter> <intent-filter>
<action android:name="android.print.PRINT_DILAOG" /> <action android:name="android.print.PRINT_DIALOG" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:scheme="printjob" android:pathPattern="*" /> <data android:scheme="printjob" android:pathPattern="*" />
</intent-filter> </intent-filter>

View File

@@ -89,8 +89,6 @@ import com.android.printspooler.MediaSizeUtils.MediaSizeComparator;
import libcore.io.IoUtils; import libcore.io.IoUtils;
import libcore.io.IoUtils;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@@ -2189,9 +2187,10 @@ public class PrintJobConfigActivity extends Activity {
@Override @Override
public int getCount() { public int getCount() {
final int additionalItemCount = (mFakePdfPrinter != null) ? 2 : 1; if (mFakePdfPrinter == null) {
return Math.min(mPrinters.size() + additionalItemCount, return 0;
DEST_ADAPTER_MAX_ITEM_COUNT); }
return Math.min(mPrinters.size() + 2, DEST_ADAPTER_MAX_ITEM_COUNT);
} }
@Override @Override
@@ -2227,15 +2226,13 @@ public class PrintJobConfigActivity extends Activity {
@Override @Override
public long getItemId(int position) { public long getItemId(int position) {
if (mPrinters.isEmpty()) { if (mPrinters.isEmpty()) {
if (position == 0) {
if (mFakePdfPrinter != null) { if (mFakePdfPrinter != null) {
if (position == 0) {
return DEST_ADAPTER_ITEM_ID_SAVE_AS_PDF; return DEST_ADAPTER_ITEM_ID_SAVE_AS_PDF;
} else {
return DEST_ADAPTER_ITEM_ID_ALL_PRINTERS;
}
} else if (position == 1) { } else if (position == 1) {
return DEST_ADAPTER_ITEM_ID_ALL_PRINTERS; return DEST_ADAPTER_ITEM_ID_ALL_PRINTERS;
} }
}
} else { } else {
if (position == 1 && mFakePdfPrinter != null) { if (position == 1 && mFakePdfPrinter != null) {
return DEST_ADAPTER_ITEM_ID_SAVE_AS_PDF; return DEST_ADAPTER_ITEM_ID_SAVE_AS_PDF;

View File

@@ -689,7 +689,6 @@ public final class PrintSpoolerService extends Service {
private static final String ATTR_PACKAGE_NAME = "packageName"; private static final String ATTR_PACKAGE_NAME = "packageName";
private static final String ATTR_STATE = "state"; private static final String ATTR_STATE = "state";
private static final String ATTR_APP_ID = "appId"; private static final String ATTR_APP_ID = "appId";
private static final String ATTR_USER_ID = "userId";
private static final String ATTR_TAG = "tag"; private static final String ATTR_TAG = "tag";
private static final String ATTR_CREATION_TIME = "creationTime"; private static final String ATTR_CREATION_TIME = "creationTime";
private static final String ATTR_COPIES = "copies"; private static final String ATTR_COPIES = "copies";
@@ -778,7 +777,6 @@ public final class PrintSpoolerService extends Service {
serializer.attribute(null, ATTR_LABEL, printJob.getLabel().toString()); serializer.attribute(null, ATTR_LABEL, printJob.getLabel().toString());
serializer.attribute(null, ATTR_STATE, String.valueOf(printJob.getState())); serializer.attribute(null, ATTR_STATE, String.valueOf(printJob.getState()));
serializer.attribute(null, ATTR_APP_ID, String.valueOf(printJob.getAppId())); serializer.attribute(null, ATTR_APP_ID, String.valueOf(printJob.getAppId()));
serializer.attribute(null, ATTR_USER_ID, String.valueOf(printJob.getUserId()));
String tag = printJob.getTag(); String tag = printJob.getTag();
if (tag != null) { if (tag != null) {
serializer.attribute(null, ATTR_TAG, tag); serializer.attribute(null, ATTR_TAG, tag);
@@ -976,8 +974,6 @@ public final class PrintSpoolerService extends Service {
printJob.setState(state); printJob.setState(state);
final int appId = Integer.parseInt(parser.getAttributeValue(null, ATTR_APP_ID)); final int appId = Integer.parseInt(parser.getAttributeValue(null, ATTR_APP_ID));
printJob.setAppId(appId); printJob.setAppId(appId);
final int userId = Integer.parseInt(parser.getAttributeValue(null, ATTR_USER_ID));
printJob.setUserId(userId);
String tag = parser.getAttributeValue(null, ATTR_TAG); String tag = parser.getAttributeValue(null, ATTR_TAG);
printJob.setTag(tag); printJob.setTag(tag);
String creationTime = parser.getAttributeValue(null, ATTR_CREATION_TIME); String creationTime = parser.getAttributeValue(null, ATTR_CREATION_TIME);