Commit Graph

17095 Commits

Author SHA1 Message Date
Lee Shombert
64f4df66d9 Merge "Enhance PropertyInvalidatedCache debug" 2020-01-30 22:21:33 +00:00
TreeHugger Robot
abc4e722c9 Merge "Modify setDefaultSmsApplication API" 2020-01-30 21:34:25 +00:00
Mady Mellor
dc7efcc2ce Merge "Make sure we visit the icon URIs of Person objects on Notifications" 2020-01-30 18:57:48 +00:00
Lee Shombert
2f529c13ac Enhance PropertyInvalidatedCache debug
Bug: 140788621

Add the cache name to most debug messages.  The cache name defaults to the
property name but can be overridden.  Overriding the cache name makes the
most sense when multiple caches share a single proprerty.  This function is
only called from inside debug log messages.

Wrap the default invocation of Query.toString() with a cache instance method
that can be overridden.  A cache that uses a simple type (like Integer) for
its Query to provide nicely formatted query strings in the debug logs.  This
function is only called from inside debug log messages.

Test: Created a test build using the hasSystemFeature() binder cache,
overriding cache name and the object query string.

Change-Id: If379ac3e8494e9fef0ff9f5cc5ca0412d02e5502
2020-01-30 10:53:16 -08:00
Makoto Onuki
dafca1e0da Merge "Make Log.wtf() safe to call from within the system server" 2020-01-30 18:50:29 +00:00
Alex Johnston
05956bd77e Modify setDefaultSmsApplication API
* Introduced new logic that allows the profile owner of an
  organization-owned device (COPE PO) to set the default
  SMS application in the personal profile.
* Modified the API to be callable on the parent profile
  instance if called by the COPE PO.
* When called by the COPE PO, the package provided
  must be a system package, otherwise an IllegalArgument
  Exception is thrown.

Bug: 148060194
Test: atest android.admin.cts.DevicePolicyManagerTest#testSetDefaultSmsApplication_failIfNotDeviceOwner
Change-Id: I5b86b10a13064f4ec852631e19f89a80a104dc2b
2020-01-30 15:51:08 +00:00
TreeHugger Robot
61e8374b44 Merge "Add documentation to #onPictureInPictureRequested" 2020-01-30 01:03:03 +00:00
Makoto Onuki
83679a6c5c Make Log.wtf() safe to call from within the system server
Make sure to use the handler if the caller is the system server

Test: Build / treehugger / manual code inspection
Change-Id: I0c9998511280193d785ebcf7aa501ee02c0a8548
Fix: 148230239
2020-01-29 14:39:53 -08:00
Mady Mellor
726df929e1 Make sure we visit the icon URIs of Person objects on Notifications
Test: manual - have bubbles test app with uri based icons, send notifs,
               notice the notifications show pictures of people instead
               of blank spaces & there are no exceptions in the logs
Fixes: 148543216

Change-Id: Idfb7c75d9c5541f2dcebfb0f20daa99f039f4181
2020-01-29 11:51:27 -08:00
jorgegil@google.com
7a926dc674 Add documentation to #onPictureInPictureRequested
Explains how app developers might want to use the new API.

Bug: 148011369
Test: compiles
Change-Id: I87b20de69ea9a30c2cb338cf19db0bd0b971b78a
2020-01-29 10:28:33 -08:00
Dmitri Plotnikov
715a1c654b Merge "Add async version of getProviderMimeType" 2020-01-29 17:59:51 +00:00
Automerger Merge Worker
fdb676b4dd Merge "Rename ZoneInfoDB -> ZoneInfoDb" am: 402674f2a0 am: c3e31d6ac5 am: f8a4287915
Change-Id: I72978765010e3da52bcdf00299f7ba999bc9201b
2020-01-29 14:33:04 +00:00
Automerger Merge Worker
f8a4287915 Merge "Rename ZoneInfoDB -> ZoneInfoDb" am: 402674f2a0 am: c3e31d6ac5
Change-Id: Ib094f9f67112998c82642dd4f8688a75f8b8e0ee
2020-01-29 14:21:11 +00:00
Neil Fuller
c3e31d6ac5 Merge "Rename ZoneInfoDB -> ZoneInfoDb"
am: 402674f2a0

Change-Id: I3dca8a93ccbc0f5e6fd4905db82bec6d8e088164
2020-01-29 06:05:50 -08:00
Treehugger Robot
402674f2a0 Merge "Rename ZoneInfoDB -> ZoneInfoDb" 2020-01-29 14:00:45 +00:00
Automerger Merge Worker
3daccde526 Merge "Extract TimeDetector/TimeZoneDetector interfaces" am: 17ac92f460 am: a9e81b53a9 am: f751b9ec06
Change-Id: Ic029c262cc34f8c0232cda3558a57f2fcaceb797
2020-01-29 10:38:45 +00:00
Automerger Merge Worker
f751b9ec06 Merge "Extract TimeDetector/TimeZoneDetector interfaces" am: 17ac92f460 am: a9e81b53a9
Change-Id: I39134e3e45d3c6f2fac78a0180da7b83eb94b86f
2020-01-29 10:22:58 +00:00
Neil Fuller
a9e81b53a9 Merge "Extract TimeDetector/TimeZoneDetector interfaces"
am: 17ac92f460

Change-Id: I7e35f2eedbe57a8e77af8af70587a87dfa61bd26
2020-01-29 02:09:11 -08:00
Ryan Mitchell
1e80cd76ed Merge changes from topic "res-loader"
* changes:
  Refactor ResourcesLoader Tests
  Refactor ResourcesLoader APIs
2020-01-29 06:57:47 +00:00
Dmitri Plotnikov
d55a387f78 Add async version of getProviderMimeType
Fixes: b/147646960
Test: atest FrameworksCoreTests:android.content.ContentResolverTest

Change-Id: I04c15ac008fe14b215f954af150226dc94f22232
2020-01-28 17:35:45 -08:00
Mady Mellor
e71999af40 Merge "Bubbles / notifs / shortcuts: if the id's don't match throw an error" 2020-01-29 01:10:53 +00:00
Ryan Mitchell
4579c0aea2 Refactor ResourcesLoader APIs
This changes refactors the ResourcesLoader APIs.
The main changes are:

Rather than pairing a ResourcesLoader with a ResourcesProvider, a
ResourcesProvider is paired with an AssetsProvider which is only
responsible for overriding the values of file-base resources and
assets. An AssetsProvider can be shared between multiple
ResourcesProviders.

ResourcesLoader now holds a list of ResourcesProviders.

ResourcesLoaders are part of ResourcesKeys and requests for resources
with the same loaders will use the same underlying ResourcesImpl. This
allows the loader specific code in RM to be cleaned up.

ResourcesLoaders and Resources objects use callbacks to notify RM
of changes to the Resources instance that may require a new
ResourcesImpl.

When a context is created from another context, the new context will
include the loaders of the original context. Change to list of either
context's loaders will not change the loaders of the other context,
but changes to the providers a loaders uses will update all Resources
objects that use that loader.

Activity resources will include the loaders of the application context
at the time of the Activity's creation.

Bug: 147359613
Test: atest ResourceLoaderTests
Change-Id: I2957c803d3f0c1280abfd3c723d76b18df2c3789
2020-01-28 15:35:14 -08:00
Mady Mellor
bd35832d9b Merge "Bubble API: post update when bubble notification suppression flag changes" 2020-01-28 22:04:38 +00:00
Neil Fuller
f14b18e153 Rename ZoneInfoDB -> ZoneInfoDb
Rename ZoneInfoDB -> ZoneInfoDb to conform with coding standards.

Bug: 148086409
Test: treehugger
Change-Id: I2a5eca6bd013d3ca2ba93aabf36745f8873fc6fb
2020-01-28 13:49:48 +00:00
Neil Fuller
ad6eb2b2d5 Extract TimeDetector/TimeZoneDetector interfaces
Extract TimeDetector/TimeZoneDetectors interfaces due to API council
feedback.

Bug: 148402378
Test: treehugger
Change-Id: I22b12c8c5cc1cca9e3a788ef76c38b77198a3bce
2020-01-28 12:18:46 +00:00
Mady Mellor
eb049d0b47 Bubble API: add support for URI based icons
I would ultimately like to restrict icons to be TYPE_URI_ADAPTIVE_BITMAP,
however, that would break existing app behaviour. Let's log a warning
and hope that we can change it to be one of the URI based icons in the
future.

Test: atest NotificationManagerTest
Bug: 138943209
Bug: 144352570
Change-Id: I044f035571fcaa817b19d8ff330fb22b4addf970
2020-01-27 13:20:00 -08:00
Automerger Merge Worker
251a110c45 DO NOT MERGE: Adds artificial package handler latency am: de626c28d7 am: 895d932835
Change-Id: Icbf1e5c7475260bee1c147f92aa328dd29f4fb17
2020-01-27 20:22:29 +00:00
Automerger Merge Worker
895d932835 DO NOT MERGE: Adds artificial package handler latency am: de626c28d7
Change-Id: I5303926e34c973ca9e4a7d12d0f4cd46e2fbcde8
2020-01-27 20:14:59 +00:00
Mady Mellor
f44b68378c Bubble API: post update when bubble notification suppression flag changes
When bubbles are expanded or if the user dismisses the notification, the
notification associated with the bubble is suppressed from the shade, but
still technically active / in active notification list because of the
bubble.

We already have a concept of this with isNotificationSuppressed on
BubbleMetadata, this just ensures that the flag is properly updated when
the state changes in System UI. This allows other things showing
notifications (e.g. long press on launcher app icon -> see notifs) to
hide or show notifications consistently with the rest of system ui.

I'm re-using the flag that apps may set to suppress notifications when
they send a bubble that is foreground, since its the same concept.

When this flag state changes a new update is sent with the flag
adjusted.

Added a notification delegate method to communicate the suppression changes
back to NoMan. This is piped through a listener set on Bubble objects.

Test: atest NotificationManagerTest NotificationTest NotificationManagerServiceTest
Bug: 131926652
Bug: 144352570
Change-Id: I25e86849858cdfe2fb81ab51b1ff09980bf70944
2020-01-27 10:46:41 -08:00
Lee Shombert
c40573a9b7 Merge "Revert "Clean up hasSystemFeature binder cache"" 2020-01-27 16:43:25 +00:00
Lee Shombert
c3133de4d0 Revert "Clean up hasSystemFeature binder cache"
Bug: 148370985

This reverts commit be9ba356aa.

Reason for revert: The change used <>, which is  supported in Java 9 but not in Java 8.

Change-Id: I06304dead0a54b33b37d6661f9446cc797785bf4
2020-01-27 15:58:42 +00:00
Bernardo Rufino
ab338ac42c Move text toast creation to system UI
In order to do that, NotificationManager now calls
StatusBar.showToast(), which is in SystemUI. StatusBar then calls a new
component, ToastUI, which is responsible for rendering the toast. The
code for rendering the toast was extracted from the Toast class, so it
should behave identically.

Also refactored the code a bit on NotificationManagerService, creating
two children of ToastRecord (one for custom, other for text toasts).

The change is gated in Toast class in this CL, but it's also gated on
the system server, so apps can't circumvent the background block.

Bug: 128611929
Bug: 144754526
Test: atest android.widget.cts.ToastTest
Merged-In: Id0021cdc6f72f41b55ff1c5a4f09ae7687586460
Change-Id: Id0021cdc6f72f41b55ff1c5a4f09ae7687586460
2020-01-27 11:13:27 +00:00
Lee Shombert
6a23143c4c Merge "Clean up hasSystemFeature binder cache" 2020-01-26 19:02:43 +00:00
Hui Yu
88910decff FGS background start restriction.
1. Background started foreground service shall not have
while-in-use permissions including location, camera and
microphone. Many exemptions have been applied including:
--FGS started by widget.
--FGS started by notification.
--FGS started by IME or other visible app.
--FGS started by ROOT_UID, SYSTEM_UID, NFC_UID.

2. Add a phenotype key KEY_DEFAULT_BACKGROUND_FGS_STARTS_RESTRICTION_ENABLED
to turn on/off this feature (default is on).

3. In dogfood, if a background started FGS with while-in-use permission
(any of location/camera/microphone) run into this restriction, the FGS
will not been granted these permission. we show a toast message to
alert user and ask them to write a bugreport using instruction at
go/r-bg-fgs-restriction. So we can have a statistic how many apps will
be impacted by this feature.
These is a flag Settings.Global.FOREGROUND_SERVICE_STARTS_LOGGING_ENABLED
to turn on/off the toast message (default is on, in dogfood)

Bug: 136219221
Test: atest android.app.cts.ActivityManagerProcessStateTest
atest android.app.cts.ActivityManagerApi29Test.java
atest android.app.cts.ActivityManagerFgsBgStartTest

Change-Id: Ibc8aaa6839a69136f9311bfacdbab9705b31b6a7
2020-01-24 20:58:47 -08:00
Julius D'souza
5eb161d910 Merge "KeyguardManager: add lock set and validation methods" 2020-01-25 03:32:36 +00:00
Nate Myren
32af0ecb7e Merge "Disable user-facing historical app ops methods" 2020-01-25 01:40:14 +00:00
Andrii Kulian
8127bfcc43 Merge "Merge sleeping activities with visibility updates" 2020-01-25 00:42:03 +00:00
Julius D'souza
9367eb8146 KeyguardManager: add lock set and validation methods
The new methods are specifically for non-handset devices
and are guarded by SET_INITIAL_LOCK permission.

Bug: 143612363
Test: TreeHugger
Change-Id: Ifbe6a1b11f4849ec0ea9515ac7b018bb446799ea
Signed-off-by: Julius D'souza <jdsouza@google.com>
2020-01-24 15:37:13 -08:00
Nate Myren
697650b3b7 Disable user-facing historical app ops methods
Disable the ability to see historical app ops using dumpsys, and by
calling "getHistoricalOps", unless the calling package has an
instrumentation, or is the statsd package.

Fixes: 148227477
Test: attempt to call into getHistoricalOps while not an instrumented
application or statsd. The method should return an empty bundle. Run
"adb shell dumpsys appops --history" should return "no such arg", and
"adb shell dumpsys appops -h" should not show "--history" in the args.

Change-Id: Ie5ad9a90ffc0473aba958199450bcff9315f71a6
2020-01-24 14:13:00 -08:00
Soonil Nagarkar
614210991b Merge "Add DPM API to request location provider enable" 2020-01-24 21:27:31 +00:00
Vinit Nayak
b320cbccf6 Merge "Add rotation field to ThumbnailData for task snapshots" 2020-01-24 21:24:24 +00:00
Yuliya Kamatkova
56f7c7f37c Merge "Add Activity#setLocusContext API. Plumb LocusID to the System Server. Add locus update event to the Usage Stats. Test: Build and run on a test device with a test app. Bug: 147594233, 147100454" 2020-01-24 21:10:54 +00:00
Ying Xu
4b0dec268d Merge "[Telephony Mainline] Remove hidden API usages in CarrierAppUtils" 2020-01-24 20:55:31 +00:00
Yuliya Kamatkova
48c38076ef Add Activity#setLocusContext API. Plumb LocusID to the System Server.
Add locus update event to the Usage Stats.
Test: Build and run on a test device with a test app.
Bug: 147594233, 147100454

Change-Id: I1e058ac87244d47719606d8dcfaea2df4bff43d2
Signed-off-by: Yuliya Kamatkova <yuliyak@google.com>
2020-01-24 11:19:10 -08:00
Lee Shombert
be9ba356aa Clean up hasSystemFeature binder cache
Bug: 140788621

This is a non-functional clean-up.
1. Rename the classes and methods used by the binder cache so that
   everything public is based off of the binder name "hasSystemFeature".
2. Modified the hashCode() method to conform to the comments in cl/9965760

Test: Built a debug image and ran one iteration of MPTS.  Verified that no
errors were seen.

Change-Id: I3ffdda43a7dbe30a12449ff346e1e22b379ee308
2020-01-24 10:48:53 -08:00
Andrii Kulian
4679918cdf Merge sleeping activities with visibility updates
Previously we were using a separate SLEEP message to communicate
with the client. The sleeping implementation on the client though
simply transitioned it between STARTED and STOPPED states.

This CL relies on visibility updates to communicate the sleeping
state. The "sleeping" status field is still used in the server-side
to record when device started going to sleep, and prevents any
activity that was launched before to influence the power state of
the device.

Bug: 137329632
Test: AM/WM CTS and unit tests
Change-Id: Idd7f5bf6730d3372168d862ef713a44f700430f1
2020-01-24 09:59:36 -08:00
Pavel Grafov
1559c076a3 Merge "Add API to limit maximum time the profile can be turned off." 2020-01-24 13:42:58 +00:00
Pavel Grafov
746e1341c3 Add API to limit maximum time the profile can be turned off.
If this policy is set:
* Whenever work profile gets turned off or system boots, timer is
  started, so theat unless the profile is unlocked in time, apps
  will be suspended.
* when the user is unlocked, alarm is discharged.

Currently there is no upfront warning notification, will be addressed
in a follow-up.

Bug: 143517719
Test: manual, using TestDPC
Change-Id: Ib0f936b6d1414f65ae8c86367b7059c14862827d
2020-01-24 11:50:42 +00:00
Automerger Merge Worker
54b1d34fc0 Merge changes from topic "add-ikev2-vpn-types" am: adb79e3b39 am: 1ebbd0bb6b am: bb3d6e2e9c
Change-Id: I4ff406efcaada5a9306afc79290cb37bdeef71f2
2020-01-24 07:59:53 +00:00
Soonil Nagarkar
980ce6a741 Add DPM API to request location provider enable
DPM can currently control the master location toggle, but cannot
influence the behavior of individual providers. This adds an API for
DPM (or other privileged entities) to request a provider to turn itself
on.

Practically, this is necessary to allow DPM to control network location,
which may be gated by additional consents. This change also renames some
internal location code to make clearer the distinction between provider
enabled and provider allowed: enabled = location on && allowed

Bug: 136219903
Test: CTS tests to be added
Change-Id: I05f03c976428f0f5a8a2cf627a84dc9e2baf3e67
2020-01-23 18:06:31 -08:00