459 Commits

Author SHA1 Message Date
Geoff Mendal
86dec04749 Import translations. DO NOT MERGE
Change-Id: I2100b649d1f2866cdc5ffd13f264afba347b6685
Auto-generated-cl: translation import
2014-10-06 10:54:01 -07:00
Svetoslav
922fcc2f9e Merge "Crash in print spooler if save to PDF selected early." into lmp-dev 2014-09-28 21:00:23 +00:00
Svetoslav
e1dcb397d5 Crash in print spooler if save to PDF selected early.
The first issue is that the save to pdf button is enabled
before the first layout completed and at this point we do
not know anything about the document. The second is that
if a layout is in progress and we select save to pdf we
end up starting the documents UI twice and finishing the
second instance carshes the spooler.

bug:17676878

Change-Id: Id0b1f06e4d377347286c2dde09669d431441234b
2014-09-28 20:05:57 +00:00
Svetoslav
528424c26c Fix carsh in print spooler if custom print setings return bad pages.
The custom settings activity of a print serivce can change the selected
pages and the spooler was not checking whether the returned pages were
valid leading to a crash.

bug:17678553

Change-Id: Id8ea3d482d2909b97a06752d61b416dfe5948483
2014-09-28 20:05:45 +00:00
Svetoslav
d23bfa9d42 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
2014-09-24 13:22:35 -07:00
Svetoslav
2bac6129a4 Merge "Missing pages in print preview when scorolling." into lmp-dev 2014-09-24 15:24:25 +00:00
Svetoslav
237806bbc5 Missing pages in print preview when scorolling.
It is possible that two providers for the same page are assigned
to two preview views despite temporariliy while rebinding. We were
however releasing the provider from the view which is being bound
if not for the same page which as a result was cancelling rendering
of this page which is provided to another view via another provider.
Hence, having an empty page. Removed the unnecessary code to release
a provider when binding the view - release is happening only if the
view holder is recycled.

bug:17515670

Change-Id: I197438c16cfdb363f521cd1320f154da54eea5f5
2014-09-23 21:29:48 -07:00
Svetoslav
09eb0b2033 Merge "Fix ANR in print spooler." into lmp-dev 2014-09-23 23:53:21 +00:00
Svetoslav
5668348138 Fix ANR in print spooler.
Saving to PDF a subset of the pages requires trimming the
undesired pages and when this is done writing the ready doc
to a URI. To write the file to URI we have to obtain it but
it is aquired by the shredding task and never released. Now
we are releasing the document immediately after trimming it.

bug:17631301

Change-Id: I4db7966c65c75f0f14c3cb52fd83b4d8fd5a4687
2014-09-23 16:25:54 -07:00
Svetoslav
254361f136 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
2014-09-23 15:54:24 -07:00
Svetoslav
cf3a86b559 Loosen the constraint for releasing a shared file.
In the spooler we have the renderer reading a file to visualize
content and the app writing a file to produce the content. Since
we have to swap the file under the renderer we have a mutex file
provider that both parties can request, use when released, and
release when required. This enables us to request the file which
closes the renderer and when the renderer is closed ask the app
to write some more pages, then open the renderer, and so on. The
mutex file provider was throwing of a thread that does not own
the file thries to relase it which is not needed, this should be
just a nop.

bug:17607134

Change-Id: Id6a2ce92d70077f57978b95315648faf02c13c68
2014-09-22 13:48:44 -07:00
Baligh Uddin
78ec95e714 Import translations. DO NOT MERGE
Change-Id: Ib08e8991a092d8404352d9709d837be2eb392b55
Auto-generated-cl: translation import
2014-09-20 12:56:55 -07:00
Svetoslav
9424b733c7 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
2014-09-19 14:24:40 -07:00
Svetoslav
688a994f4d Merge "Print UI stuck when backing out of documents UI." into lmp-dev 2014-09-18 20:34:23 +00:00
Svetoslav
b75632c736 Print UI stuck when backing out of documents UI.
When user chooses to save to PDF we open the document chooser UI.
Now if the user now backs to the print UI without choosing a file,
the print UI has all options disabled and the back button does
not work - the user is stuck. This is because we were not
transitioning the print UI in the correct state.

bug:17557454

Change-Id: I385129e106ed41564b89137ca54d409127ba8ff0
2014-09-18 13:32:38 -07:00
Baligh Uddin
6641c1051f Merge "Import translations. DO NOT MERGE" into lmp-dev 2014-09-18 18:00:17 +00:00
Svetoslav
0d2d9637ed 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
2014-09-17 23:03:19 +00:00
Svetoslav
7fd5ada98a 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
2014-09-17 11:11:08 -07:00
Svetoslav
e9f275d309 Merge "Print preview disappearing on screen off/on." into lmp-dev 2014-09-16 20:48:16 +00:00
Svetoslav
d724a40136 Print preview disappearing on screen off/on.
We were not clearing the tracked printer when the print activity is
paused and then not setting the tracked printer when the activity
is resumed.

bug:17525271

Change-Id: Ib0fb29006bfcf5ad03dce24b3407cd96dc421442
2014-09-16 11:53:19 -07:00
Svetoslav
23d3361e17 Do not change fragments if print activity finishing.
It is possible that we try to switch framents after the print
activity finish method is called. In this state the activity
is going away and trying to perform a fragment operation throws.
Now if we are finishing no fragment opration is performed.

bug:17520007

Change-Id: I0dd935d3cdaeddca31fccf49bd5de97e878abb9d
2014-09-16 10:50:55 -07:00
Baligh Uddin
5e85ddd675 Import translations. DO NOT MERGE
Change-Id: Ie9fb53c8c5a93a7059ede5961f2967c1892e0faf
Auto-generated-cl: translation import
2014-09-16 10:44:39 -07:00
Svetoslav
e3cdd4dc6c Merge "Missing or wrong pages in preview when scorlling large docs." into lmp-dev 2014-09-16 06:19:59 +00:00
Svetoslav
f3f963b0be Missing or wrong pages in preview when scorlling large docs.
The bound pages in the adapter were not properly tracked, more
specifically we did not remove pages from the bound set ending
up in a bad state. Also when the printer changes and if the
new one has different page size the content disappears due to
us not notifying for the data set change.

bug:17515670

Change-Id: Iac74e864609012f6804584fa133e87c27dc186a5
2014-09-15 21:07:27 -07:00
Svetoslav
56bdeeeb80 Merge "Page shredder callback invoked on the wrong thread." into lmp-dev 2014-09-16 02:22:22 +00:00
Svetoslav
fb3532eea3 Page shredder callback invoked on the wrong thread.
The code executed in the shredder completion callback must
be called on the main thread but instead it was called on
another one. This led to a crash.

bug:17514533

Change-Id: Id9e86d38a90fedadc60f967b193470fd83eb3362
2014-09-15 19:01:34 -07:00
Svetoslav
e0fa06c088 Update print preview when a printer becomes available
We laizily request printer capabilities and when they are reported
we were not updating the preview and as a result the content was not
rendered, hence pages showing an empty state.

bug:17514117

Change-Id: Icfee7eaa1ab63f5e4d7655d4057ef2110c27cd43
2014-09-15 18:21:14 -07:00
Svet Ganov
f230c5d21b Merge "Fix a crash in pring spooler." into lmp-dev 2014-09-15 20:27:52 +00:00
Svet Ganov
e771caf332 Fix a crash in pring spooler.
If the printer capabilities are reported with a delay which is pretty
common we were trying to evaluate the preview page dimensions without
having a media size resulting in a NPE.

bug:17501953

Change-Id: I6765137f61b8fd060e9eabff07e632875d934963
2014-09-14 20:29:30 -07:00
Baligh Uddin
0fc76f0755 Import translations. DO NOT MERGE
Change-Id: Ifb234cb1ae0c96f393e3b203488f61467d97c267
Auto-generated-cl: translation import
2014-09-14 19:11:15 -07:00
Svetoslav
2047df6f5f Merge "Page content sometimes missing while scrolling." into lmp-dev 2014-09-13 18:45:52 +00:00
Svet Ganov
922507026a Fixing controls allignment in print UI.
Making some allignment tweaks based on UX feedback.

bug:17489187

Change-Id: Ife1c7cb0f55eb0398bca4a5e015ace24437ff2a6
2014-09-12 19:54:09 -07:00
Svet Ganov
05ff998fd8 Fix a crash in print spooler.
A recent bug fix exposed another one where we were not updating
the internal state of the remote print document after it finishes
updating. This resulted in a crash on every print.

bug:16966145

Change-Id: I398ff7976533241e3d4cb6cd27f69cdc25e67be9
2014-09-12 19:25:32 -07:00
Svetoslav
e6ecba59fd 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
2014-09-12 14:31:07 -07:00
Svetoslav
2fb64a5cb1 Fix crash in spooler if printing app dies.
bug:16966145

Change-Id: I092c489a7f1b4000a96d3f12f2996ccabf734b9a
2014-09-12 13:55:35 -07:00
Svetoslav
139ba7fb0e Fix a crash in print preview on multiple rotations.
bug:16966145

Change-Id: I8266315bd9253953cb6c3b9dab1ba36f104a74a5
2014-09-12 10:35:38 -07:00
Svetoslav
36f6951e32 Merge "Fix back button behavior and clean up in print preview activity." into lmp-dev 2014-09-11 23:24:20 +00:00
Svet Ganov
c946e9ab46 Merge "Fix edit text error state in the print UI." into lmp-dev 2014-09-11 22:15:59 +00:00
Svetoslav
e17123dd6d Fix back button behavior and clean up in print preview activity.
The print preview UI owns and drives the lifecycle of several objects.
These objects were torn down too late resulting in an attempt to use
the activity as a context when it was no longer valid and service unbind
resulting in causing a crash.

Fixed a bug where if the back button is pressed mutiple times when
the print UI is being initialized a crash occurs.

bug:17454041

Change-Id: Ic1455b467586f0ad65f907e2160ec5cfb2d17d05
2014-09-11 14:12:22 -07:00
Svet Ganov
43212264dd Fix edit text error state in the print UI.
If the user input in the print UI is invalid we show an error icon
next to it. The design requires no error message being shown in a
popup but TextView does show the popup all the time.

bug:16966145

Change-Id: I7aa1ec8093bc76e2f440bcb243609e92e049786b
2014-09-11 10:35:26 -07:00
Svetoslav
e03ddd0bcc Merge "Fix a crash in print spooler." into lmp-dev 2014-09-10 23:00:42 +00:00
Svetoslav
c65510a7bc Merge "Accessibilty support for the print UI." into lmp-dev 2014-09-10 22:59:50 +00:00
Svetoslav
3ef8e203c8 Fix a crash in print spooler.
1. Leftover code was setting the state to configuring
   before initialization is complete.

2. We were not cancelling the print job if cancelled
   when initializing.

3. The remote print document was cancelled even if
   doing nothing.

bug:17451600

Change-Id: I79a80b723af8537da260012470748b4e8831fd9e
2014-09-10 15:00:11 -07:00
Svetoslav
fc81bfe3fb Merge "RTL support for print UI." into lmp-dev 2014-09-10 20:06:18 +00:00
Svetoslav
e652b02d45 Accessibilty support for the print UI.
bug:15816751

Change-Id: I5dcdbdd0357843b870ddd47d7c41cfba114d194c
2014-09-10 11:54:37 -07:00
Svetoslav
3ab1ec0549 RTL support for print UI.
bug:16966145

Change-Id: I488d11f1941545630d52eea4c4d48c43667c6067
2014-09-09 21:30:35 -07:00
Svetoslav
dfa3e7c6fd Fix page spacing in preview list.
bug:16966145

Change-Id: I2c4bde3a50ee0fc202fc169a63d4eeeb43c5f4ae
2014-09-09 19:04:51 -07:00
Svetoslav
62ce332c14 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
2014-09-09 09:38:07 -07:00
Svetoslav
6552bf3da6 Print spooler UI polish and bug fixes.
1. Added an empty state for pages that are being rendered.

2. Fixed a NPA on a binder thread when destoroying the
   remote print adapter.

3. Fixed a rare crash when the print activity gets an
   activity class callback while initializing.

4. Changed the preview pages on phone in land to four.

5. Fixed a flicker from a list of pages to an empty state
   and then back to the list of pages.

bug:15704969
bug:16966145

Change-Id: I0eea2f30a102d8fefcbf90187fa6d8612fb19434

Conflicts:
	packages/PrintSpooler/src/com/android/printspooler/widget/PageContentView.java
2014-09-05 15:21:50 -07:00
Svetoslav
d0c362de1c Fix broken aidl
Change-Id: I2187abd75b4f60e790b747a492ad610592f2ef53
2014-09-05 10:19:39 -07:00