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
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
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
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
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
* 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
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
Change-Id: I1d43f12aaf70c7c079577d3f3248248ed39f9865
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
The reason code is helpful for developers to understand why an app is
killed. It is also valuable to better quantify the benefit and impact
of App Freezer.
Bug: 183714099
Bug: 179715791
Test: dumpsys activity exit-info shows subreasons.
Change-Id: Iea808cdc8adbe9d84663071dc849d00ea28a9f7d
Now that we've settled the final API for this mechanism, retire the
preliminary one.
Bug: 186475652
Test: atest CtsAppTestCases:ServiceTest
Test: atest CtsAppTestCases:NotificationManagerTest
Change-Id: Ibe911627ad59b991f2e498689f7fa3019c19dc36