Commit Graph

5534 Commits

Author SHA1 Message Date
TreeHugger Robot
9a8e27a915 Merge "Allow UiAutomation to adopt the shell permission indentity" 2018-07-04 03:00:14 +00:00
Svet Ganov
d873ae62c4 Allow UiAutomation to adopt the shell permission indentity
For testing we often need to run shell commands. This can be done
today via running a shell command from an instrumentation test
started from the shell. However, this requires adding shell commands
which are not in the API contract, involve boilerplate code, require
string parsing, etc.

This change allows an instrumentation started from the shell to
adopt the shell UID permission state. As a result one can call APIs
protected by permissions normal apps cannot get by are granted to
the shell. This enables adding dedicated test APIs protected by
signatures permissions  granted to the shell.

Test: cts-tradefed run cts-dev -m CtsUiAutomationTestCases
          -t android.app.uiautomation.cts.UiAutomationTest#testAdoptShellPermissions

bug:80415658

Change-Id: I4bfd4b475225125512abf80ea98cd8fcacb6a1be
2018-07-03 16:39:44 -07:00
Jeff Sharkey
c609116a1b Get android.os tests running against real APIs.
Combination of moving to existing public API, tagging things as
@TestApi, and bringing utility methods into tests.

Bug: 13282254
Test: atest cts/tests/tests/os/
Change-Id: Ifd24c0d048d200e8595e194890cc1dc53ddc2b3e
2018-06-29 17:15:44 -06:00
Winson Chung
1241652d8a Merge "Ensure PiP test apis are marked as TestApi" 2018-06-29 03:13:25 +00:00
Winson Chung
37b99ba2e4 Ensure PiP test apis are marked as TestApi
Bug: 77533294
Test: atest CtsAndroidAppTestCases:PictureInPictureParamsBuilderTest
Change-Id: Icbcea8cf9d7e49db7ebcc1ce676b43722f75b7f4
2018-06-28 15:42:06 -07:00
Jeff Sharkey
3ac2a43455 Give StrictMode more bits to work with.
We're almost out of bits, and we don't really need to smash both
thread and VM policy into the same 32-bit value, so use the lower
16-bits for each policy type and the upper 16-bits for penalty.

ActivityManager is only consulting the penalty bits, so we can
remove getViolationBit() and switch CTS over to doing instanceof
checks.

Bug: 110413274
Test: atest cts/tests/tests/os/src/android/os/cts/StrictModeTest.java
Change-Id: I760e6a28f56da66dc75b7df9daf2167ff5bdff50
2018-06-26 14:12:14 -06:00
Jeff Sharkey
c59a5e7e0b StrictMode to catch implicit Direct Boot matching.
When an app starts becoming Direct Boot aware, it can be difficult
to track down all the places they're implicitly relying on
PackageManager filtering behavior.

For example, if the current Launcher isn't Direct Boot aware, we
hide it until the user is unlocked, which could confuse other Direct
Boot aware apps into thinking it had been uninstalled, which could
cause data loss.

This change helps apps track down places where they're implicitly
relying on the automatic filtering; they should instead carefully
choose a combination of MATCH_DIRECT_BOOT flags to decide on the
explicit matching behavior they want.

To implement this, we partially migrate the updateFlags() methods
out into ApplicationPackageManager, since the checking needs to
happen on the client side to correctly report StrictMode
violations.  We don't currently mutate the flags, but we retain
the naming to keep that door open in the future.

Test: manual
Bug: 110413274
Change-Id: Iff6feba19da81ea1b4eeb3af821c3bdfbd9bf17c
2018-06-26 13:20:37 -06:00
TreeHugger Robot
849c351337 Merge "Make setPrivacy not a hidden api" 2018-06-22 23:49:02 +00:00
Yi Jin
5afde76fbe Make setPrivacy not a hidden api
Bug: 110710413
Test: N/A
Change-Id: Iae8dda7f2295e3080c042398516838d84bd5d5be
2018-06-22 21:07:41 +00:00
Philip P. Moltmann
4a6dff0911 Allow permissions to have background permissions
Some permissions are getting split into foreground and background
variants. If an app only has the foreground version it can only access
the protected resource while the user is using it. Once the background
permission is added to the foreground permission the app can always
access the resource protected by the permission.

- Only having the background permission does grant anything.
- Mutliple foreground permission can share a single background permission,
  but a foreground permission can not have multiple background
  permissions.
- As the implementation of background permissions is based on AppOps
  only the system can declare such foreground/background permissions
- A CTS test enforce that the background is in the same group as the
  matching foreground permission.

Bug: 78788390
Test: Checked declared permission after boot and found new attributes
Change-Id: Ica7ba77b24345607c7467c41c982a58c39199024
2018-06-19 12:23:55 -07:00
Dianne Hackborn
1c4cc2d182 Merge "Expose new AppOps API that we had to leave hidden in P." 2018-06-14 23:42:46 +00:00
Dianne Hackborn
f0c322a9db Expose new AppOps API that we had to leave hidden in P.
Now's the time!

Test: manual
Bug: 109754053
Change-Id: I06c9428b5a133be574061410b4bb7d9c589c1b7c
2018-06-14 11:44:38 -07:00
Wale Ogunwale
65ebd955e1 Split interfaces and service for activities from current AM interfaces (1/n)
First step in unifying the window hierarchy that is currently split
within AM and WM packages. We separate the interfaces and service dealing
with activities and their containers (tasks, stack, display) from the
rest of AM interfaces and services. This will allow us to move the new
interfaces and services to WM when the internal states are cleaned-up.

Test: Existing tests pass
Test: go/wm-smoke-auto
Bug: 80414790
Change-Id: Ide9b3f89123b768cdbd3e3878113c7a8021187f3
2018-06-06 18:26:21 -07:00
Hongming Jin
6bbc61e725 Merge "Enforce permission check before returning application info Test: atest CtsAppSecurityHostTestCases:ApplicationVisibilityTest Bug: 77821568" into pi-dev am: dbc6052022
am: e2304c2ed4

Change-Id: I4a9f0c4fae6dc286fd671c007e3ff39ac357282f
2018-06-01 10:48:38 -07:00
Hongming Jin
83e162615f Enforce permission check before returning application info
Test: atest CtsAppSecurityHostTestCases:ApplicationVisibilityTest
Bug: 77821568

Change-Id: I7554805c36c0c2552163dad7b07cfc5f552b624e
2018-05-31 17:20:14 -07:00
Todd Kennedy
efb4b1b509 Merge "Ensure permission held for MATCH_KNOWN_PACKAGES" into pi-dev am: 2f898c4df5
am: 87fbe89e5d

Change-Id: Id80937d84f4e1b28673b1e6b6ee6c4741b01efb0
2018-05-31 17:04:34 -07:00
Todd Kennedy
ef9acb6ed9 Ensure permission held for MATCH_KNOWN_PACKAGES
There's an escape clause that passes the cross user permissions
if the caller UID is identical to the target user ID [eg. we're not
operating across users]. However, the method getInstalledPackagesList()
uses android.permission.INTERACT_ACROSS_USERS to filter the results and
a calling UID check is not sufficient. Ensuure the permission is
actually held, regardless of the calling UID or target user.

Change-Id: Iebf88668766d387a15246d6eea6420610665105a
Fixes: 80435086
Test: atest CtsAppSecurityHostTestCases:ApplicationVisibilityTest
2018-05-30 13:56:17 -07:00
Wale Ogunwale
56034a4f59 Merge "Added TestApi to ActivityInfo.isTranslucentOrFloating" into pi-dev am: 9d19487b1c
am: 9f6c8feb6f

Change-Id: Ia6008e05fe7a7b369be2d9a84bcedc94d74c5334
2018-05-25 19:57:10 -07:00
Wale Ogunwale
30eab1f430 Added TestApi to ActivityInfo.isTranslucentOrFloating
This would be use to determine the right activity state during CTS
test for products that have windowSwipeToDismiss set.

Also, dump ActivityRecord.fullscreen to proto for the same reason.

Bug: 76207986
Bug: 79167358
Test: atest CtsActivityManagerDeviceTestCases:ActivityLifecycleTests
Test: atest CtsActivityManagerDeviceTestCases:ActivityManagerAssistantStackTests
Change-Id: Iadc088e9129be088b8a083ebbafd8d20fe26b673
2018-05-25 10:24:14 -07:00
TreeHugger Robot
d6f175d727 Merge "Allow keycode lookup without KEYCODE_ prefix" 2018-05-23 16:55:32 +00:00
Siarhei Vishniakou
de1f904713 Allow keycode lookup without KEYCODE_ prefix
Currently, KeyEvent.keyCodeFromString(String name) requires the string
to either start with "KEYCODE_", or be directly convertible to an int.
However, the string representation of every keycode starts with
"KEYCODE_", so this requirement is redundant. Relax this requirement to
alllow both of the following usages:
1) keyCodeFromString("KEYCODE_BUTTON_A")
2) keyCodeFromString("BUTTON_A")

Currently, only 1) is supported.

The other usage,
3) keyCodeFromString("29")
is unchanged.

The input is no longer case-sensitive.
Improved the example of usage in the documentation: the input
"1001" suggests that the string must contain binary representation for
usage 3), while in fact it is supposed to be a base 10 number.

Test: atest cts.KeyEventTest#testKeyCodeFromString
Bug: 36069459

Change-Id: I54d7f9d1270748854143cc9d1e8af48c9ec0cd0f
2018-05-22 07:23:34 -07:00
Svetoslav Ganov
085ef7dcb0 Merge "Make RemoteCallback test API" into pi-dev am: a757fd7827
am: 573a696f8f

Change-Id: Iab9be37d714d1d1b8eec032d9dabbcd5cb056834
2018-05-21 13:11:12 -07:00
Svet Ganov
6b03aa76e9 Make RemoteCallback test API
Test: manual

bug:79782915

Change-Id: I61343573428333c0d4a9ee2523c444753280186c
2018-05-21 15:55:28 +00:00
Jeff Sharkey
ca46c6beea Merge "Let tests enumerate all transports/capabilities." into pi-dev am: 8e6445a1a5
am: 75299cffec

Change-Id: If07e77c92046807235229a4f67ee087bdd7bccf1
2018-05-15 08:37:39 -07:00
Jeff Sharkey
8e6445a1a5 Merge "Let tests enumerate all transports/capabilities." into pi-dev 2018-05-15 15:17:30 +00:00
Jeff Sharkey
a5ee62f356 Let tests enumerate all transports/capabilities.
This gives them a way to collect all included values without
resorting to manual probing of each newly added value.

Bug: 16207332
Test: atest com.android.cts.net.HostsideVpnTests
Change-Id: I35ca412512dc8515b44d5518e1ca4caa5bdc678f
2018-05-14 17:17:33 -06:00
Hall Liu
f2a443dbac Merge "Add CallAudioState ctor as TestApi" into pi-dev am: 785a93f61a
am: b5e999f3fd

Change-Id: I65395b8dc270ce503271bf7800f6d1ed46a2c9f2
2018-05-14 14:40:45 -07:00
Hall Liu
c1d95aad1a Add CallAudioState ctor as TestApi
Needed for CTS testing

Bug: 79528185
Test: CTS
Change-Id: Iad154257a93cc776d5800527e46e777fd6c88220
2018-05-11 17:14:58 -07:00
android-build-team Robot
46985f328b Merge "Provide method to read AppOpsManager._NUM_OP" 2018-05-09 00:19:31 +00:00
Fyodor Kupolov
6fe565e441 Make SQLiteDebug @TestApi
Test: CtsDatabaseTestCases
Bug: 77543575
Change-Id: Ied9948e962fb7a81e56be0360cb94b0c318ad14d
2018-05-07 16:13:08 -07:00
Philip P. Moltmann
2457681ec0 Provide method to read AppOpsManager._NUM_OP
So it can be changed without api breakage.

Fixes: 79204487
Test: atest android.permission.cts.AppOpsTest#testAllOpsHaveOpString
Change-Id: I7eb6d36e07108879dfd20b0432dd67925842631b
2018-05-07 12:48:36 -07:00
Dianne Hackborn
e04f13d9ea Add app op for Bluetooth scans
Bug: 78480444
Test: manual
Change-Id: I5a88abc8f26e7505ebfbd76137f13f75be6e5ff9
2018-05-03 12:02:32 -07:00
android-build-team Robot
8d7b81e67f Merge "Expose APIs used by CtsPermissionTestCases" 2018-04-27 18:56:48 +00:00
Gil O'Neil
220b47a10d Merge "Added test API to refresh the UICC Profile" into pi-dev am: 3e6ceafbaa
am: f0c09d6e0c

Change-Id: I66696ad33de00595f10e02f7e29aa33bc4442281
2018-04-26 16:55:08 -07:00
Gil O'Neil
f0c09d6e0c Merge "Added test API to refresh the UICC Profile" into pi-dev
am: 3e6ceafbaa

Change-Id: Icde39b92a744653f1fb71165df4dda8362deee8b
2018-04-26 16:36:18 -07:00
Philip P. Moltmann
33115156f9 Expose APIs used by CtsPermissionTestCases
Test: atest CtsPermissionTestCases
Bug: 77604428
Change-Id: Ib5e9b678e98aab86dac90610ed071eb89f14fce9
2018-04-26 09:40:57 -07:00
goneil
f6c6e8efa7 Added test API to refresh the UICC Profile
Bug: 74016670
Test: GTS tests - vendor/xts/gts-tests/hostsidetests/simappdialog
Change-Id: I8f8ffdad8666d523172b035d24b96278d4d1a1ee
2018-04-25 18:19:42 -07:00
goneil
6eb25b8e57 Remove duplicate TelephonyManager class in test-current.txt
Bug: 78192245
Test: None
Change-Id: I8b93a86d1107ee56e662f3315b71a51e7dd62e9f
2018-04-25 14:21:44 -07:00
Siarhei Vishniakou
4c96a5e2cb Add @TestApi to KeyEvent.actionToString(..)
Currently, it is not possible to use KeyEvent.actionToString(..) in a
CTS test because that API is @hide. However, it would be useful to print
these actions when tests fail. Therefore, add the @TestApi annotation.

Bug: 77803694 36069459
Test: m cts-input-lib CtsHardwareTestCases (under development)
Change-Id: I2d23dbd101cef3f1c6c7a70c521a9dc219797615
2018-04-24 18:02:11 -07:00
Jeff Sharkey
4cdf6e58ed Merge "Give CTS a way to force-poll network stats." into pi-dev am: 46e58e1b40
am: 77c7b732c4

Change-Id: I93be7a46fc345efc31e98975c65a287f2d344220
2018-04-20 14:07:19 -07:00
Jeff Sharkey
77c7b732c4 Merge "Give CTS a way to force-poll network stats." into pi-dev
am: 46e58e1b40

Change-Id: Id2252b803a33ddadfef71618b3b9106c93c5be2a
2018-04-20 13:51:02 -07:00
Jeff Sharkey
c3c8d16380 Give CTS a way to force-poll network stats.
Collecting network statistics is pretty heavy, which is why we're
throttling callers.  However, to keep CTS running fast, we provide a
way for tests to force a poll event, instead of making them wait for
the throttle timeout.

Bug: 77908520
Test: atest cts/tests/tests/app.usage/src/android/app/usage/cts/NetworkUsageStatsTest.java
Change-Id: Ia792f0cd495023366ff8c4839df54e7da2ae8331
2018-04-20 12:18:23 -06:00
Dan Gittik
e654ca92f4 Merge "Fixed power manager CTS test." into pi-dev am: 15d35c1274
am: 17ad53b40b

Change-Id: Ib805670acfae2c9b17afb07e6484906fae71f5ce
2018-04-17 04:02:45 -07:00
Dan Gittik
17ad53b40b Merge "Fixed power manager CTS test." into pi-dev
am: 15d35c1274

Change-Id: I375d0d77520a707cc76064a93def15faa5f8ddb1
2018-04-17 03:50:58 -07:00
Dan Gittik
26b030d829 Fixed power manager CTS test.
Added an annotation necessary to allow the power manager CTS test to
access the non-public method nap.

Test: adb install -r \
      out/host/linux-x86/cts/android-cts/testcases/CtsOsTestCases.apk
      adb shell am instrument -e class android.os.cts.PowerManagerTest \
      -w android.os.cts/android.support.test.runner.AndroidJUnitRunner

Change-Id: Ida939f074654bef351e2b8fd563c8463431ce9c6
Fixes: 77907164
2018-04-16 18:50:10 +01:00
Michael Wright
4cf175b4ed Merge "Revert "Fixed power manager CTS test."" into pi-dev am: ca1dcfb23e
am: ad93f44a3e

Change-Id: I84dc34980d768ee8807c4d9b045a1971dfdbff03
2018-04-13 11:11:05 -07:00
Michael Wright
ad93f44a3e Merge "Revert "Fixed power manager CTS test."" into pi-dev
am: ca1dcfb23e

Change-Id: Ie748557c6940961635cdd929238f1bd2070e8804
2018-04-13 10:59:47 -07:00
Dan Gittik
b5abef7867 Merge "Fixed power manager CTS test." into pi-dev am: 62444d4950
am: 33ca88a1fc

Change-Id: I3ed21dbc86c56ab1a9182607bb7bba7bbc73229e
2018-04-13 10:36:35 -07:00
Michael Wright
4d6b454b45 Revert "Fixed power manager CTS test."
This reverts commit 48fed61da3.

Reason for revert: m checkbuild failing
Bug: 77907164

Change-Id: I7f75dafc049581a7a5393c3cf0108c488eecaf48
2018-04-13 17:32:11 +00:00
Dan Gittik
33ca88a1fc Merge "Fixed power manager CTS test." into pi-dev
am: 62444d4950

Change-Id: I96d0acccf64a86a241178241dc6fc9b069f29ac8
2018-04-13 10:21:15 -07:00