History log of /frameworks/base/services/print/java/com/android/server/print/UserState.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
1d6e7cc536cb7f49b318f630ad8f2eb348786716 24-Aug-2016 Philip P. Moltmann <moltmann@google.com> Hold no locks when calling RemotePrintSpooler

The calls might be blocking and need the main thread of to be unblocked
to finish. Hence do not call while holding any monitors that might need
to be acquired the main thread.

The calls that have been moved out of the lock:
- Icon related calls: These are just caches. Hence we flush the cache we
just request the icon again
- Prune call: This just removes not installed print service from some
data structure. The order of two of these calls does not matter as
the end result of both removals will be the same, regardless of order.

Testing done: Reinstalled a print service multiple times. Before the
first reinstallation locked up the userState, now not anymore

Change-Id: I4f4cdaba65132dc2ef054877cbb097b499a723f6
Fixes: 31043684
/frameworks/base/services/print/java/com/android/server/print/UserState.java
0de4834dd8280474a11f16470d94f53dd54eb1cc 28-Jun-2016 Philip P. Moltmann <moltmann@google.com> Always reload print services

We want to reload print service if anything relevant changed. E.g. this can
be the label. Which label is loaded depends on the the resolve info and
the package manager. Hence short of reverse engineering what fields are
used to determine how this is done it is very hard to say how we figure
out the label.

Hence the only option we have is to reload the print services every time
a print services is added, removed or changed.

Change-Id: Iff5a05dd1cad923da42c360a88559a2cc61c95aa
Fixes: 29765394
/frameworks/base/services/print/java/com/android/server/print/UserState.java
640918f9117faa5fa6fdb9fe0947267de51cced9 28-Apr-2016 Philip P. Moltmann <moltmann@google.com> Check if records is inited before removing items

The record might already be removed and the records array set to null
when the binder dies, hence handle the scenario.

Bug: 28512952
Change-Id: Id21b03b6d14d1dc8cb792ee4ec0519287a289a33
/frameworks/base/services/print/java/com/android/server/print/UserState.java
4bd8fac48ed28494ca24e456e20b3058f78e8fe9 22-Apr-2016 Philip P. Moltmann <moltmann@google.com> Send update notifications when the status of a print job updates and
make sure to only access mPrintServicesChangeListenerRecords when
locked.

Bug: 28315242
Change-Id: Ie41ee695e6b1b0394e55538b9d9edaee0610f1e0
/frameworks/base/services/print/java/com/android/server/print/UserState.java
9dcb86a48d73f399fb1b5c020005d76d350eeac2 14-Mar-2016 Philip P. Moltmann <moltmann@google.com> Add the print service recommendation service

This service connects through the print manager to the print spooler:

PrintSpooler.AddPrintersActivity <-> PrintManager <-> PrintManagerService <-> UserState <-> RemotePrintServiceRecommendationService <-> PrintRecommendationService <-> PrintRecommendationServiceImpl

Hence there is a lot of mindless plumming.

The actual changes are only in the AddPrintersActivity which is extended
to show another list of services: The recommended services.

The PrintServiceRecommendationService is based on the experimenal print
service stubs provider. This provider was contributed the Android by
Mopria. As this services uses Android own network discovery service most
code from the experimental provider goes away. In fact the only logic
left over is the selections of mdns-txt fields to look at and the
printer vendor configuration.

This relies on the Android MDNS to get fixed (Bug: 27696905). This also
does not deal with how to update the recommendation service.

Bug: 24533249
Change-Id: I6edc6e25fc08a50d478b61c71bb8ea158b08624c
/frameworks/base/services/print/java/com/android/server/print/UserState.java
e8ae15482eef7617494cb3187899983e27cb8a35 22-Mar-2016 Philip P. Moltmann <moltmann@google.com> If the print spooler gets started onUserUnlock use less of a priority to have less impact on the system.

Bug: 27746455
Change-Id: I3ae0a755e8f4c212a111d76ec6ef042654589510
/frameworks/base/services/print/java/com/android/server/print/UserState.java
f0847871eaf5cdcf697f07f013efee3d84d836f2 08-Mar-2016 Philip P. Moltmann <moltmann@google.com> If services are enabled, services might become enabled in the future

Hence we always, always want to start a session if this is requested.

Bug: 27643066
Change-Id: I0fbf3ea8554de83d5ec6dc61b6b36f3783aab427
/frameworks/base/services/print/java/com/android/server/print/UserState.java
66c96591e2ddb464c67e60dbf4193ef4ec8a620b 24-Feb-2016 Philip P. Moltmann <moltmann@google.com> Add "app printer activity" and always keep the print service state
updated. Also fiddle with the UI to use more standard values.

To be sure the print service state alwasy updated I changed
PrintManager.getPrintServices to return a loader which just wraps a
registerListener/getList/removeListener combo.

I also added a new function to enabled/disable a print service to be
keep all updating logic inside the PrintManagerService->UserState.

Then I changed all code to use this new interface.

Detailed comments:

PrintServiceInfo:
- I had to add the enabled state to the PrintServiceInfo as some users
of PrintManager.getPrintServices want all services but then display
different data depending on the enabled state. Of course I could have
created two PrintManager.getPrintServices-loaders to load the two
separate list of services. I think it is much easier to add this
property though. It is updated every time new data is returned to the
PrintManager.getPrintServices-loader.

AddPrinterActivity:
- This is shown as a dialog-style overlay to indicate that the user will
return to the select-printers activity. It contains of three list that
are updated via separate loaders.
- The recommended services will be added later to keep this path set
small.

PrintActivity:
- There are two small places where we have to update the data when we
get a new list of print services.
- In very, very rare conditions it can happen that the print service
of the current printer gains or looses the "advancedOptions"
activity
- If we have no enabled print services we want to show "Add printer"
instead of "All printers...".
- Also the print registry is not the only loader anymore, hence we have
to assign loader ids to it to not conflict with the other loaders in
this activity.
- Small bug in onPrintersChanged: If a printer is selected and the print
service of this printer gets disabled the holder goes into "removed"
state which disables the printer. When the print service is then
enabled again, we forgot to re-enable the holder.

PrinterRegistry:
- The registry assumed that the FusedPrinterProvider was the only loader
in the activity. This is not true anymore, hence it has to assign the
appropriate loader ids.
- The FusedPrinterProvider has an internal loader, hence we have to
forward a loader Id into it.
- The PrintRegistry is only called backed for a single loader, hence no
need to check the loader-id.

SelectPrinterActivity:
- The AddPrinterDialog was removed as we now have the
AddPrinterActivity.
- Added a loader for the enabled services to update the empty state.
- Added dedicated loader Id for the PrinterRegistry again.
- If we have no enabled services, the SelectPrinterActivity chainloads
the AddPrinterActivity as this is the only thing the user can do
anyway. "Save a click". This should only happen when the activity is
create the first time.
- Moved the "add printer" from the menu item to the list of printers as
suggested by UX and Zach.

PrintManagerService, UserState and IPrintManagerParamtersTest:
- As the only place where the print service state is updated is now the
userstate, we have no more sychronization problems. Whohoo.
- The users can now register for changes to the print services similar
as they can register for changes to the print jobs.
- UserState.getPrintServices is the only function can exposes any
knowledge of the print services to the outside world.

Change-Id: I9be2c7300431e06aaff9bdf7eb36120d869b56ac
/frameworks/base/services/print/java/com/android/server/print/UserState.java
76d7e3ee70c4299b22b1a03505d2b4f108716c75 15-Jan-2016 Philip P. Moltmann <moltmann@google.com> Check parameters for callers of IPrintManager

- Propagate nullness and non-null-ness up and down from the interfaces.
- Add non-CTS print tests for IPrintManager binder.

Change-Id: I0c310d9cea8aefba5ce386931521ffaf19712bbb
/frameworks/base/services/print/java/com/android/server/print/UserState.java
05e34230709282f21d0df21b4bd69f6a4c5cf580 12-Jan-2016 Philip P. Moltmann <moltmann@google.com> Deal with UserState#getEnabledPrintServices returning null.

Bug: 26492364
Change-Id: I234b1632168c88d32bdd134630442756701118b6
/frameworks/base/services/print/java/com/android/server/print/UserState.java
cd65448ccd13c4c2d0fe9e9623fec3a898ab9372 09-Jan-2016 Jeff Sharkey <jsharkey@android.com> Even more PackageManager caller triage.

Finish moving all UID/GID callers to single AIDL method that requires
callers to provide flags.

Triage AppWidgets and PrintServices, which currently can only live on
internal storage; we should revisit that later.

Fix two bugs where we'd drop pending install sessions and persisted
Uri grants for apps installed on external storage.

Bug: 26471205
Change-Id: I66fdfc737fda0042050d81ff8839de55c2b4effd
/frameworks/base/services/print/java/com/android/server/print/UserState.java
8141bdfa56f13c3946bed12ba7801e492ec25c11 22-Dec-2015 Philip P. Moltmann <moltmann@google.com> Store which print services are disabled instead of which are enabled

This make services that appreared while the print manager was not active
by default enabled.

In the case we upgrade from pre-N we convert the enabled-list into a
disabled-list.

Bug: 26249649
Change-Id: Iae783a8dd19f1a9d75d675710ea4348fdfbd34f3
/frameworks/base/services/print/java/com/android/server/print/UserState.java
bb36206f08797156caed236671d36b5a34682f95 23-Dec-2015 Philip P. Moltmann <moltmann@google.com> Rename variable that hides the contatining classes name.

Change-Id: Iad0a9b341a866d33d10b7a389d243e677a65057c
/frameworks/base/services/print/java/com/android/server/print/UserState.java
bb9f686b40743df2642b7d3b7778dbf7284ae665 01-Dec-2015 Philip P. Moltmann <moltmann@google.com> Allow a print service to specify per printer icons, description and
info-activities

The icon is loaded from the discovery session only when it is displayed
to avoid having to store too many icons in memory.

Also the icons are not maintained in the historical printers. Only if
the printers are available nice icons are shown. A historical printer is
updated with the appropriate properties (including icon) once it becomes
available.

Bug: 24135005
Change-Id: Iec389bab514b024634be8fb5fc8928371cba8740
/frameworks/base/services/print/java/com/android/server/print/UserState.java
e3ce0a4051fd212157a059d5c503ea7a2e127cf2 20-Nov-2015 Philip P. Moltmann <moltmann@google.com> Create PrintDiscoverySession for future print services

If we currently don't have any print services we still want to register
a print observer so that when in the future a new service comes along we
can connect this service to the observer.

Bug: 25666802
Change-Id: I0cc28e92e0000fc9b5372733390095f3a8b19bc9
/frameworks/base/services/print/java/com/android/server/print/UserState.java
853a6f564abaf8acbd88c6704008c5d150d00471 03-Nov-2015 Philip P. Moltmann <moltmann@google.com> Add a alert that allows the user to approve a print service when
we print using it the first time.

This warning used to be shown when the print settings app was used
to enable a service.

If two warning as shown for the same print service we automcatially
dismiss all dialogs once one dialog is confirmed. Please note that
we are not confirming the printjob as it is unexpeced to have a
single click to confirm multiple print jobs.

Change-Id: I8bb0a49bac2063c1c55e2f24bd34df2c44e2df89
Bug: 24135353
/frameworks/base/services/print/java/com/android/server/print/UserState.java
b0a78390ed834724e9c6adf0feff9931d7f9ec10 11-Apr-2015 Svetoslav <svetoslavganov@google.com> Add a mechanism to make pending intents immutable.

bug:19618745

Change-Id: Ice742e0162cb9b7c0afbc32e0eea03d501666e2b
/frameworks/base/services/print/java/com/android/server/print/UserState.java
564560e46d8a075fe508514f3dbd94f29963e6eb 02-Jul-2014 Svetoslav <svetoslavganov@google.com> Installed and enabled print services not working after boot.

Due to system server changes the print manager services did not
receive the expected callbacks in correct order. This lead to
installed and enabled print services not working until toggled
from settings.

bug:16018217

Change-Id: I8d53d8d8f06507ee135cebe5201f00910a4cb364
/frameworks/base/services/print/java/com/android/server/print/UserState.java
49782e46c0eb85a25ae2abcf80880c48dbab5aea 20-Dec-2013 Amith Yamasani <yamasani@google.com> am 9158825f: Move some system services to separate directories

* commit '9158825f9c41869689d6b1786d7c7aa8bdd524ce':
Move some system services to separate directories
9158825f9c41869689d6b1786d7c7aa8bdd524ce 22-Nov-2013 Amith Yamasani <yamasani@google.com> Move some system services to separate directories

Refactored the directory structure so that services can be optionally
excluded. This is step 1. Will be followed by another change that makes
it possible to remove services from the build.

Change-Id: Ideacedfd34b5e213217ad3ff4ebb21c4a8e73f85
/frameworks/base/services/print/java/com/android/server/print/UserState.java