Commit Graph

8247 Commits

Author SHA1 Message Date
Varun Shah
ea424deee9 Merge "Fix bootloop issue with UsageStatsService." into qt-qpr1-dev am: eff156093c
am: a5c53a01ae

Change-Id: I9e172385ca47ee1a37986f27694b904acb22769b
2019-09-06 11:25:35 -07:00
TreeHugger Robot
2257e8b62d Merge "int userHandle -> int userId" 2019-09-06 18:08:08 +00:00
Varun Shah
a5c53a01ae Merge "Fix bootloop issue with UsageStatsService." into qt-qpr1-dev
am: eff156093c

Change-Id: Iece7adc8dd9a3cb5c704e917b22337cf8339f460
2019-09-06 10:59:13 -07: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
Anthony Hugh
dcd137410c Merge "Refactor PermissionManager.SPLIT_PERMISSIONS" 2019-09-05 00:53:17 +00:00
Chen Xu
c1f208cd69 Merge "remove symbols from greylist" 2019-09-04 23:31:25 +00:00
Anthony Hugh
de787d4a83 Refactor PermissionManager.SPLIT_PERMISSIONS
Creating a SystemConfig from a non-system process is taking 500+ ms.
This CL instead exposes the needed split permissions from system_server
to optimize performance.

Tested locally and creating PermissionManager / retrieving SystemConfig
is now less than 1 ms.

Bug: 139828734
Bug: 139485700
Fixes: 139828734
Test: Added systrace / logs to PermissionController app and traced
runtime of onGrantDefaultRoles().

Change-Id: I111403e8dae3bc2b0acafc32e61aa5cd890fea29
2019-09-04 15:00:24 -07:00
Varun Shah
5d9031dbee Fix bootloop issue with UsageStatsService.
When the configurations are being read from the proto file, if a
duplicate locale is found in the list, an exception is thrown from
LocaleList which causes the UsageStatsService to crash. Instead, we'll
now log a WTF if duplicate locales are found when parsing the
configuration proto and not add the duplicate locale to the list.

Bug: 140197723
Test: atest UsageStatsDatabaseTest
Change-Id: Ie178b3cfdd45e6771a7c0e4bb42e47f79b5c30cc
2019-09-04 19:12:08 +00:00
Chen Xu
27c4e658b3 remove symbols from greylist
telephony-common is not intended to used by any apps and
being in boot class is not updatability friendly.
We are removing telephony-common from bootclass and apply
<uses-library> in manifest instead.
for apps targeting < R will auto load telephony-common lib
for app compatibility. For apos >=R, only allow usage for
phone UID.

Bug: 135955937
Test: Build
Change-Id: Ia318661546df6d8516328886e5cc0c54d5cfafe6
2019-09-04 11:42:14 -07:00
TreeHugger Robot
fcc598d1e7 Merge "Remove isAutofillDisabledLocked from test api." 2019-09-04 12:52:54 +00:00
TreeHugger Robot
8e6a69c3a2 Merge "Allow apps to collect which appops were noted" 2019-08-30 18:53:22 +00:00
Aurimas Liutikas
488d37b2d0 Merge "Add missing nullability annotations." into stage-aosp-master am: 85c0a5a2be am: ed5beec21b
am: de0ebb082e

Change-Id: I60c55b6706e8d43121e8b2c7a35efff38668f66b
2019-08-30 08:54:38 -07:00
Aurimas Liutikas
ed5beec21b Merge "Add missing nullability annotations." into stage-aosp-master
am: 85c0a5a2be

Change-Id: Ic9ea2b9840fbb678bbb6ab77038415581feba918
2019-08-30 08:35:52 -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
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
Aurimas Liutikas
00be951a08 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
Merged-In: I109260842cfc25f06e40694997fcbb4afa02c867
Change-Id: I109260842cfc25f06e40694997fcbb4afa02c867
2019-08-30 00:14:44 +00:00
Jeff Sharkey
ce766b3ac7 Merge changes from topic "mappingz"
* changes:
  Sprinkle in some TEST_MAPPING.
  Fix subtle bug when using empty withValues().
2019-08-29 02:58:51 +00:00
Kevin Hufnagle
3c7aa609cc Merge "docs: Added desc. of launcher app criteria in Q" into qt-dev am: b14d2dede2 am: 13e2b970ec am: 5e1a48a660
am: eba15ec2b4

Change-Id: I3a599fb3e781067b76b8868d7cf3013c0e4a4fb3
2019-08-28 18:23:59 -07:00
Kevin Hufnagle
eba15ec2b4 Merge "docs: Added desc. of launcher app criteria in Q" into qt-dev am: b14d2dede2 am: 13e2b970ec
am: 5e1a48a660

Change-Id: Ic65f9e1e2a51d91a08b482b3ee2e66f9f0ef29ea
2019-08-28 17:56:05 -07:00
Kevin Hufnagle
5e1a48a660 Merge "docs: Added desc. of launcher app criteria in Q" into qt-dev am: b14d2dede2
am: 13e2b970ec

Change-Id: I393ec53ecf097e5ebe4ce2878e149fbf653df622
2019-08-28 17:39:34 -07:00
Kevin Hufnagle
123f51ff28 Merge "docs: Added desc. of launcher app criteria in Q" into qt-dev
am: b14d2dede2

Change-Id: Ibd55727fe3387ef7b6c6cde2e1c5ba7c2f42f34b
2019-08-28 17:21:39 -07:00
Kevin Hufnagle
b14d2dede2 Merge "docs: Added desc. of launcher app criteria in Q" into qt-dev 2019-08-28 22:08:47 +00:00
Andrew Solovay
8d4be69f1c Merge "Docs: clarify getSharedPreferences behavior" into qt-dev am: 3791f9b071 am: 73a66dc100 am: c149d6ff19
am: 9f226a0085

Change-Id: Ia766df0c95dafd61e68303d49a1b5558cc4fc9d8
2019-08-28 14:28:16 -07:00
Andrew Solovay
9f226a0085 Merge "Docs: clarify getSharedPreferences behavior" into qt-dev am: 3791f9b071 am: 73a66dc100
am: c149d6ff19

Change-Id: Ieae488ea773c6f21b4f3517a682be60c99eaa628
2019-08-28 14:13:35 -07:00
Andrew Solovay
c149d6ff19 Merge "Docs: clarify getSharedPreferences behavior" into qt-dev am: 3791f9b071
am: 73a66dc100

Change-Id: Ia14424c38de4a55096bad5e1e91d29681b26f4f5
2019-08-28 13:52:14 -07:00
Andrew Solovay
676ef1a61c Merge "Docs: clarify getSharedPreferences behavior" into qt-dev am: 3791f9b071
am: 73a66dc100

Change-Id: Ie94b91be0696090bc1bcce4a787873886a268396
2019-08-28 13:45:51 -07:00
Andrew Solovay
033de4e8c2 Merge "Docs: clarify getSharedPreferences behavior" into qt-dev
am: 3791f9b071

Change-Id: Ia631eefc35816b92004a3fa6f8ad5f00236908bf
2019-08-28 13:18:04 -07:00
Jeff Sharkey
4ef8702ce9 Fix subtle bug when using empty withValues().
We still need to populate mValues when the ContentValues was empty.

Bug: 139356941
Test: atest --test-mapping packages/providers/ContactsProvider
Change-Id: Ice90afbb7994e1a1d10076a2aa48b4d1187abe9f
2019-08-28 13:24:47 -06:00
Kevin Hufnagle
25266af6f3 docs: Added desc. of launcher app criteria in Q
As of Android Q, an app is included in the return value of
LauncherApps#getActivityList() unless it fulfills specific criteria.
This CL describes the conditions necessary for an app's activities
to *not* appear in the list.

Test: make ds-docs -j32

Bug: 130352392
Change-Id: I6a6e17351a6c1234229d1d7eb8147ee2c24ee2c9
2019-08-28 17:55:59 +00:00
Oli Lan
df720dc785 Merge "Wait for available rollbacks in RollbackTest." 2019-08-28 09:24:29 +00:00
Nate Fischer
5272c3776d Docs: clarify getSharedPreferences behavior
No change to logic, only documentation.

This updates Context#getSharedPreferences docs:

 * Fix a typo ("thead" -> "thread")
 * Formatting: use <p> when appropriate, {@link} to other APIs, limit
   the @param to only a single sentence
 * Mention getSharedPreferences() may actually perform disk IO (this was
   undocumented)
 * Mention Editor#apply() as well as #commit()

Fixes: 140137651
Test: make docs
Change-Id: I245371d13d4f317c6c522debcdf7938ab783f897
2019-08-28 00:45:08 +00:00
Varun Shah
3bade98359 Merge "Update mTransport check before trying to configure." 2019-08-27 16:55:06 +00:00
Oli Lan
0a3c06e9c9 Wait for available rollbacks in RollbackTest.
This changes RollbackTest to retry checks for available rollbacks for
a certain period of time, using a new RollbackUtils method
waitForAvailableRollbacks.

Currently many of the tests in RollbackTest are flaky due to race conditions
between checking for available rollbacks and the installer onFinished callback.
This CL should fix all of those issues.

The previous attempt to resolve this by adding NewRollbacks speculatively to
the results of getAvailableRollbacks was not successful. This CL reverts that
change so that getAvailableRollbacks once again only returns rollbacks that are
actually available.

Bug: 136548146
Test: atest RollbackTest run on cuttlefish on acloud repeatedly
Change-Id: I27e2513b34f49af2f41cd627a5d2550541831e11
2019-08-27 17:04:25 +01:00
Lorenzo Colitti
d50b505965 Merge changes I69cdbb16,I6975e0b7 am: d889cb5098 am: ac913d725f am: 93d68de285 am: bb0edef6e8
am: 7ea7b0b1f1

Change-Id: Ie87981017bf2d4deef2092407c31fb3df4464dc8
2019-08-27 04:24:55 -07:00
Lorenzo Colitti
7ea7b0b1f1 Merge changes I69cdbb16,I6975e0b7 am: d889cb5098 am: ac913d725f am: 93d68de285
am: bb0edef6e8

Change-Id: I77ca7b17bea79dee5156839d1164b0fc78b31fe5
2019-08-27 04:12:45 -07:00
Lorenzo Colitti
ac913d725f Merge changes I69cdbb16,I6975e0b7
am: d889cb5098

Change-Id: I3c8ddf7809a0d443587c1c4c06ef56ac302fc80f
2019-08-27 03:31:02 -07:00
Varun Shah
d53955329c Update mTransport check before trying to configure.
Line was too long in previous commit so just updating that fix and
cleaning it up.

Bug: 139554125
Test: atest android.content.ContentProviderTest
Change-Id: Ie63151db35cc47f691b5a4733409c10b1ac4299c
2019-08-26 18:28:12 -07: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
TreeHugger Robot
6ffb81d821 Merge "Fix getting target SDK version for uid in PermissionManagerService." 2019-08-26 17:42:09 +00:00
wangmingming1
71df3da8ae notify netd about uid internet permission changes when package replaced
1. If a previous version of an app doesn't declare internet permission;
2. The User upgraded it to a new version and the new one does declare the
internet permission;
3. The new app are not allowed to access the internet until next boot

Bug: 137864893
Test: Manual, just make sure the onPackageChanged would be executed on package changes
Change-Id: I69cdbb16a027a9c4e974b32371b1f64a23a51a23
Signed-off-by: wangmingming1 <wangmingming1@xiaomi.com>
2019-08-26 09:30:59 +09:00
Lorenzo Colitti
7b0411782a Backport PackageListObserver#onPackageChanged.
Added internally in Ic48e3c728387ecf02f89d517ba1fe785ab9c75fd,
of which this is a partial cherry-pick.

Bug: 137864893
Test: builds, boots
Change-Id: I6975e0b70ded6047e1ac8013a82bc35ff150f03b
Merged-In: Ic48e3c728387ecf02f89d517ba1fe785ab9c75fd
2019-08-26 09:30:59 +09:00
Anna Trostanetski
a6fe3996e1 Merge "Rename android.compat.IPlatformCompat" am: ee716a23a2 am: 81af0fc8bb am: 20f25166c3 am: 884ef46cdc
am: 8649477e74

Change-Id: I1722a3c2fc9444b4e05932bb287d5ccd389f1493
2019-08-24 01:40:24 -07:00
Anna Trostanetski
8649477e74 Merge "Rename android.compat.IPlatformCompat" am: ee716a23a2 am: 81af0fc8bb am: 20f25166c3
am: 884ef46cdc

Change-Id: I11d25c6de70389b9f8fb74b914a247bca224e631
2019-08-23 22:04:54 -07:00
Hai Zhang
053c3a2349 Fix getting target SDK version for uid in PermissionManagerService.
The lowest target SDK version (instead of the highest) should be used
in order to stay compatible with existing older apps.

Bug: 136503238
Test: presubmit
Change-Id: If3b23ae4441166c98934cdd1f4adb7ded714abc3
2019-08-23 15:11:57 -07:00
TreeHugger Robot
903102c430 Merge "Don't refer to DeviceIdle from SystemServiceRegistry" 2019-08-23 15:38:42 +00:00
Anna Trostanetski
81af0fc8bb Merge "Rename android.compat.IPlatformCompat"
am: ee716a23a2

Change-Id: I88fd93b46bcaa5ed782c407f2a9e9469fb0f5f0e
2019-08-23 02:26:15 -07:00
Jeff Sharkey
7b28a9f743 Merge "Public APIs for ID-specific Uris, misc items." 2019-08-23 04:24:31 +00:00
TreeHugger Robot
a68d535199 Merge "Defined a more generic way to let services "opt-out" from certain user types." 2019-08-22 20:59:41 +00:00