Commit Graph

17067 Commits

Author SHA1 Message Date
Mady Mellor
bd35832d9b Merge "Bubble API: post update when bubble notification suppression flag changes" 2020-01-28 22:04:38 +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
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
Jeffrey Huang
4329c0d2ed Merge changes I9ea3677d,I0a59dce8
* changes:
  Migrate away from using ServiceManager
  Migrate StatsManager to apex
2020-01-24 02:04:06 +00:00
Peter Wang
09014f1048 [Telephony Mainline] Remove hidden API usages in CarrierAppUtils
Bug: 146904426
Test: Build
Change-Id: Ib307e565b85e7d9a142efc7e3348b823dc46643d
2020-01-24 09:22:25 +08:00
Jeffrey Huang
f58800b66a Migrate away from using ServiceManager
Create a wrapper class to access binder objects
published by statsd mainline module

Bug: 147923515
Test: atest com.google.android.statsd.gts.StatsdHostTestCases
Change-Id: I9ea3677d88c790c856e4e89318ae2ce67ac7df1e
2020-01-23 15:47:08 -08:00
Vinit Nayak
ffd9dff181 Add rotation field to ThumbnailData for task snapshots
Add the rotation a task was in when its snapshot
is taken. This is used by launcher to know which
way to orient the bitmap when performing quickswitch

fixes: 143892437
Test: Test: With launcher in portrait
* Thumbnail in reverse portrait,
landscape, seascape, normal
With launcher in landscape
* Thumbnail in seascape, normal,
reverse portrait, landscape
With launcher in seascape
* Thumbnail in seascape, normal,
reverse portrait, landscape

Change-Id: Iaf32341d0db1fc023c29676e0d365eee03b98959
2020-01-23 15:12:32 -08:00
TreeHugger Robot
296afcc029 Merge "Expose system update related API to corp-owned managed profile" 2020-01-23 21:41:39 +00:00
Jeffrey Huang
38330a0833 Migrate StatsManager to apex
Link frameworks-statsd.jar against framework-all
since it is currently infeasible to to link against stubs

Linking against stubs in frameworks/base cannot be done because
we still have StatsLog that calls StatsEvent.getBytes which
is a hidden API.

We can't move StatsLog to the apex because of hidden APIs in the
autogenerated code which is currently being migrated.

Test: m -j
Bug: 147923515
Change-Id: I0a59dce83a8075bdde3e72d1d8eceef2ed572791
2020-01-23 13:21:53 -08:00
Alex Johnston
371edb56f3 Merge "Modify setApplicationHidden and isApplicationHidden APIs" 2020-01-23 18:42:54 +00:00
Rubin Xu
ca00dd4900 Expose system update related API to corp-owned managed profile
Allows profile owner of corporate-owned managed profile to call
the following APIs:
* setSystemUpdatePolicy
* installSystemUpdate

The following APIs can already be called by regular profile owners
so no changes are needed:
* getSystemUpdatePolicy
* getPendingSystemUpdate

Test: atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testSystemUpdatePolicy
Test: atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testInstallUpdate
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testSystemUpdatePolicy
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testInstallUpdate
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testInstallUpdateLogged
Bug: 147414327
Change-Id: I7224eb208f665ca7cb301daa7d17cce5126f7858
2020-01-23 17:35:41 +00:00
Alex Johnston
a552dd65fa Modify setApplicationHidden and isApplicationHidden APIs
* Introduced new logic that allows the profile owner of an
  organization-owned device (COPE PO) to hide/unhide system
  apps in the personal profile.
* Modified both APIs 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: 147413198
Test: manual testing
      atest com.android.server.devicepolicy.DevicePolicyManagerTest
      atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testApplicationHidden
      atest com.android.cts.devicepolicy.ManagedProfileTest#testParentProfileApiDisabled

Change-Id: I4fae8acee9f00e3b9c805f29cf826f917cda6abd
2020-01-23 17:05:58 +00:00
Ivailo Karamanolev
1a6fad470a Merge changes from topics "add-lights-manager", "lights-aidl-hal"
* changes:
  Add LightsManager implementation to LightsService
  Add Lights AIDL HAL support to LightsService
  Rename Light to LogicalLight to avoid namespace conflicts when adding AIDL HAL lights support.
2020-01-23 16:05:07 +00:00
Pavel Grafov
31c7fe0459 Merge "Add DPM methods to allow org owned PO to suspend personal apps" 2020-01-23 15:22:45 +00:00
Eran Messeri
d474dcd54f Merge "Prevent auto-granting of location permission via DPM" 2020-01-23 14:38:56 +00:00
Pavel Grafov
499f005e3d Add DPM methods to allow org owned PO to suspend personal apps
* When personal apps are suspended, only dialer, IMEs, a11y, launcher
  are some other critical apps are exempted.
* User is presented with notification, clicking on which invokes an
  activity in the DPC.

Bug: 147414651
Test: manual via TestDPC
Change-Id: I09f8dad08e54b0ce8201cd5c76b3f34342e0da8f
2020-01-23 13:33:39 +00:00
Adrian Roos
d7d9c3e354 Merge "Introduce WindowContext API" 2020-01-23 13:19:08 +00:00
Benedict Wong
1ebbd0bb6b Merge changes from topic "add-ikev2-vpn-types"
am: adb79e3b39

Change-Id: I205121bbd8ef8adbe5e7a5ea1c57bbcac0efae0e
2020-01-22 22:09:41 -08:00
Automerger Merge Worker
b864dc150e Merge changes from topic "connectivity-diagnostics-system-server" am: 9cd249c11a am: 45e0caf5dc am: 1544e76f76
Change-Id: If70281f2989778896eb34ac65bcfe0215393ef60
2020-01-23 03:41:09 +00:00
Benedict Wong
50b444359e Add VpnManger API surface
This change adds the VpnManager, which will be used by apps to install
profiles for all platform VPN types (currently only IKEv2).

Bug: 143325939
Test: Compiles, FrameworksNetTests passing.
Change-Id: I57f854d0a5b18358f3541c24ca0cd8aed03fd7a1
2020-01-22 19:24:24 -08:00
Cody Kesting
45e0caf5dc Merge changes from topic "connectivity-diagnostics-system-server"
am: 9cd249c11a

Change-Id: I48a9f1f734b5e2dd4f7ed91c052cec5c8c62c076
2020-01-22 19:10:05 -08:00
Andrii Kulian
4a31697319 Introduce WindowContext API
Test: atest WmTests CtsWindowManagerDeviceTestCases
Bug: 128338354
Change-Id: I9c9dfc5e7f4edd4c968e60d2ffcbb19b5c72a853
2020-01-22 18:30:29 -08:00
Hall Liu
36f8b83e45 Merge "Expose OPSTR_READ_DEVICE_IDENTIFIERS" 2020-01-23 01:56:42 +00:00
Cody Kesting
9cd249c11a Merge changes from topic "connectivity-diagnostics-system-server"
* changes:
  Add ConnectivityDiagnosticsManager to System Server.
  Make DataStallReport Parcelable.
  Make ConnectivityReport Parcelable.
2020-01-23 01:56:33 +00:00
Shu Chen
24c495fa51 Merge "Adds more flags for cursor control features." 2020-01-23 01:24:15 +00:00
Hall Liu
6b06a38e3a Expose OPSTR_READ_DEVICE_IDENTIFIERS
Expose the constant for use in Telephony.
Also replace a usage of a hidden UserHandle API with a systemapi
equivalent.

Bug: 146834818
Test: atest SmsApplicationTests
Change-Id: I569d921abf923c384d7e771e2fc28f54e0dbfdd1
2020-01-22 16:20:23 -08:00
Ivailo Karamanolev
090d02ca84 Add LightsManager implementation to LightsService
Includes backend code to support LightsManager binder calls and route
them to the HALs.

Bug: 144979010
Bug: 144978691
Bug: 142715294
Fix: 142230898
Test: atest LightsManagerTest
Test: atest LightsServiceTest
Change-Id: I2db7f2caa432cd1e2389ea5ca6544200ada18675
Exempt-From-Owner-Approval: Reviewed in OOO OWNERS's stead.
2020-01-22 23:49:02 +01:00
Santiago Etchebehere
0ec06391e2 Merge "[Zoom-out 1/N] Add API in WallpaperManager" 2020-01-22 22:35:43 +00:00
TreeHugger Robot
3d004d168c Merge "Rewrite R constants before creating Application" 2020-01-22 22:08:41 +00:00