Commit Graph

97 Commits

Author SHA1 Message Date
Evan Severson
aacd48b0bc Implement permission revoke with reason
The reason is passed to app exit info so a given app can get more
information about why their app was killed in the event of permission
revoke.

Test: atest RevokePermissionTest ActivityManagerAppExitInfoTest#testPermissionChangeWithReason
Fixes: 159659620
Change-Id: Id711667eb2c1579ecb2a1b83a62af3cc7862d5f6
2020-06-24 10:03:54 -07:00
Adam Bookatz
36bacceee5 Clarify doc for users, clarifying profiles
Test: N/A
Bug: 159173436
Change-Id: I3c105559801a72ef1d91d9db2d42a816e27e24f6
Merged-In: I3c105559801a72ef1d91d9db2d42a816e27e24f6
2020-06-18 00:08:51 +00:00
Eugene Susla
44753b4c8f Correct javadoc for an auto-revoke API
Test: presubmit
Bug: 153607914
Change-Id: Ie271ecfbb3e9356080c28103df658b411ebd61ec
2020-05-21 11:03:37 -07:00
Philip P. Moltmann
1a4467816a No need for copying dump state for PC
Also
- enforce permission when dumping PC data

Bug: 155680199
Test: dumpsys permissionmgr
Change-Id: I2cacd6f9d8db0ea329de1d15c96bea9f2ae15dd1
2020-05-11 14:32:17 -07:00
Philip P. Moltmann
5ab27fca5c Forward dumps from PermissionControllerManager to permissionmgr
Test: adb shell dumpsys permissionmgr
Bug: 155680199
Change-Id: Iab5da24277eb6333ef047ab84dfcb65b7c4c2ff2
2020-05-06 17:24:40 -07:00
Philip P. Moltmann
fa658e0206 Merge "Fix typos in permissions.md" into rvc-dev 2020-04-27 21:18:40 +00:00
Philip P. Moltmann
14be93f59a Fix typos in permissions.md
Bug: 151379035
Change-Id: I1335ca5a0ed22b8a39a57adc22c6b3b0b5d6e06d
2020-04-27 16:10:39 +00:00
Philip P. Moltmann
18247c1a8c Allow tests for more PermissionControllerManager methods
Test: atest RuntimePermissionPresentationInfoTest PermissionControllerTest
Bug: 155019930
Change-Id: I4baca0f35e7218fbf127d56fcdf1fe1855d64929
2020-04-26 17:52:41 -07:00
Michael Groover
56a84b26f4 Refactor device ID access SystemAPI to PermissionManager
Based on feedback during the API review of the new SystemAPI for
telephony to check device identifier access the method was moved
from DevicePolicyManager to a more generic location to perform
the non-subscriber portions of the check.

Bug: 147761267
Test: atest TelephonyPermissionsTest
Test: atest PermissionManagerServiceTest
Test: atest DeviceIdentifierTest
Test: atest DeviceOwnerTest#testDeviceOwnerCanGetDeviceIdentifiers
Test: atest TelephonyManagerTest
Test: atest DeviceOwnerTest#testDeviceOwnerCannotGetDeviceIdentifiersWithoutPermission
Test: atest ManagedProfileTest#testProfileOwnerOnPersonalDeviceCannotGetDeviceIdentifiers
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testProfileOwnerCannotGetDeviceIdentifiersWithoutPermission
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testProfileOwnerCanGetDeviceIdentifiers
Change-Id: Ic1867dad0b2369f2dc1a7d31facb65f89131376f
2020-03-19 20:42:47 +00:00
Peter Wang
f4885bf28f Merge "[Telephony Mainline] Hide all PermissionManager APIs for R" into rvc-dev 2020-03-19 19:21:21 +00:00
Peter Wang
256683e3a8 [Telephony Mainline] Hide all PermissionManager APIs for R
Bug: 142019744
Fix: 142019744
Test: Build
Change-Id: Ic1e08757ccba510fac3636c5bae33e8da23b7e6b
2020-03-18 22:07:22 -07:00
TreeHugger Robot
045181d7f8 Merge "Add executor to onUpdateUserSensitiveFlags" into rvc-dev 2020-03-19 00:11:03 +00:00
Philip P. Moltmann
379322f066 Merge "Suggested additions to permissions docs" into rvc-dev 2020-03-17 22:19:32 +00:00
Nate Myren
24e88d5569 Add executor to onUpdateUserSensitiveFlags
Added an executor to the onUpdateUserSensitiveFlags api

Test: None
Fixes: 141311767
Change-Id: I90ac4e6f61e461147fc2059680976d05e715ad29
2020-03-16 11:23:48 -07:00
Eugene Susla
922cd08f62 Introduce per-app API for installer whitelisting
Test: presubmit
Bug: 146513245
Change-Id: I5a4502aeb78d2e35209ed88312d24bcafbb4ba7c
2020-03-13 22:09:22 -07:00
Philip P. Moltmann
7d29aaa386 Suggested additions to permissions docs
Test: Docs only
Bug: 151379035
Change-Id: Iac3114def3355e3a6fa4d7e8c86e73cd08a35cd4
2020-03-13 17:23:22 -07:00
Eugene Susla
ff17a587a8 Merge "Introduce per-app manifest flags for autoRevoke" into rvc-dev 2020-03-13 22:40:36 +00:00
Nate Myren
2585289c30 Merge "Update USER_SENSITIVE flags on app install and optimize it" into rvc-dev 2020-03-13 19:43:10 +00:00
Eugene Susla
db77bc14de Introduce per-app manifest flags for autoRevoke
This introduces extra attributes on <application/> tag corresponding to
requesting to be shown in UI for the user to disable auto-revoke
(allowDontAutoRevokePermissions)
and being whitelisted by the installer (dontAutoRevokePermissions)

Test: presubmit
Bug: 146513245
Change-Id: I07902632812b70ea418a667d343b74d7ae170bb9
2020-03-13 11:23:26 -07:00
Philip P. Moltmann
767ef39c1a Add docs for users, permissions, appops.
Test: Only docs changes
Change-Id: I2115b32c41a500d3a9847a5ea3c1d8b82dd5112c
Fixes: 151379035
2020-03-13 00:52:22 +00:00
Eugene Susla
4fce75d572 Update USER_SENSITIVE flags on app install and optimize it
This also parallelizes flag updating.

Currently, the broadcast listener is disabled, due to test flake, so it
will not update on app install/changes

Bug: 141311767
Test: - on first boot go to permissions screen, and ensure system apps
categorization makes sense
- install app that requests location, and ensure it's not listed
as system app in permission screen

Change-Id: I37ea4b196313fe9fa71150c21e7cca591067d572
2020-03-12 14:40:01 -07:00
Evan Severson
0dc24cba2b Upgrade permissions on PermissionController version change
If the version of the permsision controller is different than what was
persisted then call the upgrade controller defined in the permission
controller.

Exempt-From-Owner-Approval: Got verbal approval from an OWNER

Bug: 148595539
Test: Manual; verify the version is persisted in runtime-permissions.xml
              verify the upgrade is run when changing the version number
	      move runtime-permissions.xml to old location, verify works
Change-Id: I873ea4d5a0f1f66fed121e38cc6be62fa046a210
2020-03-04 18:44:56 -08:00
Daniel Colascione
614105b373 Add context UID to package-name-based permission query
The code for caching permission queries incorrectly used the UID of
the calling process instead of the Context UID when asking
PermissionManagerService whether a package (identified by name) has a
permission. As a result, permission checks produced incorrect results
for certain cross-user scenarios. This CL makes the checking UID part
of the package-name-based permission query.

Test: atest com.android.car.VmsPublisherSubscriberTest
Bug: 150172373
Bug: 150025558
Bug: 150140220
Change-Id: I903a9e79fbbba97ea987120066817eeea9b01d51
2020-02-27 12:29:30 +00:00
Daniel Colascione
a46b7b3f5e Cache package and permission information
We use the package settings class as a central point for invalidating
on package information changes; for permission changes, we invalidate
from inside the individual permission data objects.

Bug: 140788621
Test: boots, package tests (pending)
Change-Id: Iec14d4ec872124e7ef4612c72d94c89a7319ace0
2020-02-20 09:24:32 -08:00
Hai Zhang
8714427b08 Add UPGRADE_RUNTIME_PERMISSIONS permission to support testing.
Bug: 136503238
Test: presubmit
Change-Id: I3f3b60e3c2cf04195efcf9233016eae103c74d7e
2020-01-31 16:10:02 -08:00
Peter Wang
09014f1048 [Telephony Mainline] Remove hidden API usages in CarrierAppUtils
Bug: 146904426
Test: Build
Change-Id: Ib307e565b85e7d9a142efc7e3348b823dc46643d
2020-01-24 09:22:25 +08:00
Peter Wang
f7eb0fa797 [Telephony Mainline] Refactored PermissionManager
to expose grantDefaultPermissionsToEnabledImsServices,grantDefaultPermissionsToEnabledTelephonyDataServices,revokeDefaultPermissionsFromDisabledTelephonyDataServices

Bug: 138745534
Test: Build and ImsServiceControllerTest
Change-Id: I9a7cf7a3a960e23fc943f58a67baed354c0d2a92
2020-01-15 14:25:18 -08:00
Evan Severson
43e17e0369 Create permission for managing one-time permission sessions
Test: Manual
Bug: 136219229
Change-Id: I6870c7782f2dd51c655eea37bcb2487e5e29dfff
2020-01-03 13:49:33 -08:00
Evan Severson
b252d8bdbf Create system server component for one-time permissions
In this change we introduce new system api to manage tracking apps for
inactivity when they hold one-time permissions. The api includes adding
a package, removing a package, and a callback to notify the app has gone
inactive and which permissions are considered one-time.

Also introduce a new permission flag so that it is possible to determine
if a currently granted permission is one-time.

Test: Manual
Bug: 136219229
Change-Id: Iac3cb776a0204c64953f0a03abe76c8e320c9e56
2019-12-18 11:01:33 -08:00
Eugene Susla
d91d606ed8 Merge "Rename updateUSerSensitive API" 2019-12-12 15:10:33 +00:00
Peter Wang
56dec3f134 [Telephony Mainline] Refactored grantDefaultPermissionsToActiveLuiApp
and revokeDefaultPermissionsFromLuiApps from PermissionManagerService to
Permmission Manager

Bug: 142019744
Test: Build
Change-Id: Ic39e1a66b650e7969242eb2116f342de488b1ca6
2019-12-05 13:23:02 -08:00
Eugene Susla
5fb3f0eed7 Rename updateUSerSensitive API
Fixes: 141226832
Test: presubmit
Change-Id: I545f710296a4f05db01bb64c4014eba96373b526
2019-11-14 11:11:53 -08:00
Philip P. Moltmann
4a6c5de60a Allow an app to drive permission backup+restore
In AOSP the permission backup+restore is driven by the system server,
but some OEMs might drive it from an app. Hence allow a privilidged app
to backup + restore permission backups.

Test: atest CtsBackupTestCases
Fixes: 141007569
Change-Id: Ic89b476948872c491de8ea54b83667afc0183bb4
2019-10-07 14:58:24 -07:00
Eugene Susla
27455541e9 updateUserSensitive asynchronously
This is known to take 500ms and affects only UI,
so can be done async

Test: Ensure nothing looks badly broken; presubmit
Fixes: 139485700
Change-Id: I2b83b51ec5b002e08986019b4b6be3d681741544
2019-09-13 10:41:17 -07:00
Anthony Hugh
de787d4a83 Refactor PermissionManager.SPLIT_PERMISSIONS
Creating a SystemConfig from a non-system process is taking 500+ ms.
This CL instead exposes the needed split permissions from system_server
to optimize performance.

Tested locally and creating PermissionManager / retrieving SystemConfig
is now less than 1 ms.

Bug: 139828734
Bug: 139485700
Fixes: 139828734
Test: Added systrace / logs to PermissionController app and traced
runtime of onGrantDefaultRoles().

Change-Id: I111403e8dae3bc2b0acafc32e61aa5cd890fea29
2019-09-04 15:00:24 -07:00
Aurimas Liutikas
4d1699da48 Add missing nullability annotations.
To prepare for enabling MissingNullability Metalava check this CL
works on adding missing nullability issues that metalava flags if
we tell it to flag new things since API 29.

This is not a complete CL, mostly addresses public api and
toString/equals for @SystemApi

Exempt-From-Owner-Approval: Large scale nullability clean up
Bug: 124515653
Test: make -j checkapi
Change-Id: I109260842cfc25f06e40694997fcbb4afa02c867
2019-08-29 17:15:44 -07:00
Todd Kennedy
c5b0e860a4 Move few remaining permission methods
This should be the last method movement. More work needs to
happen with the intenral APIs between the permission manager
and the package manager. There is still a lot of package
manager internal logic inside the permission manager.

Bug: 135279435
Test: atest PermissionUpdateListenerTest
Test: atest android.content.pm.cts.PackageManagerTest
Test: atest android.permission2.cts.RestrictedPermissionsTest
Change-Id: Iec118d198cb4ce3c4789991ddbdd2928dbc4bf6f
2019-07-17 15:29:42 -07:00
Todd Kennedy
583378df9c Move providers to permission manager
Bug: 135279435
Test: atest PermissionUpdateListenerTest
Test: atest android.content.pm.cts.PackageManagerTest
Test: atest android.permission2.cts.RestrictedPermissionsTest
Test: atest TeleServiceTests
Test: atest DataConnectionTest
Change-Id: Ife563589929b2662c60e1a0ab0ec8f6a2d7e4c12
2019-07-16 13:09:33 -07:00
Todd Kennedy
c971a45e65 Move grant/revoke permission APIs
These were the last few APIs that used the permission callback.
Completely remove it from the package manager and full implement
in the permission manager.

Bug: 135279435
Test: atest PermissionUpdateListenerTest
Test: android.content.pm.cts.PackageManagerTest
Test: android.permission2.cts.RestrictedPermissionsTest
Change-Id: Iab7c20215c907f4718f78a98fb96afec9fef6780
2019-07-11 14:14:02 -07:00
Todd Kennedy
7e3dd3afe2 Move whitelist permissions to permission manager
Also while doing this, it made sense to move the permission change
listener to the permission manager [it resulted in fewer hacks to
get the two sides to talk to one another].

Bug: 135279435
Test: atest PermissionUpdateListenerTest
Test: android.content.pm.cts.PackageManagerTest
Test: android.permission2.cts.RestrictedPermissionsTest
Change-Id: Ie08701dfe999cd435335103f4b4daeaa0b31ef10
2019-07-11 14:14:02 -07:00
Todd Kennedy
ca1ea17a3e Move check permission methods
Bug: 135279435
Test: atest android.content.pm.PackageManagerTests
Test: atest CtsCameraApi25TestCases
Change-Id: Id96093e4106edcd5302fd8aaa020d1ab83f68258
2019-07-11 14:14:02 -07:00
Todd Kennedy
230c0a7e60 Move permission flag methods
Bug: 135279435
Test: atest android.content.pm.cts.PackageManagerTest
Test: atest android.permission2.cts.RestrictedPermissionsTest
Change-Id: I3a5a7d8d3a3ba9d0b3e0e62d178a18903a94ec26
2019-07-11 14:13:53 -07:00
Todd Kennedy
6ffc5a6eee Move add/remove permission
Bug: 135279435
Test: atest android.content.pm.cts.PackageManagerTest
Change-Id: I40a6d592031483a6dfe61906f6fa011c91910328
2019-07-03 10:14:19 -07:00
Todd Kennedy
1d29b4af0b Move permission info queries
Now begins the parade of methods that can be migrated to the
permission manager service and be removed from the package
manager service.

We will still need to maintain some sub-set of APIs in the
package manager service due to unsupported app usage. When
we finally no longer support these AIDL methods, they can
be removed from package manager service.

Bug: 135279435
Test: Manual. Builds and runs
Change-Id: If12609ffdaeb75445d3ec9bcc7f946b8829ba769
2019-07-03 10:14:09 -07:00
Todd Kennedy
8f135982a8 Create permission manager AIDL
Today, the package manager largely routes any permission related
method to the PermissionManagerService. But, PermissionManagerService
is a service in name only. Instead, we will make the
PermissionManagerService a real service and direct API calls directly
to it.

We will likely need to maintain all of the public permission APIs
that already exist on PackageManager. However, the public -> private
implementation will go directly to PermissionManagerService.

Bug: 135279435
Test: Manual. Device boots
Change-Id: Ia4992ba6d1f4b9050db98c7d7647d51a5d45fcbe
2019-07-02 13:17:05 -07:00
Winson
01045f5d08 Merge "Expose PermissionManager as TestApi and fix SplitPermissionInfo equality" into qt-dev am: d703395fcb am: 7347c0f704
am: 02c612552f

Change-Id: I0e4fbc7d7c7e208d0eb7c029f5dc1ee57afd1ab0
2019-06-10 13:33:41 -07:00
Winson
f27394ee70 Expose PermissionManager as TestApi and fix SplitPermissionInfo equality
Bug: 129200416
Bug: 129200610

Test: atest SplitPermissionsTest

Change-Id: I98795944e6440e5b7ebba134bd7735a6f78ebc4f
2019-06-07 15:09:06 -07:00
Nate Myren
1a4e0bc457 Merge "set RuntimePermissionPresentationInfo, getAppPermissions, and OnGetAppPermissions as Test Api, added Get Runtime Permissions to shell" into qt-dev am: 1ce9983162 am: 40bcb1d3cd
am: 364c09f390

Change-Id: I26127032cd6185632d33e779e33cb7976b9ee2c1
2019-05-28 09:59:45 -07:00
Nate Myren
17f2159181 set RuntimePermissionPresentationInfo, getAppPermissions, and OnGetAppPermissions as Test Api, added Get Runtime Permissions to shell
Test: Run PermissionControllerTest
Fixes: 129200595

Change-Id: I44cf152e52895d9344b39b978b85ac263a5cb37c
2019-05-28 16:15:16 +00:00
Philip P. Moltmann
cc0208bc63 Merge "Mark perm DB version as -1 when upgrading from P" into qt-dev am: da7156d13d am: 2cf8337bcd
am: a0aecd7b46

Change-Id: I58cf36c13a7d728f265c2534863a05043c3d51de
2019-05-24 17:52:39 -07:00