OSDN Git Service

Deal with print-preview renderings that do not match the correct number
authorPhilip P. Moltmann <moltmann@google.com>
Thu, 10 Mar 2016 00:54:52 +0000 (16:54 -0800)
committerPhilip P. Moltmann <moltmann@google.com>
Fri, 18 Mar 2016 17:57:32 +0000 (10:57 -0700)
commit066bf81b983ce23b91d19b85b7c37a61fba7a9a6
tree474b2e2c2aaff77a879e29efbd3347552cd80dab
parentef5577a15dfc652edcfeaab46cdea830b749f1b8
Deal with print-preview renderings that do not match the correct number
of pages.

If the printing app declares more pages than the print preview pdf has
we used to throw an exception in the PDFManupulationService. This caused
the bitmap to be never written and the read-bitmap function to hang
forever. This was because read() return 0 meaning "pipe is closed" which
lead to an infinite loop. Now a read of 0 page might cause an exception
if the page is not fully read. This exception then causes the
preview_page_error to be displayed.

Bug: 27556666
Change-Id: I7b9de50dce930629e8d38efd4e2659a00b70cc4e
packages/PrintSpooler/jni/com_android_printspooler_util_BitmapSerializeUtils.cpp
packages/PrintSpooler/res/drawable/print_warning.xml [new file with mode: 0644]
packages/PrintSpooler/res/layout/preview_page_error.xml [new file with mode: 0644]
packages/PrintSpooler/res/values/strings.xml
packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
packages/PrintSpooler/src/com/android/printspooler/renderer/PdfManipulationService.java
packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java
packages/PrintSpooler/src/com/android/printspooler/widget/PageContentView.java