Commit Graph

5566 Commits

Author SHA1 Message Date
Jeff Sharkey
e0339a6f6e Merge "Support more createPackageContextAsUser() users." 2018-09-13 20:08:57 +00:00
Michael Wachenschwanz
3f6039393e Merge "Intial ProtoInputStream checkin" 2018-09-13 02:02:19 +00:00
Michael Wachenschwanz
8d38b29ba7 Intial ProtoInputStream checkin
Enable proto reading on the Android Framework with a memory efficient
pull parser.

Fixes: 112269636
Test: atest CtsProtoTestCases
Change-Id: If8331edb1ec393acd724ffb5d27d6efad1a42a80
2018-09-12 18:54:19 -07:00
Jeff Sharkey
ec5f7d1625 Support more createPackageContextAsUser() users.
We created this API to make it easy to pass a given UserHandle into
all Managers obtained from a given Context, which works great for
"normal" users, but we should also support special users like ALL
and CURRENT.

Also add an AutoCloseable marker to make try-with-resources easier.

Bug: 112153259
Test: atest android.content.cts.ContextTest
Change-Id: I261dfcc5cfdfc76bda5d70181785e11c2715a558
2018-09-12 14:02:11 -06:00
TreeHugger Robot
1dfc2c7188 Merge "[Magnifier-48] Allow on-the-fly zoom update" 2018-08-31 09:03:30 +00:00
TreeHugger Robot
b6a2cfbd75 Merge "[Magnifier-47] Expose magnifier properties" 2018-08-30 13:36:51 +00:00
Mihai Popa
beeaf5589d [Magnifier-48] Allow on-the-fly zoom update
The CL adds Magnifier#setZoom(float), which allows dynamically changing
the initial zoom applied to the content that will be magnified and
displayed in the magnifier.

Bug: 72211470
Test: manual testing
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: I1dd01085ef5a1589a3602aefd03223d1451564f5
2018-08-29 11:16:26 +01:00
Mihai Popa
c2e0bee9ea [Magnifier-47] Expose magnifier properties
The CL adds public getters around magnifier properties. The properties
mostly correspond to the ones that can be specified using the magnifier
builder class.

Bug: 72211470
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: I84c827bed039cb46b19c2dfb5123bd2d97374eca
2018-08-29 11:16:26 +01:00
Makoto Onuki
eb932592ad Add test API for sqlite CTS
Test: CtsDatabaseTestCases
Bug: 112777941
Bug: 111939259
Change-Id: Ibd394aa801ddfbb383acb9ae73c2029b47965f83
2018-08-27 12:14:05 -07:00
Sudheer Shanka
be85ed60a8 Add @TestApi to ActivityManager.IMPORTANCE_CANT_SAVE_STATE_PRE_26.
Fixes: 112329019
Test: cts-tradefed run singleCommand cts-dev -m CtsAppTestCases -t \
      android.app.cts.ActivityManagerProcessStateTest
Change-Id: I1c6f1dd9503cde5b11e9d2c3c02841771b665660
2018-08-23 15:02:11 -07:00
Michael Wright
3f4d546525 Revert the DISMISSAL_NOT_DISMISSED to previous value.
This is existing API and can't be changed.

Bug: 113071843
Test: make update-api
Change-Id: Ib6b1002f29ba35d7a2ca8c26cac61344dae9f43f
2018-08-22 23:41:02 +01:00
Aurimas Liutikas
78567088a8 Run update-api to catch up missing api changes.
Bug: 113054005
Test: make update-api
Change-Id: I96897492f4c98d34132d74b55b953c66e3680971
2018-08-22 13:12:34 -07:00
Felipe Leme
37f837222e New Autofill Save UI API to switch visibility of views.
Test: atest \
      OnClickActionTest VisibilitySetterActionTest CustomDescriptionUnitTest

Fixes: 112709898

Change-Id: I05d59ecbdd21d68e9056adeb361e5a9bdd3d2a43
2018-08-20 14:22:33 -07:00
TreeHugger Robot
b2484fa070 Merge "Add TestApi for CtsActivityManagerDeviceTestCases." 2018-08-20 13:30:18 +00:00
Aurimas Liutikas
735dd9adaf Merge "Add @TestApi annotation to a few @hide APIs that were used in CTS." 2018-08-14 20:52:57 +00:00
Julia Reynolds
901bf28b5f The quietening part 2: rules
Apply some rules about what notifications are automatically
silenced.

Test: make ExtServicesUnitTests &&
adb install -r $OUT/testcases/ExtServicesUnitTests/ExtServicesUnitTests.apk &&
adb shell am instrument -w android.ext.services.tests.unit/android.support.test.runner.AndroidJUnitRunner
Bug: 111475013

Change-Id: Idf0434c0688b3249a9fc2d5aa655665e71e53249
2018-08-14 20:45:25 +00:00
Aurimas Liutikas
80e4e18b8c Add @TestApi annotation to a few @hide APIs that were used in CTS.
CtsViewTestCases tests were using @hide APIs. This change makes some
of these APIs @TestApi, so CtsViewTestCases can just link againts test_current.

Test: make -j
Bug: 37778825
Change-Id: I685ab5f0d1d5fcb5557ce4d93fe4f55cc695ed3d
2018-08-13 16:13:37 -07:00
Julia Reynolds
efcdff4528 The quietening round 2 part 1
Allow the notification assistant to block or silence
incoming notifications, or demote notifications after they
are posted

Also temporarily silence everything by default

Plus: bonus refactoring of the cancel notification runnable so I could
write just one of those tests :)

Bug: 111475013
Test: manual, runtest systemui-notification
Change-Id: Ifa04a21919f60d06080cd63e7d7747180b641308
2018-08-10 15:47:54 -04:00
Ralph Nathan
3de75f42da Merge "Mark BluetoothClass#getClassOfDevice as TestApi" am: d5eff002eb am: 045247ec3a am: b9edd4fbc4
am: 07fe5664c5

Change-Id: I79e8943ff3ec4791b40eebdf991e71a0935e377b
2018-08-08 21:20:37 -07:00
Treehugger Robot
d5eff002eb Merge "Mark BluetoothClass#getClassOfDevice as TestApi" 2018-08-09 00:58:44 +00:00
lumark
793e056aa1 Add TestApi for CtsActivityManagerDeviceTestCases.
1) Use @TestApis for verify AM related functions to replace using command.
2) Remove "development" protection level for some @TestApis permissions.

Bug: 77988683
Bug: 80415658
Test: atest CtsActivityManagerDeviceTestCases
Change-Id: I4bb10b45a2269c9e871f38f219d3e92cb45eeb9d
2018-08-08 15:14:15 +08:00
Ralph Nathan
29335fdc9b Mark BluetoothClass#getClassOfDevice as TestApi
This method is being used the Android Things instrumentation test apk.

Bug: 111654175
Test: tests pass
Change-Id: Id3fcd2d89789868e50048542fd1dfe25d9986103
2018-08-06 15:21:30 -07:00
Makoto Onuki
a8f9c8af7e Merge "Rework slow-query log" 2018-08-02 23:15:20 +00:00
Makoto Onuki
a761d2b354 Rework slow-query log
- Allow per-uid slow query log with "db.log.slow_query_threshold.UID"
- Add db.log.bindargs to enable bind args log in slow query log
 (debuggable build only)

Bug: 111210683
Test: setprop db.log.slow_query_threshold 0 -> slow query log enabled for all processes
Test: setprop db.log.slow_query_threshold.ACORE-UID 0 -> slow query log enabled for acore
Test: setprop db.log.bindargs 1  + setprop db.log.slow_query_threshold.ACORE-UID 0 + kill acore ->
  Bind args also logged

Change-Id: I3e85479e0c946308837b827f856016bc4fbe1ea3
2018-08-02 20:33:19 +00:00
TreeHugger Robot
c4f2ec7b3a Merge "Allow NotificationAssistantService to suggest smart replies" 2018-08-02 13:03:48 +00:00
Tony Mak
c9acf67886 Allow NotificationAssistantService to suggest smart replies
If the apps has provided their own choices, they will be used, as opposed
to the "smart replies" from NAS.
Otherwise, smart replies will be applied to the notifications
with a freeform RemoteInput but without choices.

The smart reply model is not ready yet, so canned response is hardcoded
and it is disabled by default. To test it out, run
adb shell setprop persist.sys.smart_replies_experiment true
Also, to get rid of the target >= P SDK requirement, you may want to run:
adb shell settings put global smart_replies_in_notifications_flags enabled=true,max_squeeze_remeasure_attempts=3,requires_targeting_p=false

Test: atest SystemUITests
Test: atest frameworks/base/services/tests/uiservicestests/src/com/android/server/notification/NotificationListenerServiceTest.java
Test:
1. adb shell setprop persist.sys.smart_replies_experiment true
2. adb shell settings put global smart_replies_in_notifications_flags enabled=true,max_squeeze_remeasure_attempts=3,requires_targeting_p=false
3. Send a message to myself, observe the hardcoded smart replies.

Bug: 111674540

Change-Id: Ia61a77faef7c4dcba0501abfec80e3e8cc7274e4
2018-08-02 11:39:35 +01:00
John Reck
9ab32f8740 Add a frame commit callback test API
Bug: 111719753
Test: CtsUiRenderingTestCases
Change-Id: Ie08d49b735f5a42a2f06e9049547a2287ecce575
2018-07-27 09:32:08 -07:00
Philip P. Moltmann
6c644e620d Always review permissions before <M app is started the first time
This splits the
- review permissions
- individually control permissions
- consent to manage wireleess (wifi + bluetooth)
properties.

Almost all code cares only for the first and it is now always true.
Hence a lot of code can be simplified.

Bug: 110431654
Test: atest PermissionsHostTest
      started pre-M app
Change-Id: I733cd476ccd0bf5eaa59e9a9506db34f57c6baee
2018-07-24 11:45:34 -07:00
Tony Mak
dad5ef0d50 Merge "Allow NotificationAssistantService to suggest smart actions" 2018-07-11 17:32:39 +00:00
Tony Mak
628cb9368c Allow NotificationAssistantService to suggest smart actions
Here is the flow:
NAS generates Adjustment -> NMS convert this to RankingUpdate ->
SystemUI.NotificationListener receives the RankingUpdate in either
onNotificationPosted / onNotificationRankingUpdate (Depend on does NAS
provides the adjustment before the notification is en-queued) ->
NotificationEntryManager determines the need of reinflation ->
NotificationInflater inflates / reinflates the view with these
extra bits like smart actions.

Note: We do re-inflation here as simply adding a button to the existing
notification view seems problematic. For example, if the original
notification does not have any action, we will need to inflate the
template with the action container.

Screenshot:
https://hsv.googleplex.com/5731489463402496

Test: atest SystemUITests
Test: atest com.android.server.notification.NotificationAdjustmentExtractorTest
Test: Modify ExtServices to provide adjustment in
      createEnqueuedNotificationAdjustment, post a notification with
      a entity in a sample app, observed the notification is updated.
      (Testing the onNotificationPosted flow)
Test: Modify ExtServices to provide adjustment in onNotificationPosted
      by calling adjustNotification. Post a notification with
      a entity in a sample app, observed the notification is updated.
      (Testing the onRankingUpdated flow)
Test: Repeat the above test, but explicitly make the RowInflaterTask
      slow by inserting Thread.sleep. This can test the onRankingUpdated
      flow when the row is not yet inflated.

BUG: 110527159

Change-Id: I98aee3ac62f60b189ea92ac9fc000127325dfead
2018-07-11 11:12:29 +01:00
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
Jeff Sharkey
b04a511ac4 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.

Cherry-pick of ag/4052941 with minor conflicts in the imports.

Bug: 16207332
Test: atest com.android.cts.net.HostsideVpnTests
Change-Id: Ia764b3412bf834890612378e0c3846913f4e0a06
Merged-In: Ie5cd22cfa2b6a60510fd1e31d7ebcd8f6cc890a0
Merged-In: If07e77c92046807235229a4f67ee087bdd7bccf1
2018-06-06 08:25:36 +00: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
Hall Liu
378f1f4972 Add CallAudioState ctor as TestApi
Needed for CTS testing

Bug: 79528185
Test: CTS
Change-Id: Iad154257a93cc776d5800527e46e777fd6c88220
Merged-In: Iad154257a93cc776d5800527e46e777fd6c88220
2018-05-25 15:22:16 -07:00