109 Commits

Author SHA1 Message Date
Svetoslav
5ab717f21a Print UI tweaks.
1. The refresh button in a print notification was using
   wrong asset.

2. If the page count is unknown, just not show the page
   count instead unknown.

bug:10983508

Change-Id: I15f1fcbff60fe1f30d37868864da41550bb14487
2013-10-04 17:50:31 -07:00
Svetoslav Ganov
2829955b6c am 0d9ff161: am 538df343: am 331f9e79: Merge "Print attributes hint not honored." into klp-dev
* commit '0d9ff1613a290a0c9b197a099c898ccc9cc5f60c':
  Print attributes hint not honored.
2013-10-04 17:36:21 -07:00
Svetoslav Ganov
0d9ff1613a am 538df343: am 331f9e79: Merge "Print attributes hint not honored." into klp-dev
* commit '538df3437b80d15b07cda2464b2ae4e5bae8219b':
  Print attributes hint not honored.
2013-10-04 15:14:15 -07:00
Svetoslav Ganov
331f9e79ad Merge "Print attributes hint not honored." into klp-dev 2013-10-04 22:08:25 +00:00
Svetoslav Ganov
7be27acac9 Print attributes hint not honored.
1. Initially we have a single printer, the fake PDF printer, and
   wait for printers to be discovered. This printer was handling
   only a couple of media sizes. Hence, if the app provides a
   media size hint and the PDF printer does not support it, we
   were essentially ignoring the suggested media size since it
   was not supported by the selected printer and we fell back to
   the default paper size for that printer. The fake PDF printer
   should support all predefined media sizes.

2. The list of available paper sizes was shown in the order they
   are added ignoring the current locale. It is much better user
   experience if the media sizes used in the current locale are
   shown at the top and all others after that. Also the media
   sizes for the current locale should be alphabetically ordered
   so the user can quickly find the desired one.

3. The orientation was reset on media size or printer change.

bug:10564537

Change-Id: Iaa0d42242730ce69cea3effd4d0f4bc087068804
2013-10-04 11:45:15 -07:00
Baligh Uddin
21201f4e0d Merge "Import translations. DO NOT MERGE" 2013-10-04 18:12:57 +00:00
Svetoslav
a7e6ddb608 am 6077037a: am 2f6aabd7: am 5c126892: Merge "Print UI tweaks as per UX request." into klp-dev
* commit '6077037abf6f44390e762e7f302373d435db71f8':
  Print UI tweaks as per UX request.
2013-10-04 11:11:03 -07:00
Baligh Uddin
5e3d3ba85c Import translations. DO NOT MERGE
Change-Id: Ia6e68f8160731c8366dc09eba214343ef204bb1b
Auto-generated-cl: translation import
2013-10-04 11:04:38 -07:00
Baligh Uddin
3eb6b8d626 Import translations. DO NOT MERGE
Change-Id: Id91951dbb1084dd04fd93aa1cd26b6b558ff33ef
Auto-generated-cl: translation import
2013-10-04 11:02:34 -07:00
Svetoslav
6077037abf am 2f6aabd7: am 5c126892: Merge "Print UI tweaks as per UX request." into klp-dev
* commit '2f6aabd7c399377e4ea033e5882b71420737017c':
  Print UI tweaks as per UX request.
2013-10-04 09:03:23 -07:00
Svetoslav
2f6aabd7c3 am 5c126892: Merge "Print UI tweaks as per UX request." into klp-dev
* commit '5c126892ec53772d784fcf9cef9165acf1d92ce3':
  Print UI tweaks as per UX request.
2013-10-04 09:00:52 -07:00
Svetoslav
5c126892ec Merge "Print UI tweaks as per UX request." into klp-dev 2013-10-04 15:58:10 +00:00
Baligh Uddin
0a6db6691b Merge "Import translations. DO NOT MERGE" 2013-10-03 03:41:01 +00:00
Svetoslav
39e71de6b4 Print UI tweaks as per UX request.
1. Limit the width of the dropdown of the printers list.

2. Add icons the the list in the all pritners activity.

3. Update the empty state view for the all printers activity.

bug:10983508

Change-Id: I19effcf32770fdda278009a060b5170a3f29988e
2013-10-02 19:30:43 -07:00
Baligh Uddin
17e98098af Import translations. DO NOT MERGE
Change-Id: I4380f0069eaef0df57367ada16caa152ff939f55
Auto-generated-cl: translation import
2013-10-02 11:14:12 -07:00
Baligh Uddin
82b8c8c73c Import translations. DO NOT MERGE
Change-Id: I4aa7e1ed8ccce520518231a116608bc8e013bb4c
Auto-generated-cl: translation import
2013-10-02 11:12:53 -07:00
Svetoslav
abfe8d2046 am f7851e3f: am 2f5440bd: am cbf3f2cd: Merge "Adding an empty state UI for the printer search activity in the spooler." into klp-dev
* commit 'f7851e3f80b724ac65c589985b81e0a89a54bae0':
  Adding an empty state UI for the printer search activity in the spooler.
2013-10-02 09:44:27 -07:00
Svetoslav
f7851e3f80 am 2f5440bd: am cbf3f2cd: Merge "Adding an empty state UI for the printer search activity in the spooler." into klp-dev
* commit '2f5440bd3bfbd102051928b9e38711ffb3ad59fe':
  Adding an empty state UI for the printer search activity in the spooler.
2013-10-02 09:37:18 -07:00
Svetoslav
2f5440bd3b am cbf3f2cd: Merge "Adding an empty state UI for the printer search activity in the spooler." into klp-dev
* commit 'cbf3f2cde569aac3a49d888d2bd52d77dc139738':
  Adding an empty state UI for the printer search activity in the spooler.
2013-10-01 19:24:31 -07:00
Svetoslav
976b4e6312 Adding an empty state UI for the printer search activity in the spooler.
The user can select all printers from the print dropdown to get to
a search for printers activity where one can filter out the list
of a available printers. We did not have an empty state UI for the
case when the query yields no printers.

bug:11009053

Change-Id: I6b45517b8a7b319992019a1bf65858319a19a0de
2013-10-01 15:32:57 -07:00
Baligh Uddin
d04f0265a4 Merge "Import translations. DO NOT MERGE" 2013-10-01 02:40:25 +00:00
Svetoslav Ganov
fb83af78fa am c783f673: Merge "Adding a timeout for waiting to get the selected printer\'s capabilities." into klp-dev
* commit 'c783f6738f0f6d2cb57702cfbc9219c59a3410a3':
  Adding a timeout for waiting to get the selected printer's capabilities.
2013-09-30 17:09:51 -07:00
Svetoslav
049e69070a am 25b0151a: Merge "Printers in the list of printers change position." into klp-dev
* commit '25b0151a570ff6fb7a6acd9c788b9c3cc9f76be9':
  Printers in the list of printers change position.
2013-09-30 17:07:13 -07:00
Baligh Uddin
b1310d4e28 Import translations. DO NOT MERGE
Change-Id: Ia050326f182c55e8954f73e33d36d96ed575497b
Auto-generated-cl: translation import
2013-09-30 09:30:06 -07:00
Baligh Uddin
dd4ce7119f Import translations. DO NOT MERGE
Change-Id: Ie40b704529f71e71f5c384450a79923c68354bb9
Auto-generated-cl: translation import
2013-09-30 09:28:55 -07:00
Svetoslav Ganov
c783f6738f Merge "Adding a timeout for waiting to get the selected printer's capabilities." into klp-dev 2013-09-28 00:28:08 +00:00
Svetoslav Ganov
6be4c76441 Adding a timeout for waiting to get the selected printer's capabilities.
A print service may choose to provide only the printer info and then when
it is requested to start tracking the state of the printer, the service
should provide the printer capabilities. If the capabilities are not
received within ten seconds we mark the printer as unavailable and stop
tracking it.

bug:10748639

Change-Id: I9171cb5dc116fd321c23a8e4ab55109448e2fc6a
2013-09-27 09:43:32 -07:00
Svetoslav
c335eb4115 Printers in the list of printers change position.
1. The printers in the printers list of settings change position if
   they are updated. The settings app is using hidden platform APIs
   the this change fixes.

2. Enable ProGuard for the PrintSpooler.

3. Added icons on the list of printers so the user knows which
   print service used the printer. Now the user can know when
   he is using cloud print and maybe incurring data costs vs
   local printer discovered by a vendor plug in.

bug:10955751

Change-Id: I292f48b424cb561218fdb424d0388f4d786d8339
2013-09-26 18:49:10 -07:00
Svetoslav Ganov
af1066d917 am 4609d9a9: am 5cab967b: Merge "Adding hidden APIs for observing the print jobs state." into klp-dev
* commit '4609d9a9ebc17d804d31d5241968157439c92a57':
  Adding hidden APIs for observing the print jobs state.
2013-09-26 12:28:59 -07:00
Svetoslav Ganov
4609d9a9eb am 5cab967b: Merge "Adding hidden APIs for observing the print jobs state." into klp-dev
* commit '5cab967bf2bab49777bfa86dff8b0f892192ede6':
  Adding hidden APIs for observing the print jobs state.
2013-09-26 12:25:10 -07:00
Svetoslav Ganov
5cab967bf2 Merge "Adding hidden APIs for observing the print jobs state." into klp-dev 2013-09-26 19:22:20 +00:00
Svetoslav Ganov
704697b619 Adding hidden APIs for observing the print jobs state.
This is needed for implementing the print job settigns UI.

bug:10935736

Change-Id: I63b42cbf4ce6a259fa1af47fa368b148ca5621c1
2013-09-25 17:57:07 -07:00
Baligh Uddin
bef7ffafb5 Import translations. DO NOT MERGE
Change-Id: I43ea4f6dcef11d0fa62c8f329b39c0ea49be2439
Auto-generated-cl: translation import
2013-09-25 16:34:46 -07:00
Baligh Uddin
df79953527 Import translations. DO NOT MERGE
Change-Id: I4842b7afb76ee393c19a39d0818f3f2066616803
Auto-generated-cl: translation import
2013-09-25 16:33:59 -07:00
Baligh Uddin
46485d6df6 Import translations. DO NOT MERGE
Change-Id: Id5391f651538cc46ad7455dedaa3426e29efc9c9
Auto-generated-cl: translation import
2013-09-25 08:42:54 -07:00
Svetoslav
62034df44d am de31fbe0: am b55afe8b: Merge "User should not be able to select unavailable printers." into klp-dev
* commit 'de31fbe04a75d9a8c3c163fbebeacd052ce54e72':
  User should not be able to select unavailable printers.
2013-09-24 16:21:31 -07:00
Svetoslav
de31fbe04a am b55afe8b: Merge "User should not be able to select unavailable printers." into klp-dev
* commit 'b55afe8b835da2d0ebe596877bf93076e4726724':
  User should not be able to select unavailable printers.
2013-09-24 16:17:43 -07:00
Svetoslav
2a708617df User should not be able to select unavailable printers.
1. If the printer is unavailable we should not allow the user
   to select it. Rather, show it grayed out.

2. Some string changes requeted by translators.

bug:10917222

Change-Id: I370f05f9c8e70e3f077db7eb02cf48e19a59925d
2013-09-24 15:46:17 -07:00
Baligh Uddin
8a72458461 Import translations. DO NOT MERGE
Change-Id: I26e4d60d81e13181feeb872b09db4c242105e34e
Auto-generated-cl: translation import
2013-09-23 09:11:15 -07:00
Baligh Uddin
e209e27112 Import translations. DO NOT MERGE
Change-Id: Ia5c6ae14529080f176a14f5b8b2307cc2aa39fed
Auto-generated-cl: translation import
2013-09-23 09:10:23 -07:00
Svetoslav
d8f391b4e0 Offer to enable a print service after it is installed.
The user has to explicitly enable a print service from the settings UI
before using it. Usually, users very rarely if at all interact with print
services, therefore all print service management task are performed from
the print settings. We also have to get user consent warning that the
user's data is about to be given to a third-party app. We now post a
notification allowing the user to go directly to the settings screen to
turn the service on.

bug:10447510

Change-Id: Iea56c0825f0bf38328ad94912f0ea5576e9339b3
2013-09-20 17:40:25 -07:00
Svetoslav
013b816ac7 Update the print dialog.
1. The print dialog was resizable and as a result when printers
   come and go its size changes which looks bad. The dialog is
   now trying to be maximally large limited by a max size or the
   screen - whichever is smaller. This required moving from
   GridLayout to several LinearLayouts since the former does not
   support distribution of empty space evently between the items
   in a row. Also we want all items in a column of inputs to be
   of equal size (the spinners specifically).

2. Added labeledBy attribute to associate a view with another one
   that serves as its label for accessibility purposes. We have
   lebelFor attribute but it is not useful in most layout files
   since it has to refer the auto-generated id of a view which
   usually appears later in the layout file, thus generating a
   compilation error. This was needed for the accessibility support
   of the print dialog.

bug:10631660

2. Disabling the spinners or the print button did not produce
   visual feedback leading to user frustration.

bug:10741907

Change-Id: I0c12eddabc4035bc7becd1b86c1f1b8fdcf4289c
2013-09-18 12:31:26 -07:00
Svetoslav
2fbd2a7f07 App UI freezes when printing. API clean up.
1. The UI of a printing app was freezing a little when calling the print
   method since the print manager service was waiting for it to bind to the
   print spooler which generated the print job id (and the initial print
   job info really). Now the print manager service is responsible for job
   id generation and does not not wait for the print spooler to spin. Hence,
   the app UI is not blocked at all. Note that the print manager initiates
   the binding to the spooler and as soon as it completes the spooler shows
   the print UI which is hosted in its process. It is not possible to show
   the print UI before the system is bound to the spooler since during this
   binding the system passes a callback to the spooler so the latter can
   talk to the system.

2. Changed the print job id to be an opaque class allowing us to vary the
   way we generate print job ids in the future.

3. The queued print job state was hidden but the print job returned by the
   print method of the print manager is in that state. Now now hidden.

4. We were incorrecly removing print job infos if they are completed or
   cancelled. Doing that is problematic since the print job returned by
   the print method allows the app to query for the job info after the
   job has been say completed. Hence, an app can initiate printing and
   get a print job whose state is "created" and hold onto it until after
   the job is completed, now if the app asks for the print job info it
   will get an info in "created" state even though the job is "completed"
   since the spooler was not retaining the completed jobs. Now the spooler
   removes the PDF files for the completed and cancelled print jobs but
   keeps around the infos (also persisting them to disc) so it can answer
   questions about them. On first boot or switch to a user we purge the
   persisted print jobs in completed/cancelled state since they
   are obsolete - no app can have a handle to them.

5. Removed the print method that takes a file since we have a public
   PrintDocumentAdapter implementation for printing files. Once can
   instantiate a PrintFileDocumentAdapter and pass it to the print
   method. This class also allows overriding of the finish method to
   know when the data is spooled and deleted the file if desired, etc.

6. Replaced the wrong code to slice a large list of parcelables to
   use ParceledListSlice class.

bug:10748093

Change-Id: I1ebeeb47576e88fce550851cdd3e401fcede6e2b
2013-09-16 17:55:14 -07:00
Svetoslav Ganov
860f8a6b66 Spooler should not crash if print service config activities are not exported.
1. If a print service does not export its activities for settings and
   adding printers the print spooler ignores them instead of crashing.
   Also if the service is not enabled its activities are now ignored.

2. Added a dedicated permission for a print service to optionally
   protect its settings and add printer activities such that only the
   system can bind to them.

3. Fixed a crash in the print dialog if its content is detached
   from the window and animators are running.

bug:10680224

Change-Id: I20b57d6622a15f9b2352ba78d04c44e67b316a15
2013-09-14 01:00:55 -07:00
Svetoslav Ganov
56960fbd39 Merge "Fixing some minor RTL bugs in print dialog" into klp-dev 2013-09-05 21:37:26 +00:00
Svetoslav Ganov
4cff92ac5b Fixing some minor RTL bugs in print dialog
Change-Id: I164e3d3b643c885e9d6e65c24b1f5e2323e42c97
2013-09-04 14:47:24 -07:00
Svetoslav Ganov
9186d0cb2b Bug fixes in the printer dialog activity and fused printer loader.
1. Fused printers loader was not using the discovered printers to update the
    historical ones. Now if a historical printer is discovered we update its state
    with the discovered, i.e. most recent, information.

2. Fixed a bug in the destination adapter of the print job config dialog that
    was leading to a crash if all printers item is selected when there are no
    discovered printers.

3.  Updated the add printers asset in the all printers screen.

4. Historical printers were not persisted by the print dialog activity.

5. Reduced the number of printers we send per transation to avoid the binder
   transaction size limit. Added sending of printers in chunks in a place
   this was missing.

Change-Id: I88b54888360bc0e53b06bd260c2b832d0d6454b6
2013-09-03 08:42:17 -07:00
Svetoslav Ganov
d26d4898fc Print spooler security and some new print service facing APIs.
1. Updated the security mode of the print spooler. Now the spooler
   is not signed with the system key, it is not a privileged app so if
   it gets compromised (PDF rendering is a potential attack vector)
   it cannot access dangerous permissions. Also only the system
   can bind to the spooler.

2. Added APIs for asking a print service to start and stop tracking
   a given printer. This is need for the case when the user selects
   the printer and the print service should do a best effort to keep
   the system updated for the current state of the printer.

3. Added APIs for putting a print job in a blocked state. A print
   service would report the print job as blocked if for some reason
   the printer cannot proceed, e.g. 99 pages are printed but there
   is no paper for the last one. The user has to add more paper
   and the print service can resume the job.

4. Changed the read/write APIs to use ParcelFileDescriptor instead
   of FileDescriptor since the latter does not have a clean API for
   detaching the wrapped Linux file descriptor when one wants to
   push it to native.

5. Added API for getting the size of the printed document so the
   print service can avoid handling big filed over cellular network
   or ask the user if needed.

6. Now the print services that are preinstalled on the system image
   are automatically enabled.

Change-Id: Ia06c311d3d21cabb9e1368f13928e11cd0030918
2013-08-29 15:39:44 -07:00
Svetoslav Ganov
44720af55a Print UI bug fixing and printer discovery refactoring.
1. Added support for selecting a printer from the all printers activity
   that is not in the initial printer selection drop down. The user
   initially sees a sub set of the printers in the drop down and the
   last option is to see all printers in a separate activity. Some
   of the printers in the all printers activity are not shown in the
   initial drop down.

2. Refactored printer discovery by adding (private for now) printer
   discovery app facing APIs. These APIs are needed to support multiple
   printer selection activities (print dialog and all printers activities)
   and also the settings for showing all printers for a service.

   Now multiple apps can request observing for printers and there is
   a centralized mediator that ensures the same printer discovery
   session is used. The mediator dispatches printer discovery specific
   requests to print services. It also aggregates discovered printers
   and delivers them to the interested apps. The mediator minimizes
   printer discovery session creation and starting and stopping discovery
   by sharing the same discovery session and discovery window with
   multiple apps. Lastly, the mediator takes care of print services
   enabled during discovery by bringing them up to the current
   discovery state (create discovery session and start discovery if
   needed). The mediator also reports disappearing of the printers
   of a service removed during discovery and notifies a newly
   registered observers for the currnet printers if the observers are
   added during an active printer discovery session.

3. Fixed bugs in the print UI and implemented some UX tweaks.

Change-Id: I4d0b0c5a6c6f1809b2ba5dbc8e9d63ab3d48f1ef
2013-08-23 18:36:33 +00:00
Svetoslav
269403b032 Implemented advanced printer selection and API refactoring.
1. Added past printer history tracking and merging favorite printers
   with discovered printers.

2. Added save as PDF support.

3. Added all printers activity with search capability and optional
   add printers chooser (if any print service provides add printers
   activity)

4. Refactored the printer discovery session APIs. Now one session
   can have multiple window discovery windows and the session stores
   the printers found during past discovery periods.

5. Merged the print spooler and the print spooler service - much
   simpler and easier to maintain.

Change-Id: I4830b0eb6367e1c748b768a5ea9ea11baf36cfad
2013-08-19 13:24:11 -07:00