Commit Graph

20850 Commits

Author SHA1 Message Date
Rubin Xu
b9be267361 Merge "Allow any apps to call DPM.isUsbDataSignalingEnabled()" into sc-dev 2021-06-09 15:54:21 +00:00
Rubin Xu
4d68ae240b Allow any apps to call DPM.isUsbDataSignalingEnabled()
This is to allow 3p apps to query the state of the policy so they
can show appropriate UX to the user in case the app's interaction
with the plugged-in USB devices is  disrupted by the admin policy.

Bug: 190024751
Test: atest FrameworksServicesTests:DevicePolicyManagerTest
Change-Id: I829ff84256e0288b88c11add53da312ee2bc2558
2021-06-09 10:13:21 +01:00
Tom Natan
5977f60c19 Merge "Rename PlatformCompat#setOverridesOnReleaseBuilds to putOverridesOnReleaseBuilds." into sc-dev 2021-06-08 18:23:42 +00:00
TreeHugger Robot
f59889a08f Merge "Preventing component spoofing during getShortcutIntent" into sc-dev 2021-06-08 18:21:21 +00:00
tomnatan
1752194766 Rename PlatformCompat#setOverridesOnReleaseBuilds to putOverridesOnReleaseBuilds.
Bug: 190495884
Test: atest FrameworksServicesTests:PlatformCompatTest
Change-Id: I0b84732b5639b199f11b50b993ed3da4b3df1eda
2021-06-08 15:45:16 +00:00
Kholoud Mohamed
209f21d2ae Merge "Fix security vulnerability in DPMS" into sc-dev 2021-06-08 13:17:37 +00:00
Wei Sheng Shih
6b0741b3fe Merge "Introduce setSplashscreenStyle to specify splash screen style." into sc-dev 2021-06-08 12:16:24 +00:00
wilsonshih
72a03ff774 Introduce setSplashscreenStyle to specify splash screen style.
Provide a method ActivityOptions#setSplashscreenStyle to specify
splash screen style if needed.

If not set, the default option will be empty-style splash screen, so
without any other change, the activity launched from systemui with
ActivityOptions will become empty style splash screen.

Bug: 188023621
Bug: 189293785

Test: manual test start application from Launcher and Notification.

Change-Id: I299320db8f32fbd835c7ec0acaad3df3486a13f5
2021-06-08 12:21:27 +08:00
kholoud mohamed
54dc06ab99 Fix security vulnerability in DPMS
Changed DPMS#getCrossProfileCalendarPackagesForUser to always require
INTERACT_ACROSS_USERS or INTERACT_ACROSS_USERS_FULL.

Bug: 187043444
Test: N/A
Change-Id: I53300bfe2e0481df0d473cc73a85857b5603a45e
2021-06-07 16:05:20 +01:00
Christopher Tate
9396c029ac Improve test flakiness around FGS notifications
Make sure that even transient package-associated state is cleared when
the package is uninstalled, and provide a testing hook for instrumenting
global rate limits appropriately to high-rate test sequences.

Bug: 190019349
Test: atest CtsAppTestCases:android.app.cts.ServiceTest
Test: atest CtsAppTestCases:android.app.cts.NotificationManagerTest
Change-Id: Ic38157c6f21bcf09bcf74de591e41dc64f7bf0f7
2021-06-03 16:34:26 -07:00
Chris Tate
d3a0befee4 Merge "Fix FGS enter/exit statslog semantics" into sc-dev 2021-06-03 22:19:23 +00:00
Jeff DeCew
7b96af705c Merge "Fix background color (again)" into sc-dev 2021-06-03 19:32:50 +00:00
Christopher Tate
29f1852efd Fix FGS enter/exit statslog semantics
Logging wasn't quite right in the case of deferred FGS notification in
various ordering scenarios.

Bug: 189926836
Test: atest CtsStatsdAtomHostTestCases:android.cts.statsdatom.statsd.UidAtomTests#testForegroundServiceState
Change-Id: I650730db9e01faa90a36a73b486464ab5b179fc6
2021-06-03 09:28:07 -07:00
Jeff DeCew
10de71a380 Merge "Notification layout fixes:" into sc-dev 2021-06-03 16:16:25 +00:00
Jeff DeCew
ea4b3a56b4 Fix background color (again)
* originally fixed in ag/14189045
* regressed in ag/14140988

Bug: 185920837
Test: post conversation notifications, and look at badge or face pile background; should match notification background
Change-Id: I8ef77901ed9d43eccf89dcc1f3905f0dbb38851f
2021-06-03 11:18:35 -04:00
Jeff DeCew
604c074dbe Notification layout fixes:
* "Headerless" notifications no longer capped at 88dp.  This allows DecoratedCustomViewStyle content to be sized larger than 48dp, but all that sizing is now controlled by the max heights for the entire notification, which is enforced by the ExpandableNotificationRow, rather than the layout.
* Reduce the max heads up height to 136dp (down by 7dp).  For standard headerless templates, this won't have any effect, because they would never get that tall.  For HUNs with decorated custom content this reduces the custom content area to 96dp without actions (to match RVC) and 56dp with actions (up slightly from 48dp in RVC).
* Fixed a bug where the snooze button would be bound when viewType=NORMAL, which only affected messaging style, and was hiding a layout bug if the snooze setting was enabled.
* Fixed a bug with the action margin on messaging notifications appearing in the collapsed state and causing oversized notifications.

Fixes: 189937886
Test: significant manual testing with notify and notify2, especially with HUNs
Change-Id: I775a0bb29944922581d01f237dbbc5580ced00c4
2021-06-02 20:23:59 -04:00
Svetoslav Ganov
1028eb2f62 Merge "Switch media fw permissions checks to AttributionSource" into sc-dev 2021-06-02 23:07:22 +00:00
Jon Spivack
dd934371ae Merge "Allow AssistDataRequester to fetch AssistContent without AssistStructure" into sc-dev 2021-06-02 17:08:47 +00:00
Mady Mellor
81cac3a9f1 Merge "Remove doc saying setSuppressNotification requires being in foreground" into sc-dev 2021-06-02 16:18:19 +00:00
Jay Sullivan
c2650e0440 Merge "Fix intermittent async noteOps" into sc-dev 2021-06-02 00:42:31 +00:00
Svet Ganov
2eebf92965 Switch media fw permissions checks to AttributionSource
Attribution source is the abstraction to capture the data
flows for private data across apps. Checking permissions
for an attribution source does this for all apps in the
chain that would receive the data as well as the relevant
app ops are checked/noted/started as needed.

Teach speech recognition service about attribution
chains. If an implementation does nothing the OS
would enforce permisisons and do blame as always.
This apporach leads to double blaming and doesn't
support attribition chains where app calls into
the default recognizer which calls into the on
device recognizer (this nests recursively). If the
implementer takes advantage of the attribution chain
mechanims the permissions for the entire chain are
checked at mic access time and all apps are blamed
only once.

Fixed a few bugs around finishing ops for attribution
chains. Also ensured that any app death in a started
attribution chain would lead to finishing the op for
this app

bug: 158792096

Test: (added tests for speech reco)
      atest CtsMediaTestCases
      atest CtsPermissionTestCases
      atest CtsPermission2TestCases
      atest CtsPermission3TestCases
      atest CtsPermission4TestCases
      atest CtsPermission5TestCases
      atest CtsAppOpsTestCases
      atest CtsAppOps2TestCases

Merged-In: Ic92c7adc14bd2d135ac13b96f17a1b393dd562e4

Change-Id: Ic92c7adc14bd2d135ac13b96f17a1b393dd562e4
2021-06-01 23:43:29 +00:00
Mady Mellor
f8218030bb Merge "Re-add checks for mutable intents on bubbles" into sc-dev 2021-06-01 22:59:54 +00:00
Mady Mellor
72c320aefc Remove doc saying setSuppressNotification requires being in foreground
ag/13330774  removed the requirement & added tests; this updates the
javadoc around it.

Bug: 189175840
Test: treehugger
Change-Id: I5c8fc35607c79a6e70e8245d8662d66d5e884fa1
2021-06-01 14:16:22 -07:00
Mady Mellor
4d9ab47b4b Re-add checks for mutable intents on bubbles
Also adds a note in the javadoc.

Bug: 177252626
Test: atest NotificationManagerServiceTest
Change-Id: I1e55b08d3de7b6be22090cc821794c78c6659620
2021-06-01 14:01:17 -07:00
Jeff DeCew
3c3af99d00 Merge "Do not show the custom views of spoofing notitifactions." into sc-dev 2021-06-01 18:24:21 +00:00
TreeHugger Robot
2ee596d203 Merge "Fix various FGS notification deferral issues" into sc-dev 2021-06-01 17:32:02 +00:00
Jing Ji
e6436d95f8 Merge "Don't call onNullBinding when the service host is dead" into sc-dev 2021-05-28 01:35:24 +00:00
Ryan Mitchell
488522c9c5 Merge changes from topic "inc-dis" into sc-dev
* changes:
  Disable incremental hardening on own resources
  StringBlock incremental hardening default values
2021-05-27 21:31:04 +00:00
Christopher Tate
10a3ccad53 Fix various FGS notification deferral issues
A number of scenarios involving both FGS and non-FGS notification
operations were not yet working as intended.  This CL lands the
following behaviors:

* notify() to update the notification content during an FGS's
notification deferral period now respects the new Notification's
deferral policy rather than forcing immediate display.  An app can now
choose whether to force immediate display, or to have the new content be
what eventually appears at the end of the deferral period, by using the
same builder API as controls the deferral policy for startForeground().

* If an app posts a notification via notify() then adopts that
notification with new content (i.e. uses the same notification ID) in a
call to startForeground(), there is now no deferral: the existing
notification is always updated immediately, regardless of the
notification's or the service's configuration viz deferral policy.

* Fixed a latent bug when the app called notify() to update the
notification after startForeground(), then the service was killed for
memory and relaunched.  The notification might have been reposted with
stale content.

* Adjusted the metrics handling to more accurately express "was display
of the notification content for this transition to the FGS mode
deferred?"

Bug: 178406514
Bug: 185771298
Bug: 187860135
Test: atest CtsAppTestCases:android.app.cts.ServiceTest
Test: atest CtsAppTestCases:NotificationManagerTest
Change-Id: Ieb62f7195eb619c1769e3c1bd518cb6a7b6e4b7c
2021-05-27 12:57:11 -07:00
Ryan Mitchell
c0416698db Disable incremental hardening on own resources
When an application is incrementally installed, and a resources
operation fails due to the resources not being fully present,
the app should crash instead of swallowing the error and
returning default values to not alter the experience of
using the application.

Disable IncFsFileMap protections on ApkAssets that are a part of the
application that is running (base and splits).

Bug: 187220960
Test: atest ResourcesHardeningTest
Change-Id: Ibc67aca688720f983c7c656f404593285a54999b
2021-05-27 09:50:36 -07:00
Bernardo Rufino
365d013e43 Merge "Fix background bypass via notifications" into sc-dev 2021-05-27 10:48:45 +00:00
TreeHugger Robot
018e114202 Merge "Create ActivityClientRecord early in preExecute" into sc-dev 2021-05-27 03:50:20 +00:00
Jon Spivack
de1d8b4092 Allow AssistDataRequester to fetch AssistContent without AssistStructure
This provides a new request type for AssistDataRequester, ASSIST_CONTEXT_CONTENT. Using this prevents ActivityTaskManagerService from sending the potentially large AssistStructure when it isn't necessary.

Bug: 189164641
Test: Manual (confirmed the new call worked as expected on Pixel 3A)
Change-Id: I5cec15c88c52f8319808aee474cc2351f2fa931a
2021-05-26 17:45:16 -07:00
Jing Ji
980dc5ae12 Don't call onNullBinding when the service host is dead
Bug: 189038850
Test: atest CtsAppTestCases
Change-Id: I8bcdaf545ee8ca46327fc25c14d9821e288600a4
2021-05-26 14:01:06 -07:00
Jeff DeCew
31b55249e8 Do not show the custom views of spoofing notitifactions.
Fixes: 189189308
Fixes: 189189219
Fixes: 189189310
Fixes: 189078626
Test: lots of manual testing with custom views
Change-Id: I069a83288f72803b6d0956899a44a527a7758c18
2021-05-26 16:40:54 -04:00
Bernardo Rufino
5fbeff59df Fix background bypass via notifications
Apps were able to bypass BAL and BG-FGS restrictions by retrieving their
own notifications and firing their PI since those were allowlisted for
those operations.

Now we strip the token that granted them that ability
from notifications returned via NM.getActiveNotifications(), which
returns the notifications of the caller.

Notifications returned via notification listener APIs still contain such
token, as they should.

Bug: 185388103
Bug: 169821287
Test: atest -d android.app.cts.NotificationManagerTest#testActivityStartFromRetrievedNotification_isBlocked
Change-Id: I2ede0d639a560f6acacec3864a0a7d23af152ba5
2021-05-26 16:25:39 +01:00
Orion Hodson
2869d5a8c8 Merge "Use updated NetworkEventDispatcher API" into sc-dev 2021-05-26 13:34:07 +00:00
Victor Chang
ad227b1cab Merge "Refactor ddm ChunkHandler utility methods from libcore to framework" into sc-dev 2021-05-26 08:27:06 +00:00
Chilun
8f3a6caab8 Create ActivityClientRecord early in preExecute
We can guarantee that LaunchActivityItem will queue before
ActivityConfigurationChangeItem.
But ActivityConfigurationchangeItem#preExecute() still has the
opportunity to execute before LaunchActivityItem#execute(). And at this
time, ActivityClientRecord has not been created.

This CL create ActivityClientRecord early in
LaunchActivityItem#preExecute() and store in a new list of
ActivityThread. Thus others can guarantee to get the
ActivityClientRecord in preExecute().

Bug: 187691892
Test: atest TransactionExecutorTests
Change-Id: Ib40270345223c5c6e76333803faf98937c5527f9
2021-05-26 12:50:33 +08:00
Pinyao Ting
3997eaa6fb Preventing component spoofing during getShortcutIntent
Bug: 184972789
Test: manually verified in log that calling PendingIntent#send
      resulted in SecurityException which is being swallowed in
      PendingIntentRecord#sendInner

Change-Id: Iebf95631949c52a262455621b62b49c320113a21
2021-05-26 03:01:47 +00:00
Wei Sheng Shih
d42b8e2c73 Merge "Fix setApplicationNightMode crash due to permission denial." into sc-dev 2021-05-26 01:56:30 +00:00
Nikita Iashchenko
3938aac8a6 Refactor ddm ChunkHandler utility methods from libcore to framework
As a part of internal libcore cleanup three utility methods for ddm
chunks (de)serialization were removed from the CorePlatformApi set and
moved to framework.

As a part of API council review made following changes:
 * Renamed connected/disconnected callback methods to
   onConnected/onDisconnected, respectively
 * Made unregisterHandler method a part of core api
 * Renamed threadNotify/enableRecentAllocations setters

Bug: 154796679
Bug: 184654804
Test: m droid
Merged-In: I1d43f12aaf70c7c079577d3f3248248ed39f9865
Change-Id: I1d43f12aaf70c7c079577d3f3248248ed39f9865
2021-05-26 01:36:53 +01:00
Orion Hodson
a0ce8ac42c Use updated NetworkEventDispatcher API
Bug: 185153775
Test: m
Change-Id: Ib5ea04b0bae0dce9783c4017f1dd0db0efd49976
2021-05-25 21:05:55 +01:00
Li Li
a80340f9c6 Merge "Freezer kill reason in App Process Kill Stats" into sc-dev 2021-05-25 19:34:49 +00:00
Jeff DeCew
f294d0ba5f Merge "Resolve Notification.Colors once, instead of lazily." into sc-dev 2021-05-25 16:44:59 +00:00
Vadim Caen
fc1efcb428 Merge changes from topic "splashscreen-surface" into sc-dev
* changes:
  Do not reparent the SC when package is already realeased
  Display Splashscreen AVD in a SurfaceView
2021-05-25 15:24:08 +00:00
Jeff Sharkey
023570d056 Merge "Retire preliminary FGS deferral control API" into sc-dev 2021-05-25 14:27:07 +00:00
Jeff DeCew
cab7d8e011 Resolve Notification.Colors once, instead of lazily.
* Instead of resolving colors as-needed, resolve the entire palette potentially used by the notification at the start.
* Centralize color logic and palette storage into Notification.Colors for easier unit testing.
* Adds unit tests for the Notification.Colors, including validating color contrast ratios for various colors.
* Fix a bug with ColorContrastUtil where the luminosity for dark/light font cutoff was 0.5, which resulted in a max contrast ratio of 1.9 for some colors.  Now contrast ratios of 4.5:1 can be achieved for all colors.
* Removes a few of the color accessors in Notification.Builder which were infrequently used, and replaces them with direct use of Notification.Colors.
* Notification specific colors (primary, secondary, default) have only been used by colorized notifications for a few months.  Remove the dark mode overrides of these, ensuring that colorized notifications have the same exact appearance in light and dark themes.
* Replace the use of the "default" color with the "secondary text color"; this practically only affects the alerted bell icon, is more consistent, and reduces complexity.

Fixes: 187881776
Test: manual
Test: atest android.app.NotificationTest
Change-Id: Ib8840d04093094c324d8bdce5b2e84c93a94db8d
2021-05-25 09:57:11 -04:00
wilsonshih
d22e8b1403 Fix setApplicationNightMode crash due to permission denial.
Test activity crash when calling UiModeManager#setApplicationNightMode.
There should call clearCallingIdentity before updating configuration in
system server.
Also clear some code around those methods.

Fixes: 189166288
Test: atest SplashscreenTests#testSetApplicationNightMode
Change-Id: I163919927030f81739aa3d9520e2012a92028793
2021-05-25 19:09:58 +08:00
Shan Huang
35a187904c Merge "Tweak dark area thresholds." into sc-dev 2021-05-25 06:07:39 +00:00