Commit Graph

12364 Commits

Author SHA1 Message Date
Mary Xia
c82e25e13c Rename targetsDisplayCategory to requiredDisplayCategory based on feedback to avoid confusion with lunch target and
specify activity needs a particular display category.

RESOURCES_FINALIZATION=attribute rename
Test: atest PackageParserTest
Bug: 260161954
Change-Id: I882da1efe8c2dd6837eaab4566d4f15d2762b757
2022-12-02 20:45:51 +00:00
Yasin Kilicdere
bd3b879b2d Merge "Defer sending broadcasts to when the user switch is complete." 2022-12-02 15:51:41 +00:00
Tyler Freeman
bae1102a51 fix(non linear font scaling): fix crash with certain negative SP values
The crash was due to some old logic that was looking for near matches.
Now we only return exact matches, and let the interpolation deal with
near matches.

Add test to make sure it doesn't crash at any value passed in.

Test: atest FrameworksCoreTests:android.content.res.FontScaleConverterTest

Bug: b/260984829

Change-Id: Ic90d1c5b48862e4f78b90be5926c9ce6d468acf9
2022-12-01 17:05:32 -08:00
Yasin Kilicdere
3430907152 Defer sending broadcasts to when the user switch is complete.
Send the following broadcasts after a user switch is complete,
instead of while the switch is happening.
* ACTION_USER_BACKGROUND
* ACTION_USER_FOREGROUND
* ACTION_USER_SWITCHED

Otherwise managing these broadcasts occupy system_server process and
make the user switch longer than it could be.

If a code should be run while the user switch is happening, in other
words while the screen is frozen, (because possibly they move things
around on the screen), they should register a UserSwitchObserver and
override its onUserSwitching method. Then when they are done, they
should call reply.sendResult(null); on the provided reply parameter.

Bug: 257437695
Test: atest FrameworksServicesTests:UserControllerTest
Change-Id: I7b8662600b45459cd83653ac6f15e73335903262
2022-12-01 19:37:21 +00:00
TreeHugger Robot
329bb092dc Merge "Add a new function in ResourcesProvider for SelfTargeting" 2022-12-01 11:29:35 +00:00
TreeHugger Robot
f7aaff3232 Merge "Unhide the "SHORT_SERVICE" FGS type." 2022-12-01 08:05:18 +00:00
felkachang
212f61cf58 Add a new function in ResourcesProvider for SelfTargeting
This patch adds a new function to load a SelfTargeting overlay to be
a ResourcesProvider instance. If the app wants to overlay itself’s
resources, the first step is to call this new function to get a
ResourcesProvider instance and then add the ResourcesProvider in a
ResourcesLoader instance.
* ResourcesProvider#loadOverlay

Test: atest \
          OverlayHostTests \
          OverlayDeviceTests \
          SelfTargetingOverlayDeviceTests \
          OverlayRemountedTest \
          FrameworksServicesTests:com.android.server.om \
          CtsContentTestCases:android.content.om.cts \
          CtsContentTestCases:android.content.res.loader.cts \
          idmap2_tests

Bug: 205919743
Change-Id: Id54da44a54ee6cbc685ad486d1bf69ef388c33ae
2022-12-01 06:13:44 +00:00
felkachang
ec915c669c Add overlay management functions into OverlayManager
Self-Targeting apps can manage the overlays by the following classes.
* OverlayManager
* OverlayManagerTransaction

For OverlayManager, it provides 2 functions for the app.
* Start a overlay manager transaction
      OverlayManager#beginTransaction()
* List the registered overlays
      OverlayManager#getOverlayInfosForTarget(targetPackage).

For OverlayManagerTransaction, it provides 3 functions for the app.
* register a FabricatedOverlay
      OverlayManagerTransaction#registerFabricatedOverlay
* unregister a FabricatedOverlay
      OverlayManagerTransaction#unregisterFabricatedOverlay
* commit the transaction
      OverlayManagerTransaction#commit

Test: atest \
          OverlayHostTests \
          OverlayDeviceTests \
          SelfTargetingOverlayDeviceTests \
          OverlayRemountedTest \
          FrameworksServicesTests:com.android.server.om \
          CtsContentTestCases:android.content.om.cts \
          idmap2_tests

Bug: 205919743
Change-Id: I3b0b60a30689b3d033f96cfcf02e2f67b480f207
2022-12-01 00:23:36 +00:00
Yurii Zubrytskyi
505d514184 Merge changes I94af279b,Id6e0e49d
* changes:
  Optimize filter/alias rebuilding in AssetManager2
  Make ApkAssets::IsUpToDate() @CriticalNative
2022-11-30 18:44:16 +00:00
Makoto Onuki
53f8439da4 Unhide the "SHORT_SERVICE" FGS type.
Bug: 257270313
cts-coverage-bug: 260748204
Test: manual test with a test app.
Change-Id: I2e40b26a971c777971c28fb733ef9e72766c04c7
2022-11-30 10:01:31 -08:00
Felka Chang
1b8935ae7b Merge "Add self-targeting constructor in FabaricatedOverlay" 2022-11-30 12:20:15 +00:00
Chun-Wei Wang
28b621620b Merge "Install constraints API" 2022-11-30 11:22:22 +00:00
Yurii Zubrytskyi
fbdfba51b3 Make ApkAssets::IsUpToDate() @CriticalNative
This function keeps being called hundreds times per second

Bug: 237583012
Test: Build + boot + UTs

Change-Id: Id6e0e49d561e0c81f6960a5fd77b2076892bd339
2022-11-30 01:00:34 -08:00
felkachang
f661351bad Add self-targeting constructor in FabaricatedOverlay
When the app wants to overlay its resource in runtime, it’s a
SelfTargeting scenario. This patch adds a new builder
constructor in FabaricatedOverlay for SelfTargeting.  It's
 `Builder(@NonNull String overlayName, @NonNull String targetPackage)`.

The app needs to pass 2  parameters.
* the overlay name
* target package to be overlaid

This patch also marks the nullability and checks the arguments of
`setResourceValue` and it needs related CTS tests to verify the
nullability.
* setResourceValue

Test: atest \
          OverlayHostTests \
          OverlayDeviceTests \
          SelfTargetingOverlayDeviceTests \
          OverlayRemountedTest \
          FrameworksServicesTests:com.android.server.om \
          CtsContentTestCases:android.content.om.cts \
          idmap2_tests

Bug: 205919743
Change-Id: Ie8e2de13076c9d28bbcf7ee52deab91114f7ec57
2022-11-30 13:08:13 +08:00
TreeHugger Robot
966144cc5e Merge "Let self-targeting apps be able access OverlayManager" 2022-11-30 01:59:19 +00:00
William Loh
fe266d0918 Merge "Add API to skip application enable in install flow" 2022-11-30 01:31:05 +00:00
Nick Kovacs
29bc594ae0 Merge "Enforce min installable target sdk version" 2022-11-30 00:11:00 +00:00
Tyler Freeman
7f0fb8234f Merge "feat(non linear font scaling)!: add FontScaleConverter for non-linear font scaling." 2022-11-29 23:43:18 +00:00
Tyler Freeman
5f7036df71 feat(non linear font scaling)!: add FontScaleConverter for non-linear font scaling.
Non-linear font scaling is meant to improve readability at larger font
scales: larger fonts will scale up more slowly than smaller fonts, so we
don't get ridiculously huge fonts that don't fit on the screen.

The thinking here is that large fonts are already big enough to read,
but we still want to scale them slightly to preserve the visual
hierarchy when compared to smaller fonts.

The FontScaleConverter converts SP dimensions to DP, to be used in
TypedValue.applyDimension() which will affect most TextViews and font
sizes automatically.

For now, all the lookup tables are hardcoded. A follow-up CL will make
them configurable via XML. The hardcoded arrays also default to a linear
curve, as to not break any tests. The non-linear curve will come in a
follow-up CL, to make it easier to roll-back if requested.

Also included is some Javascript to generate the hardcoded arrays, which
can later be manually tweaked and optimized.

Test: unit, CTS, and manual:
1. Run `adb shell settings put system font_scale 2.0`
2. Check different apps to see if they are readable.

Bug: b/237558231

Change-Id: I17d67252bf31f55e57e1f3e8a0f638770e6d2cfd
2022-11-29 12:09:02 -08:00
Nick Kovacs
ee536b9dcf Enforce min installable target sdk version
This change will block the installation (but not the execution)
of apps that do not meet the minimum target sdk version.

The intention is to improve security and privacy by blocking low
target sdk apps as malware can target older sdk versions to avoid
the enforcement of new API behavior.

This change is fenced off by a feature flag. The plan is to
progressively ramp up the min_installable_target_sdk version
up to version 23 for Android U.

Bug: 237321649
Test: adb shell device_config put package_manager_service MinInstallableTargetSdk__install_block_enabled true
Test: adb shell device_config put package_manager_service MinInstallableTargetSdk__min_installable_target_sdk 5
Test: adb install com.senecacreeksoftware.simpletip-3.apk (this app uses
target sdk 4)
Test: adb shell device_config put package_manager_service
MinInstallableTargetSdk__min_installable_target_sdk 6
Test: adb install com.senecacreeksoftware.simpletip-3.apk
Test: adb shell device_config put package_manager_service
MinInstallableTargetSdk__min_installable_target_sdk 23
Test: Attempted side load install via files app
Test: Attempted install from Play Store of low target sdk app

Change-Id: Id86c65d088b62b0a9b36734c14fbf919fa458e32
2022-11-29 18:21:15 +00:00
Jing Ji
813816a4cc Merge "Add health connect permissions to FGS type "health"" 2022-11-29 17:14:44 +00:00
felkachang
1cbf6fbbb4 Let self-targeting apps be able access OverlayManager
Self-targeting apps can't get an OverlayManager instance without the
system privilege.  This patch makes sure that the self-targeting
application can get an OverlayManager instance via Context.

```
OverlayManager overlayManager =
         context.getSystemService(OverlayManager.class);
```

In order to make the self-targeting feature compatible in the future,
this patch adds SELF_TARGETING_OVERLAY compatibility feature.

Test: atest \
          OverlayHostTests \
          OverlayDeviceTests \
          SelfTargetingOverlayDeviceTests \
          OverlayRemountedTest \
          FrameworksServicesTests:com.android.server.om \
          CtsContentTestCases:android.content.om.cts \
          idmap2_tests

Bug: 205919743
Change-Id: Ib0b619a2a54e22d31e6c14bf700e421688b6f506
2022-11-30 00:49:42 +08:00
Matt Gilbride
8e7404af95 Merge "Add parameters to @PermissionMethod" 2022-11-28 20:07:34 +00:00
Nikita Ioffe
d063f91638 Merge "Register managers provided by the com.android.virt APEX" 2022-11-25 14:51:56 +00:00
Nikita Ioffe
167b913ad4 Register managers provided by the com.android.virt APEX
This allows apps to retrieve an instance of VirtualMachineManager via
Context.getSystemService() API.

Bug: 249093790
Test: builds
Test: atest --test-mapping packages/modules/Virtualization:avf-presubmit
Change-Id: I488c275343753f2a3af6270cbad2ab02f33f203f
2022-11-24 16:39:13 +00:00
JW Wang
1c61ab5cb2 Install constraints API
Design doc: go/installconstraints

Install constraints are the requirements for a session
to proceed installation. The API can be used by app stores
to deliver auto-updates without disrupting the user
experience.

This CL addes PackageInstaller#checkInstallConstraints
which can be used by installers to check whether
constraints are satisfied before installing a package.

Bug: 235306967
Test: atest CtsStagedInstallHostTestCases
Change-Id: I3b66a3bf5b6f9411bdb3ea27d6c4ff11a53a17e0
2022-11-24 16:07:00 +08:00
Jing Ji
3d3659bc1d Rename android.app.ForegroundServiceTypeNotAllowedException to
..android.app.InvalidForegroundServiceTypeException.

And also add MissingForegroundServiceTypeException.

Bug: 254662240
Bug: 246792057
Test: atest CtsAppFgsTestCases
Change-Id: I9d39cb7fa75a14eb1b8cc97af13b612491803b61
2022-11-23 21:31:12 -08:00
TreeHugger Robot
2064ae92ad Merge "AudioDeviceVolumeManager and VolumeInfo API changes" 2022-11-24 03:07:56 +00:00
Charlie Wang
bf720fc448 Merge "WearableSensing framework API for wearables." 2022-11-24 02:18:37 +00:00
Almaz Mingaleev
b799b6cf59 Merge "Clean-up after TZUvA feature removal." am: 06b9abf013 am: ac0cf4e9ae am: fe16fe6f8c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2300422

Change-Id: Ifd1e49c1611ed2d55337609e5d07d43761f3e44d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-23 18:37:04 +00:00
Jean-Michel Trivi
283a4c7153 AudioDeviceVolumeManager and VolumeInfo API changes
Context service name for accessing AudioDeviceVolume manager.
Address API comments on VolumeInfo and AudioDeviceVolumeManager.
Add support in VolumeInfo to know whether it carries an explicit
  mute/unmute information (vs just default value of isMuted()).

Bug: 244326361
Test: atest android.media.audio.cts.AudioDeviceVolumeManagerTest
Test: atest android.media.audio.cts.VolumeInfoTest
Change-Id: Id718fbd7e0d5795ac480d9188faad4a70fba9808
2022-11-23 18:14:47 +00:00
Almaz Mingaleev
fe16fe6f8c Merge "Clean-up after TZUvA feature removal." am: 06b9abf013 am: ac0cf4e9ae
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2300422

Change-Id: Id8a86a06c500d6e58571ec903a4238613597eae8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-23 11:28:16 +00:00
Almaz Mingaleev
ac0cf4e9ae Merge "Clean-up after TZUvA feature removal." am: 06b9abf013
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2300422

Change-Id: I1d9b114c135f7e3c80613ae1f7b32346cd0b258f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-23 11:02:13 +00:00
Almaz Mingaleev
06b9abf013 Merge "Clean-up after TZUvA feature removal." 2022-11-23 10:16:21 +00:00
Jing Ji
2d49689f32 Add health connect permissions to FGS type "health"
Bug: 246792057
Bug: 254662338
Test: atest CtsAppFgsTestCases
Change-Id: I95be5f3f69c35299bb0edc998b40b103f3963d17
2022-11-22 20:13:58 -08:00
William Loh
e677b4717e Add API to skip application enable in install flow
This CL addes a new API to PackageInstaller.SessionParams that can be
used to skip the app enable step during the package install flow. This
can be used by installers to keep the app's existing enabled state
after a upgrade instead of setting it to enabled by default.

This also corrects the variable userId used in the enable step to
currentUserId that was preventing it from enabling the app when
installed for all users.

Bug: 244430570
Test: atest PackageManagerShellCommandTest#testAppUpdateSkipEnable
Change-Id: I42b003f8c42a7f8c45a581bd9383c78090462d0f
2022-11-22 20:08:15 +00:00
mattgilbride
8e806dd2b1 Add parameters to @PermissionMethod
- orSelf: signifies that this method checks if the calling process OR
  the current process has the permission
- anyOf: signifies that if this method checks multiple permissions,
  the check passes if ANY ONE of the permissions is granted
- value (default parameter): a hard coded list of permissions that this method checks.
  This parameter is useful for static analysis, where the implementation
  of some @PermissionMethod may not be visible across library
  boundaries.  A good example of this is
  NetworkStack#checkNetworkStackPermission, which is a source in
  framework-minus-apex, but is used from services.core.unboosted.  Since
  it passes straight into a helper which checks the actual permissions,
  it's not possible for lint running on services.core.unboosted to see
  which permissions are checked.

Bug: 247537842
Test: TH
Change-Id: Ia5d92149763766576602f5d84a86c67f6fb7e96d
2022-11-22 19:04:17 +00:00
Sudheer Shanka
6fe293bbae Merge "Allow senders to specify the delivery group via matching filters." 2022-11-22 12:01:06 +00:00
Sudheer Shanka
7645452cd1 Allow senders to specify the delivery group via matching filters.
Senders can specify an IntentFilter object that should match
against another broadcast intent to be considered in the same
delivery group.

Bug: 249160234
Test: atest services/tests/mockingservicestests/src/com/android/server/am/BroadcastRecordTest.java
Test: atest services/tests/mockingservicestests/src/com/android/server/am/BroadcastQueueModernImplTest.java
Test: atest tests/app/src/android/app/cts/BroadcastOptionsTest.java
Test: atest tests/tests/content/src/android/content/cts/IntentFilterTest.java

Change-Id: I36f1e3ffab8e30371a9968cb23c7b345c3301682
2022-11-22 01:04:29 +00:00
Ömer Yaveroğlu
e9a45e095b Fix the bug where the added field into the toString implementation does
not have a corresponding %s formatting.

Bug: 239134974
Test: atest frameworks/base/core/tests/coretests/src/android/content/integrity
Test: atest services/tests/servicestests/src/com/android/server/integrity
Change-Id: Ib9c3ecadfc5a823cd4fcd44237b25900f86b4e5c
2022-11-18 22:34:54 -08:00
Patrick Baumann
3daff41c2c Merge "Expanding owners for /pm/" am: 43023f5f04 am: 199e2ed6ba am: 419935579f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2305613

Change-Id: I3225b15bc6295b5977f5f71602552f66075aa9c9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-18 05:35:04 +00:00
Patrick Baumann
419935579f Merge "Expanding owners for /pm/" am: 43023f5f04 am: 199e2ed6ba
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2305613

Change-Id: I67c520ee2249c63455d0754c4979fb611a5fb39e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-18 05:00:24 +00:00
Patrick Baumann
199e2ed6ba Merge "Expanding owners for /pm/" am: 43023f5f04
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2305613

Change-Id: I22a8a053aa15ac48b53d4bb8ddfab394291f9ffd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-18 04:33:51 +00:00
Hai Zhang
9ed9b9a5e7 Merge "Expose PermissionInfo.PROTECTION_FLAG_VENDOR_PRIVILEGED as system API." 2022-11-18 00:04:47 +00:00
Patrick Baumann
e0fe83be5c Expanding owners for /pm/
Change-Id: If9e5553ef34004c20ed628c89ba74ae82120c15f
2022-11-17 23:24:19 +00:00
TreeHugger Robot
e27a387a63 Merge "Add constants "short service" foreground service" 2022-11-17 18:24:41 +00:00
Charlie Wang
6908f1db77 WearableSensing framework API for wearables.
WearableSensing framework APIs are intended to be used to interact and
manage the WearableSensingService. The WearableSensingService provides
an isolated service environment for an application to provide a remote
data stream to and run sensing workloads on the data stream. Clients
that want to use this API must hold the permission
MANAGE_WEARABLE_SENSING_SERVICE. The permission protection level is signature|privledged.

API overview: go/wearable-sensing-api
Design doc: go/trusted-glasses

A follow up CL will implement the integration between
WearableSensingService and AmbientContextManager. A subsequent follow up
will also add unit and cts testing.

Bug: 244181656, 249135378
Test: Builds.
Ignore-AOSP-First: to prevent new feature leak.
CTS-Coverage-Bug: 259453662
Change-Id: I0c5e3c5aa01dda9d3289733abd22abfcccc15f96
2022-11-17 08:47:47 -08:00
Makoto Onuki
f36f22de3e Add constants "short service" foreground service
Aslo add the timeout callback.

All APIs are still hidden.

Bug: 257270313
Test: Build
Change-Id: I9868de22a343e97c83cc2524cf81aec159aa62ab
2022-11-16 14:51:40 -08:00
Cintia Martins
9931f45e39 Merge "Fixed Attribution Source’s calling Uid check for multiuser." am: ec48cfcfcd am: 8e151a5245
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2301147

Change-Id: Icadd7fed74b27fdd82248d0f47027d9547d334e8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-16 21:16:04 +00:00
Cintia Martins
8e151a5245 Merge "Fixed Attribution Source’s calling Uid check for multiuser." am: ec48cfcfcd
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2301147

Change-Id: I8885ae1fbf8bfdd7b5f67f95ad3cad6c81d11b2d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-16 20:53:25 +00:00