Commit Graph

12301 Commits

Author SHA1 Message Date
Cole Faust
22deef8d08 Merge "[conflict] Merge "Fix errorprone warnings that should be errors" am: 677d6cd780 am: f9df26ae3c am: d3c499dabc" 2022-11-16 03:17:38 +00:00
Jing Ji
cba1edbc25 Merge changes from topic "fgs_246792057_type"
* changes:
  Implement the foreground service type enforcement
  Introduce foreground service type enforcement
2022-11-16 02:03:28 +00:00
Cole Faust
e4abcbec1d [conflict] Merge "Fix errorprone warnings that should be errors" am: 677d6cd780 am: f9df26ae3c am: d3c499dabc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2256563

Change-Id: I84d67fdfcc99f9f6fca218d4264ab8e0bc1f1653
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-15 19:47:41 +00:00
Cole Faust
d3c499dabc Merge "Fix errorprone warnings that should be errors" am: 677d6cd780 am: f9df26ae3c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2256563

Change-Id: I8090e254f06a3b5fc7e9b23fdae6c5bd3db230c5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-15 19:37:15 +00:00
Cole Faust
f9df26ae3c Merge "Fix errorprone warnings that should be errors" am: 677d6cd780
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2256563

Change-Id: I0e9c5077610407a117ee34ff688b40b52e161a03
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-15 19:11:55 +00:00
Oli Lan
327a277684 Merge "Add isMainUser system API." 2022-11-15 18:05:57 +00:00
Jing Ji
8e4ffc82c2 Introduce foreground service type enforcement
All foreground services are required to declare a type now, or
it'll get a ForegroundServiceTypeNotAllowedException if the app's
target SDK level is Android U or later.

Upon starting the foreground service, the app is required to
have been granted with the proper permissions which are required
by the foreground service types it's starting with.

Deprecated the type "none" and "dataSync", introduced new types:
"heath", "remoteMessaging", "systemExempted" and "specialUse".

The implementation of the enforcement will be in a follow up CL.

Bug: 246792057
Bug: 254662338
Test: atest CtsAppFgsTestCases
Change-Id: I54e60b443df8134653379a6ff13e00ed14d3f194
2022-11-15 05:18:24 -08:00
Oli Lan
f8a6722afc Add isMainUser system API.
This adds an API to determine if the context user is the designated
main user on the device. This user may have access to features which
are limited to a single user on the device.

In Android U, this will be the first user to go through setup.

On regular devices, this will be the system user, but on devices in
No Primary User / Headless System User Mode, it will be a different
user.

The isPrimaryUser System API is confusing because it actually always
returns the system user, even in headless mode. That API is deprecated
in this change.

On devices that are upgrading, if they are non-headless, the system user
will be the main user. If they are headless, the full user with the
earliest creation date will be given the flag.

Bug: 256624031
Test: atest UserManagerTest
Change-Id: Ib36f3b372f9bf33cbb097c4af63eb43515ac835b
2022-11-15 10:47:38 +00:00
Cole Faust
7da659bb6c Fix errorprone warnings that should be errors
This commit is part of a large scale change to fix errorprone
errors that have been downgraded to warnings in the android
source tree, so that they can be promoted to errors again.
The full list of changes include the following, but not all
will be present in any one individual commit:

BadAnnotationImplementation
BadShiftAmount
BanJNDI
BoxedPrimitiveEquality
ComparableType
ComplexBooleanConstant
CollectionToArraySafeParameter
ConditionalExpressionNumericPromotion
DangerousLiteralNull
DoubleBraceInitialization
DurationFrom
DurationTemporalUnit
EmptyTopLevelDeclaration
EqualsNull
EqualsReference
FormatString
FromTemporalAccessor
GetClassOnAnnotation
GetClassOnClass
HashtableContains
IdentityBinaryExpression
IdentityHashMapBoxing
InstantTemporalUnit
InvalidTimeZoneID
InvalidZoneId
IsInstanceIncompatibleType
JUnitParameterMethodNotFound
LockOnBoxedPrimitive
MathRoundIntLong
MislabeledAndroidString
MisusedDayOfYear
MissingSuperCall
MisusedWeekYear
ModifyingCollectionWithItself
NoCanIgnoreReturnValueOnClasses
NonRuntimeAnnotation
NullableOnContainingClass
NullTernary
OverridesJavaxInjectableMethod
ParcelableCreator
PeriodFrom
PreconditionsInvalidPlaceholder
ProtoBuilderReturnValueIgnored
ProtoFieldNullComparison
RandomModInteger
RectIntersectReturnValueIgnored
ReturnValueIgnored
SelfAssignment
SelfComparison
SelfEquals
SizeGreaterThanOrEqualsZero
StringBuilderInitWithChar
TreeToString
TryFailThrowable
UnnecessaryCheckNotNull
UnusedCollectionModifiedInPlace
XorPower

See https://errorprone.info/bugpatterns for more
information on the checks.

Bug: 253827323
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I8446f9076a45ebf7e7ffa06cb0d4ddb1001b6c00
2022-11-14 17:57:30 -08:00
Yurii Zubrytskyi
67a8c66c19 Merge "Replace often searched ArrayList with ArraySet" 2022-11-15 00:19:53 +00:00
Jeremy Meyer
558358612b Merge "implement drawable frros" 2022-11-14 22:35:08 +00:00
Daniel Kim
ba16af7804 Merge "Update the proximity feature to return proximity levels" 2022-11-14 19:02:44 +00:00
Jeremy Meyer
a761f3325e implement drawable frros
Test: unit tests
Bug: 251283316
Change-Id: Iead53711c54596c3787eeba6dcf9ced129f94426
2022-11-14 18:38:12 +00:00
Daniel
2419ded7bb Update the proximity feature to return proximity levels
The original proximity feature which returned the distance in meters was
determined to be too privacy-invasive. AttentionManagerService continue
to receive proximity in distance from Attention Service, but
HotwordDetectedResult will map it
to different proximity levels, near and far. These proximity levels will be used in HotwordDetectionConnection. Use a RequiredServiceRule to make sure we only run the test if the device has the attention service

Bug: 253326426
Test: atest CtsVoiceInteractionTestCases
Change-Id: I4d55564c39d48dd1869d747beb37f81170c102f6
2022-11-14 00:21:23 +00:00
Yurii Zubrytskyi
da0b92b1ab Replace often searched ArrayList with ArraySet
ArrayList.contains() is the top function in PackageManager's
boot profile for IntenFilter.matchAction(). Replacing the arrays
with ArraySets makes those completely disappear.

Bug: 237583012
Test: build + boot
Change-Id: I659f802be54c5a3f70fd23688bbff1fb5f44cb51
2022-11-11 15:45:10 -08:00
Jigar Thakkar
5ab5bb8a5e Add new UserProperty to enable cross profile contact access
Adding a user property to dictate the behaviour to redirect
the contact calls to the parent user profile, thereby using
the parent's contacts database to serve its calls

Bug: 253004929
Test: atest UserManagerServiceUserPropertiesTest
Change-Id: Ifc81c067893aceab3afd8bf20fb7d931e3a529f9
2022-11-11 11:50:54 +00:00
TreeHugger Robot
d0795ca227 Merge "Use a single lock and add a flag." 2022-11-10 00:06:01 +00:00
Ankita Vyas
3d1d415843 Merge "Add new UserProperty InheritDevicePolicy" 2022-11-09 11:17:52 +00:00
Bishoy Gendy
6234d7472a Add support for a generic action to show output switcher in the platform.
- We need to add this action in the platform so that WearOS can also handle it, not only SysUi.
- Add tests for MediaOutputDialogReceiver class.
- Add android:priority=1 to the MediaOutputDialogReceiver so that it's always the default handler for the action.

Bug: 246997969
Test: atest MediaOutputDialogReceiverTest
Change-Id: I25d60eef7d4170b5f0b748b9b61ebf043a7c189c
2022-11-08 11:25:39 +00:00
Kweku Adams
c1a4a0dbfa Use a single lock and add a flag.
Using separate locks adds a little bit of overhead to the get method.
Switch to a single lock to minimize the performance cost.

Also add a control flag to disable caching in the future, if so desired.

Bug: 257054989
Test: atest CorePerfTests:AccountManagerPerfTest
Change-Id: I5bbcc54f28cbe3c434995af8b3452debfc68c4ee
2022-11-07 17:02:59 +00:00
Hai Zhang
fc09d61b99 Merge "Add knownCerts to system API and copy constructor." 2022-11-05 21:02:51 +00:00
Hai Zhang
ea82335c13 Add knownCerts to system API and copy constructor.
PermissionInfo.PROTECTION_FLAG_KNOWN_SIGNER is already @SystemApi, and
we need system API for accessing the actual certs in the modularized
permission subsystem.

The copy constructor missed knownCerts in ag/13504004 and is fixed now.
knownCerts isn't deep copied in the copy constructor because
PackageItemInfo.metaData isn't deep copied either.

Bug: 182523293
Test: atest CtsContentTestCases:PermissionInfoTest
Change-Id: I784764fdf7238f6b10455ff40c693de0823a94cb
2022-11-05 20:56:42 +00:00
“Ankita
8f2b774497 Add new UserProperty InheritDevicePolicy
Indicates whether and how user restrictions and device policies to be
inherited from parent profile.

Bug: 251401809
Test: atest UserManagerServiceUserPropertiesTest
Test: atest android.multiuser.cts.UserManagerTest
Test: atest com.android.server.pm.UserManagerTest

Change-Id: I899804813fbb2ad6c007600a14ce91cee89e7d88
2022-11-05 09:39:15 +00:00
Cintia Martins
7f02a673f9 Merge "Fixed Attribution Source’s calling Uid check for multiuser." 2022-11-03 16:48:43 +00:00
Ankita Vyas
7705b093cf Merge "Add new UserProperty ShowInSettings" 2022-11-03 03:37:39 +00:00
Thiébaud Weksteen
c0c3bb836c Add PermissionEnforcer class am: ec0d763059 am: 0c93fbab73
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2272966

Change-Id: I1d14cb0d037e5aee44447b057867e09ce781c0d6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-03 00:05:22 +00:00
Thiébaud Weksteen
0c93fbab73 Add PermissionEnforcer class am: ec0d763059
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2272966

Change-Id: If59d54d09ee650643d28b26ef41c245acea74f2a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-02 23:36:55 +00:00
TreeHugger Robot
e2ce20253b Merge "Consolidate UserID+Package classes." 2022-11-02 01:12:23 +00:00
“Ankita
3857c95563 Add new UserProperty ShowInSettings
Indicates whether apps in the given user profile should be displayed
with either parent, separately or not at all.

Bug: 235065648
Test: atest UserManagerServiceUserPropertiesTest
Test: atest android.multiuser.cts.UserManagerTest
Test: atest com.android.server.pm.UserManagerTest
Change-Id: I17e127cab37c11f806b535ab29762dd2a99716a5
2022-11-01 09:01:54 +00:00
Jackal Guo
62185c378a Merge "Revise the return type of #getLabel" 2022-11-01 03:59:19 +00:00
Cintia Martins
2332d49347 Fixed Attribution Source’s calling Uid check for multiuser.
The method UserHandle.getAppId() strips off the part of the Uid that is related to the current user (which may not be zero for multiuser).

Bug: 236100828

Change-Id: Ie27c8570ba2551b6d99d9848a0b2469fe76ac3d1
2022-10-31 21:28:14 +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
Miranda Kephart
c2f7a291ce Merge "Add IS_REMOTE extra for ClipData" into tm-qpr-dev am: 07d111f508
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20223086

Change-Id: I6e17daf127e59a31c597d822eb2dc045404442f4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-28 21:09:33 +00:00
Miranda Kephart
b4a5acfcc2 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)
Merged-In: I6998b7a216fac73a1387367f4179efb95d7562c5
Change-Id: I6998b7a216fac73a1387367f4179efb95d7562c5
2022-10-28 15:16:38 +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
ec0d763059 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
Merged-In: I2bd23f62a0d207ddac6bbe69666ced96e77ba16f
2022-10-27 12:12:11 +11: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