Commit Graph

8341 Commits

Author SHA1 Message Date
Makoto Onuki
701edd6c0c Merge "Add Context.createContextAsUser()" 2019-10-10 18:52:49 +00:00
Makoto Onuki
b844001d6a Add Context.createContextAsUser()
Without it, apps (mainline modules) will need to use createPackageContext...,
which is a bit painful.

Bug: 142472686
Test: atest android.content.cts.ContextTest#testCreateContextAsUser
Change-Id: Id640e03862462724df1a4a3101f0b08faafba22f
2019-10-10 15:58:20 +00:00
Makoto Onuki
5c12df642b Merge "Tiny improvement on UserInfo.getUserHandle()" 2019-10-09 21:57:42 +00:00
Makoto Onuki
d06da23f07 Tiny improvement on UserInfo.getUserHandle()
Test: boot / manual code inspection
Bug: 142134660
Change-Id: I49e25d4d2ac339365c08288b53a67ffba39e2405
2019-10-09 10:32:48 -07:00
Christopher Tate
e4f5f2d3f5 Move PackageManagerInternal to services.jar
The one messy internal caller is the settings provider, so a new @hide
API on PackageManager was introduced to decouple the provider from
LocalServices.  That new entry point is only callable by uid 1000,
paralleling the previous system-caller-only availability.

Bug: 140833849
Test: system boots & runs normally
Change-Id: I93ae38b8f55db7864893a97795aea63014bf5e12
2019-10-08 15:49:43 -07:00
atrost
e4d912f1d0 Replace targetSDK check with platform compat framework gating.
Define a new change id and use it for gating the change.

Test: atest -p cts/tests/signature, atest AndroidTestBaseUpdaterTest
Bug: 30188076
Change-Id: Ic8c85eae0c490a7eca117b74c4326dd50df2b352
2019-10-08 18:42:09 +01:00
Alan Stokes
564724a714 Merge "Revert new app installed notification doc" into qt-dev am: 98540e2a16 am: 24e18b415f am: 9ed11c9dea
am: 36ac62aaa8

Change-Id: Ifef27d668b3f6381405cc9bc81abfea3d495d4e6
2019-10-07 08:42:42 -07:00
Alan Stokes
36ac62aaa8 Merge "Revert new app installed notification doc" into qt-dev am: 98540e2a16 am: 24e18b415f
am: 9ed11c9dea

Change-Id: I639bb92f80a8be435014b6d52c6577b337121fca
2019-10-07 08:36:47 -07:00
Alan Stokes
9ed11c9dea Merge "Revert new app installed notification doc" into qt-dev am: 98540e2a16
am: 24e18b415f

Change-Id: I2675329bb8a87beb1e8c221f35e12f0fa675445a
2019-10-07 08:30:38 -07:00
Alan Stokes
98540e2a16 Merge "Revert new app installed notification doc" into qt-dev 2019-10-07 14:41:57 +00:00
Rhed Jao
c2653261c5 Merge "Accessibility shortcut improvement (3/n)" 2019-10-07 02:00:40 +00:00
Jeff Sharkey
cd5db63e06 Merge "New argument to hint at locale to use for sorting." 2019-10-05 18:48:39 +00:00
Jeff Sharkey
85e90d09e1 New argument to hint at locale to use for sorting.
We've heard that some developers want more detailed influence over
the sort order applied internally inside of a ContentProvider.  For
example, when the locale is "zh", the caller may want to sort using
either "pinyin" or "zhuyin" style collations.

Thankfully ICU already supports this type of collation control when
creating a ULocale object, and it also supports other useful types
such as "de@collation=phonebook".  Thus this CL adds a new
QUERY_ARG_SORT_LOCALE that can be used to pass an ICU locale string
into a ContentProvider.

Similar to the other existing query arguments, we know that only
certain providers may support this new option, so we document that
it should be included in EXTRA_HONORED_ARGS when applied.

Bug: 140248907
Test: atest cts/tests/tests/content/src/android/content/cts/ContentResolverTest.java
Change-Id: I3277725ecd21a58680f2b8a5cc62514184d9e179
2019-10-05 10:26:24 -06:00
TreeHugger Robot
f25b446cae Merge "Add Resources Perf Tests" 2019-10-04 21:54:30 +00:00
Philip P. Moltmann
e653663037 Merge "Update PermissionChecker usages to avoid unnecessary attribution." 2019-10-04 19:26:54 +00:00
Svet Ganov
249810df2e Update PermissionChecker usages to avoid unnecessary attribution.
We had accidental usages of the PermissionChecker for cases where no
private data was provided to the app but the checkPermission API on
the latter also did blame data access on the app. The PermissionChecker
was designed to handle IPC calls and not for generic API checks.

To avoid future accidental incorrect PermissionChecker usages this
change renames the existing APIs of the latter to clearly indicate
that they should be used for data delivery and also adds sibling
methods for doing the same permission checks for preflight purposes.
Also the documentation is improved to furhter assist developers.

In addition, this change fixes accidental permission checker usages
that blame when they should not by using the new preflight flavor
of the permission check APIs.

Test:
    atest com.android.settingslib.location.RecentLocationAppsTest
    atest CtsPermissionTestCases
    added: LocationAccessCheckTest#notificationOnlyForAccessesSinceFeatureWasEnabled
    added: LocationAccessCheckTest#noNotificationIfFeatureDisabled
    added: LocationAccessCheckTest#noNotificationIfBlamerNotSystemOrLocationProvider
    added: LocationAccessCheckTest#testOpeningLocationSettingsDoesNotTriggerAccess

bug:141028068
Exempt-From-Owner-Approval: merge
Change-Id: I65c71569d0dd8a40bc6fecabb22c5373dd6e806e
2019-10-04 19:25:54 +00:00
Philip P. Moltmann
36329e5725 Merge "Update PermissionChecker usages to avoid unnecessary attribution." into qt-dev am: 0a71df1f7e am: 43f6144e21
am: 7cd4256dde

Change-Id: I2cdc90ac3af6e1a89bd79d13f5baa637864e7ccb
2019-10-04 12:20:06 -07:00
Philip P. Moltmann
7cd4256dde Merge "Update PermissionChecker usages to avoid unnecessary attribution." into qt-dev am: 0a71df1f7e
am: 43f6144e21

Change-Id: Ib8548cbfc7531a5f5e9100ae26cf9b6c8f97760f
2019-10-04 12:05:17 -07:00
Ricky Wai
5f5bacfda0 Revert new app installed notification doc
Bug: 111214100
Test: Able to compile
Change-Id: Id4fdabf0e8c69074eb8cb5838ab11d9d5f030093
2019-10-04 16:10:17 +01:00
Rhed Jao
0090ad7fd4 Accessibility shortcut improvement (3/n)
- New class AccessibilityShortcutInfo to describe accessibility
  shortcut.
- New Intent category for the target of accessibility shortcut

Bug: 136293963
Test: atest AccessibilityShortcutInfoTest
Change-Id: Id47d397a03f3f710368550e551097214c7839943
2019-10-04 16:50:30 +08:00
TreeHugger Robot
2bb20ce423 Merge "Fix UserInfo Parcel" 2019-10-04 03:30:02 +00:00
TreeHugger Robot
62296e3ddf Merge "Fix CONNECTIVITY_SERVICE value in the doc." 2019-10-04 01:04:07 +00:00
Bookatz
e80af14d33 Fix UserInfo Parcel
ag/9372503 put the order of reading preCreated from a UserInfo parcel
in the wrong spot. We fix it here.

Test: none
Change-Id: I4502e901ff2aac977c584fa8c5a3d1263be33572
2019-10-03 17:36:30 -07:00
Svet Ganov
7fe065eb66 Update PermissionChecker usages to avoid unnecessary attribution.
We had accidental usages of the PermissionChecker for cases where no
private data was provided to the app but the checkPermission API on
the latter also did blame data access on the app. The PermissionChecker
was designed to handle IPC calls and not for generic API checks.

To avoid future accidental incorrect PermissionChecker usages this
change renames the existing APIs of the latter to clearly indicate
that they should be used for data delivery and also adds sibling
methods for doing the same permission checks for preflight purposes.
Also the documentation is improved to furhter assist developers.

In addition, this change fixes accidental permission checker usages
that blame when they should not by using the new preflight flavor
of the permission check APIs.

Test:
    atest com.android.settingslib.location.RecentLocationAppsTest
    atest CtsPermissionTestCases
    added: LocationAccessCheckTest#notificationOnlyForAccessesSinceFeatureWasEnabled
    added: LocationAccessCheckTest#noNotificationIfFeatureDisabled
    added: LocationAccessCheckTest#noNotificationIfBlamerNotSystemOrLocationProvider
    added: LocationAccessCheckTest#testOpeningLocationSettingsDoesNotTriggerAccess

bug:141028068
Merged-In: I65c71569d0dd8a40bc6fecabb22c5373dd6e806e
Change-Id: I65c71569d0dd8a40bc6fecabb22c5373dd6e806e
2019-10-03 21:58:13 +00:00
Sudheer Shanka
09b0ee6315 Fix CONNECTIVITY_SERVICE value in the doc.
Fixes: 120119768
Test: n/a
Change-Id: Id20e183e0952cd938a0415b7124bac1642e500ae
2019-10-03 14:45:15 -07:00
TreeHugger Robot
16660951c8 Merge "Added option to pre-create user templates to optimize first user creation time." 2019-10-03 17:44:02 +00:00
Felipe Leme
c1ca4410e1 Added option to pre-create user templates to optimize first user creation time.
Initial user creation is slow because the system must prepare per-user data (like storage and
permissions) whose cost is proportional to the number of pre-installed apps. On automovive's
reference implementation, it can take more than 10s, which is a bad user experience.

This change lets OEMs pre-create some users , so that high initial-creation cost is "paid" during
the initial boot. On automotive, it improves the creation of an additional user (or guest user)
in about 7s (from ~17s to 9s).

Bug: 111451156
Bug: 132111956
Bug: 140750212
Bug: 140868593

Test: manual verification
Test: atest FrameworksServicesTests:UserControllerTest#testStartTemplateUser_background

Change-Id: I81de1b5376dc9c42b63be8853d7204c88826401f
2019-10-02 08:35:42 -07:00
Julius D'souza
92dbd38d18 Add SYNCHRONOUS to EnabledFlags for PackageManager
SYNCHRONOUS is a flag for setComponentEnabledSetting()
which will serialise the given user's package restrictions
state (including enabled + disabled packages) after the
specified component state has been updated.

Test: manual
Bug: 130044763
Change-Id: I615e5af6361718b5f3c355ca4424d1f8c4fb078f
Signed-off-by: Julius D'souza <jdsouza@google.com>
2019-10-01 09:52:21 -07:00
Mårten Kongstad
77b53b2c56 Remove the FEATURE_FLAG_IDMAP2 flag
Test: atest OverlayDeviceTests OverlayHostTests FrameworksServicesTests:com.android.server.om CtsAppSecurityHostTestCases:OverlayHostTest

Change-Id: Ib68eaf7f721c5d440fe7185777e88e23cb9840a4
2019-10-01 00:08:48 -07:00
Winson Chiu
29f3a0b63d Merge "Revert "Deprecate PackageParser#Package"" 2019-10-01 00:31:40 +00:00
Winson Chiu
8e18a0ab89 Revert "Deprecate PackageParser#Package"
This reverts commit 243e7ea14b.

Reason for revert: b/141854898

Exempt-From-Owner-Approval: Revert for failure to boot

Change-Id: Id6812e5ecf7d88504706b2c4110d83f1034ab85c
2019-10-01 00:23:30 +00:00
TreeHugger Robot
0617359e5a Merge "Allowing more than one app to suspend apps" 2019-09-30 22:43:18 +00:00
Winson Chiu
7267e3ef6b Merge "Deprecate PackageParser#Package" 2019-09-27 18:02:56 +00:00
Jeongik Cha
cac5791954 Merge changes from topic "system_ext" am: a828ee6442 am: dee02a0fae
am: 6a46c5315a

Change-Id: Ic31f9d12fffda486d36ce427848e04c7755cc531
2019-09-26 16:00:00 -07:00
Jeongik Cha
6a46c5315a Merge changes from topic "system_ext" am: a828ee6442
am: dee02a0fae

Change-Id: If2cc7cfe20182578b4e3c515f42209d9446f6a68
2019-09-26 15:53:32 -07:00
Ryan Mitchell
346594121a Merge "Enable CTS verification of overlayable API" 2019-09-26 21:48:13 +00:00
Ryan Mitchell
4043ca78ea Add Resources Perf Tests
This changes adds benchamrks for Resources, ResourcesManager,
OverlayManager, and Resources.Theme.

Bug: 136085555
Test: atest OverlayManagerPerfTest
Test: atest ResourcesManagerPerfTest
Test: atest ResourcesPerfTest
Test: atest ResourcesThemePerfTest

Change-Id: I6a3b3275399c161e55ff6ce34e7bc2ae5556edf1
2019-09-26 14:15:26 -07:00
Winson
243e7ea14b Deprecate PackageParser#Package
Replaces PackageParser#Package and it's related structures with
ParsingPackage, ParsedPackage, and AndroidPackage.

This is a large scoped CL, the first step in an eventual goal
to refactor how data is handled in the package parsing and install
process. It introduces as few logic changes as necessary. Mostly
migrating to interfaces and renaming, moving parsing data calls into
3 separate interfaces that outline the intended flow for parsing.

ParsingPackage is built and used during what was PackageParser, now
replaced by ApkParseUtils and it's related classes. This is almost
exactly what was parsed from the XML/files on disk.

ParsedPackage is used when the object exits PackageParser and is
adjusted by PackageManagerService to what is considered the final
"parsed" state, adjusted from literal values, but consistent given
the same APK on disk. This should eventually be moved out of PMS
and possibly collapsed into the previous interface entirely.

AndroidPackage is the final state of the package after parsing and
adjustment has completed and no more mutations should be expected.
There are a few exceptions to this, included in AndroidPackageWrite,
which will eventually be refactored into PackageSetting or another
state class.

This marks PackageParser#Package and all the old infrastructure with
@Deprecated, as none of them are used internally. All usages were
converted, and the legacy Package is only built for un-converted tests
and @UnsupportedAppUsage methods.

There are numerous TODOs still outstanding, but addressing them
in this initial CL would introduce several logic changes. They've been
marked with the bug number and will be handled in follow ups.

This is being merged with caution thrown to the wind because
testing this on devices and in development will be the best way
to debug differences introduced by the migration. Getting it merged
as early as possible gives the most amount of time to fix regressions.

Waiting for tests of all the functionality could take literal years
before covering enough to merge this with all regressions verified.

Given a sample size of 4 heap dumps and the caveat it was taken very
early in the migration, there is a memory overhead of about 200 KB
versus the legacy implementation. This should be verified more
accurately and addressed in follow ups.

This CL also kills child/parent package support, since that's
broken already, and difficult to support with the new interface
structure.

Bug: 135203078

Test: booted an emulator, works generally as expected

Specific tests which failed / failed to build were fixed, but because
not all tests are currently passing before this change, not all were
verified.

Change-Id: I4ba050c228e6c60b8f63a9e3347b1f9a57ef794a
2019-09-26 13:27:17 -07:00
Ryan Mitchell
2e3942246d Enable CTS verification of overlayable API
Allows retrieval of a string representation of overlayable resources
that can be compared during CTS testing to verify that the overlayable
resources on device match the expected overlayable API.

Bug: 135052616
Test: libandroidfw_tests
Test: atest OverlayHostTest
Change-Id: I613f28c202a0904a917577f932d072111c1aa7bd
2019-09-26 17:53:20 +00:00
Chen Xu
8dcf873d9a Merge "Revert "remove symbols from greylist"" 2019-09-26 03:45:27 +00:00
TreeHugger Robot
85ce7cb0fd Merge "Do not check package if package-equivalent components have set" 2019-09-26 02:48:42 +00:00
Suprabh Shukla
d3278449d7 Allowing more than one app to suspend apps
We want to allow wellbeing apps to suspend in managed profiles.
This requires changing the internal data design of package-suspend
state to allow more than one suspending package, each with their
own parameters, namely - dialog info, app extras and launcher extras.

Also, removed the restriction of using setPackagesSuspendedAsUser when a
PO/DO exists

Test: atest com.android.server.pm.PackageUserStateTest
atest com.android.server.pm.PackageManagerSettingsTests
atest com.android.server.wm.ActivityStartInterceptorTest
atest GtsSuspendAppsTestCases

Bug: 138812320
Change-Id: If1263142fc9e6687e95af9b8d71ba8eff0c0fae9
2019-09-25 17:11:17 -07:00
Eran Messeri
3acf4a3e2d Merge "API for individual attestation" 2019-09-25 22:02:31 +00:00
TreeHugger Robot
be0f335f5a Merge "Whitelist packages for user types" 2019-09-25 18:45:13 +00:00
Chen Xu
a56786981e Merge "new TelephonyRegistryManager" 2019-09-24 18:32:48 +00:00
Patrick Baumann
572143fbaa Merge "Breaks isInstantApp into public and internal" 2019-09-24 18:24:11 +00:00
Eran Messeri
da05c80d6b API for individual attestation
Introduce a new API to request use of individual attestation
certificate for attesting keys generated by the
DevicePolicyManager.generateKeyPair method.

It builds on existing device ID attestation capabilities in two ways:
(1) Eligibility check: Assuming similar privacy requirements for the use
    of individual attestation certificates, enforce the same conditions
    for using them as the conditions for requesting device identifiers
    in the attestation record.
(2) Keymaster interaction: Passing the right Keymaster tag to the
    attestKey call, which is easily done in AttestationUtils.

Bug: 136494773
Test: CTS test to be added.
Change-Id: Idb5cee66d986a521c17e1955532d0bfae66c035d
2019-09-24 18:14:05 +01:00
Bookatz
04d7ae5c6f Whitelist packages for user types
Creates a new SystemConfig xml entry which allows a device to whitelist
system packages to be installed on users when they are created, based on
the type of user.

System packages will be installed on users when they are created, or
during OTAs, based on this whitelist. The whitelist can be
enabled/disabled via a Config resource.

For any user type, system packages can be whitelisted or blacklisted.
If it is both (for the same user type), the blacklist takes priority.
If it is neither, it won't be installed (since it isn't whitelisted).

If a system package isn't mentioned in the whitelist file at all, for
any user, then its behaviour depends on the Config resource value, which
can optionally implicitly whitelist all such apps on all users.

For now, the list is mostly empty and the default config is set to be
enabled but implicitly whitelist all system packages that are not
mentioned.

Test: atest FrameworksServicesTests:SystemConfigTest
Test: atest com.android.server.pm.UserManagerServicePackageWhitelistTest
Test: manually test user 0 by flashall -w and checking packages
Test: manually test OTA by setting setprop persist.pm.mock-upgrade 1
Bug: 134605778

Change-Id: Ia098c1f597f66a1c946cfcc9b7771c25e8ceabf7
2019-09-24 09:38:58 -07:00
Louis Chang
9c5a3300a5 Do not check package if package-equivalent components have set
Two intents that can be resolved to the same component were
evaluated as different intent filters, because one had the package
name set while the other one did not(null).

Skip performing package check if both two intents have components which
equals to its set package.

Bug: 64108432
Test: manual
Change-Id: I8163cbb6b56366ebbecaede7fa04ab3eab7cfe9f
2019-09-24 17:41:28 +08:00
Chen Xu
6155eb9663 Revert "remove symbols from greylist"
This reverts commit 27c4e658b3.

Reason for revert: <potential performance regression. revert for now and looking for possible optimization from ART team>

Change-Id: I5bf728e4f6789d7e6398cf90f22fbf3a24d481c2
2019-09-23 18:51:02 -07:00