Commit Graph

9191 Commits

Author SHA1 Message Date
Diego Vela
fb94ded221 Merge "Fix incorrect closing tag" into rvc-dev 2020-03-30 23:42:08 +00:00
Adam Bookatz
9968525afb Merge "UserSystemPackageInstaller only (un)installs when appropriate" into rvc-dev 2020-03-30 18:09:25 +00:00
Ryan Mitchell
ad5a070a87 Merge "Synchronize before calling unstableRemoveIf" into rvc-dev 2020-03-30 15:44:00 +00:00
Jackal Guo
c822c12780 Merge "Using for loop instead of stream" into rvc-dev 2020-03-30 01:08:46 +00:00
Adam Bookatz
1efd27cde3 UserSystemPackageInstaller only (un)installs when appropriate
The UserSystemPackageInstaller (USPI) uninstalls system
packages that are not needed, depending on the user type.
When that determination changes (or the feature is disabled)
it can also re-install those packages.
This cl specifies when it is appropriate for USPI to actually
perform the (un)installation.

1.
Introduces uninstallReason: records the reason why a package
was uninstalled from a given user. Right now, the only values
are UNKNOWN and USER_TYPE. The latter indicates that the USPI
system uninstalled the package. If the USPI whitelist changes
(or the USPI feature is disabled), uninstalled packages will
only be installed by USPI if the uninstallReason was USER_TYPE.
Any further uninstalls (e.g. by ManagedProvisioning) will reset
the uninstallReason to UNKNOWN, so USPI will no longer install
such packages in the future.
This prevents USPI from reinstalling system packages that other
mechanisms (such as ManagedProvisioning) uninstalled.

2.
USPI will uninstall a system package if it is blacklisted, but
only if that system package is new, i.e in two circumstances:
a. on first boot
b. on an OTA where the package was not present prior to the OTA

Bug: 143200798
Test: atest UserSystemPackageInstallerTest
Test: Confirmed (un)installations during manually simulated OTAs
Change-Id: Ia0714d1faa8f7c79082f2cc93a92ae36b9a4c918
Merged-In: Ia0714d1faa8f7c79082f2cc93a92ae36b9a4c918
2020-03-28 00:19:37 +00:00
Chris Li
c64d21d47a Merge "Report incorrect context usage in ViewConfiguration" into rvc-dev 2020-03-27 20:19:15 +00:00
TreeHugger Robot
644d25d4c4 Merge "Always use TypedArray to obtain manifest values" into rvc-dev 2020-03-27 17:30:26 +00:00
Yurii Zubrytskyi
a7b10f5623 Merge "Dynamic args complete removal." into rvc-dev 2020-03-27 07:23:55 +00:00
Chris Li
bfe1b70fcd Report incorrect context usage in ViewConfiguration
Before, the documentation said that the passed context is an application context, which is incorrect to get the density, window metrics, and window manager. We should use visual context to get these instead.

Bug: 151474461
Test: StrictModeTest#testIncorrectContextUse_GetViewConfiguration
Change-Id: Iea28d727cafbb3ec8536742c6a0e594f73fe5a51
2020-03-26 22:09:28 -07:00
Jackal Guo
ae0379230c Using for loop instead of stream
With an ArrayList, a hand-written counted loop is faster than the
enhanced for loop and stream.

Bug: 152227957
Test: Run atest under both pm folder
Change-Id: I714eec2add030d794d0449ae8d07b572e5904880
2020-03-27 11:22:03 +08:00
Ryan Mitchell
c23b0165f8 Synchronize before calling unstableRemoveIf
The call to unstableRemoveIf should be synchronized on the
ResourcesManager instance since the collection belongs to the instance.

Also remove dead code from the loader refactor to prevent apps from
creating AssetManagers that return InputStreams instead of
AssetInputStreams.

Bug: 145510133
Test: boots
Change-Id: I50bcfc8e882f3d8a7827688e32f68790dd226801
2020-03-26 19:28:09 -07:00
Alex Buynytskyy
686a537376 Dynamic args complete removal.
Bug: b/150470163
Test: atest PackageManagerShellCommandIncrementalTest PackageManagerShellCommandTest
Change-Id: I122f37f210ef9b8b02d565c34245ebeec26d83b2
2020-03-26 16:28:33 -07:00
Dmitri Plotnikov
f7b0b5a373 Merge "Propagate exception thrown by ContentProvider.canonicalize" into rvc-dev 2020-03-26 23:03:31 +00:00
Todd Kennedy
fb590035e1 Merge "Define permission for installer API v2" into rvc-dev 2020-03-26 21:50:17 +00:00
Todd Kennedy
83eddae766 Always use TypedArray to obtain manifest values
In some paths, the "isolatedSplits" attribute was read directly from
the XML file. In others, it was read using a TypedArray [ie. it used
the application's resource table].

It's possible we should never allow some manifest values to be set
via resource table. This change does not attempt to resolve that.
Instead, it merely ensures consistency to how manifest values are
retrieved.

Bug: 150184652
Test: atest PackageParserTest
Change-Id: Ib7c6a5ae081959e2d3aba4abdf60dd52db05991a
2020-03-26 14:43:27 -07:00
Dmitri Plotnikov
da4f3c8353 Propagate exception thrown by ContentProvider.canonicalize
Test: atest FrameworksCoreTests:android.content.ContentResolverTest
Fixes: 149184281
Change-Id: Id200748c9d54222aaf669209a43cbaa5675d8331
2020-03-25 18:34:11 -07:00
Diego Vela
0f14ffc354 Fix incorrect closing tag
Change incorrect opening bold tag to closed.

Bug: 152199751
Test: N/A - fixing a comment
Change-Id: I5dfa779c3093cc7d8dc6d4f6c2db07031da81e83
2020-03-25 16:50:13 -07:00
Todd Kennedy
66ed8dff37 Define permission for installer API v2
The package installer v2 APIs were marked as @SystemApi merely as
a convenience for development. These APIs may change in the next
version of Android and their usage must be strictly controlled.

Bug: 151716357
Test: Manual. Use old Shell and see that incremental installation fails with a SecurityException
Test: Manual. Request INSTALLER_V2 permission for shell and see that incremental installation succeeds
Change-Id: I9612dc145eadda20083bcc43e7a35ef3cd90aa40
2020-03-25 12:57:05 -07:00
Alex Kershaw
ec19b8d075 Add hidden API to clear all cross-profile app-ops
Reset the INTERACT_ACROSS_PROFILES app-op for all apps on the device
when creating a new work profile. This ensures that user grants for
previous work profiles (perhaps with a different admin) are not saved
and also not restored with backup-and-restore.

Also, clear the shared preference storing which oem-whitelisted apps the
user has granted. This ensures that the user sees them all again
during work profile provisioning.

Fixes: 151145623
Test: atest com.android.managedprovisioning.task.CreateManagedProfileTaskRoboTest
Change-Id: I5f5c5aea1c36bd17a74c02e1b6fa9b4047f15003
2020-03-25 18:21:19 +00:00
Dmitri Plotnikov
f903ef10e5 Merge "Propagate exception thrown by ContentProvider.getType" into rvc-dev 2020-03-25 17:24:31 +00:00
Eugene Susla
2f54a864d5 Merge "Switch auto-revoke manifest flag to a tri-state" into rvc-dev 2020-03-25 17:03:32 +00:00
TreeHugger Robot
9bbdb759d8 Merge "PackageManager: Restrict some camera intents to MATCH_SYSTEM_ONLY" into rvc-dev 2020-03-25 08:34:12 +00:00
Dmitri Plotnikov
be61c4468c Propagate exception thrown by ContentProvider.getType
Test: atest FrameworksCoreTests:android.content.ContentResolverTest
Fixes: 149184281
Change-Id: If3c33e58b1d0f3b88148eb3d2085c9d23cf12fc2
2020-03-24 15:49:15 -07:00
Eugene Susla
49b84c3495 Switch auto-revoke manifest flag to a tri-state
Test: presubmit
Bug: 146513245
Change-Id: I179f91d10d1de7f2907cebe3e2bc0cfb0ab2300d
2020-03-24 11:54:01 -07:00
Pavel Grafov
70b1c45a9e Merge "Suspend newly installed apps when personal apps are suspended" into rvc-dev 2020-03-24 17:42:11 +00:00
Pavel Grafov
97bb33b93c Suspend newly installed apps when personal apps are suspended
Also make use of PackageManager.getUnsuspendablePackages() which
already takes care of launcher and dialer packages and some
other critical apps, like package verifier, package
[un-]installer, etc.

For newly installed packages it PackageManager.getUnsuspendableApps()
seems to be sufficient since that app won't be critical for the
functioning of the device.

Test: Test: atest
    OrgOwnedProfileOwnerTest#testPersonalAppsSuspensionInstalledApp
Bug: 149394138
Change-Id: Ic3196dbfdd5c506e708563d305a42494391dc878
2020-03-24 12:28:07 +00:00
Narayan Kamath
83084f25f7 PackageManager: Restrict some camera intents to MATCH_SYSTEM_ONLY
These intents permit the handler to write camera / video images
directly to a supplied FD or Uri, and can be used to circumvent
EXIF redaction and may leak location info. Therefore, they are
restricted to pre-installed apps only, which can be CTS tested

Test: atest AvailableIntentsTest
Bug: 117223876
Change-Id: If0a77d0b8a6747da30803681cb1b813aee476b2b
2020-03-23 19:48:47 +00:00
kholoud mohamed
2459a08f86 Add new hidden API in CrossProfileApps and other minor changes
* Added a new hidden API canUserAttemptToConfigureInteractAcrossProfiles
to be used in settings.
* Changed canRequestToInteractAcrossProfiles to return true when app is
not whitelisted by the admin or installed in the other profile, this
enables the app to navigate the user to the cross profile settings page
were more information about why they can't grant the permission will be
provided.

Bug: 149742043
Test: atest CrossProfileAppsServiceImplRoboTest
Test: atest CrossProfileAppsPermissionHostSideTest
Test: CrossProfileAppsTest
Change-Id: I9c7734d7ab0c7436d84a27604146ff539e1cb26a
2020-03-23 17:23:17 +00:00
Aaron Huang
cd44942a14 Remove Context.NETWORK_POLICY_SERVICE from @SystemApi
Hide Context.NETWORK_POLICY_SERVICE as it has no usage.

Bug: 151266974
Test: make checkapi, build
Change-Id: I0586a5ef22f76fa1407219b96cb246f162f02947
2020-03-23 15:15:40 +08:00
Remi NGUYEN VAN
1f0355a1cd Merge "Fix javadoc for Context.TETHERING_SERVICE" into rvc-dev 2020-03-23 01:20:13 +00:00
TreeHugger Robot
9a58d5747a Merge "Un-expose APIs added for telephony mainline." into rvc-dev 2020-03-21 21:17:33 +00:00
Evan Severson
4846c5e3a9 Merge "Add one-time flag to test api" into rvc-dev 2020-03-21 05:44:34 +00:00
Amit Mahajan
4009110b3b Un-expose APIs added for telephony mainline.
Will be reworked on in R.

Test: basic sanity
Bug: 140908357
Change-Id: Ib18b66c9351b0434d7c46e004cd162928d7133f7
2020-03-21 00:21:48 +00:00
Evan Severson
1da1137fd1 Add one-time flag to test api
Test: Build
Fixes: 152076715
Change-Id: I63d327ff9df6075b4420db7df8ee2430fb7922ae
2020-03-20 15:16:54 -07:00
Taras Antoshchuk
2ecaeeba03 Merge "Change dynamic MIME feature accodring to API review" into rvc-dev 2020-03-20 21:04:15 +00:00
Jeff Sharkey
cb31e0486c Merge "Add missing symmetrical ContentResolver method." into rvc-dev 2020-03-20 20:31:52 +00:00
Ryan Mitchell
b0544a733c Merge changes from topic "res_loader_dir" into rvc-dev
* changes:
  Allow using loaders on non-RM Resources instances
  Move AssetsProvider to native layer
  Add ResourcesProvider.loadFromDirectory
  Refactor tests for ApkAsset loading APIs
  Refactor ApkAsset loading APIs
  Fix bugprone-use-after-move warnings
  Fix bugprone-use-after-move warnings
2020-03-20 18:16:30 +00:00
Taras Antoshchuk
8a6002477d Change dynamic MIME feature accodring to API review
Remove PackageManager#clearMimeGroup method. Add expected best
practices of the MIME group naming to Javadocs.
getMimeGroup/setMimeGroup throw in case of undefined MIME group.

Bug: 151101912
Test: atest CtsDynamicMimeHostTestCases
Change-Id: Ica468c77785cb0f9862b412a0bbc664f23e2f2d4
2020-03-20 17:07:56 +01:00
Jeff Sharkey
ce8a353b8b Add missing symmetrical ContentResolver method.
We have a new ContentProvider.checkUriPermission() method, but we
forgot to add the symmetric ContentResolver.checkUriPermission() to
the public API, and a first-party developer helped identify this
oversight.

Bug: 151165313
Test: atest CtsContentTestCases:android.content.cts.ContentResolverTest
Change-Id: Ic5496b5a6fda14c25cb3752f5af2f71564d003ba
2020-03-19 21:41:57 -06:00
Ryan Mitchell
39cacf2de7 Allow using loaders on non-RM Resources instances
Currently there is a limitation where ResourcesLoaders cannot be  used
on Resources object not created through ResourcesManager. This change
creates an update handler for Resources objects that are not registered
with ResourcesManager.

The handler changes the loaders on the asset manager owned by the
Resources instance.

Bug: 151666644
Test: atest ResourceLoaderValuesTest
Change-Id: I5a89f686386bdb088dc964014e7becc0c2b4770f
2020-03-19 18:33:55 -07:00
Ryan Mitchell
4ea1e42889 Move AssetsProvider to native layer
Querying in the native layer for assets provided through
AssetsProviders does not currently work. This change refactors the
AssetProvider API to return a file descriptor that is read in the
native layer and can bubble up to the java layer.

This change also removes the InputStream API to favor of developers
using memfd_create.

Bug: 142716192
Test: atest ResourceLoaderValuesTest
Change-Id: I1a7eca0994c3b7cc32008d9a72bf91086ff0e816
2020-03-19 18:33:55 -07:00
Ryan Mitchell
c07aa70270 Add ResourcesProvider.loadFromDirectory
This API allows a directory to be loaded as if it was a zipped APK.
This is a substitute for the DirectoryAssetProvider API that
currently does not work in the native layer.

Bug: 142716192
Test: atest FrameworksResourceLoaderTests
Change-Id: Ia13e15653e75b421423dd56f9fe89e183ab4cb9a
2020-03-19 18:33:55 -07:00
Ryan Mitchell
ef40d2e832 Refactor ApkAsset loading APIs
To add the partner requested ResourcesProvider#loadFromDir APIs, this
change adds format type integer that allows us to reduce the number of
ApkAssets loading overrides.

This change also adds hidden offset and length based ResourcesProvider
APIs that could not make R.

Bug: 142716192
Test: atest FrameworksResourceLoaderTests
Change-Id: I926fde257cae701901dcd4ca408024feae8c90a6
Merged-In: I926fde257cae701901dcd4ca408024feae8c90a6
2020-03-19 18:33:55 -07:00
Evgenii Stepanov
21c6a0f598 Merge "Convert enableGwpAsan to @IntDef and rename to gwpAsanMode." into rvc-dev 2020-03-19 22:47:05 +00:00
Winson Chiu
5051748f22 Merge "Convert InstantAppRequestInfo to getters and add @MainThread" into rvc-dev 2020-03-19 21:02:36 +00:00
TreeHugger Robot
cff44bd82e Merge "Change createRequestInteractAcrossProfilesIntent to throw Exception" into rvc-dev 2020-03-19 20:51:30 +00:00
Peter Wang
24f63edb41 Merge "[Telephony Mainline] Hide setSystemAppState and related constants for R" into rvc-dev 2020-03-19 20:50:10 +00:00
Patrick Baumann
8a25d0fa42 Merge "Fixes wildcard intent filter matching logic" into rvc-dev 2020-03-19 20:43:32 +00:00
Songchun Fan
2f83e15e18 Merge "remove dynamicArgs from public methods" into rvc-dev 2020-03-19 19:07:18 +00:00
Evgenii Stepanov
d43d109af8 Convert enableGwpAsan to @IntDef and rename to gwpAsanMode.
Following API feedback, make
  ApplicationInfo.enableGwpAsan
  ProcessInfo.enableGwpAsan
a @IntDef integers instead of @Nullable booleans.

Rename both, and the manifest attribute, to gwpAsanMode.
Turn the manifest attribute into an enum.
Fix manifest documentation to match the implementation.

Bug: 151262688
Test: CtsGwpAsanTestCases
Exempt-From-Owner-Approval: cherrypick
Merged-In: Ie33954700e1526f9764a751e474a3f930a65e957
Change-Id: Ie33954700e1526f9764a751e474a3f930a65e957
(cherry picked from commit 7487f249dd)
2020-03-19 16:35:41 +00:00