diff --git a/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java b/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java index eb2c9207e18db..85b2490c68fb1 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java +++ b/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java @@ -412,8 +412,6 @@ public final class PageContentRepository { } private static final class AsyncRenderer implements ServiceConnection { - private static final int MALFORMED_PDF_FILE_ERROR = -2; - private final Object mLock = new Object(); private final Context mContext; @@ -486,7 +484,7 @@ public final class PageContentRepository { return mRenderer.openDocument(source); } catch (RemoteException re) { Log.e(LOG_TAG, "Cannot open PDF document"); - return MALFORMED_PDF_FILE_ERROR; + return PdfManipulationService.MALFORMED_PDF_FILE_ERROR; } finally { // Close the fd as we passed it to another process // which took ownership. @@ -497,7 +495,7 @@ public final class PageContentRepository { @Override public void onPostExecute(Integer pageCount) { - if (pageCount == MALFORMED_PDF_FILE_ERROR) { + if (pageCount == PdfManipulationService.MALFORMED_PDF_FILE_ERROR) { mOnMalformedPdfFileListener.onMalformedPdfFile(); mPageCount = PrintDocumentInfo.PAGE_COUNT_UNKNOWN; } else { diff --git a/packages/PrintSpooler/src/com/android/printspooler/renderer/PdfManipulationService.java b/packages/PrintSpooler/src/com/android/printspooler/renderer/PdfManipulationService.java index 62716b2168514..00e505149d1de 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/renderer/PdfManipulationService.java +++ b/packages/PrintSpooler/src/com/android/printspooler/renderer/PdfManipulationService.java @@ -47,6 +47,8 @@ public final class PdfManipulationService extends Service { public static final String ACTION_GET_EDITOR = "com.android.printspooler.renderer.ACTION_GET_EDITOR"; + public static final int MALFORMED_PDF_FILE_ERROR = -2; + private static final String LOG_TAG = "PdfManipulationService"; private static final boolean DEBUG = false; @@ -88,7 +90,7 @@ public final class PdfManipulationService extends Service { } catch (IOException|IllegalStateException e) { IoUtils.closeQuietly(source); Log.e(LOG_TAG, "Cannot open file", e); - throw new RemoteException(e.toString()); + return MALFORMED_PDF_FILE_ERROR; } } }