Commit Graph

16181 Commits

Author SHA1 Message Date
Philip P. Moltmann
5ffb16c95f Merge "Do not call into system server with sLock held" 2019-09-10 17:11:56 +00:00
Philip P. Moltmann
9bcc40655e Do not call into system server with sLock held
This is not necessary and causes lock issues.

Fixes: 140536454
Test: atest CtsAppOpsTestCases
Change-Id: I3d1c10f784fd18f82ddfc895ecf6e68711929fba
2019-09-09 23:23:51 +00:00
TreeHugger Robot
2257e8b62d Merge "int userHandle -> int userId" 2019-09-06 18:08:08 +00:00
Bookatz
f56f258495 int userHandle -> int userId
Throughout the codebase, sometimes an integer user ID is called
userId, and sometimes it is called userHandle. Here, we rename the
occurences of "int userHandle" to "int userId" in select files.
Additionally, we add the @UserIdInt annotation in many more places.

This certainly does not cover all uses of userHandle, which is used
widely throughout Android; doing so would be more dangerous and cause
merge conflicts. But at least the core User code can have a consistent
nomenclature.

Bug: 138384792
Test: compiles. presubmit passes.

Change-Id: I9a2684e9bfac637e0476c4b68027008ebb8a160b
2019-09-06 09:26:35 -07:00
Evan Rosky
4c67d2678e Merge changes from topic "unify_window_resize_1"
* changes:
  Unify Window resize (1/N)
  Remove TaskRecord.updateOverrideConfig
2019-09-05 22:28:52 +00:00
Julia Reynolds
5cb8d5a6c3 Address API review feedback
Make methods fully public, add documentation, swap what method is public

Test: make
Fixes: 139833596
Bug: 138589409
Change-Id: If39d6423efedcf8578dc2942274f6fbb341d164a
2019-09-05 16:22:29 +00:00
TreeHugger Robot
a821dabaaa Merge "Revert "Fix: vendor public libraries are accessible via System.loadLibrary"" 2019-09-05 08:56:16 +00:00
Jiyong Park
37131e1ee6 Revert "Fix: vendor public libraries are accessible via System.loadLibrary"
This reverts commit cfe38cdb1c.

The CL 8f712189dfc02285573337e2b4ab17678011db14 in libcore project avoids
the need for adding the new paths in LoadedApk. With the CL, a classloader
does not give up even when loader.findLibrary() has failed due to some
paths are not added to it. Instead, the classloader converts the given
libname into a filename (e.g. foo -> libfoo.so) then calls dlopen()
with the filename. The classloader reports failure only when the dlopen()
call has failed. Therefore, manually adding these paths to the classloader
is no longer needed and thus removed.

Bug: 109720125
Test: System.loadLibrary("adsprpc") is successful in Pixel (because
libadsprpc.so is in Pixel's vendor public lib list)
Test: atest cts/tests/tests/jni

Change-Id: I1970eba7e732728699042a36b89571915ec81451
2019-09-05 08:49:49 +00:00
Chris Tate
6290916b9b Merge "Kill apps outright for API contract violations" 2019-09-04 20:51:19 +00:00
TreeHugger Robot
f70fb1be14 Merge "Add more doc for RoleControllerService.onIsApplicationVisibleForRole()." 2019-09-04 09:24:59 +00:00
TreeHugger Robot
18f86541bf Merge "Add wrapper functions to eventually remove enum logic from callers." 2019-09-03 22:24:52 +00:00
Hai Zhang
cd228b9a84 Add more doc for RoleControllerService.onIsApplicationVisibleForRole().
Fixes: 140410946
Test: presubmit
Change-Id: Ib32a6fba238ee10959325c98273ad6e193ea2193
2019-09-03 10:40:31 -07:00
TreeHugger Robot
189da4f994 Merge "Move usage stats data to credential encrypted storage." 2019-08-30 22:12:24 +00:00
Evan Rosky
dbe2ce5e82 Unify Window resize (1/N)
This decouples the Split and Pinned stack resize flows. The
current goal is to prepare for a leashed resize implementation
for split-screen. For this to work, it needs to be clear
what actual logic belongs to the various docked resizing modes
vs what is for general stack resize or pinned resize. This
also enables PiP and Split to be worked-on in parallel.

As can be seen, general stack resize is actually not required
because freeform and fullscreen modes use task resize.

Bug: 119687367
Test: go/wm-smoke + related CTS
Change-Id: I9cca1910a18b87dda618235e89f2bdc582086f34
2019-08-30 13:56:09 -07:00
TreeHugger Robot
8e6a69c3a2 Merge "Allow apps to collect which appops were noted" 2019-08-30 18:53:22 +00:00
Mady Mellor
8c209679f5 Merge "qt-r1-bubbles-dev @ build 5835883" 2019-08-30 18:11:37 +00:00
Varun Shah
3a31520250 Move usage stats data to credential encrypted storage.
Move all of the usage stats data from the regular system storage to
the system CE (credential encrypted) storage.

All events being reported while the user is locked will be stored
in memory and will be processed via the handler after the user is
unlocked. All of these events reported will regularly be persisted to
system DE storage to ensure important events are not lost.
Any query requests will be ignored while the user is locked.

Two new usage events have been added: one to indicate the user has been
unlocked and the other to indicate the user has been stopped.

Also updated documentation for APIs in UsageStatsManager to reflect the
new behavior in R when the user is locked.

Bug: 135484470
Test: atest android.app.usage.UsageStatsTest#testDataIsInCe
Test: atest android.app.usage.cts.UsageStatsTest#testUserUnlockedEventExists
Test: atest android.app.usage.cts.UsageStatsTest
Test: atest UsageStatsDatabaseTest
Change-Id: I18da1a9354b6686472972c5f2304e4c19e28307f
2019-08-30 10:44:22 -07:00
Philip P. Moltmann
2b08aafc14 Allow apps to collect which appops were noted
If private user data is send to an app the data provider should note an
app-op. This change adds a new API AppOpsManager#setNotedAppOpsCollector
that allows an app to get notified every time such an private data access
happens.

This will allow apps to monitor their own private data usage. Esp. with
big, old apps, distributed teams or 3rd party libraries it might not always
be clear what subsystems access private data.

There are three different situations how private data can be accessed and
an app op is noted:

1. Private data access inside a two-way binder call.
E.g. LocationManager#getLastKnownLocation. When we start a two way
binder transaction, we remember the calling uid via
AppOpsManager#collectNotedAppOps. Then when the data providing code
calls AppOpsManager#noteOp->AppOpsManager#markAppOpNoted the noted
app-op is remembered in
AppOpsManager#sAppOpsNotedInThisBinderTransaction. Then when returning
from the binder call, we add the list of noted app-ops to the
reply-parcel via AppOpsManager#prefixParcelWithAppOpsIfNeeded. On the
calling side we check if there were any app-ops noted in
AppOpsManager#readAndLogNotedAppops and then call the collector while
still in the binder code. This allows the collector e.g. collect a stack
trace which can be used to figure out what app code caused the
private data access.

2. Very complex apps might do permissions checks internal to themself.
I.e. an app notes an op for itself. We detect this case in
AppOpsManager#markAppOpNoted and immediately call the collector similar
to case (1).

3. Sometimes private data is accessed outside of a two-way binder call.
E.g. if an app registers a LocationListener an app-op is noted each time
a new location is send to the app. In this case it is not clear to the
framework which app-action triggered this app-op-note. Hence the data
provider has to describe in a AsyncNotedAppOp object when an why the
access happened. These objects are then send to the system server via
IAppOpsService#noteAsyncOp and then the collector in the app. There are
rare cases where a private data access happens before the app is running
(e.g. when a geo-fence is triggered). In this case we cache a small
amount of AsyncNotedAppOps (in AppOpsService#mUnforwardedAsyncNotedOps)
and deliver them when the app is ready for these events (in
AppOpsManager#setNotedAppOpsCollector).

Test: atest CtsAppOpsTestCases (includes new tests covering this
                                functionality)
Bug: 136505050
Change-Id: I96ded4a8d8d9bcb37a4555d9b1281cb57945ffa9
2019-08-30 08:18:50 -07:00
Aurimas Liutikas
34c56bcf4a Merge "Add missing nullability annotations." 2019-08-30 15:14:37 +00:00
Mady Mellor
06b770cf14 qt-r1-bubbles-dev @ build 5835883
Test: presubmit setup on source branch

Bug: 126945401
Bug: 128932906
Bug: 129158983
Bug: 130237686
Bug: 130250809
Bug: 130442248
Bug: 131267438
Bug: 131609280
Bug: 131692350
Bug: 131849856
Bug: 133444037
Bug: 134064116
Bug: 134064858
Bug: 134070807
Bug: 134077101
Bug: 134090085
Bug: 134155107
Bug: 134423445
Bug: 134512898
Bug: 134514210
Bug: 134514227
Bug: 134734945
Bug: 134960381
Bug: 134989736
Bug: 135214687
Bug: 135280077
Bug: 135472021
Bug: 135475155
Bug: 135487618
Bug: 135488406
Bug: 135518045
Bug: 135633218
Bug: 136034310
Bug: 136150954
Bug: 136199542
Bug: 136538998
Bug: 137201711
Bug: 137213469
Bug: 137214359
Bug: 137214536
Bug: 137233453
Bug: 137876221
Bug: 138301618
Bug: 138445026
Bug: 138659213
Bug: 138749133
Bug: 138799651
Bug: 138801505
Bug: 138941969
Bug: 139002444
Bug: 139025304
Bug: 139816141
Change-Id: Ic271a6a0f0803941dd5a84124dabf4d8c5fcc755
2019-08-29 20:24:52 -07:00
TreeHugger Robot
7ce605ebe9 Merge "Updated onSharedPreferenceChanged listener behavior." 2019-08-30 03:10:08 +00: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
Christopher Tate
9fbc5e75b4 Kill apps outright for API contract violations
...rather than relying on in-app code to perform the shutdown.

Bug: 128649910
Test: manual
Test: atest OsHostTests#testForegroundServiceBadNotification
Change-Id: I94d9de50bb03c33666471e3dbd9c721e9278f7cb
2019-08-29 15:35:32 -07:00
TreeHugger Robot
0ac25af13a Merge "Removing @Deprecated && @removed method from KeyguardManager." 2019-08-29 20:32:46 +00:00
TreeHugger Robot
4485bf80df Merge "Make grant origin tracing more ergonomic" 2019-08-29 17:42:04 +00:00
Rubin Xu
6762470fc2 Merge "Make DPM.isActivePasswordSufficient() synchronous again" 2019-08-29 12:24:00 +00:00
George Mount
44846f0c70 Merge "Add test API to change the exit transition timeout." 2019-08-28 21:05:52 +00:00
TreeHugger Robot
47114169b7 Merge "Add RoleControllerManager.isApplicationVisibleForRole()." 2019-08-28 11:19:50 +00:00
George Mount
dccc068f09 Add test API to change the exit transition timeout.
Bug: 139458376

Allows tests to increace the exit transition timeout so that
cloud devices don't finish before the exit transition completes.

Test: ActivityTransitionTest
Change-Id: Ib94086f5ab06ff8172b80b26260e41158d428b0c
2019-08-27 10:47:23 -07:00
Abhijeet Kaur
e9998513db Add wrapper functions to eventually remove enum logic from callers.
The bugreport API uses newly added enum for bugreport options
(example: BugreportParams.BUGREPORT_MODE_FULL). So, now we need to
maintain and keep in sync both of these enums as requestBugreport will
use the bugreport API; Need to move towards one enum for bugreport
options.

Currently, the caller of requestBugReport(int bugreport) needs to know
the underlying enum for the bugreport it is requesting. Instead of
changing the enum logic at the caller of requestBugreport(), create
wrapper functions for specific bugreports.

Bug: 137825297
Test: Builds
Change-Id: I62a58511867624f9662287ee39f78a31ff9cd765
2019-08-27 16:55:40 +01:00
TreeHugger Robot
f468327f9f Merge "Deprecated APIs related to ActivityGroup" 2019-08-27 13:53:38 +00:00
Charles Chen
c380f0279c Deprecated APIs related to ActivityGroup
Since ActivityGroup logic has been deprecated, it does not make sense to
maintain related APIs in Activity. Deprecate them and make developers
to use fragment APIs or APIs without fromChild suffix version.

Bug: 137825207
Test: build, flash and presubmit
Change-Id: Ia0b6e78079efd4734cacc52bf2c708f628ef323b
2019-08-27 16:43:02 +08:00
Varun Shah
5d2049f2f7 Updated onSharedPreferenceChanged listener behavior.
The onSharedPreferenceChanged listener will now also be called on
Editor#clear with a null key.
This change is gated behind a flag using the new app compat framework.

Removed the OnSharedPreferencesClear listener interface.

Bug: 119147584
Bug: 138293946
Test: atest android.content.cts.SharedPreferencesTest
Change-Id: Ieea168eb40afb8f1b5830f1541be20d93d6f94b5
2019-08-26 15:26:24 -07:00
Hai Zhang
aedc3ab3cf Add RoleControllerManager.isApplicationVisibleForRole().
Settings doesn't actually need to know whether an application
qualifies for a role, but only whether the default app setting should
be visible for an application. Qualification and visibility differs in
cases such as FallbackHome inside Settings which is a qualifying home
activity but should never be shown in default apps UI.

Fixes: 138636320
Test: manual
Change-Id: I216195c64a7b106e2769b11c1a998741a77fdce2
2019-08-26 15:05:06 -07:00
Makoto Onuki
52c24b377b Move DeviceIdle to the JS apex
Test: atest cts/tests/tests/batterysaving/src/android/os/cts/deviceidle/DeviceIdleTest.java
Bug: 137763703
Change-Id: I836350c09f45f95afbf90b562ab1ceed75526498
2019-08-23 16:03:30 -07:00
TreeHugger Robot
903102c430 Merge "Don't refer to DeviceIdle from SystemServiceRegistry" 2019-08-23 15:38:42 +00:00
Rubin Xu
1985486fbf Make DPM.isActivePasswordSufficient() synchronous again
At the moment isActivePasswordSufficient() can return stale result
immediately after a password change since the latest password metrics
information is pushed from LSS to DPMS asynchronously (this is to
avoid deadlock between LSS and DPMS due to lock inversion). Fix this
by moving the password metrics ground truth to LSS, and make DPMS
query LSS about the password metrics when needed.

Bug: 37090873
Test: atest com.android.server.devicepolicy.DevicePolicyManagerTest
Test: atest com.android.server.locksettings
Test: atest DeviceAdminHostSideTestApi24#testResetPassword_nycRestrictions
Test: atest DeviceAdminHostSideTestApi24#testRunDeviceOwnerPasswordTest
Test: atest MixedManagedProfileOwnerTest#testPasswordQualityWithoutSecureLockScreen
Test: atest MixedManagedProfileOwnerTest#testResetPasswordWithToken
Test: atest MixedManagedProfileOwnerTest#testPasswordSufficientInitially

Change-Id: Ib1d1716024b8a6a6554afdb4ee9824d457ed8308
2019-08-23 13:38:14 +01:00
Jeff Sharkey
0be6fcd0d9 Merge changes from topic "activez"
* changes:
  Public API to check and note media operations.
  Public API to watch for "active" operations.
2019-08-22 17:17:22 +00:00
Jeff Sharkey
5997cc8516 Public API to check and note media operations.
These operations are used by MediaProvider when checking and noting
interactions with specific media types on the device.

Bug: 137890034
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: Id452ad121bd8a0b7c1c337a2b7fe030135a9d776
2019-08-22 11:12:57 -06:00
Jeff Sharkey
7095ab9f52 Public API to watch for "active" operations.
We already have startOp() and finishOp() to provide a mechanism to
mark an operation as being "active".  This change publishes a set of
APIs to check the status of these active operations, matching the
naming of similar existing APIs on the same class.

Bug: 139128842
Test: atest com.android.server.appop.AppOpsActiveWatcherTest
Test: atest android.media.cts.AudioRecordAppOpTest
Exempt-From-Owner-Approval: trivial API refactoring
Change-Id: I9fb381d748ff23ff24dd363ed5b117bd661793ab
2019-08-22 11:12:45 -06:00
Martin Stjernholm
b36a5bc699 Merge "Update path to the new ART APEX." 2019-08-22 15:00:09 +00:00
Eugene Susla
cb923e3829 Make grant origin tracing more ergonomic
Add missing package name, and separate grant logs from spammy flag update ones

Test: manual
Change-Id: I22d587e92c8b7c8e94492bac3596764ba4240eab
2019-08-21 10:50:58 -07:00
Julia Reynolds
9ef59c953d Merge "Make some APIs used by ExtService module @SystemApi" 2019-08-21 13:05:11 +00:00
Martin Stjernholm
3de5cbbd1c Update path to the new ART APEX.
Test: atest CtsJniTestCases
Bug: 135753770
Change-Id: Ica35fc7f6adade19160cbb16adf5647d189ecc45
2019-08-21 10:49:47 +01:00
Rhed Jao
2b1f8ce42b Merge "More logs for UiAutomation" 2019-08-20 02:59:57 +00:00
Julia Reynolds
a10437f460 Make some APIs used by ExtService module @SystemApi
These are all pieces of data apps could get anyway;
these are code nice-to-haves to reduce code replication

Test: make
Bug: 122138479
Bug: 138589409
Change-Id: Ie8ffacb6c28840f779c68f7aa95f1405e70f5ce5
2019-08-19 11:32:12 -04:00
Rhed Jao
8529293231 More logs for UiAutomation
Test: atest UiAutomationTest
Bug: 134536201
Change-Id: Ibab34b1908143d894076abf5d9f3692bc03c70db
2019-08-16 19:07:13 +08:00
Eran Messeri
756326e708 Merge "DPM key grant: Address API review" 2019-08-16 04:48:31 +00:00
Alex Light
74e8d3be48 Merge "Add agent startup-attach" 2019-08-15 16:00:53 +00:00
TreeHugger Robot
426b942eb1 Merge "Fixed SystemServiceRegistry to return a null AppPredictionManager when the service is not defined." 2019-08-15 07:36:07 +00:00