Commit Graph

431 Commits

Author SHA1 Message Date
Neil Fuller
bc4a843f18 Add permission to shell for CTS test
This grants the shell app the SUGGEST_EXTERNAL_TIME permission needed
for the TimeManagerTest (CTS) to invoke the
TimeManager.suggestExternalTime() method during tests.

Bug: 184947690
Bug: 177079827
Test: See associated cts change
Merged-In: Ia1995ec9503dbd2b12e0b5b5f92a96e02f85beec
Change-Id: Ia1995ec9503dbd2b12e0b5b5f92a96e02f85beec
2021-05-18 14:04:55 +01:00
Treehugger Robot
71d1186b1b Merge "Shell: Allow usage of UwbManager ranging API" am: d0c859c58f am: 8125586204 am: 3897959f77
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1680127

Change-Id: Ib84bc63ccf536686aa0d17ff97e3dcddf73819a9
2021-04-21 19:30:58 +00:00
Treehugger Robot
d0c859c58f Merge "Shell: Allow usage of UwbManager ranging API" 2021-04-21 18:26:11 +00:00
TreeHugger Robot
16472322f9 Merge "Pipe start op throught app ops policy and delegate" into sc-dev 2021-04-21 15:06:11 +00:00
Kholoud Mohamed
48cf9cdfb0 Merge "Add a new permission to install testOnly apps" into sc-dev 2021-04-21 11:07:50 +00:00
Svet Ganov
8b1aad623e Pipe start op throught app ops policy and delegate
bug: 185504196

Test: atest CtsAppOpsTestCases
      atest CtsPermissionTestCases
      atest CtsPermission2TestCases
      atest CtsPermission3TestCases
      atest CtsPermission4TestCases
      atest CtsPermission5TestCases

Change-Id: I5869a3e9719830f59624519f2d54f0765119cf5f
2021-04-21 08:06:35 +00:00
Hyundo Moon
013cf241a1 Merge changes from topic "system_mr2_media_content_control" into sc-dev
* changes:
  System MediaRouter2: Resolve API review
  Change MODIFY_AUDIO_ROUTING permission to MEDIA_CONTENT_CONTROL
2021-04-21 01:45:42 +00:00
Suprabh Shukla
508e114192 Adding a permission to Shell for testing
Adding UPDATE_DEVICE_STATS to enable testing alarms with WorkSource
objects.

Test: atest CtsAlarmManagerTestCases

Bug: 185530825
Change-Id: Ia0f8afa6dc1a13c95553b691f352c6d8c7ae5ccf
Merged-In: Ia0f8afa6dc1a13c95553b691f352c6d8c7ae5ccf
2021-04-20 15:32:03 -07:00
Shubang Lu
c505cc19a2 Merge "TIF: Change the isForeground API to isVisible and isMainSession" into sc-dev 2021-04-20 20:19:42 +00:00
kholoud mohamed
dead379e48 Add a new permission to install testOnly apps
Added a new permission INSTALL_TEST_ONLY_PACKAGE
and granted it to shell, this will allow installing
testOnly apps from a testAPI.

Test: N/A
Bug: 183716601
Change-Id: I047a4013fb3462db3487eab2d1635ea75ae29264
2021-04-20 15:37:30 +00:00
Ken Chen
e6565f57fc resolve merge conflicts of a3e32c8b4f to sc-dev
Bug: 185071689
Change-Id: I1524a534590361a585469ddf959e582484493e4e
2021-04-20 09:22:10 +00:00
shubang
e8c3a42409 TIF: Change the isForeground API to isVisible and isMainSession
isForeground is not a good approach to indentify current channel info

And add a permission for tuned info.

Bug: 180482268
Test: atest CtsPermission2TestCases
Test: atest TvInputManagerTest#testGetCurrentTunedInfos
Change-Id: Ib1c1f2da719336ae856684e843b06f8b9b442723
2021-04-20 05:49:14 +00:00
Suprabh Shukla
b0db699780 Adding a permission to Shell for testing
Adding UPDATE_DEVICE_STATS to enable testing alarms with WorkSource
objects.

Test: atest CtsAlarmManagerTestCases

Bug: 185530825
Change-Id: Ia0f8afa6dc1a13c95553b691f352c6d8c7ae5ccf
2021-04-19 23:35:39 +00:00
Roshan Pius
0662c37218 Shell: Allow usage of UwbManager ranging API
This permission is needed for uwb CTS ranging specific tests.

Is the minimally scoped permission that needs to be added?
- Yes, this only allows the app to range to uwb devices.

What options did you explore that did not need this permission?
- Without this permission, it would be impossible to test the raning
UwbManager API which is protected by UWB_RANGING + UWB_PRIVILEGED.

Bug: 183747097
Test: Compiles
Change-Id: I23fc60a111fd7d868e3982d71ffa354ea9957bfb
2021-04-19 13:45:13 -07:00
Alex Buynytskyy
e7339d98df API feedback: make DataLoader API System.
Bug: 184713911
Fixes: 184713911
Test: atest PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest IncrementalServiceTest PackageManagerServiceTest ChecksumsTest
Change-Id: I00107102eb2e98004ed0a5db2a318a052ab60220
2021-04-18 15:48:21 +00:00
Ken Chen
81b55fbe8c Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission to shell
The shell *already had* the privileges granted by this permission due to
specific code in netd, and it lost those privileges when it gained the
CHANGE_NETWORK_STATE permission. Explicitly add
CONNECTIVITY_USE_RESTRICTED_NETWORKS so that it can obtain sufficient
permission in netd no matter CHANGE_NETWORK_STATE is set or not.

Remove a duplicate row by the way.

Bug: 185071689
Test: atest NetdClientTest#protectFromVpnTcp6
Change-Id: I64bc321de2c83378ce7bc8d9eb3044ae7772faca
2021-04-16 05:48:47 +00:00
Hyundo Moon
6ffbb9568c Change MODIFY_AUDIO_ROUTING permission to MEDIA_CONTENT_CONTROL
As changing the permission for MediaRouter2 system APIs, this CL
changes the permission in shell accordingly.

The permission was added by ag/13959439.

Bug: 183428114
Test: Passed CTS tests
Change-Id: I3aee256a11db730dd786e69821f3bb8bd590074f
2021-04-15 20:01:06 +09:00
Treehugger Robot
51e5e80876 Merge "Grant shell missing permissions" 2021-04-15 00:52:03 +00:00
Roshan Pius
43158d470e Shell: Allow usage of UwbManager APIs
This permission is needed for uwb CTS tests.

Is the minimally scoped permission that needs to be added?
- Yes, this only allows the app to range to uwb devices.

What options did you explore that did not need this permission?
- Without this permission, it would be impossible to test any of the
UwbManager API's.

Bug: 183747097
Test: Compiles
Change-Id: Ie4264cdcd3f84c965da70f8f8fefe538378c47f6
Merged-In: Ie4264cdcd3f84c965da70f8f8fefe538378c47f6
2021-04-14 21:01:58 +00:00
Roshan Pius
6e943b5450 Merge "Shell: Allow usage of UwbManager APIs" into sc-dev 2021-04-14 21:01:40 +00:00
Roshan Pius
8cf4edc118 Shell: Allow usage of UwbManager APIs
This permission is needed for uwb CTS tests.

Is the minimally scoped permission that needs to be added?
- Yes, this only allows the app to range to uwb devices.

What options did you explore that did not need this permission?
- Without this permission, it would be impossible to test any of the
UwbManager API's.

Bug: 183747097
Test: Compiles
Change-Id: Ie4264cdcd3f84c965da70f8f8fefe538378c47f6
2021-04-14 11:53:19 -07:00
Abhijeet Kaur
6d27ed1a3b Merge "Add ACCESS_MTP permission to Shell for CTS test coverage" into sc-dev 2021-04-14 14:47:43 +00:00
Abhijeet Kaur
a8ddeb4feb Add ACCESS_MTP permission to Shell for CTS test coverage
Bug: 183377919
Test: atest CtsScopedStorageHostTest
Change-Id: Ic66617e66fd88302ee82bfeb217f9b7bf9b3776b
2021-04-13 11:25:24 +01:00
Kholoud Mohamed
4701b29dbc Merge "Grant shell missing permissions" into sc-dev 2021-04-09 16:31:25 +00:00
kholoud mohamed
b8bd53aa60 Grant shell missing permissions
Granted shell the missing normal, dangerous, and
development permissions that can already be granted
to third party apps.

Test: N/A
Bug: 183716601
Merged-In: I11df0d753f830b6ba6ea2222f7d8a7d778161953
Change-Id: I11df0d753f830b6ba6ea2222f7d8a7d778161953
2021-04-09 16:30:07 +01:00
kholoud mohamed
b173952e19 Grant shell missing permissions
Granted shell the missing normal, dangerous, and
development permissions that can already be granted
to third party apps.

Test: N/A
Bug: 183716601
Change-Id: I11df0d753f830b6ba6ea2222f7d8a7d778161953
2021-04-09 11:10:49 +01:00
Jeff Sharkey
6dcac06a84 New BLUETOOTH_ADVERTISE manifest permission.
This change is part of defining a distinct BLUETOOTH_ADVERTISE
permission to guard the BluetoothLeAdvertiser APIs, since that's a
distinct enough of an operation from SCAN and CONNECT.  It'll
continue to be covered under the general "Nearby devices" runtime
permission group.

Bug: 181813006
Test: atest CtsPermission2TestCases
Test: atest CtsPermission3TestCases
Change-Id: I8b62e4d625df1e201f12a73025cd29c431feea79
2021-04-08 20:15:02 -06:00
Svetoslav Ganov
64b26b5c49 Merge "Activity recognition source app op tracking" into sc-dev 2021-04-08 18:34:58 +00:00
Benjamin Franz
eceaea94ba Merge "Grant OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD to Shell" am: 9a24f337aa am: 780e00790d am: f7d6fde325
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1652463

Change-Id: Ice653f148e2d8930f58a73e36ddcaa5ffd96a4d7
2021-04-08 12:32:52 +00:00
Benjamin Franz
9a24f337aa Merge "Grant OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD to Shell" 2021-04-08 11:06:09 +00:00
Treehugger Robot
32a5d19754 Merge "Add BIND_IMS_SERVICE permission to the shell" am: 00e669c96e am: e9a927c672 am: 637853536e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1661139

Change-Id: Ic1aa141040c2b82909eefca7338eadcdd590d78d
2021-04-06 21:57:32 +00:00
Svet Ganov
99d6115e99 Activity recognition source app op tracking
The activity recognition source may access activity
recognition in its operation as being the activity
recognition source. Accesses from an AR source
(for special tags it designates - the APK may contain
other components) for location and AR are tracked in
a dedicated app op.

bug: 182204957

Test: atest CtsActivityRecognitionTestCases

Change-Id: If29fba1c51d70a2806a0907a73a96d3d8d7a3100
2021-04-06 11:59:03 -07:00
Svet Ganov
48801b0bbd Hookup renounced permissions
Propagate renounced permissions from context params
to the context attribution source. Throw if one
tries to request at runtime a renounced permission.

Also make the AttributionSource take null for the
setters to ease usage, otherwise folks should always
check for null before calling a builder method.

Additionally, we allow apps that have UPDATE_APP_OPS_STATS
to register arbitrary trusted AttributionSource for
testing. Note that this permission allows abritrary app
op operations, thus we are not relaxing the security
model.

bug: 158792096

Test: atest CtsPermission5TestCases

Change-Id: I4330684bb8695fb998cf31e9363b94ad981ba2cc
2021-04-02 17:30:10 +00:00
Abel Tesfaye
1877288cc3 Add MANAGE_ROTATION_RESOLVER permission to shell application to fix CTS on non-eng builds
Test: atest CtsRotationResolverServiceDeviceTestCases & adb shell cmd resolver

Bug: 182922465
Change-Id: I8cc4252c00a074c99026bbdffaf031ba91d6a7e5
2021-04-01 19:53:16 +00:00
Hyundo Moon
9ebc56d6dd Add MODIFY_AUDIO_ROUTING permission to shell for CTS test.
Grant MODIFY_AUDIO_ROUTING permissions to the shell identity
for use within CTS tests.

Bug: 183428114
Test: CTS passed with the permission
Change-Id: I6e8c7553d7fe3263c0345adf0fe67340e5afcbe5
2021-04-01 13:19:40 +09:00
Santiago Seifert
ae0193e841 Add BIND_IMS_SERVICE permission to the shell
For testing a android.media.MediaPlayer.setOnRtpRxNoticeListener

Bug: 169965769
Change-Id: Ifff944ad85592adb3c132c86f123b36b60410643
Test: Built, flashed and booted a device
2021-03-31 23:05:23 +00:00
Suprabh Shukla
502baa4117 Merge "Adding some permissions to Shell to enable testing" 2021-03-31 21:08:54 +00:00
Suprabh Shukla
7ff8faf4af Merge "Adding a permission to Shell to enable testing" into sc-dev 2021-03-31 21:08:07 +00:00
Suprabh Shukla
50c85cbe58 Adding some permissions to Shell to enable testing
Test: Builds, boots.

Bug: 183661625
Change-Id: I983b0d9d7a5ab417e74feae9dadf4d472d277b20
Merged-In: I60e745c4ff32cbf8f8ff8b5d016555a25a065f39
Merged-In: I6adc84856f1fe9c33e0ad8470e7248a20587a1e9
Merged-In: I983b0d9d7a5ab417e74feae9dadf4d472d277b20
2021-03-30 23:47:49 -07:00
Suprabh Shukla
6f86e37f42 Adding a permission to Shell to enable testing
Adding SCHEDULE_PRIORITIZED_ALARM permission to Shell so the API can be
called from tests.

Test: Builds, boots.
atest CtsAlarmManagerTestCases:BasicApiTests

Bug: 183661625
Change-Id: I983b0d9d7a5ab417e74feae9dadf4d472d277b20
2021-03-30 22:43:28 -07:00
Svet Ganov
8d2ed50604 Runtime permission attribution improvements
When an app is proxying access to runtime permission protected
data it needs to check whether the calling app has a permission
to the data it is about to proxy which leaves a trace in app ops
that the requesting app perofmed a data access. However, then the
app doing the work needs to get the protected data itself from the
OS which access gets attributed only to itself. As a result there
are two data accesses in app ops where only the first one is a
proxy one that app A got access to Foo through app B - that is the
one we want to show in the permission tracking UIs - and one
for the data access - that is the one we would want to blame on
the calling app, and in fact, these two accesses should be one -
that app A accessed Foo though B. This limitation requires fragile
one off workarounds where both accesses use the same attribution
tag and sys UI has hardcoded rules to dedupe. Since this is not
documented we cannot expect that the ecosystem would reliably
do this workaround in apps that that the workaround in the OS
would be respected by every OEM.

This change adds a mechaism to resolve this issue. It allows for
an app to create an attribution context for another app and then
any private data access thorugh this context would result in a
single app op blame that A accessed Foo though B, i.e. we no longer
have double accounting. Also this can be nested through apps, e.g.
app A asks app B which asks app C for contacts. In this case app
B creates an attribution context for app A and calls into app C
which creates an attribution context for app B. When app C gets
contacts the entire attribution chain would get a porper, single
blame: that C accessed the data, that B got the data from C, and
that A got the data form B. Furthermore, this mechanism ensures
that apps cannot forget to check permissions for the caller
before proxying private data. In our example B and C don't need
to check the permisisons for A and B, respectively, since the
permisisons for the entire attribution chain are checked before
data delivery. Attribution chains are not forgeable preventing
a bad actor to create an arbitrary one - each attribution is
created by the app it refers to and points to a chain of
attributions created by their corresponding apps.

This change also fixes a bug where all content provider accesses
were double counted in app ops due to double noting. While at
this it also fixes that apps can now access their own last ops.
There was a bug where one could not pass null getting the attributed
ops from a historical package ops while this is a valid use case
since if there is no attribution everything is mapped to the null
tag. There were some app op APIs not being piped thorough the app
ops delegate and by extension through the app ops policy. Also
now that we have nice way to express the permission chain in a
call we no longer need the special casing in activity manager to
handle content provider accesses through the OS. Fixed a bug
where we don't properly handle the android.os.shell calls with
an invlaid tag which was failing while the shell can do any tag.

Finally, to ensure the mechanims is validated and works end-to-end
we are adding support for a voice recognizer to blame the client
app for the mic access. The recognition service can create a blaming
context when opening the mic and if the mic is open, which would
do all permission checks, we would not do so again. Since changes
to PermissionChercker for handling attribution sources were made
the CL also hooks up renounced permissoins in the request permission
flow and in the permission checks.

bug:158792096
bug:180647319

Test:atest CtsPermissionsTestCases
     atest CtsPermissions2TestCases
     atest CtsPermissions3TestCases
     atest CtsPermissions4TestCases
     atest CtsPermissions5TestCases
     atest CtsAppOpsTestCases
     atest CtsAppOps2TestCases

Change-Id: Ib04585515d3dc3956966005ae9d94955b2f3ee08
2021-03-29 16:49:33 +00:00
Benjamin Franz
bb68a9e0b7 Grant OVERRIDE_COMPAT_CHANGE_CONFIG_ON_RELEASE_BUILD to Shell
This is needed to write CTS tests for the underlying changes.

Bug: 180396382
Test: atest CtsAppCompatHostTestCases
Change-Id: Id6b03f45ee1dcabc175e7536ac2675fce8effba8
2021-03-25 18:22:01 +00:00
kholoud mohamed
cf21de27a8 Create new permission SET_AND_VERIFY_LOCKSCREEN_CREDENTIALS
Created a new permission to allow setting and verifying lock screen
credentials.

Test: N/A
Bug: 182260585
Merged-In: I3cf624f063ba582bc8d3b6aeeb11a46a2ab37636
Change-Id: I3cf624f063ba582bc8d3b6aeeb11a46a2ab37636
2021-03-25 15:15:58 +00:00
kholoud mohamed
b78cc199cd Remove no longer needed QUERY_USERS permission
Bug: 178695365
Test: atest PermissionPolicyTest#platformPermissionPolicyIsUnaltered
Merged-In: I4e050d6ea7df08ba789021fd06e8c4cf8936dfe9
Change-Id: I4e050d6ea7df08ba789021fd06e8c4cf8936dfe9
2021-03-25 10:09:35 +00:00
kholoud mohamed
b071084a3f Create new permission QUERY_AUDIO_STATE
Created a new permission to allow access to device audio
state and granted it to shell.

Test: N/A
Bug: 182260585
Merged-In: If1bfcb1341402717fec74cc704caa7e1eb18fa2e
Change-Id: If1bfcb1341402717fec74cc704caa7e1eb18fa2e
2021-03-24 21:01:50 +00:00
kholoud mohamed
fc40a4a777 created FORCE_DEVICE_POLICY_MANAGER_LOG and CLEAR_FREEZE_PERIOD
Created the following new permissions and granted it to shell:
* FORCE_DEVICE_POLICY_MANAGER_LOG: will be used to expose
DPM#forceNetworkLogs and DPM#forceSecurityLogs as TestAPIs.
* CLEAR_FREEZE_PERIOD: will be used to expose
DPM#clearSystemUpdatePolicyFreezePeriodRecord as a TestAPI.

Bug: 180500227
Test: atest PermissionPolicyTest#platformPermissionPolicyIsUnaltered
Merged-In: I8a2a49aa45704d8991e9cf3689b5259442fb1db3
Change-Id: I8a2a49aa45704d8991e9cf3689b5259442fb1db3
2021-03-24 18:12:31 +00:00
TreeHugger Robot
16d5f62a66 Merge "Add high sampling rate permission to shell" into sc-dev 2021-03-23 18:47:59 +00:00
Anthony Stange
dc78cb5473 Add high sampling rate permission to shell
Tooling run with the shell needs to be able to sample sensors above
200hz to facilitate with running tests.

Fixes: 183240340
Test: Run tool that requires the permission to sample at a high rate
Change-Id: Ic6782ea5afe750d3ec3167d11eef791881dceb53
2021-03-23 16:56:24 +00:00
Kholoud Mohamed
5ee5b490d8 Merge "Create new permission SET_AND_VERIFY_LOCKSCREEN_CREDENTIALS" into sc-dev 2021-03-23 15:04:43 +00:00
Jeff Sharkey
7b14b87647 Request new Bluetooth runtime permissions.
An upcoming platform change is introducing a new "Nearby devices"
runtime permission which contains the new BLUETOOTH_CONNECT and
BLUETOOTH_SCAN permissions.

We have logic in place to use <split-permission> to translate the
older BLUETOOTH and BLUETOOTH_ADMIN permissions into these new
runtime permissions, but modern apps will need to pivot to
requesting them directly as part of targeting Android S.

This change requests both the old and new permissions to avoid
breakage while the new permission enforcement is being phased in.

Bug: 181813006
Test: atest CtsPermission2TestCases
Test: atest CtsPermission3TestCases
Test: atest CtsStatsdAtomHostTestCases
Change-Id: I39f45e7d22d132d44c84017cd98e6d9e98533c7f
2021-03-22 15:34:05 -06:00