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
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
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
Bug: 30932767
Test: ensure getAssociations works as before
Change-Id: I58dc4dac5bf7aae83fe3611890116a928e290a43
(cherry picked from commit 544d714626db38714f826a31a5483c647510a743)
... 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
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
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
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
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
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
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
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
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
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
isUserUnlockingOrUnlocked should be enforced for calls made by apps.
Calls from system server should be handled gracefully.
Test: manual
Bug: 31833240
Change-Id: If56b0f9994209eb45a47072e0377d11293a9cbad
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
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
- 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
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
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
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
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
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
- 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
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
- Propagate nullness and non-null-ness up and down from the interfaces.
- Add non-CTS print tests for IPrintManager binder.
Change-Id: I0c310d9cea8aefba5ce386931521ffaf19712bbb
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
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
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
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