Commit Graph

12269 Commits

Author SHA1 Message Date
TreeHugger Robot
e2ce20253b Merge "Consolidate UserID+Package classes." 2022-11-02 01:12:23 +00:00
Jackal Guo
62185c378a Merge "Revise the return type of #getLabel" 2022-11-01 03:59:19 +00:00
Kweku Adams
c6a6194824 Consolidate UserID+Package classes.
https://xkcd.com/927/

Many different components have created their own classes to represent a
userID+packageName combination. This means 1) duplicate code, 2)
duplicate objects in memory representing the same thing. Creating a
common class that limits itself to one object per userID+packageName
combo addresses those two concerns.

There are still others with similar classes. They're not included in
this CL because they have slight differences and would require a little
bit more work to consolidate.

Bug: 141645789
Bug: 247127880
Test: atest CtsAccountManagerTestCases
Test: atest CtsContentTestCases:OverlayManagerTest
Test: atest CtsShortcutManagerTestCases
Test: atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/tare
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/om
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/pm
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/tare
Test: atest FrameworksMockingServicesTests:PrefetchControllerTest
Test: atest FrameworksMockingServicesTests:QuotaControllerTest
Change-Id: I63d5bc946cc7b24a0536e8b2051da07a801b3a8a
2022-10-31 14:57:28 +00:00
Wenhao Wang
5d57481569 Merge "Init BackgroundInstallControlService" 2022-10-28 02:12:49 +00:00
Wenhao Wang
7843bbb2f0 Init BackgroundInstallControlService
The BackgroundInstallControlService monitors background installed apps.
It can provide the list of those apps to the service clients via binder.
See the following desgin doc and PRD for more details.
go/bg-install-control
go/BIC-prd

Bug: 244216300
Test: manual test (verify the binder service is published)
Change-Id: Ic45770061c1291ef3e650337514fca99e0c683b8
2022-10-27 03:24:08 +00:00
Thiébaud Weksteen
ea6b13120e Merge "Add PermissionEnforcer class" 2022-10-26 22:20:23 +00:00
Sudheer Shanka
755b166f80 Merge "Allow senders to specify "merged" delivery group policy." 2022-10-26 15:56:07 +00:00
Miranda Kephart
61d755d88a Merge "Add IS_REMOTE extra for ClipData" 2022-10-26 15:13:55 +00:00
Santiago Seifert
fd4dfc79e0 Merge "Non-functional simplification of ComponentName.equals" am: 00c792bba0 am: 13202ef31e am: fdb083e349
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2268166

Change-Id: I432ab6b98471c46357f2d7db9839985fb57e77eb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-26 13:02:29 +00:00
Santiago Seifert
13202ef31e Merge "Non-functional simplification of ComponentName.equals" am: 00c792bba0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2268166

Change-Id: Ieafb7c7bfdc5daa5c0d10afb87a2a6303619d8be
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-26 12:06:28 +00:00
Sudheer Shanka
c2a195074b Allow senders to specify "merged" delivery group policy.
Bug: 249160234
Test: atest FrameworksMockingServicesTests:BroadcastQueueTest
Test: atest FrameworksMockingServicesTests:BroadcastQueueModernImplTest
Change-Id: Ic998c98e85b17e8d6958178904d901d4c6fd553b
2022-10-26 10:41:34 +00:00
Jackal Guo
0ac143f39b Revise the return type of #getLabel
Address the feedback of API review, and change the return type
to CharSequence.

Bug: 255592779
Test: atest CtsContentTestCases:PreapprovalDetailsTest
Test: atest CtsPackageInstallTestCases:PreapprovalInstallTest
Change-Id: I777d54e8b9614f87c8a899c49ea476792ca8c515
2022-10-26 12:57:39 +08:00
Hai Zhang
5611f58784 Merge "Move TypedXml{Parser,Serializer} to modules utils package." 2022-10-25 02:44:29 +00:00
Jackal Guo
c97fc0ca28 Merge "Add a switch for pre-approval request" 2022-10-25 01:53:13 +00:00
Santiago Seifert
868f2e071f Non-functional simplification of ComponentName.equals
Bug: 205124386
Change-Id: Ib9c895592ed67e10cb965890cd67499bd55e444d
Test: atest ComponentNameTest
2022-10-24 18:17:33 +00:00
Adam Bookatz
9bdbc5786d Merge "getUserPropertiesCopy handles Query/Manage perms" 2022-10-24 18:14:47 +00:00
Mary Xia
5dc888399c Merge "Define a new manifest attribute targetDisplayCategory in <activity> tag and parse into ActivityInfo through string validation" 2022-10-24 17:43:52 +00:00
Adam Bookatz
6d410f10e8 getUserPropertiesCopy handles Query/Manage perms
getUserPropertiesCopy should use the standard way of querying whether a
caller has Query or Manage users permission. In particular, a caller
that has Manage should be treated as though it has Query as well, which
this cl will ensure. Some variable names and comments are updated to
make this clearer.

Test: atest UserManagerServiceUserPropertiesTest
Change-Id: I6ba312b27e6ab47498a03ecac6c1ffd6f60442e8
2022-10-21 14:53:17 -07:00
Mary Xia
dc8eab4039 Define a new manifest attribute targetDisplayCategory in <activity> tag and parse into ActivityInfo through string validation
Test: atest PackageParserTest or atest ParsedActivityTest
Bug:233910285

Change-Id: I8306b93e9479135f319837108f943192f93fe8de
2022-10-21 14:50:21 +00:00
Hai Zhang
e55b8eeb28 Move TypedXml{Parser,Serializer} to modules utils package.
A subsequent change will actually move the files to the other git
project.

Bug: 243194720
Test: presubmit
Change-Id: If126bb68f74852528c4da8df79831b49b5129983
2022-10-21 04:28:13 -07:00
Amos Bianchi
62e8cf3a70 Add Device Lock service to system server.
Bug: b/241442337
Bug: b/228907574
Test: service successfully starts
Test: atest DeviceLockUnitTests
Test: cts-tradefed run cts -m CtsDeviceLockTestCases

Change-Id: I928d697c4040168955090712547c973a9e7ff61c
2022-10-20 22:50:42 -07:00
Jackal Guo
1d1eb8e621 Add a switch for pre-approval request
In case we decide not to provide pre-approval request to installer
for some reason (e.g., feature off), we need a way to disable this,
and let callers know the typical flow will be needed instead.

Bug: 242677131
Test: atest CtsPackageInstallTestCases:PreapprovalInstallTest
Change-Id: I42dead8044597238588dcf55ddd7d617ac21f671
2022-10-21 13:24:45 +08:00
Miranda Kephart
6de38c8840 Add IS_REMOTE extra for ClipData
This extra can be used to indicate that a ClipData comes from a
separate device rather than being local. It is a rendering hint
that can be used to take different behavior based on the source
device of copied data.

Bug: 246808749
Test: manual (no behavior change)
Change-Id: I6998b7a216fac73a1387367f4179efb95d7562c5
2022-10-20 13:51:19 -04:00
Jeff Sharkey
f7b7e8bcab Merge changes from topic "oct11"
* changes:
  BroadcastQueue: Handle successor ProcessRecords.
  More robust ProcessRecord routing for resultTo.
2022-10-18 21:37:39 +00:00
Vladimir Komsiyski
cd8f204717 Merge changes from topic "virtual-device-context"
* changes:
  Add deviceId to Context and allow for creating Contexts with different deviceId.
  Open the visibility of VirtualDeviceManager and VirtualDeviceManager#getVirtualDevices.
  Add an API to get the details of all virtual devices.
2022-10-18 06:36:52 +00:00
Vladimir Komsiyski
7c1be3298d Add deviceId to Context and allow for creating Contexts with different deviceId.
Applications may create contexts associated with the default host device or with any virtual device. The only way to create a non-default device context for now is via an explcit createDeviceContext call.

Bug: 239152561
Test: atest FrameworksCoreTests:ContextTest
Change-Id: If18dc7661fb232b0bc40121c723673ba880be9d5
2022-10-17 17:45:53 +02:00
Vladimir Komsiyski
0050a51961 Open the visibility of VirtualDeviceManager and VirtualDeviceManager#getVirtualDevices.
Bug: 239152561
Test: n/a
Change-Id: Ib504a3bad36072730a527b139de945874ec4741a
2022-10-17 17:44:12 +02:00
Jeff Sharkey
a515632319 More robust ProcessRecord routing for resultTo.
To deliver a "resultTo" listener for a broadcast intent, we need to
know about the ProcessRecord we're returning the result to, so that
we can potentially unfreeze them and sequence the response through
their main thread.

Also offer to lookup the "system_server" process when the caller
provides an in-process resultTo instance; this smoothly handles
dozens of situations where the system sends broadcasts without
having easy access to its own ProcessRecord.

Bug: 251486235
Test: manual
Change-Id: I1ff58a0e918b620def25a056624f093d951667a6
2022-10-17 09:40:45 -06:00
Winson Chiu
b41437f51f Merge "Move SystemConfig to services.jar" 2022-10-14 20:06:56 +00:00
Winson Chiu
9efbc1352b Move SystemConfig to services.jar
Migrates getDefaultVrComponents used by SettingsProvider and
adds a flag for hidden API enforcement to ApplicationInfo.

This removes any dependency on SystemConfig from core/ and
so it can be moved into services/core and exposed as a
mainline API.

This was done instead of exposing all of the methods through
SystemConfigManager, as that is designed for use across
processes, and it's more efficient to expose SystemConfig
directly for modules running in the server process.

Although VrManager is a nullable service, so getDefaultVrComponents
had to live there to simplify the logic and maintain the existing
behavior.

Bug: 236389629

Change-Id: I4c2b14e1d34aaf439ceb1a3f9c8207e5d39fa6c2
2022-10-13 15:54:15 +00:00
Thiébaud Weksteen
db259e0e45 Add PermissionEnforcer class
Defines a new PermissionEnforcer class used to check permission as part
of the @EnforcePermission AIDL annotation. It is registered as a system
service to avoid the cost of creating a new object for each new client.

Bug: 234083358
Test: TH
Change-Id: I2bd23f62a0d207ddac6bbe69666ced96e77ba16f
2022-10-13 14:21:01 +00:00
Jackal Guo
9cbc89c25b Merge changes from topic "pre-commit-install"
* changes:
  Refactoring PackageInstallerSession (4/n)
  Handle pre-commit install session in PackageInstaller (3/n)
  Pre-commit install approval (2/n)
2022-10-12 23:57:39 +00:00
Yurii Zubrytskyi
ab3cb30aa0 Ensure no duplicates in ThemeKey
Some apps keep adding the same resources to their theme key
objects on e.g. switching dark mode. Need to be prepared to
limit the size of the arrays, otherwise theme switching gets
slower with each toggle

+ a bit more efficient native handling

Bug: 242005877
Test: manual, 10k of theme switches with no noticable slowdown
Change-Id: Icf74770bd41ebeb0a31f527ae3616de00f23b0ae
2022-10-11 12:23:42 -07:00
Winson Chiu
6d17ac0a33 Merge "Expose some package APIs for ART" 2022-10-11 15:35:47 +00:00
Anna Zhuravleva
4d05eedd75 Merge "Add Health Connect service to the StringDef." 2022-10-11 10:27:46 +00:00
Anna Zhuravleva
12c426c01a Add Health Connect service to the StringDef.
Bug: 251393380
Test: build
Change-Id: I031dadd324c5565cf3eb46aa1d9aa72a234d53f0
2022-10-10 17:23:28 +00:00
Brandon Liu
4146674d06 Have AssetFileDescriptor.AutoCloseInputStream use pread
Previously two AssetFileDescriptors pointing to the same file could be
using the same underlying file descriptor and reading from both would
provide unexpected results since they would both modify the file offset
in the kernel data structure.

Test: Added testTwoFileDescriptorsWorkIndependently() to
android.content.res.cts.AssetFileDescriptor_AutoCloseInputStreamTest
Test: atest AssetFileDescriptor_AutoCloseInputStreamTest
Fix: 168310122

Change-Id: Ibf3c9ff0207544e3b227511aae93c8f4ddf52867

Override getChannel() in AssetFileDescriptor.AutoCloseInputStream

Previous fix do not have getChannel() handled which caused issues. This
is to override getChannel().

Test: Added testGetChannel() to
android.content.res.cts.AssetFileDescriptor_AutoCloseInputStreamTest
Test: atest AssetFileDescriptor_AutoCloseInputStreamTest
Bug: 168310122

Change-Id: I472655c91491fd33ef0c2631d94fc0b8d0328404

Adding OffsetCorrectFileChannel help to correct offset

Test: Added testGetChannel() to
android.content.res.cts.AssetFileDescriptor_AutoCloseInputStreamTest
Test: atest AssetFileDescriptor_AutoCloseInputStreamTest

Bug: 168310122
Change-Id: I9ed584ac795cabbed6a4e297c61c224233b9575c
2022-10-08 17:37:03 +00:00
Winson Chiu
584867717f Expose some package APIs for ART
This was separated out to make review easier. Applies @SystemApi
to expose a subset of PackageState and its child type APIs.

Bug: 235462722
Bug: 246609797
Bug: 244444049
Bug: 229089418
Bug: 229090204
Bug: 229090094

Test: presubmit

Change-Id: Ifc0ee3584347a79fbb0e7815d42bac6d2c2f3a4a
2022-10-07 20:37:54 +00:00
Jackal Guo
0016ca0496 Refactoring PackageInstallerSession (4/n)
Move some minor changes into this smaller independent CL for better
reviewing.

Bug: 242677131
Test: atest CtsPackageInstallTestCases
Change-Id: I71db4c272c355c97251e812881f361ea32b7666f
2022-10-06 15:21:27 +08:00
Jackal Guo
b0ff86efa9 Pre-commit install approval (2/n)
Introduce a new mechanism to allow developers requesting the approval
from users for an install before committing the session and without
any of the APK file.

Bug: 242677131
Test: atest CtsPackageInstallTestCases
Change-Id: I38029d9dbf28f03b81e4988f1f864e552129c957
2022-10-06 15:18:29 +08:00
Matt Gilbride
01a8beee3f Merge "Add @PermissionName annotation to complement @PermissionMethod" 2022-10-04 15:41:17 +00:00
mattgilbride
af19a09a4f Add @PermissionName annotation to complement @PermissionMethod
For use by static analysis, @PermissionMethod documents
the methods in the platform that perform permission "checks" (e.g.
context.enforceCallingOrSelfPermission).

@PermissionName denotes that the annoated String is a permission name.
It is typically used to annotate the argument to a @PermissionMethod
that is the permission value.  This is consumed by static analysis, for
example when helper methods wrap @PermissionMethod calls to pass a hard
coded permission value e.g. "enforceAudioSettingsPermission".

See: go/enforcepermission-migration-design
Bug: 247537842
Test: Tested manually, ultimately will be tested in presubmit (atest
AndroidFrameworkLintCheckerTest, see b/240445172)

Change-Id: I811ae923de62046e782ec7b109a0f99483dab4b2
2022-10-03 14:59:38 +00:00
Helen Qin
20ff355163 Framework credential manager developer APIs definitions.
The CredentialManager module provides solution for developers to create
or get credential from a user that can be used to authenticate to the app.
It can potentially launch system level UI flows to collect user consent,
render a unified selector when more than one credential exists, and
perform anything else needed.

Check bug id for detailed design.

Note that this is still very early stage of productionizing the module
and proper test cases will be added subsequently when the service
gets more concrete business logic.

Bug: 246564035
CTS-Coverage-Bug: 246637346
Test: Local Build & Deployment
Change-Id: Ia5884a7f6a3908de3b8b4b29f154f98e25730bd7
2022-10-03 07:28:30 +00:00
Anna Zhuravleva
8b0ce1fbac Merge "Add HealthConnect system service scaffold." 2022-09-30 15:05:30 +00:00
Anna Zhuravleva
5bdd56de55 Add HealthConnect system service scaffold.
Setup scaffold for the Health Connect system service.
This service will provide system APIs to read and write
health data.

Bug: 249321392
CTS-Coverage-Bug: 248508112
Test: atest android.healthconnect.cts
Change-Id: I503c24a039c37d09895fc4f73a1de1a13eeb72b0
2022-09-29 16:03:25 +00:00
TreeHugger Robot
1df179f411 Merge "Introduce PreapprovalDetails class (1/n)" 2022-09-29 06:46:55 +00:00
TreeHugger Robot
fdfde64c82 Merge "Log resource api times to statsd" 2022-09-28 15:57:27 +00:00
Lee Shombert
1452bc759a Log resource api times to statsd
Bug: 246953799

Log resource api times to statsd.  Two APIs are logged:
getResourceValue() and retrieveAttributes().  Other APIs may be timed
by the runtime layer but these are not logged.

This fixes a bug in ResourceTimer.startTimer() that caused the class
to skip the first repeated publication point.

This change renames the two RecourceTimer instances in
android_util_AssetManager.cpp to "_timer" to be more explicit and to
avoid the use of the more generic "_tag".

Test: manual
Change-Id: I0c5e0906f79ff35db1e34593275b39fb7f2f179b
2022-09-27 10:47:02 -07:00
Ahaan Ugale
f531cf31c0 Merge "Add credential manager FEATURE_ constant to Package Manager Test: Manual. Built locally Bug: 248609653" 2022-09-27 15:12:03 +00:00
Matt Gilbride
f4ea4c04e6 Merge "Add @PermissionMethod annotation" 2022-09-27 14:55:21 +00:00