Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 48ca1cbd authored by Svetoslav's avatar Svetoslav Committed by Android Git Automerger
Browse files

am d32e5cc8: am 737fa54b: am 299a89b5: Merge "Print spooler should not crash...

am d32e5cc8: am 737fa54b: am 299a89b5: Merge "Print spooler should not crash if fed non-PDF content." into lmp-dev

* commit 'd32e5cc8d56d8b8a5638417ae86bd16661304466':
  Print spooler should not crash if fed non-PDF content.
parents 102a9826 0b71057e
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -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 {
+3 −1
Original line number Diff line number Diff line
@@ -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;
                }
            }
        }