Loading core/java/android/print/IPrintDocumentAdapter.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -37,4 +37,5 @@ oneway interface IPrintDocumentAdapter { void write(in PageRange[] pages, in ParcelFileDescriptor fd, IWriteResultCallback callback, int sequence); void finish(); void kill(String reason); } core/java/android/print/PrintManager.java +21 −0 Original line number Diff line number Diff line Loading @@ -633,6 +633,17 @@ public final class PrintManager { } } @Override public void kill(String reason) { synchronized (mLock) { // If destroyed the handler is null. if (!isDestroyedLocked()) { mHandler.obtainMessage(MyHandler.MSG_ON_KILL, reason).sendToTarget(); } } } @Override public void onActivityPaused(Activity activity) { /* do nothing */ Loading Loading @@ -719,6 +730,7 @@ public final class PrintManager { public static final int MSG_ON_LAYOUT = 2; public static final int MSG_ON_WRITE = 3; public static final int MSG_ON_FINISH = 4; public static final int MSG_ON_KILL = 5; public MyHandler(Looper looper) { super(looper, null, true); Loading Loading @@ -794,6 +806,15 @@ public final class PrintManager { } } break; case MSG_ON_KILL: { if (DEBUG) { Log.i(LOG_TAG, "onKill()"); } String reason = (String) message.obj; throw new RuntimeException(reason); } default: { throw new IllegalArgumentException("Unknown message: " + message.what); Loading core/jni/android/graphics/pdf/PdfEditor.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -89,8 +89,17 @@ static jlong nativeOpen(JNIEnv* env, jclass thiz, jint fd, jlong size) { if (!document) { const long error = FPDF_GetLastError(); switch (error) { case FPDF_ERR_PASSWORD: case FPDF_ERR_SECURITY: { jniThrowException(env, "java/lang/SecurityException", "cannot create document. Error:" + error); } break; default: { jniThrowException(env, "java/io/IOException", "cannot create document. Error:" + error); } break; } destroyLibraryIfNeeded(); return -1; } Loading core/jni/android/graphics/pdf/PdfRenderer.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -82,8 +82,17 @@ static jlong nativeCreate(JNIEnv* env, jclass thiz, jint fd, jlong size) { if (!document) { const long error = FPDF_GetLastError(); switch (error) { case FPDF_ERR_PASSWORD: case FPDF_ERR_SECURITY: { jniThrowException(env, "java/lang/SecurityException", "cannot create document. Error:" + error); } break; default: { jniThrowException(env, "java/io/IOException", "cannot create document. Error:" + error); } break; } destroyLibraryIfNeeded(); return -1; } Loading graphics/java/android/graphics/pdf/PdfEditor.java +4 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,10 @@ public final class PdfEditor { * * @param input Seekable file descriptor to read from. * * @throws java.io.IOException If an error occurs while reading the file. * @throws java.lang.SecurityException If the file requires a password or * the security scheme is not supported. * * @see #close() */ public PdfEditor(@NonNull ParcelFileDescriptor input) throws IOException { Loading Loading
core/java/android/print/IPrintDocumentAdapter.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -37,4 +37,5 @@ oneway interface IPrintDocumentAdapter { void write(in PageRange[] pages, in ParcelFileDescriptor fd, IWriteResultCallback callback, int sequence); void finish(); void kill(String reason); }
core/java/android/print/PrintManager.java +21 −0 Original line number Diff line number Diff line Loading @@ -633,6 +633,17 @@ public final class PrintManager { } } @Override public void kill(String reason) { synchronized (mLock) { // If destroyed the handler is null. if (!isDestroyedLocked()) { mHandler.obtainMessage(MyHandler.MSG_ON_KILL, reason).sendToTarget(); } } } @Override public void onActivityPaused(Activity activity) { /* do nothing */ Loading Loading @@ -719,6 +730,7 @@ public final class PrintManager { public static final int MSG_ON_LAYOUT = 2; public static final int MSG_ON_WRITE = 3; public static final int MSG_ON_FINISH = 4; public static final int MSG_ON_KILL = 5; public MyHandler(Looper looper) { super(looper, null, true); Loading Loading @@ -794,6 +806,15 @@ public final class PrintManager { } } break; case MSG_ON_KILL: { if (DEBUG) { Log.i(LOG_TAG, "onKill()"); } String reason = (String) message.obj; throw new RuntimeException(reason); } default: { throw new IllegalArgumentException("Unknown message: " + message.what); Loading
core/jni/android/graphics/pdf/PdfEditor.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -89,8 +89,17 @@ static jlong nativeOpen(JNIEnv* env, jclass thiz, jint fd, jlong size) { if (!document) { const long error = FPDF_GetLastError(); switch (error) { case FPDF_ERR_PASSWORD: case FPDF_ERR_SECURITY: { jniThrowException(env, "java/lang/SecurityException", "cannot create document. Error:" + error); } break; default: { jniThrowException(env, "java/io/IOException", "cannot create document. Error:" + error); } break; } destroyLibraryIfNeeded(); return -1; } Loading
core/jni/android/graphics/pdf/PdfRenderer.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -82,8 +82,17 @@ static jlong nativeCreate(JNIEnv* env, jclass thiz, jint fd, jlong size) { if (!document) { const long error = FPDF_GetLastError(); switch (error) { case FPDF_ERR_PASSWORD: case FPDF_ERR_SECURITY: { jniThrowException(env, "java/lang/SecurityException", "cannot create document. Error:" + error); } break; default: { jniThrowException(env, "java/io/IOException", "cannot create document. Error:" + error); } break; } destroyLibraryIfNeeded(); return -1; } Loading
graphics/java/android/graphics/pdf/PdfEditor.java +4 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,10 @@ public final class PdfEditor { * * @param input Seekable file descriptor to read from. * * @throws java.io.IOException If an error occurs while reading the file. * @throws java.lang.SecurityException If the file requires a password or * the security scheme is not supported. * * @see #close() */ public PdfEditor(@NonNull ParcelFileDescriptor input) throws IOException { Loading