Commit Graph

7812 Commits

Author SHA1 Message Date
Amith Yamasani
282420fe7b Merge "Avoid elevating apps to high proc states on binding" 2019-04-03 05:50:28 +00:00
Mårten Kongstad
15a0ac0d76 OMS: rename methods to include package downgrades
The overlay manager service handles package upgrades and downgrades the
same way: all it cares about is a difference in versions, not if the new
version has a higher or lower value. In both cases, the same family of
methods are called: onPackageUpgrading and onPackageUpgraded.

Rename onPackageUpgrading and onPackageUpgraded to onPackageReplacing
and onPackageReplaced to better highlight that both upgrades and
downgrades are supported.

Test: atest OverlayDeviceTests OverlayHostTests
Change-Id: I04c5c550f504114c22bb30d35c9f2809194d2543
2019-04-02 18:47:31 +00:00
Amith Yamasani
f235d0b53a Avoid elevating apps to high proc states on binding
For service and provider bindings from TOP and
FOREGROUND_SERVICE apps, don't elevate bound apps
to above BOUND_FOREGROUND_SERVICE.

For service bindings, it is possible to explicitly
request the binding to match the foreground app
such that the bound app can get similar privileges
of foreground permissions.

For instance, when a foreground service has a location
type, providers it binds to don't automatically get the
location privilege. On the other hand, sometimes apps
showing UI want to treat their dependencies also as if
they are showing UI.

This change does not affect the oom_adj calculation,
only the proc state calculation for bound processes.

New BIND_INCLUDE_CAPABILITIES flag can be used to restore old
behavior for bound services.

Introduces a new state PROCESS_STATE_BOUND_TOP

Bug: 128337543
Test: atest CtsAppTestCases:ActivityManagerProcessStateTest

Change-Id: I13733e7f43a78903299254bc110cd8f7a8db4c40
2019-04-02 10:27:03 -07:00
Mohammad Samiul Islam
20da56d267 Merge "Improve PackageInfo parsing for apex files" 2019-04-02 05:33:44 +00:00
TreeHugger Robot
10fbf9a3f5 Merge "Adds @NonNull to getChildSessionIds" 2019-04-02 00:42:42 +00:00
Philip P. Moltmann
8f8cf3430b Merge "Remove dual storage permission model" 2019-04-01 23:45:23 +00:00
Philip P. Moltmann
129a0b0c5e Remove dual storage permission model
- Also remove typed media permissions
- Leave typed media app-ops

Bug: 129716569
Test: Used apps, looked at permissions in the UI
Change-Id: If7714fb1a6955584157e1a60ab72b09e35287827
2019-04-01 16:30:11 -07:00
TreeHugger Robot
53046156ac Merge "Removing API to access app usage as it is no long public" 2019-04-01 22:30:12 +00:00
Patrick Baumann
b00bd62157 Adds @NonNull to getChildSessionIds
Addresses API council feedback to appropriately annotate
SessionInfo.getChildSessionIds.

Test: None
Bug: 126699287
Change-Id: Iaebc4f2db07b359cef0aff863e517c221259b47c
2019-04-01 14:21:51 -07:00
Mohammad Samiul Islam
7aa7d2eee8 Improve PackageInfo parsing for apex files
"meta-data" in AndroidManifest was not getting parsed by the existing logic.

Bug: 129091257
Test: atest android.content.pm.PackageParserTest
Change-Id: I3d1c38ba3b2a0ccef6a0d7d0ee5ab857b62a7b82
2019-04-01 16:31:50 +01:00
Hyunyoung Song
b9b310a976 Merge "Fix OverlayInfo API" 2019-04-01 03:50:52 +00:00
Jeff Sharkey
a1189dcf68 Merge changes from topic "permz"
* changes:
  Flesh out remaining CR.wrap() methods.
  Apps using storage must have runtime permission.
2019-03-31 16:36:05 +00:00
Jeff Sharkey
5693cfd1c2 Flesh out remaining CR.wrap() methods.
Along with tests to verify that they're all delegated as expected.

Bug: 129564663
Test: atest cts/tests/tests/content/src/android/content/cts/ContentResolverTest.java
Test: atest cts/tests/tests/content/src/android/content/cts/ContentResolverWrapTest.java
Change-Id: I07dcabb78174ed2bb63061394bf737df71f49bb0
2019-03-29 20:09:41 -06:00
Jeff Sharkey
448c1ea84d Apps using storage must have runtime permission.
A major goal of the Q release is to promote user transparency around
permission usage, and to also give user controls over those
permissions.  To further this goal, all apps requesting the
internal WRITE_MEDIA_STORAGE permission must also request (and be
granted) the "Storage" runtime permission in order to gain the
associated access.

If the user revokes the "Storage" runtime permission, then the app
must lose all access granted to it via WRITE_MEDIA_STORAGE.

Bug: 129144016
Test: atest android.permission.cts.ProviderPermissionTest#testWriteMediaStorage
Change-Id: I7e747de0107cf9364a0ff2401686906340d31995
2019-03-29 19:46:20 -06:00
Winson Chiu
fbe87233d5 Merge changes from topic "code-paths-and-resources-caching-fix"
* changes:
  Revert ContextImpl LoadedApk packageInfo caching workaround
  Fix AssetManager2 isUpToDate check
  Diff resource dirs when checking LoadedApk packageInfo cache in ActivityThread
  Diff overlays between PackageManagerService and OverlayManagerService
  Propagate base code path and split dir changes to Resources objects
2019-03-29 23:50:02 +00:00
TreeHugger Robot
a869ccb1d0 Merge "Grants camera permission to Attention Service." 2019-03-29 21:31:26 +00:00
Shafik Nassar
936eb3153c Merge "Enforce multipackage installs have consistent rollback params" 2019-03-29 20:50:49 +00:00
Jeff Sharkey
65e18e43a2 Merge "Manifest flag for apps to request sandboxing." 2019-03-29 19:31:33 +00:00
Winson
b0085ce5b6 Fix AssetManager2 isUpToDate check
This logic was lost in the AssetManager1 -> 2 migration.

The old AM1 checked the last modification time of the file
and compared it to a previously stored value. This re-adds the
logic to ApkAssets and fixes the checks in the JNI/Java layer.

Unfortunately I couldn't find a failing/practical case where
this check mattered. It only came up when diagnosing an issue
which ended up being unrelated.

Test: manually ran with other overlay changes

Change-Id: I758e4af1d32a9c03b2204a8a3a26e82b7e83feda
2019-03-29 12:18:18 -07:00
Winson
e0b984e805 Diff overlays between PackageManagerService and OverlayManagerService
When uninstalling an update to a system app, PMS re-creates the
PackageSetting object, and OMS doesn't get notified of the change.

This makes OMS diff the known valid overlays with the resourceDirs
in the target's ApplicationInfo and forces a reload when they
disagree.

Bug: 124363683

Test: manual ran Wellbeing reproduction steps in bug

Change-Id: Ib080d8593d12596ae8f8a729cc9740462c4b9b69
2019-03-29 12:18:15 -07:00
Hyunyoung Song
fa0257a83a Fix OverlayInfo API
Bug: 124402715
Test: builds

Change-Id: I1618d3c019802a15278f0aaa65df1d6a849b6c9c
2019-03-29 12:17:40 -07:00
Sunny Goyal
beee197b99 Removing API to access app usage as it is no long public
Bug: 117409586
Bug: 124126265
Test: N/A
Change-Id: If3cd71ef7f8932dfc6680557b1e84338cfed3852
2019-03-29 11:38:55 -07:00
TreeHugger Robot
d3de7b95df Merge "Add annotations" 2019-03-29 15:46:12 +00:00
Todd Kennedy
a710ac6053 Add annotations
Fixes: 126701951
Test: It builds, it runs!
Change-Id: Ia464beb7121efddd716d81b4b72a5a017fbd96aa
2019-03-29 06:39:49 -07:00
Felipe Leme
a8d33c24f8 Implemented ContentCaptureConditions APIs.
Test: atest ContentCaptureConditionTest \
       CustomViewActivityTest#testContentCaptureConditions \
       CustomViewActivityTest#testContentCaptureConditions_otherPackage
Test: atest CtsContentCaptureServiceTestCases # sanity check (minus usual flakiness)

Fixes: 129266058

Change-Id: I199c3ae99fa6b407da64562a71d8d7581ebf80e6
2019-03-28 18:48:31 -07:00
Jeff Sharkey
bcff13c657 Manifest flag for apps to request sandboxing.
We're iterating on the design to let apps request via a manifest
flag if they'd like to opt-in or opt-out of storage sandboxing.  The
default is to assume that P apps don't allow sandboxing, and that
Q apps do allow sandboxing.

Bug: 129487770
Test: manual
Change-Id: I8fddb35eed412c78622be4ccae57c7b7d2aa1286
2019-03-28 14:34:47 -06:00
shafik
43f1af9dd9 Enforce multipackage installs have consistent rollback params
PackageInstallerSession:
* Add multipackage consistency check to sealAndValidateLocked. The check
asserts all child sessions match parent session in respect to:
	* Staged parameter
	* Rollback enabled parameter
* Remove the staged conistency check from addChildSessionId
* Remove sealAndValidateLocked from constructor because it was used only
when sessions where loaded (from XML file) and there's no guarantee that
child sessions will be loaded before parent. Instead, mark the session
as ShouldBeSealed.

PackageInstallerService:
* To make sure relevant sessions are sealed and validated after they are
loaded from an XML file, iterate through the loaded seasions and seal and
validate those marked as ShouldBeSealed. Sessions that do not pass the
validation are destroyed.

Test: atest StagedRollbackTest
Test: atest CtsAtomicInstallTestCases
Test: atest PackageInstallerSessionTest
Fixes: 127765168
Fixes: 124215984
Change-Id: I8f152332cadb0f6c9063264f27668821fad1cec7
2019-03-28 16:55:14 +00:00
Felipe Leme
f0d44c6aa8 Improved Content Capture and LocusId javadocs.
Test: mmm frameworks/base/:doc-comment-check-docs # and checked resulting HTML

Fixes: 123577059
Fixes: 128427733
Fixes: 123954513

Change-Id: I955e99efa099cbb68477b394450fa468c85f352c
2019-03-27 13:42:24 -07:00
Joe Onorato
8f3f4816ea Fix api council feedback
Bug: 126700270
Test: treehugger
Change-Id: Ib274c7c7975b6260b018d63216e03fd8eff57223
2019-03-26 21:29:09 -07:00
Joe Onorato
99598ee6ee incidentd can now handle multiple callers asking it for incident reports
Test: bit incident_test:* GtsIncidentManagerTestCases:*
Bug: 123543706
Change-Id: I9f671dd5d8b2ad139f952a23e575c2be16120459
2019-03-26 11:20:48 -07:00
Mohammad Samiul Islam
8c84b92e58 Merge "Use AndroidManifest to fill PackageInfo from apex" 2019-03-26 10:16:58 +00:00
TreeHugger Robot
44dbdbc348 Merge "Add an api to get active staged session" 2019-03-25 22:02:05 +00:00
TreeHugger Robot
c046eb7272 Merge "Adding permission annotation as per API review" 2019-03-25 22:00:45 +00:00
Sunny Goyal
ddd089a0e8 Adding permission annotation as per API review
Bug: 126180005
Test: N/A
Change-Id: Ie88dce300e5e12ca519c20e8e37060e6ebe4d1ad
2019-03-25 18:38:12 +00:00
Jeff Sharkey
4b457c3915 Clean up scan calls used for testing.
We've converged on explicit scanVolume() and scanFile() methods
which tests should be calling.  These are more robust than the
previous broadcast-based events, which could hang for a long time.

Bug: 127323913
Test: atest --test-mapping packages/apps/MediaProvider
Change-Id: I4f7918c70a67bcafab69ae2a71ee8e4bdaff01eb
2019-03-25 10:55:18 -06:00
Nikita Ioffe
00a08f12fe Add an api to get active staged session
This was requested during review of ag/6638240

Test: CtsStagedInstallHostTestCases
Bug: 127296534
Change-Id: Ifcc6270dc1655b1b07a0879c140f30967df8910d
2019-03-25 16:42:08 +00:00
Mohammad Samiul Islam
935a1560a7 Use AndroidManifest to fill PackageInfo from apex
Some of the applicationInfo was hard coded while some packageInfo was
missing. Using AndroidManifest, they are completed as much as possible.
For remaining missing values, sane defaults are used where possible.

Bug: 124043099
Test: 1. added more assert rules in PackageParserTest.java
      2. atest PackageParserTest

Change-Id: I950283d822966ee2cb97f7bf13b7f55bb1227946
2019-03-25 16:36:39 +00:00
Yi Jiang
8915b35ff1 Grants camera permission to Attention Service.
Bug: 128641304
Test: manually ran DefaultPermissionGrantPolicyTest
Change-Id: I63a1d7b9fdba02b813dfb0d4ef3ccfe4aa4857d1
2019-03-24 02:40:37 +00:00
Jeff Sharkey
ae80b5417b Merge changes from topic "mar22z"
* changes:
  Point people towards ModernMediaScanner.
  Translate paths before leaving app sandbox.
2019-03-23 17:59:03 +00:00
TreeHugger Robot
778423d951 Merge "Make Resources.Theme.rebase() public API" 2019-03-23 05:00:14 +00:00
TreeHugger Robot
1987dfa035 Merge "Added a "lite" flag on ContentCaptureOptions." 2019-03-23 04:33:21 +00:00
Jeff Sharkey
9c9ee953e6 Translate paths before leaving app sandbox.
When sending the ACTION_MEDIA_SCANNER_SCAN_FILE broadcast, an app
provides a raw filesystem path, which might be inside of their
sandbox.

Once the broadcast is delivered, we don't know where it came from,
so we need to translate the path before leaving the app process.

Bug: 117909601
Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore*
Change-Id: Ibddd72a2d85e1f6541e0d6209e539fe6b5c4bde0
2019-03-22 17:18:40 -06:00
TreeHugger Robot
0369790fac Merge "Add Shell permission for CTS test." 2019-03-22 22:31:32 +00:00
Winson
173f573a8b Make Resources.Theme.rebase() public API
Needed for androidx dark mode to recreate UI without triggering
lifecycle event.

Bug: 128982541

Test: none needed

Change-Id: I7d16692f074cc7e50470868a6e232e26ff9d1ed3
2019-03-22 14:47:46 -07:00
Ryan Mitchell
fb1ed2258a Merge "Add targetOverlayableName to OverlayInfo" 2019-03-22 21:39:41 +00:00
TreeHugger Robot
f870dc12bb Merge "Introduce new service bind flag to permit capabilities" 2019-03-22 17:23:48 +00:00
TreeHugger Robot
c396d6738c Merge "API review followup: DynamicAndroidClient" 2019-03-22 17:21:39 +00:00
Hyunyoung Song
67a72e8172 Merge "OverlayManager API fixes" 2019-03-22 15:07:19 +00:00
Hai Zhang
be1fe6f31a Merge "Add getDeclaredShareLibraries() for role qualification checking." 2019-03-22 09:43:48 +00:00
Amith Yamasani
f178c96cab Introduce new service bind flag to permit capabilities
Any process state-based capabilities such as location
can be allowed to permeate to the bound app, if the app
has the required permissions as well.

Bug: 128337543
Test: N/A
Change-Id: I0b066d2667333fbd65985959e202785641f704fc
2019-03-21 19:40:11 -07:00