History log of /frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
eaaf0512fcbf03b926cdbbbb7f54df474ecf861a 26-Nov-2014 Svet Ganov <svetoslavganov@google.com> Crash in print spooler when back pressed before content update complted.

We are updating the printed content asynchronously. If the user cancels
printing before the first update is complete the spooler components are
in a destroyed state but we attempt to handle the completed update resulting
in a crash. Now if printing is cancelled we ignore the update result.

bug:18525491

Change-Id: I1ef47a17de19896cba2c7a1dd2bfc205065e0a5a
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
c80814e70aea8940d0d43cd7170baae8c0c4e8e3 24-Nov-2014 Svet Ganov <svetoslavganov@google.com> Lockup in the print spooler.

A recent change modified the way we destroy the remote renderer from
asynchronous to synchronous. This caused problems since it was possible
that the remote rendering service is unbound while we are reading the
contents of a rendered page. As a result the reader was blocking on I/O
and the print spooler was getting into a locked state that required a
restart of its process. Now the remote renderer is destroyed
asynchronously.

bug:18498626

Change-Id: I1312bf808f30430728b4038dd4be43c55d2be825
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
f6cd14dbc99b38af7afe1e5f72347395603d7de2 20-Nov-2014 Svet Ganov <svetoslavganov@google.com> Print spooler crash when printing after a rotation.

1. Available printers are provided by a loader driven by the activity
lifecycle. After a rotation of an app that does not handle rotation
the print activity is destroyed in a delayed fashion. When another
print task is started the loader of the destroed activity gets two
cancellations, one when the activity is stopped and one when it is
destroyed but when the second cancellation happens the loader has a
bad state that it is loading while it is not and a NPE occurs.

2. If a rotation happens early before the print activity is fully initialized
(there are asyncrconous operations that take place) we get a NPE as
the print preview controller is not created yet.

3. A lockup of the print preview process occurs if the print print
activity is destroyed after we initiated binding to the rendering
service but before we receive the remote interface. In this case no
remote service is received as exepcted since we already unbound from
it resulting in a missed signal.

bug:18238590

Change-Id: I81817d81702f649ded97dfbab7d7bba28f22fa91
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
fce84f035c35606c5707e735f503f7bdcfd5b2a1 01-Nov-2014 Svet Ganov <svetoslavganov@google.com> Crash apps that print malformed or password protected PDFs.

If apps are writing malformed content (typically not a PDF file) or if the
PDF content they provide to the print system is password protected, are now
crashed as both of these are app bugs.

bug:17636435

Change-Id: Ifce6a3199e587448dd38f6a84290a965c24b698b
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
7c053c1e414c77ae28adb90390027e21ce57bc5e 29-Oct-2014 Svetoslav <svetoslavganov@google.com> Print preview disappearing if printer is changed.

This is a regression caused by my previous patch.

Change-Id: I80a0b4d880fd4e48e6a44fac303a4c8204e8ec0d
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
b32f04b785306f06d7d07b824fb8dcc1b4a61aa6 25-Oct-2014 Svet Ganov <svetoslavganov@google.com> Merge "Printing from two apps at the same time not working." into lmp-mr1-dev
99a82437ed8e0537d9a355a124d2bb30aea46ad8 25-Oct-2014 Svet Ganov <svetoslavganov@google.com> Printing from two apps at the same time not working.

When printing from two apps at the same time the second print UI is
getting stuck. There were a couple of issues here:

AdapterView was not notifying for item selection if the data changes
after scheduling a dalayed selection notification and the notification
execution. The code assumed that a layout pass will occur and posponed
the notification after the layout pass but it is not guaranteed that
such a layout pass will occur. Now we delay only if a layout pass is
being scheduled.

Also when binding to the PDF rendering service the print spooler was
using the same intent and as a result two print activites were getting
the same renderer instance while they should get separate ones. Now
we use different data in the intent to ensure we get separate renderer
instances.

Change-Id: I6aa7c7b041957804b4273549dd837a6d70064efc
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
4237c92d850b7fb0fa0be15df94e4d1689e353fc 24-Oct-2014 Svet Ganov <svetoslavganov@google.com> Crash in print spooler if printing app killed from recents.

If the printing app with the print UI on top is killed from recents we get
a crash because: 1) the remote print document was not transitioned to a
failed state if the printing app dies (this is an unrecoverable failure);
2) the print preview controller was destroyed asyncronosly during which it
also asynchronously disconnects from the rendering service which however
happens after the system has already cleaned up all connections of the print
UI activity as it is being destoryed.

bug:18109386

Change-Id: If6200b14a8aa90622228bbb659e9c4962226f561
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
d23bfa9d42c477970189a96d4562d627d609e604 24-Sep-2014 Svetoslav <svetoslavganov@google.com> Print spooler should not crash if fed non-PDF content.

It is possible that a buggy app breaks the contract and provides
content to be printed in format other than PDF. This was leading
to a crash in the print spooler. This change fixes the crash and
shows a user friendly error message.

bug:17642690

Change-Id: I5a4acb06080a152562655da6851467b3e71d8658
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
254361f136aa9461e16f11f0170fde05e83a1b92 24-Sep-2014 Svetoslav <svetoslavganov@google.com> Print spooler crash on back before first layout is complete.

If the user presses back before the remote print document
update has completed we get a crash. The reason is that
after the update completion we were trying to finish the
activity if we are in a cancelled state but this is not
needed as we aready handled the back key so we will finish.
Handling finish twice was creating the problem as classes
with lifecycles are not designed to be used after being
finished. In particular, we were calling doFinish() twice.

bug:17630561

Change-Id: If418f237a2def7c8e4a072ac8826283f4dd7fc85
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
9424b733c7f777fc806a751a7f00d234c11c0e7c 19-Sep-2014 Svetoslav <svetoslavganov@google.com> Fix a print spooler crash when printing.

The spooler communicates with he remote PDF renderer asynchronously.
When print is confirmed we close the renderer, destroy it, and unbind
from its service. If we unbind from the service after the print activiy
is finished we get a crash. The bug was that we did not wait until we
disconnect from the remote renderer before finishing the print activity.

bug:17583115

Change-Id: I55b0135f9c5658b3a4fda2901b8b3bdef044e211
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
0d2d9637ed4f46062d508cfa7da0e9776fc444f8 18-Sep-2014 Svetoslav <svetoslavganov@google.com> Page content sometimes missing in preview when scrolling.

Removed the restriction for the page content providers to
be singletons as the RecyclerView may hold on views with
providers and ask us to bind other views for the same page.
Note that the views that RecyclerView is holding will be
soon rebound or recycled just they are not at the time we
bind other views for the same position. We were guarding
against this but caused some pages not appearing sometimes
on scrolling. Also now keeping the media size and magins
of recycled page view (will be updated if needed on
rebinding) or avoid changes of the background to null as
setting it to not null later causes an undesired layout pass.

bug:17537922

Change-Id: If029f6c413e15d4f5c1ba1ac5e4d52ad2cad5904
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
7fd5ada98aa9e035682531d9fe25633fdd24a058 16-Sep-2014 Svetoslav <svetoslavganov@google.com> Page content sometimes disappears when scrolling a long doc in print preview.

The operations of the remote renderer have to be performed in order, open,
render some pages, close. One of the tasks was executed on the wrong executor
resuling in a race and an occassional bad state.

Also fixed a NPE if the preview list is flinged and then the user presses
back.

bug:17537922

Change-Id: I5048078ba2b875a2a8335f3a4324afaa34d014a2
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
e6ecba59fd618b80dd13f581b625eea420672a0a 12-Sep-2014 Svetoslav <svetoslavganov@google.com> Page content sometimes missing while scrolling.

The logic when a page view to request the content had a logical
error and it was getting in a bad state where it never requested
the content anymore. This change simplifies the logic and minimizes
the kept state.

Removed unnecessary calls to recycle for a bitmap as according
to the graphics folks we should not be calling this API anymore.

bug:16966145

Change-Id: Idda8314b43343136d3b867167261790481116fac
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
62ce332c141cf7bc7200c4c87d63e395874fc3ec 05-Sep-2014 Svetoslav <svetoslavganov@google.com> Trim unnecessary pages when printing.

A user may request a subset of the document's pages to be printed.
In this case the expectation is that the resulting document does
not include not selected pages. While print serivices can do the
trimming themselves or the printer may do so, moving, potantually
many, redundant pages is inefficient. The real problem is when
saving to a PDF file where the saved file must not have the pages
the user did not select. This change adds shredding of undesired
pages from the PDF before saving it or passing it to a print service.
:
bug:17285994

Change-Id: I7deba535af99457bea3c118202314f0f3812e809
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
def58cbffc32d12445b60ed1a0d8bb81d8dc6625 04-Sep-2014 Svet Ganov <svetoslavganov@google.com> Merge "Switching to raw byte copy of bitmaps for print preview." into lmp-dev
8c07e8d2a370a6d59dfe5150af3b07ff031ac165 04-Sep-2014 Svetoslav <svetoslavganov@google.com> Merge "Fix some print UI issues." into lmp-dev
9e795e19c7f900fb2636c5dff3ba30098da65f1b 03-Sep-2014 Svetoslav <svetoslavganov@google.com> Unregister from the remote renderer only if bound.

bug:8213791

Change-Id: Ia9efa33331437c4db447acf0c510d4cb4932a593
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
df6444931b030d3cdd9769e23f16f0a16fe9c654 30-Aug-2014 Svet Ganov <svetoslavganov@google.com> Switching to raw byte copy of bitmaps for print preview.

Using compression and decompression for moving bitmap data
acorss processes is slow as compression is expensive. This
change switches to using direct streaming of the bitmap
data.

bug:15938254

Change-Id: I78bc450031ee60ada4c3b66f14586a73c72ce34f
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
6f249835a4ff9e7e7e3ca0190b7ecf72e689656d 03-Sep-2014 Svetoslav <svetoslavganov@google.com> Fix some print UI issues.

1. Fixed a crash when orientation changes and the content
is scrolled due to wrong size bitmap being requested.

2. Closed a file dscriptior that was being left open.

3. Clearing the bitmap before passing it to the renderer to
ensure it is white for pixels not touched when rendering.

4. Removed debug logs.

5. Switched to the correct layout manager for RecyclerView.

bug:16966145

Change-Id: I8ab9d22635c93cac5ff85c6f4b5d82e58cd8df5c
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
13f542cabd635c55ade5442764cc4a3d2f7880ea 30-Aug-2014 Svet Ganov <svetoslavganov@google.com> Move print rendering in an isolated process.

Security review of the PDF rendering code revealed that it is
not sercure. Therefore, this code must be run in a sandbox.
This change moves the rendering code in an isolated process.

bug:16897933

Change-Id: I711ce42a56892db1837950137bfaa79e1d61a7c4
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
5ef522bc19cc9fc1af48cccd2865744228c5ec02 24-Jul-2014 Svetoslav <svetoslavganov@google.com> Handle wrong file format when printing.

PDF is the only format suppored for printing but a buggy app
can write content in another format which was crashing the
print spooler. Now we are generating an error instead of
crashing.

bug:16487161

Change-Id: Ic59d2ac6d57213f4e8f364659d8dc7df2140e61d
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
39afc200f299ffd7e6a2a507017c3de2a548f877 12-Jul-2014 Svetoslav <svetoslavganov@google.com> Remove commented out dead code

Change-Id: I3e59d0ee55fd864ea0d8bc5f99cdb74d9b0e49bb
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
1710e0318db5db833974e390eb4bde54ab2f3c62 12-Jul-2014 Svetoslav <svetoslavganov@google.com> Fix print preview rendered page preloading.

After the preview list is scrolled we are preloading the
pages around the ones that are shown, so now if the user
does a slight adjustment (expected after a scroll) the
pages around are rendered. There was an off by one error
and one of the bitmaps of the shown pages was reused and
as a result the wrong content was shown.

Change-Id: If04aebf46bcc637491221c6218005ecc1a7253d2
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
15cbc8a03250eafdf947cd8ad4e77f34444d5ba4 11-Jul-2014 Svetoslav <svetoslavganov@google.com> Addressing comments for the print preview feature.

Change-Id: Ib72140a912e22f859258d970e0d1c4ef06e807d5
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java
525a66b2bb5abf844aff2109bdc9ed819566bece 15-Jun-2014 Svet Ganov <svetoslavganov@google.com> Adding print preview.

This change adds the pring preview part of the new print UX. The
UI has two parts, the top section is the print options and the
bottom section print preview with a list of pages. The user can
interact only with one of them. When print options are expanded
they cover the preview content and a scrim is laid out on top of
the preview. Tapping the scrim collapses the print options. When
the user types in page ranges and closes the options to look at
the preview, the latter is updated to show only these pages. In
the list of pages the user can further prune pages by deselecting
them.

Change-Id: I0b23d2c598afe2a34400ccfa43e4e935af83c72f
/frameworks/base/packages/PrintSpooler/src/com/android/printspooler/model/PageContentRepository.java