156 Commits

Author SHA1 Message Date
Mark Chien
30642b395c Merge "Add TETHER_PRIVILEGED permission to shell for CTS test." 2019-12-19 04:59:02 +00:00
Abhijeet Kaur
b7518de1b4 Add Light/Dark theme for bugreport warning dialog
Previously added "android:theme="@android:style/Theme.
DeviceDefault.DayNight" to the application tag in this manifest file to
enable dark theme for bugreport info.
BugreportWarningActivity is nested within this application tag, so
assumed all the child tags to have DayNight theme.

android:theme="@android:style/Theme.DeviceDefault.Dialog.Alert" shows
the dialog always as Dark mode.

android:theme="@android:style/Theme.DeviceDefault.Light.Dialog.Alert"
shows the dialog always as Light mode.

This bug is not easily notice-able as "Do not show this again" checkbox
is checked by default for this dialog. Unless one wipes data partition,
this dialog doesn't come up even after flashing new builds.

Bug: 141663298
Bug: 146400225
Test: Normal (light mode) Trigger interactive/full/wifi bugreport.
      Click on bugreport finished "Share" notification.
      Light mode warning dialog should appear. (with white background)
      Uncheck the "Do not show this again" checkbox to test with dark
      mode.
Test: Go to Settings. Turn on Dark theme.
      Trigger interactive/full/wifi bugreport.
      Click on bugreport finished "Share" notification.
      Dark mode warning dialog should appear. (with dark grey background)

Merged-In: I200c592608261665e4c2416303f573522c6bc59a
Change-Id: I200c592608261665e4c2416303f573522c6bc59a
(cherry picked from commit 43bbe8a2fcce4bddfb59b8545e55ed328315a064)
2019-12-18 14:09:44 +00:00
Abhijeet Kaur
6a8f0fb9a5 Fix bugreport warning dialog
This bug was introduced when fixing dark theme for bugreport dialogs.

Bug: 135446537
Bug: 146400225
Test: manually (both in light and dark theme)
Merged-In: Ib8c16d068c00632d009033c2eab7d2d6cb7e4eea
Change-Id: Ib8c16d068c00632d009033c2eab7d2d6cb7e4eea
(cherry picked from commit f90de9746b119d2bc540b563ac7cc46fa7957366)
2019-12-18 14:09:17 +00:00
markchien
9fe658adc3 Add TETHER_PRIVILEGED permission to shell for CTS test.
Grant TETHER_PRIVILEGED permissions to the shell identity
for use within CTS tests.

Bug: 145490751
Test: atest CtsTetheringTest
Change-Id: Ifad265cdc5e0b1b1b2fa8f4f79eeb7dd18493624
Merged-In: Ifad265cdc5e0b1b1b2fa8f4f79eeb7dd18493624
2019-12-17 13:30:26 +00:00
Tyler Gunn
f701f7a765 Car mode InCallService changes.
1. Grant ENTER_CAR_MODE and CONTROL_INCALL_EXPERIENCE permissions to the
shell identity for use within CTS tests.
2. Remove un-needed Telecom shell command.

Test: unit tests, telecom CTS tests, manual testing
Bug: 144345414
Change-Id: I54a2e723d6ef9552117e6cadf4ab7c449dd5e3cb
2019-11-26 13:43:53 -08:00
Tyler Gunn
f05f2c2cc2 Add prioritized enableCarMode API in UiModeManager
Per design doc (go/android-car-mode-design), added new system API to
enable car mode and specify a priority for the calling app.
Also modified UiModeManager to pass the package name of the caller to
UiModeManagerService.

Bug: 136109592
Test: Added new unit tests and CTS tests.
Test: Added Telecom test app functionality to verify.
Change-Id: I2848039c9ea18ba93e7694e04c4e5dc70759daa3
Merged-In: I2848039c9ea18ba93e7694e04c4e5dc70759daa3
2019-11-19 23:15:52 +00:00
Kweku Adams
4d345d7af1 Move heap dump sharing to SHELL.
The system shouldn't be granting read URI permissions as itself. This
means that heap dumps aren't successfully shared. Moving the heap dump
sharing mechanism to SHELL, which already has the permission to dump
heaps so that dumps can be shared properly.

The ActivityManagerService changes are submitted separately.

Bug: 126885951
Bug: 135150619
Test: collect a heap dump and confirm it's successfully shared with an app
Test: do manual test on a secondary user & confirm it's not available to
other user

Change-Id: I6fad69280b5124c8ec2d3b4bef0f7dddb6a9422c
2019-10-29 15:17:42 -07:00
Shuo Qian
b61230c51d Integrate the active emergency session listener in TelephonyRegistry
Add Telecom shell command: "adb shell telecom set-system-dialer"

Test: PhoneStateListener cts
Bug: 135204580
Merged-In: I5eaada6a671606642a849f0ff6fe964332d80d5f
Change-Id: I5eaada6a671606642a849f0ff6fe964332d80d5f
2019-09-30 20:43:42 +00:00
jay
ed63903250 Merge "Clean up duplicated uses-permission"
am: 2bfe37de04

Change-Id: I283778ef4b61e9f0a7a6592f1be563da91e8c628
2019-08-05 13:10:39 -07:00
jay
67feca7041 Clean up duplicated uses-permission
android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS
It would be duplicated and we can remove it.

Bug:
Test: refactoring CL

Change-Id: I75bf3761be64d850781c29b734c2f7e60ef3b6a2
Signed-off-by: jay <jdragon.bae@gmail.com>
2019-07-26 09:09:03 +00:00
TreeHugger Robot
190e99cf3a Merge "Add dark theme for Shell app." into qt-dev 2019-05-29 14:03:55 +00: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
Abhijeet Kaur
8549ccf69b Add dark theme for Shell app.
Bugreport info dialog is used in the BugreportProgressService; services
are not themeable from the manifest file. Added themed context wrapper
in the service file.

Text view underlines are no longer black, and are white in color.

Bug: 128364209
Test: build and flash to device, manually verified the color of the dialog
Change-Id: Ia42c1c7c2b6f2e30d91a5522f1d6b3507b032cdb
2019-05-24 14:28:56 +00:00
Varun Shah
a248265d93 Add INTERACT_ACROSS_PROFILES permission to shell for CTS test.
Bug: 127804311
Test: atest CrossProfileAppsHostSideTest#testStartActivity
Change-Id: I1deb66409fae1ec654555adb8d4a61d670689d2a
2019-05-20 20:56:59 -07:00
Zimuzo Ezeozue
ab9c69fda4 Merge "Add ExplicitHealthCheckServiceImplTest" into qt-dev 2019-05-20 20:16:22 +00:00
Zimuzo
0d70a6ac49 Add ExplicitHealthCheckServiceImplTest
Test: atest
android.ext.services.watchdog.ExplicitHealthCheckServiceImplTest
Bug: 132640467

Change-Id: I2d1820a38adce238a157e925512898c184dadec0
2019-05-19 19:39:29 +01:00
Jeff Sharkey
b66f4f4bad Aggresive performance optimizations.
Now that we have LocalCallingIdentity, we can start caching it in
very narrow cases.  We must be careful to not cache too long, since
any changes to granted permissions for the UID mean we need to
re-evaluate any cached answers.

The best middle-ground for this in the Q release is to use an active
camera session as a proxy for when we should create a cache object
and then later invalidate it.  (It's very unlikely that a user
changes permissions while actively using the camera, and this is
a strong signal that the caller is sensitive to performance.)

Many other sprinkled optimizations to avoid extra binder calls into
the OS, such as aggressively caching VolumeInfo related details.

Track IDs that are owned by each LocalCallingIdentity, to speed up
all future security checks.

Dispatch all change notifications asynchronously, and delay them by
several seconds while the camera is being actively used, to give
more important foreground work a fighting chance.  Invalidate
thumbnails asynchronously.

Optimizations to ModernMediaScanner where it's safe to skip the
"reconcile" and "clean" steps when we're focused on a single file
that we successfully scanned.

Local tests show this CL improves performance of a test app that
takes 100 rapid shots by 45%.  (All the collective optimizations
done so far this week add up to a 70% improvement.)

Bug: 130758409
Test: atest --test-mapping packages/providers/MediaProvider
Exempt-From-Owner-Approval: trivial manifest change
Change-Id: I38cc826af47d41219ef44eae6fbd293caa0c01d5
2019-05-18 05:48:21 +00:00
Evan Laird
deb46f3c36 Grant STATUS_BAR permission to com.android.shell
Allows for testing APIs protected by this permission from CTS tests

Test:  adb shell dumpsys package com.android.shell | grep "\bSTATUS_BAR:
granted=true" # should find the permission
Bug: 130178313

Change-Id: Ida0950664b98217d9c0801c0f19436c754ee6744
2019-04-19 16:23:40 +00:00
Narayan Kamath
f207dc666f Shell: Grant CACHE_CONTENT to Shell
Required to test ContentResover#[get|put]Cache

Bug: 127711435
Test: atest CtsContentTestCases

(cherry picked from commit a31ed1bbdd45625036ac65bb41d2f1d462e14a04)

Merged-In: I5eb72772a0a35897611dd6db95c68a2d2e971e9a
Change-Id: I91a91a2969db175d88e9f41938869bc751f7b108
2019-04-09 18:58:02 +01:00
Julia Reynolds
dc6adc6ca8 Adjust testapis/permissions for CTS tests
Test: cts
Bug: 127341023
Change-Id: Ice19dc337a06a3f20edca583ecbe5ef3148fd96d
2019-04-09 17:55:39 +00:00
Narayan Kamath
a31ed1bbdd Shell: Grant CACHE_CONTENT to Shell
Required to test ContentResover#[get|put]Cache

Bug: 127711435
Test: atest CtsContentTestCases
Change-Id: I5eb72772a0a35897611dd6db95c68a2d2e971e9a
2019-04-09 09:50:53 +01:00
Svet Ganov
d8eb8b2690 Restricted permission mechanism - framework
This change adds a mechanism for restricting permissions (only runtime
for now), so that an app cannot hold the permission if it is not white
listed. The whitelisting can happen at install or at any later point.

There are three whitelists: system: OS managed with default grants
and role holders being on it; upgrade: only OS puts on this list
apps when upgrading from a pre to post restriction permission database
version and OS and installer on record can remove; installer: only
the installer on record can add and remove (and the system of course).

Added a permission policy service that sits on top of permissions
and app ops and is responsible to sync between permissions and app
ops when there is an interdependecy in any direction.

Added versioning to the runtime permissions database to allow operations
that need to be done once on upgrade such as adding all permissions held
by apps pre upgrade to the upgrade whitelist if the new permisison version
inctroduces a new restricted permission. The upgrade logic is in the
permission controller and we will eventually put the default grants there.

NOTE: This change is reacting to a VP feedback for how we would handle
SMS/CallLog restriction as we pivoted from role based approach to roles
for things the user would understand plus whitelist for everything else.
This would also help us roll out softly the storage permisison as there
is too much churm coming from developer feedback.

Exempt-From-Owner-Approval: trivial change due to APi adjustment

Test: atest CtsAppSecurityHostTestCases:android.appsecurity.cts.PermissionsHostTest
Test: atest CtsPermissionTestCases
Test: atest CtsPermission2TestCases
Test: atest RoleManagerTestCases

bug:124769181

Change-Id: Ic48e3c728387ecf02f89d517ba1fe785ab9c75fd
2019-04-07 22:39:54 -07:00
Hall Liu
f276a56215 Merge changes from topics "nw-scan-cts", "nw-scan-changes"
* changes:
  Add shell permissions for CTS testing
  Allow requestNetworkScan to return sanitized info
2019-04-01 20:31:10 +00:00
TreeHugger Robot
5595790416 Merge "Grant com.android.shell access to DynamicSystem" 2019-03-31 15:12:39 +00:00
Hall Liu
64fbe76fba Add shell permissions for CTS testing
Add NETWORK_SCAN to shell permissions to enable CTS testing of the
network scan changes

Bug: 126779616
Test: CTS
Change-Id: I1f75c9005620b3b0e06f066677cba6190f1d266c
Merged-In: I1f75c9005620b3b0e06f066677cba6190f1d266c
2019-03-29 17:15:02 +00:00
Mark Chien
be40054bee Merge "[KA09] add keepalive offload permission to shell" 2019-03-29 04:20:39 +00:00
Hall Liu
9cf3e7ae68 Add shell permissions for CTS testing
Add NETWORK_SCAN to shell permissions to enable CTS testing of the
network scan changes

Bug: 126779616
Test: CTS
Change-Id: I1f75c9005620b3b0e06f066677cba6190f1d266c
2019-03-28 12:57:02 -07:00
Po-Chien Hsueh
e56f2f583d Grant com.android.shell access to DynamicSystem
Add permission INSTALL_DYNAMIC_SYSTEM to Shell's AndroidManifest.xml
and privapp-permissions-platform.xml.

Bug: 124637092
Test: adb shell am start-activity
Change-Id: Id7727a195f61c2fbffa0b2f52f3098784feeee52
2019-03-28 17:25:36 +08:00
markchien
95ddfff752 [KA09] add keepalive offload permission to shell
This change adds PACKET_KEEPALIVE_OFFLOAD to shell, which allows
shell or code with shell permission identity to use privileged
tcp keepalive offload API.

Bug: 114151147
Test: -atest ConnectivityManagerTest#testCreateTcpKeepalive
      -build, flash, boot

Change-Id: Ib6660a5eaa72f83042596481452be4d415383f02
Merged-in: Ib6660a5eaa72f83042596481452be4d415383f02
2019-03-28 04:41:14 +00:00
wilsonshih
5db7b39dd8 Add Shell permission for CTS test.
Add Shell permission for new CTS tests to test the multi-display
functionality in WallpaperService/WallpaperManagerService.

Bug: 123707989
Test: atest WallpaperManagerMultiDisplayTests
Test: atest ActivityManagerMultiDisplayTests

Change-Id: Id97db050a0b9d1940c2dfaa793fbe526df578105
2019-03-22 09:13:10 +08:00
Zimuzo Ezeozue
91ea7af912 Merge "Add CONTROL_KEYGUARD_SECURE_NOTIFICATIONS to shell app" 2019-03-21 16:03:05 +00:00
markchien
5e430e5a39 [KA09] add keepalive offload permission to shell
This change adds PACKET_KEEPALIVE_OFFLOAD to shell, which allows
shell or code with shell permission identity to use privileged
tcp keepalive offload API.

Bug: 114151147
Test: -atest ConnectivityManagerTest#testCreateTcpKeepalive
      -build, flash, boot

Change-Id: Ib6660a5eaa72f83042596481452be4d415383f02
2019-03-21 19:56:42 +08:00
Zimuzo
901c70d18c Add CONTROL_KEYGUARD_SECURE_NOTIFICATIONS to shell app
Shell app needs the permission when we run KeyguardManager CTS for
allowing private notifications as a privileged app.

Bug: 127351183
Test: m -j
Change-Id: I199bac8c8fed9ff0fc63b8c62f8002a6b273b28f
2019-03-19 22:19:56 +00:00
Richard Uhler
1fc10c1209 Only allow rollback to be enabled on modules.
Only allow rollback to be enabled on the modules included in a mainline
update. We don't want to support rollbacks for all apks in general yet.

Enforce that only installers granted the MANAGE_ROLLBACKS permission can
enable rollback for a package.

Introduce a new TEST_MANAGE_ROLLBACKS permission that can be used to
enable rollback on packages that are not modules. This allows us to
continue testing rollbacks, given we can't do a mainline update as part
of the rollback tests.

Test: atest RollbackTest, with new tests for permissions added.
Bug: 128277794
Change-Id: I29ab9a750a1283592b8a855322ece516e42260ca
2019-03-18 14:05:28 +00:00
Benedict Wong
7e89a284ec Merge "Add MANAGE_TEST_NETWORKS permission as @hide" am: 96f51fd970 am: 7a66b02e62
am: db34163526

Change-Id: Ic283c247bbb5b62f9816cf074abd1fbeb5778cd4
2019-03-14 11:31:44 -07:00
Benedict Wong
600d93f1de Add MANAGE_TEST_NETWORKS permission as @hide
This commit adds a new permission for test networks, granted to the
shell permission identity.

Bug: 124519473
Test: In-progress CTS tests
Change-Id: I995b93a66d283b9e37381b616843dd44dbafe319
2019-03-13 00:44:04 +00:00
Hai Zhang
f7e8368d31 Add OBSERVE_ROLE_HOLDERS permission to shell.
This allows testing relevant APIs in CTS tests. The listener itself
only gives the changed role name and user affected.

Bug: 125404675
Test: build
Merged-In: I5c979a26dae103ea1b633c2119c59363d8953aa2
Change-Id: I29ca1827e597d318cbd74ba3e70796c5853a9dc4
2019-02-26 16:55:35 -08:00
Hai Zhang
abf0d98d61 Add OBSERVE_ROLE_HOLDERS permission to shell.
This allows testing relevant APIs in CTS tests. The listener itself
only gives the changed role name and user affected.

Bug: 125404675
Test: build
Change-Id: I5c979a26dae103ea1b633c2119c59363d8953aa2
2019-02-26 16:50:53 -08:00
Sergii Piatakov
b7c41e9afd Merge "Grant Shell ability to clear instant app" am: f5a0e41e18 am: 7282c21b57
am: 57ee0ed8d2

Change-Id: I8a6d3b87d3bf0711fcd70f9965164b46a789b9fb
2019-02-11 20:35:33 -08:00
Treehugger Robot
f5a0e41e18 Merge "Grant Shell ability to clear instant app" 2019-02-12 03:42:40 +00:00
Varun Shah
913a014f5f Merge "Add OBSERVE_APP_USAGE permission to shell for CTS test." 2019-02-05 15:21:25 +00:00
Varun Shah
0586192423 Add OBSERVE_APP_USAGE permission to shell for CTS test.
Bug: 123314449
Test: atest android.content.pm.cts.LauncherAppsTest
Change-Id: I5e58aefa9920dd4a974d24388f8ecd8dea7936b3
2019-02-01 17:29:48 +00:00
Julia Reynolds
876219430d Tests for matchesCallFilter
Test: cts
Bug: 123406095
Change-Id: Ibece70d3e5d77d447ece4f3d3118b315a8d6e5cb
2019-01-30 10:39:08 -05:00
William Hester
a96d3d3ff4 Implement test harness mode
Test Harness Mode is a feature for device farms that want to wipe
their devices after each test run. It stores the ADB keys in the
persistent partition (used for Factory Reset Protection) then performs
a factory reset by broadcasting the MASTER_CLEAR intent.

Upon rebooting, the Setup Wizard is skipped, and a few settings are set:
  * Package Verifier is disabled
  * Stay Awake While Charging is enabled
  * OTA Updates are disabled
  * Auto-Sync for accounts is disabled

Other apps may configure themselves differently in Test Harness Mode by
checking ActivityManager.isRunningInUserTestHarness()

Bug: 80137798
Test: make && fastboot flashall -w
Test: adb shell cmd testharness enable
Change-Id: I91285c056666e36ad0caf778bffc140a0656fcfa
2019-01-22 13:32:20 -08:00
Stanislav Zholnin
f5235d22be Merge "Add READ_DEVICE_CONFIG and WRITE_DEVICE_CONFIG permissions to the Shell." 2019-01-17 10:16:25 +00:00
Stanislav Zholnin
bec8835093 Add READ_DEVICE_CONFIG and WRITE_DEVICE_CONFIG permissions to the
Shell.

Bug:117663715
Test: Manually tested that device_config API work from the
shell.

Change-Id: I5bde4192a6223112daa090a02f13abd7c13585e2
2019-01-16 14:45:43 +00:00
Michal Karpinski
7b97a0267b Add a new START_ACTIVITIES_FROM_BACKGROUND
signature|privileged|vendorPrivileged|oem
permission

And grant it to SystemUI and Shell (adb shell am start).

Bug: 110956953
Test: atest WmTests:ActivityStarterTests
Change-Id: I4885a9a62ee8d47a3aef85f0e34b746c3f51ca2b
2019-01-14 18:13:47 +00:00
Winson Chung
fb922e9bac Merge changes from topic "prediction_suggestion_services"
* changes:
  Initial commit of Content Suggestions (overview long press) Manager.
  Adding initial implementation of Prediction client/service API
2019-01-11 20:21:19 +00:00
Svet Ganov
8455ba2341 Historical app ops.
This change is the main check in for the historical app op feature.
The idea is to store a historical data about past app op rejections,
accesses, and durations per op for any UID state indefinitely.

Keeping all operations on record is not practical as app ops are
very frequently performed. To address this we are storing aggregated
data as snapshots where we store for every UID and its packages
how many times each op was accessed, rejected, lasted as an aggregate.

To allow history scaling indefinitely we are taking a logarithmic
approach with only the most recent state stored in memory and all
preceding state stored on disk. State on disk is stored in separate
files where each preceding file, i.e. for an older period, would
cover X times longer period with X number of snapshots covering
X times longer period. Initially X is ten but can be tweaked. For
example, the first file could contain data for ten days with daily
snapshots, while the file for older period would have data
for a hundred days with snapshots every ten days, etc.

The implementation is optimized for fast history update and no impact
on system runtime performance and minimizing memory footprint. We
are lazily persisting state to disk on a dedicated thread as this is
slow. We are also reading the relevant historical files on a query
as this is very rare as opposed to state updates.

The base snapshot interval, i.e. snapshot time span, in the initial
iteration and the logarithmic step are configurable. These can be
changed dynamically and the history would be rewriten to take this
into account.

Test: atest CtsAppOpsTestCases

bug:111061782

Change-Id: I55c32c79911ba12b2ace58d2a782b8df1e6bff60
2019-01-10 19:31:31 -08:00
Winson Chung
3fb0f258d3 Initial commit of Content Suggestions (overview long press) Manager.
Test: compile
Bug: 120865921
Change-Id: I9f8310112bedc883406f0f50a99041f542036fd9
2019-01-10 16:35:13 -08:00