Commit Graph

8356 Commits

Author SHA1 Message Date
Anthony Hugh
75908bcb4d Update UserInfo.supportsSwitchToByUser to support Headless User Mode
Updates UserInfo.supportsSwitchToByUser() to support the headless system
user mode.

Fixes: 142492424
Test: Check user picker in UI and see that it works
Change-Id: I46addf60b02025b882c705c292bca3335d0f0596
2019-10-17 13:51:01 -07:00
Alan Stokes
69d2abf4c5 Add InstallSource to hold trustable installer information.
Create a new class which will hold persisted information about how an
app was installed that cannot be modified, even by the installer of
record or an app with INSTALL_PACKAGES permission.

Add a first field to hold the package name of the app that initiated
the install session.

Plumb this into SessionParams, PackageInstallerSession, InstallParams,
InstallArgs, PackageSettings, PackageProto, ActiveInstallSession etc.

Various minor refactorings along the way.

Bug: 134746019
Test: atest -p services/core/java/com/android/server/pm
Change-Id: I96d9b5034bc98af8c63088df2341e6d4a1fb1b6e
2019-10-16 09:55:24 +01:00
Ryan Mitchell
d2eebf1840 Merge "Revert "Revert "Remove overlay logic from package manager and parser""" 2019-10-15 22:06:41 +00:00
Abhijit Adsule
95862c5724 Add feature to disable slices
Bug: 142022263
Change-Id: I090b4c1460fcc4784e9e901847829ee61bfc31ef
2019-10-15 10:11:16 -07:00
TreeHugger Robot
6b905bca2f Merge "Explicitly take flags in createContextAsUser()" 2019-10-15 04:11:04 +00:00
Makoto Onuki
e5449f0b34 Explicitly take flags in createContextAsUser()
Bug: 142472686
Test: atest android.content.cts.ContextTest#testCreateContextAsUser
Change-Id: Id2e3d5ffe5887a4916e0872a7e85d62cbb439744
2019-10-14 11:09:00 -07:00
Roshan Pius
73266f2f64 Add a new wifi protection level
Wifi mainline module needs some permissions which are currently only
granted to signature components. Since mainline modules are not going to
be signed with OEM's signature, we need a new protection level to grant
some of these permissions to the wifi mainline APK.

Bug: 142234604
Test: Verified that wifi can get INTERACT_ACROSS_USERS_FULL permission
Change-Id: I26b0edff62497b5e08c2f2f504b0cd5f950682ad
2019-10-12 20:23:10 +00:00
Chen Xu
176dd6b7aa Merge "add a new telephony protection level" 2019-10-12 05:58:56 +00:00
Chen Xu
45c183d201 add a new telephony protection level
for oems which take telephony mainline module, all telephony related
apks will be signed with non-platform certificate. that said apks won't
be able to grant platform signature permission. Solution is to add a new
telephony protection level.

Bug: 141479803
Test: cts & manual
Change-Id: Ib3be016080d42fd76e7c131f4e44d815ce431e6e
2019-10-11 13:46:01 -07:00
Winson Chiu
8e4f087cc1 Merge "Add ResourceLoader API with .apk and .arsc support" 2019-10-11 18:05:00 +00:00
Jeff Sharkey
1a4223e543 Merge "Reveal color standard, transfer, and range." 2019-10-11 17:21:01 +00:00
Jeff Sharkey
588c15e56e Reveal color standard, transfer, and range.
We've already been parsing them for many years, and they're well
defined by other public APIs, so let's reveal them in MediaStore.

Also get some storage-related documentation updated to guide
developers towards replacements in a post-scoped-storage world.

Bug: 140247264, 139185855, 141523097, 139185322
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: Id39a74a9972a330b3f83913b2eef5100ec59627d
2019-10-10 17:44:57 -06:00
Winson
9947f1e4fa Add ResourceLoader API with .apk and .arsc support
ResourceLoaders allow inserting another .apk/.arsc into AssetManager's
resource resolution search. The effect is similar to overlays,
where a entry of >= config later in the path list will return that
ApkAsset's resource value instead.

Because loading from an .arsc is supported, which doesn't contain
any actual files, ResourceLoader exposes loadDrawable and
loadXmlResourceParser to allow an application load those files from
anywhere or create them in code.

The data being loaded is either pushed into an .apk or .arsc that
mocks itself as the package being "overlaid" and is passed in
through ResourcesProvider, an interface with static methods that
supports loading from a readable path on disk or a FileDescriptor.

The APIs are accessed through a Context's getResources(), which
has been changed to be unique per "Context-scope", which is usually
the lifetime of the Java object. The exception is that Activities
who get their Resources object persisted across recreations
maintain that logic for persisting ResourceLoaders.

Bug: 135270223

Test: atest FrameworksResourceLoaderTests

Change-Id: I6929f0828629ad39a21fa155e7fec73bd75eec7d
2019-10-10 15:41:03 -07:00
Mårten Kongstad
bff3fd7500 OMS: fix Javadoc copy-and-paste error
The Javadoc for OverlayManager#invalidateCachesForOverlay was mistakenly copied
from OverlayManager#getOverlayInfosForTarget.

Test: builds
Change-Id: I1e12e8f52262619e9ac55fdeb8833cd8a110fa55
2019-10-10 12:45:07 -07:00
Makoto Onuki
701edd6c0c Merge "Add Context.createContextAsUser()" 2019-10-10 18:52:49 +00:00
Ryan Mitchell
e6d7a2d022 Revert "Revert "Remove overlay logic from package manager and parser""
This reverts commit 08e4756fd3.

Change-Id: I10fda3e01e9dcdaa282a299e910e0c70b3c9fd56
2019-10-10 18:01:46 +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