• Home
  • History
  • Annotate
  • only in /frameworks/base/services/print/java/com/android/
History log of /frameworks/base/services/print/java/com/android/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
973d8af11b11da273d54f289217c04ce39bf9200 31-Jul-2017 Narayan Kamath <narayan@google.com> PrintManagerService: Don't prune services on all package change events.

We should only need to prune services if the package that changed
had a print service or has been changed to have a print service.

Bug: 63019430
Test: Manual; observed that the print spooler isn't started up.
Test: run cts -m CtsPrintTestCases

Change-Id: I32df27e4b1d11615cf6053dd3d35c2b60068d0d3
erver/print/PrintManagerService.java
6870033d374a15fd212675d570a2877c28f1cbf0 19-Jun-2017 Philip P. Moltmann <moltmann@google.com> Enforce permission for print system APIs

The permission is preinstalled as we want to leave the PrintSpooler
unpriviledged.

Test: Checked that Settings, PrintSpooler and BuiltInPrintService still
behave as expected.
Fixes: 62350107
Change-Id: Id33896f2899533f2d05cafa926df29cf1c6bfa77
erver/print/PrintManagerService.java
5ab024333065c60620867e58eaa27f27dfa85752 27-Jun-2017 Jeff Sharkey <jsharkey@android.com> Only require that system UIDs tag their sockets.

Apps with a normal UID are typically isolated enough to not require
socket tagging; we're mostly interested in tracking down internal
UIDs that have lots of code sharing the same UID.

Also fix up everyone doing manual string checks of Build.TYPE, since
we now have first-class fields for those.

Bug: 38126076
Test: builds, boots
Change-Id: I3a40348196bd8459289f2b9355d9783a07f1e7dd
erver/print/RemotePrintSpooler.java
a76f1cbd1d89d98318eb44dcc87e488647779dcd 13-Jun-2017 yangbingqian <yangbingqian@xiaomi.com> Merge "remove the lock-use for prunePrintService in case blocking main thread" am: b124bea782
am: 60246acdbf

Change-Id: If773ac8166bee1e92168f4df7a9de2dd7cea190f
82cff68a3ad08c908a29174a523fecc3ad9be248 12-Jun-2017 yangbingqian <yangbingqian@xiaomi.com> remove the lock-use for prunePrintService in case blocking main thread

As in the change: I4f4cdaba65132dc2ef054877cbb097b499a723f6
the lock object is removed when calling RemotePrintSpooler
and so as it in the method prunePrintService(). But in the
constructor of UserState, the mLock is still held when calling
prunePrintService(), it may also block the main thread

It is better to take it out of the synchronized block

Test: null

Change-Id: I709b491d611dbcbf21a5fd493b879ed290dd0247
Signed-off-by: yangbingqian <yangbingqian@xiaomi.com>
erver/print/UserState.java
0d3dd12fa0ba38ffedbb18b55886306acf98988e 18-Apr-2017 Eugene Susla <eugenesusla@google.com> Move CompanionDeviceManagerService to a place of its own

Fixes: 37473452
Test: Ensure companion devi9ce functionality still works
Change-Id: I89624217373b3e77296c71f9429387d99d15e236
erver/print/CompanionDeviceManagerService.java
cf00adebec29d4cdbec5bc0f004b26a09327c236 10-Apr-2017 Eugene Susla <eugenesusla@google.com> API for notification listener for Companioon apps

Test: 1. Trigger the confitrmation dialog.
Ensure it looks exactly like the one from settings.
2. Call an API without associating the appa first
Ensure exception is thrown with a message mentioning the need to associate 1st
Change-Id: I94d4116e1988db869ed445ae3fd018c50590e3f4
erver/print/CompanionDeviceManagerService.java
4df89bcb31cde334dc317cce705a75b0ff036a8a 29-Mar-2017 Eugene Susla <eugenesusla@google.com> [DO NOT MERGE] Fix associations serialization optimization bug

There mas a missing defensive copy causing false positive detections of
"associations not changed" case, leading to xml file not being updated once
at least one record is present

Bug: 30932767
Test: Associate at least two different devices and ensure the xml has both.
Change-Id: Ic0dc615dd2b847e137555c1084c616831b4dde83
erver/print/CompanionDeviceManagerService.java
200c37f4136e0d49fd853122900d2209e424701c 29-Mar-2017 Eugene Susla <eugenesusla@google.com> [DO NOT MERGE] Stop scan on device chooser activity backgrounded

This effectively treats chooser activity pause event as cancel.

Bug: 30932767
Test: Install two toy apps and call associate API from both.
Ensure foreground app always end up showing fresh data.

Change-Id: I7f5742e9878245550f678efd244bf84c427baef3
erver/print/CompanionDeviceManagerService.java
adce09b9a48b1d25c97fe7d3c731de1862f0487b 29-Mar-2017 Eugene Susla <eugenesusla@google.com> Add ICompanionDeviceManager.getAssociation overload with explicit userId

Bug: 30932767
Test: ensure getAssociations works as before
Change-Id: I58dc4dac5bf7aae83fe3611890116a928e290a43
(cherry picked from commit 544d714626db38714f826a31a5483c647510a743)
erver/print/CompanionDeviceManagerService.java
7e01895e6972c0ebc552215b1207a519529af3fd 02-Apr-2017 Philip P. Moltmann <moltmann@google.com> Return inet addr for discoverable printers

... by extending the RecommendationInfo to store the inet addresses not
just the count. Thankfully the recommendation plugins already contained
all the printers, not only the count.

Also expose the print service state as system APIs as they will be used
by the default print service.

Bug: 35765644
Test: Ran AddPrinterActivity on network that had printers to discover
Change-Id: I929a177adb75f6848848ba30a472cf0343d2e67e
erver/print/UserState.java
fe9a53bc45fd0124a876dc0a49680aaf86641d3e 31-Mar-2017 Jeff Sharkey <jsharkey@android.com> Consistent dump() permission checking.

This change introduces new methods on DumpUtils that can check if the
caller has DUMP and/or PACKAGE_USAGE_STATS access. It then moves all
existing dump() methods to use these checks so that we emit
consistent error messages.

Test: cts-tradefed run commandAndExit cts-dev -m CtsSecurityTestCases -t android.security.cts.ServicePermissionsTest
Bug: 32806790
Change-Id: Iaff6b9506818ee082b1e169c89ebe1001b3bfeca
erver/print/PrintManagerService.java
a38fbf63fd2a29884637a59387643c801ed4f663 14-Mar-2017 Eugene Susla <eugenesusla@google.com> Unbind from service on app killed and dedup association requests

1. Listen to calling package binder death stopping the scanning on that.
2. Don't restart scanning when a request with the same values was made.

Bug: 30932767
Test: 1.:
- Using a test app start scanning and kill the app.
- In debug mode ensure that DeviceDiscoveryService#stopScan gets triggered
2.:
- Start scanning and rotate the device while device chooser is visible
- Ensure no visible loss of state is happening
Change-Id: If126a2c963da90172a956fbd88e6b3dcd7ac8b01
erver/print/CompanionDeviceManagerService.java
6a7006a9683ba5a79ca338050c7c50b346b04de0 13-Mar-2017 Eugene Susla <eugenesusla@google.com> Register PackageMonitor for CompanionDeviceManagerService

1. On package removed -> remove all its associations
2. On package updated -> if had associations, update special access permission
in accordance with (potentially changed) permission entries in manifest

Bug: 30932767
Test: 1. Remove app, and ensure xml entries for it got removed.
2. adb install new version of app without special permissions in manifest, and
ensure whitelist removal method got called
Change-Id: I87261c05ddcf40a18332d160b44ee2f8284df5e4
erver/print/CompanionDeviceManagerService.java
36e866b8e0ec08e45b5e7fbc65aeeb3a9bb7b11e 24-Feb-2017 Eugene Susla <eugenesusla@google.com> Support multiple filters per association request

By supporting multiple filters per one request we should be able to cover
multiple kinds of use cases such as:
- Letting the user select from a list of devices of more then one medium
type (e.g. Bluetooth and BLE)
- Allowing to provide multiple criteria for any field (e.g. filtering by
more than one service UUID)

Bug: 30932767
Test: Provide multiple filters and ensure that devices matching either are
shown in the list to choose from.
Ensure wifi SSIDs are shown in the list if wifi filter is provided

Change-Id: I0a978787551a1ee5750ec5544b241d3bbfed5a7c
erver/print/CompanionDeviceManagerService.java
d66c95fa907dc9eb3d7238fbbf3dc6dbd4b243a0 09-Mar-2017 Hector Tellez <htellez@google.com> Revert "Support multiple filters per association request"

This reverts commit e70e6aa62c6f3a9a79624a4f9d97df95edda0364.

Change-Id: I12857cbbea0a0c74521191ab5e3713db230626ab
erver/print/CompanionDeviceManagerService.java
e70e6aa62c6f3a9a79624a4f9d97df95edda0364 24-Feb-2017 Eugene Susla <eugenesusla@google.com> Support multiple filters per association request

By supporting multiple filters per one request we should be able to cover
multiple kinds of use cases such as:
- Letting the user select from a list of devices of more then one medium
type (e.g. Bluetooth and BLE)
- Allowing to provide multiple criteria for any field (e.g. filtering by
more than one service UUID)

Bug: 30932767
Test: Provide multiple filters and ensure that devices matching either are
shown in the list to choose from.
Ensure wifi SSIDs are shown in the list if wifi filter is provided
Change-Id: I6621da388e2bf4ed97c5af2692629a321d0b63c7
erver/print/CompanionDeviceManagerService.java
47aafbe033202ccc2c0ea9af2b0f1596ebed4373 13-Feb-2017 Eugene Susla <eugenesusla@google.com> Record app<->device association to xml file

Bug: 30932767
Test: Ensure file not exists -> query associations -> ensure result is empty list
Associate device -> cat xml file -> ensure record appears as extected
Disassociate device -> cat xml file -> ensure record is no longer present
Change-Id: Ibe456a6d9292e05e2391f5138e43fdaa37f87e1b
erver/print/CompanionDeviceManagerService.java
da0acdf938f1d6e7a978e143d5d80d8dd5af52ad 15-Feb-2017 Svet Ganov <svetoslavganov@google.com> Auto-grant background execution and data access

Companion apps can declare they want background access and
background execution exceptions via dedicated permissions
in their manifest. If such a permission is requested we
auto-grant the corresponding exception after the user has
chosen a device from the companion UI. These permissions
are appop ones allowing us to use the app ops for gauging
whether the user has made a change after we auto-granted
the permission since we would like to revoke these special
privileges when the app disassociates itself from the
companion device if the user did not make an excplicit
choice otherwise.

While at this auto-grant fixed location permission to the
companion device discovery service.

Test: manual

Change-Id: I46ee4291e5e5a8f7613f0dd75eb61d6b9341f306
erver/print/CompanionDeviceManagerService.java
6ed45d8cd33c297e608aba94fc1f61dace7a7cca 22-Jan-2017 Eugene Susla <eugenesusla@google.com> CompanionDeviceManager

This introduces an API for apps that support companion devices to provide a
more streamlined flow for pairing and setting up the device

Bug: 30932767
Test: Using a toy app, invoke the newly introduced API (CompanionDeviceManager),
and go through the flow. Ensure filtering works, and device is returned to
the calling app. Ensure the calling app can pair to the selected device.
Change-Id: I0aeb653afd65e4adead13ea9c7248ec20971b04a
erver/print/CompanionDeviceManagerService.java
126913cb3a4299e117d25ea0f9d55fc3ee10661c 15-Dec-2016 Philip P. Moltmann <moltmann@google.com> Ignore commands if service connection is destroyed.

Test: Print CTS tests (currently affected by b/33449823). Print spooler
unit test
Fixes: 33106285
Change-Id: I5c771b17992ef627ce5ac3a66a02358c4540893c
erver/print/RemotePrintService.java
c06f184ae92179414dfa133506e60cc05c6ed43a 09-Nov-2016 Jeff Sharkey <jsharkey@android.com> Move dump() to dumpAsync(), more oneway calls.

When calling out to dump services hosted by external apps, use
dumpAsync() to avoid hanging if the remote process is wedged.

Test: builds, boots, runs with minimal logs triggered
Bug: 32715088
Change-Id: I70aa2666ae21dae8f09ded2063bed359c0b210c5
erver/print/RemotePrintSpooler.java
76932df9ec7f7c2a18f9d899767846c8d7ede4fc 21-Nov-2016 Philip P. Moltmann <moltmann@google.com> Merge "Wait when other thread is binding to print spooler"
dc589ac82b5fe2063f4cfd94c8ae26d43d5420a0 11-Nov-2016 Sudheer Shanka <sudheersai@google.com> Update usage of ActivityManagerNative.

- Remove references to ActivityManagerProxy.
- Add isSystemReady to ActivityManager.

Bug: 30977067
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test android.server.cts
adb shell am instrument -e class com.android.server.am.ActivityManagerTest,com.android.server.am.TaskStackChangedListenerTest \
-w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I07390b6124fb1515821f5c0b37baf6ae74adc8fa
erver/print/PrintManagerService.java
93a224936945d1fd773c761279b8949d30325bac 10-Nov-2016 Philip P. Moltmann <moltmann@google.com> Wait when other thread is binding to print spooler

Fixes: 32581183
Test: print cts and workflow tests
Change-Id: I3c6ccc40a1ea6504d2e25ec402cecf31d724865b
erver/print/RemotePrintSpooler.java
c4f65e0da88955d3451d2a6e9b8f7b4814aa0b3e 09-Nov-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Move dump() to dumpAsync(), more oneway calls."
850c83e6da3b34a4eab804133420247fc9dbb8a1 09-Nov-2016 Jeff Sharkey <jsharkey@android.com> Move dump() to dumpAsync(), more oneway calls.

When calling out to dump services hosted by external apps, use
dumpAsync() to avoid hanging if the remote process is wedged.

Test: builds, boots, runs with minimal logs triggered
Bug: 32715088
Change-Id: I70aa2666ae21dae8f09ded2063bed359c0b210c5
erver/print/RemotePrintSpooler.java
383db5ebcc3a4a615faf249bf4f126f42e80b82e 22-Jun-2016 Tamas Berghammer <tberghammer@google.com> Update package names to work with the proto3 compiler

Bug: b/28974522
Change-Id: I5f3adf4946ee4ba1e09e4f40afe83c151405972a
erver/print/UserState.java
e5d91213d05f192201bdbe03860efa161850fccb 06-Oct-2016 Fyodor Kupolov <fkupolov@google.com> Do not enforce unlocked state for system calls

isUserUnlockingOrUnlocked should be enforced for calls made by apps.
Calls from system server should be handled gracefully.

Test: manual
Bug: 31833240
Change-Id: If56b0f9994209eb45a47072e0377d11293a9cbad
erver/print/PrintManagerService.java
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
erver/print/RemotePrintSpooler.java
erver/print/UserState.java
e2ad85d230392e18013bc50f37b46268aa4245a6 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
erver/print/RemotePrintSpooler.java
erver/print/UserState.java
df4a7ad5d19cab52944d44944581518909bd881b 28-Jun-2016 Philip P. Moltmann <moltmann@google.com> Merge \\"Always reload print services\\" into nyc-mr1-dev am: fd28d8ebd1
am: 14a4ec6574

Change-Id: I4d6afaca275e5596d601c707eeea928d4f089932
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
erver/print/UserState.java
2e3012624b703a653fed44d4dc1b8904406c0d99 16-Jun-2016 Philip P. Moltmann <moltmann@google.com> Add event tracking to print UI.

Bug: 29391676
Change-Id: Iec09ac7296e50329e87268bcb70f5e60d566961c
erver/print/UserState.java
e8bffdccd178c6118bce3f80c841f90db1051fa5 11-May-2016 Philip P. Moltmann <moltmann@google.com> Reconnect to service when it is updated

- Remove service from mActiveServices when the binder died. (before update)
- Treat the failure to bind as if when the binder dies. (while updating)

If the service is removed for mActiveServices, onConfigurationChanged will
automatically restart the service.

Fixes: 27977706
Change-Id: I643248f56a9f2f4b7dce63cc1489a60739ab4537
erver/print/RemotePrintService.java
erver/print/UserState.java
f8a765bce2656b6de2a75bf7a5a79adb6500fb3f 03-May-2016 Philip P. Moltmann <moltmann@google.com> Merge "Check if records is inited before removing items" into nyc-dev
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
erver/print/UserState.java
efb1950263b70dc3b7a6cd163bba1f38df54c15c 29-Apr-2016 Philip P. Moltmann <moltmann@google.com> Check if user is unlocked when handler is executed

When the user gets unlocked we schedule a handler-runnable to do cleanup work.
This runnable might be executed after the user is already locked again.

Fixes: 28512952
Change-Id: I6c05cbc8adab699e451565d74d56ad0f9b965954
erver/print/PrintManagerService.java
ce18c8167766f92856f94a8e88e19de4698960e6 28-Apr-2016 Jeff Sharkey <jsharkey@android.com> Introduce "unlocking" vs "unlocked" nuance.

There is a narrow window of time during user unlock where we're
reconciling user storage and dispatching the "unlock" status to
various internal system services. While in this "unlocking" state,
apps need to be told that the user still isn't actually "unlocked"
so they don't try making calls to AccountManager, etc.

The majority of internal services are interested in merging together
both the "unlocking" and "unlocked" state, so update them.

Clarify naming in AccountManagerService to make it clear that a local
list is being used, which mirrors the naming in MountService.

To match UX/PM requested behavior, move PRE_BOOT_COMPLETED dispatch
after the user is unlocked, but block BOOT_COMPLETED dispatch until
after all PRE_BOOT receivers are finished to avoid ANRs.

Bug: 28040947, 28164677
Change-Id: I57af2351633d9159f4483f19657ce0b62118d1ce
erver/print/PrintManagerService.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
erver/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
erver/print/PrintManagerService.java
erver/print/RemotePrintServiceRecommendationService.java
erver/print/UserState.java
59d1c9430aa8b65febf1b77f99930328fd739844 26-Mar-2016 Philip P. Moltmann <moltmann@google.com> Merge "If the print spooler gets started onUserUnlock use less of a priority to have less impact on the system." into nyc-dev
d74d1e549168ba521e8009961b76e8718be37aa1 18-Mar-2016 Philip P. Moltmann <moltmann@google.com> Change hasCustomPrintIcon and setStatus as requested by API council.

Bonus: null advanced keys produced a exception deep in the print
spooler. Hence prevent null keys on the surface from now on.

Bug: 27716355
Change-Id: I3c064956f4e670cd7091437ade06605aa8d797b0
erver/print/RemotePrintService.java
erver/print/RemotePrintSpooler.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
erver/print/PrintManagerService.java
erver/print/RemotePrintSpooler.java
erver/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
erver/print/UserState.java
852c950bbfbfb10c6e05dc62dd2e662980238a46 08-Mar-2016 Philip P. Moltmann <moltmann@google.com> Correct how to deal with print service installation

- Deal with case that there are currently no print services installed
- Deal with the case that a package modification adds a print service

Bug: 27530312
Change-Id: I67a647bd0982a092a4810d6c1285d0c7b64e104e
erver/print/PrintManagerService.java
c2c83eeda6cf51313e9a6f594b3ff876df4a7c09 07-Mar-2016 Jae Seo <jaeseo@google.com> Fix NPE in PrintManagerService

Bug: 27530312
Change-Id: I86800572a93fbcf37f2e073a1eaee6fbe6658de1
erver/print/PrintManagerService.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
erver/print/PrintManagerService.java
erver/print/RemotePrintSpooler.java
erver/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
erver/print/PrintManagerService.java
erver/print/RemotePrintService.java
erver/print/UserState.java
cdf2b400349ca22fedfeb5a2deb8a043791b22ef 14-Jan-2016 Philip P. Moltmann <moltmann@google.com> Enforce non-nullness in PrinterId and exploit it.

Change-Id: Ifdf3b2329548a665d609dd66b738baab5c765b54
erver/print/RemotePrintService.java
05e34230709282f21d0df21b4bd69f6a4c5cf580 12-Jan-2016 Philip P. Moltmann <moltmann@google.com> Deal with UserState#getEnabledPrintServices returning null.

Bug: 26492364
Change-Id: I234b1632168c88d32bdd134630442756701118b6
erver/print/PrintManagerService.java
erver/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
erver/print/PrintManagerService.java
erver/print/UserState.java
f0e4daecc9eccccd7aa2c48b2166f0681381cff9 08-Jan-2016 Jeff Sharkey <jsharkey@android.com> Skip package updates when user is locked.

Bug: 26464060
Change-Id: If762ce799f402571fd0387947f19c824f4a1b000
erver/print/PrintManagerService.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
erver/print/PrintManagerService.java
erver/print/RemotePrintSpooler.java
erver/print/UserState.java
bb36206f08797156caed236671d36b5a34682f95 23-Dec-2015 Philip P. Moltmann <moltmann@google.com> Rename variable that hides the contatining classes name.

Change-Id: Iad0a9b341a866d33d10b7a389d243e677a65057c
erver/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
erver/print/PrintManagerService.java
erver/print/RemotePrintService.java
erver/print/RemotePrintSpooler.java
erver/print/UserState.java
0999c0d6e9c83873d9595ee764b6388dbc49dcb8 17-Dec-2015 Jeff Sharkey <jsharkey@android.com> Make printing framework encryption-aware.

Only create UserState objects when a user has been unlocked, meaning
we can connect to the spooler. Ignore package events that occur
while a user is locked, since we'll kick off updateIfNeededLocked()
when that user is eventually unlocked.

In all other cases, throw if someone tries obtaining UserState for
a still-locked user. This should help catch any edge cases in the
system, and communicate clearly through public APIs that printing
isn't available until the user is unlocked.

Bug: 26246836
Change-Id: If15744621890baee206d355484fe20933afc65d8
erver/print/PrintManagerService.java
b3078c235e7674fd61be75fb469105ba6174aba5 24-Nov-2015 Philip P. Moltmann <moltmann@google.com> Allow print service to specify progress of print and status

The status has always been there in error cases, it is now also visible
in non-error cases.

If the progress is not set, no progress bar is shown.

Bug: 24135025
Change-Id: Iea23f45d236365433c6f6739597833d236ed6d19
erver/print/RemotePrintService.java
erver/print/RemotePrintSpooler.java
03755a1f12390be9ddfcce8c5ad3f887fa5ccf9f 25-Nov-2015 Philip P. Moltmann <moltmann@google.com> Syncronosuly notify SelectPrinterActivity about changes to enabled print
services

If the SelectPrinterActivity is visible it shows different emptyState
depending on if there are print services available or not. Hence the
activity has to listen to changes to the list of enabled services.

This also fixes a small syncronsation problem if two observers are
registered for the enabled print services.

Bug: 25666802
Change-Id: I79af66f25f10e66347b48ce9bb99c1657b30a8dd
erver/print/PrintManagerService.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
erver/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
erver/print/PrintManagerService.java
erver/print/RemotePrintSpooler.java
erver/print/UserState.java
d69e4c1460017062e7c36be55801cb434ad19d97 24-Apr-2015 Dianne Hackborn <hackbod@google.com> Update use of procstate for services.

Now that we have a separate foreground service proc state
(above a sleeping top app), update various system services
to put their bindings into this state when appropriate.

There are two new bind flags for this -- one that just always
makes it a foreground service, another that only does it when
the device is awake (useful for things like the wallpaper).

And with all of that, tweak network policy manager to only
include apps that are at least foreground service state when
in power save and device idle modes. This will allow us to
further reduce the set of apps that have network access
(in particular not giving access to the current top app when
the screen is off), hopefully leading to even better battery
life.

Change-Id: I91d85a5c5ed64e856149e9a5d94a634a7925ec7f
erver/print/RemotePrintService.java
erver/print/RemotePrintSpooler.java
b0a78390ed834724e9c6adf0feff9931d7f9ec10 11-Apr-2015 Svetoslav <svetoslavganov@google.com> Add a mechanism to make pending intents immutable.

bug:19618745

Change-Id: Ice742e0162cb9b7c0afbc32e0eea03d501666e2b
erver/print/UserState.java
4a357cd2e55293402d7172766f7f9419815fc1e8 19-Mar-2015 Alan Viverette <alanv@google.com> Replace usages of deprecated Resources.getColor() and getColorStateList()

Change-Id: I8f64fe6c4c44a92ff6d07250223ba590a1d691b0
erver/print/PrintManagerService.java
f983d084e7b8a6de722d9cede1c0cf73831c8e92 02-Oct-2014 Svet Ganov <svetoslavganov@google.com> Increase bind remote print spooler timeout for eng builds.

bug:17734729

Change-Id: I70bfe3b64fca24752cf3efc225b21d5453e53b68
erver/print/RemotePrintSpooler.java
c82768ff4b045b5b4edc08405964d504438a681f 05-Sep-2014 Svetoslav <svetoslavganov@google.com> Handle user changes off the main thread.

The remote print spooler can only be accessed off the main thread
by design as calls into it may block for a short amoun of time since
the frist call into the spooler may have to wait for the system to
bind to the spooler service. A recent change introduced a regression
where the user state changes are now dispatched on the main thread.
This change schedules the user change handling to a background handler
thread.

bug:17396682

Change-Id: I059be8f31ba41122cb2967d8afadd19e6b5a08e5
erver/print/PrintManagerService.java
07ad8dc2087aa02da48353acc19ba82e62d99f82 01-Sep-2014 Kenny Guy <kennyguy@google.com> Use context for user when calling notifyAsUser

Create a context for the user the notification is
being posted for when using NotificationManager.notifyAsUser.

Bug: 17002733
Change-Id: Ie41d27bbb781ca38cc9bc910bd4410b8862edee1
erver/print/PrintManagerService.java
86b1df234397802895771fe14cd8f2813fa43415 21-Aug-2014 Svetoslav <svetoslavganov@google.com> Print services setting changes not handled for managed profiles.

We keep per user settings for enabled print services which are
observed to update the print manager service state. We were listening
to all user changes but the handling code was not updating the state
of the user whose settings changed, rather the current user.

Added hidden APIs in content observer to know which user changed
and now the print manager serivce handles content changes for the
correct user.

bug:16977006

Change-Id: I71ec88c8f3f38cb405844c13ab83695c2029eb79
erver/print/PrintManagerService.java
255dd04271088590fedc46c8e22b2fd4ab142d39 19-Aug-2014 Selim Cinek <cinek@google.com> Added notification color to all system notifications

Bug: 17128331
Change-Id: I81a94510ef51b99916f314c0dd65852426a1fbeb
erver/print/PrintManagerService.java
194db6ad91c4aee995930ea8f04ea877730234fd 05-Aug-2014 Svet Ganov <svetoslavganov@google.com> Fix cross-user permission checks in print manager service.

The cross-user check was requesting both interact across users and
interact across users all permissions which is too restrictive. Each
one is sufficient. Further, if the app has one of these premissions
but specifies a given user not current or current-self, the code
was throwing while the correct actions is to return the requested
user id as we alreay vetted the caller's permissions.

bug:16398152

Change-Id: I1a4863eb7b05dababb66bac6e143b78dfad42b81
erver/print/PrintManagerService.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
erver/print/PrintManagerService.java
erver/print/UserState.java
a798c0a984f29f7180883a61839f68d2cbf0c6ce 15-May-2014 Svetoslav <svetoslavganov@google.com> Refactor printing

Change-Id: I19850154ef2798afff511e4490a268ce38e8cbae
erver/print/RemotePrintService.java
erver/print/RemotePrintSpooler.java
04533dd3ba4e916f5a639d0cfbc331c32515cc84 08-May-2014 Svetoslav <svetoslavganov@google.com> Teach print manager services about user profiles.

For user profiles the printing layer will have a separate state and
set a set of print plugins. The rationale behind this is that if a user
uses different profiles for different domains he would expect that
each domain is separate as domains may have different security and
privacy requirements.

bug:14567366

Change-Id: I461ae4636294fa8968785295afb952aeb14a13b5
erver/print/PrintManagerService.java
cab8617b8ccea3a99b1ee15e15915c512a10c738 11-Feb-2014 Jeff Brown <jeffbrown@google.com> am 25df673b: am 1b51c9cb: Merge "Make SystemService constructor take a Context." into klp-modular-dev

* commit '25df673b849de374cf1de40250dfd8a48b7ac28b':
Make SystemService constructor take a Context.
b880d880c6cd989eacc28c365fc9a41d31900da1 11-Feb-2014 Jeff Brown <jeffbrown@google.com> Make SystemService constructor take a Context.

This change simplifies the process of initializing a SystemService
by folding the onCreate() step back into the constructor. It removes
some ambuiguity about what work should happen in the constructor and
should make it possible for services to retain most of their final
fields after refactoring into the new pattern.

Change-Id: I25f41af0321bc01898658ab44b369f9c5d16800b
erver/print/PrintManagerService.java
9f97de13359662c2709eed227b3fab2ce7d5dabc 06-Feb-2014 Adam Lesinski <adamlesinski@google.com> am a5a93f55: am 7f416631: Merge "Check feature bits before loading optional services" into klp-modular-dev

* commit 'a5a93f559d337ad5b79716b05ea43707eb779dc8':
Check feature bits before loading optional services
898c13df7b9b12ff10062f3542593e12fbe0c119 29-Jan-2014 Adam Lesinski <adamlesinski@google.com> Check feature bits before loading optional services

At startup, we check with PackageManager whether a system service is
available before attempting to load it. A system service is available
if its associated feature (similar to hardware features) is present.
This does not remove unavailable services from the compiled jar.

Change-Id: I13571805083aa4e65519a74acb52efd17b9fb3d7
erver/print/PrintManagerService.java
e58a49e411327e26b6ad9939833f53c7fa5aef20 21-Dec-2013 Amith Yamasani <yamasani@google.com> Merge commit '817ec49e' into manualmerge

Conflicts:
services/print/java/com/android/server/print/PrintManagerService.java

Change-Id: I1b9bf364ca50ee3c48f53d87ae0ce23e7f3c2bc2
817ec49e7991d4cac50b2308cd7cf5f8641e1e29 20-Dec-2013 Amith Yamasani <yamasani@google.com> Wrap some services into a SystemService

These services can now be excluded by modifying the list of REQUIRED_SERVICES (TB renamed)

Changed appwidget, devicepolicy, backup and print services.

Change-Id: Id8e2855d5c045cd57bdb02dca9ed75172803bce7
erver/print/PrintManagerService.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
erver/print/PrintManagerService.java
erver/print/RemotePrintService.java
erver/print/RemotePrintSpooler.java
erver/print/UserState.java