Commit Graph

7843 Commits

Author SHA1 Message Date
TreeHugger Robot
b73580d2fa Merge "Revert "Remove overlay logic from package manager and parser"" into qt-dev 2019-04-11 04:12:23 +00:00
Nikita Ioffe
7d7583e421 Merge "Improve documentation for getActiveStagedSession API" into qt-dev 2019-04-10 23:04:15 +00:00
Jack He
61034792b4 Revert "Remove overlay logic from package manager and parser"
This reverts commit c6778e5435.

Reason for revert: This CL causes Bluetooth fail to start

Bluetooth Java services cannot turn on.

Change-Id: I4a9649d61de7781d3a00074da780c3a5a1dfbd56
Fixes: 130260055
Test: compile, BluetoothInstrumentationTests
2019-04-10 23:01:45 +00:00
Winson
7a3d82a581 Close ApkAssets in PackageParser
Immediately closes ApkAssets to free up some memory during package
parsing/install process.

This is used instead of implementing AutoCloseable because of
complexities with AssetManager and tracking assets opened
outside of the ApkAssets.java class.

Explained more in b/72056911.

Test: manually booted emulator; closing ApkAssets is used at
boot in PackageParser#parseApkLiteInner
Test: adb install test.apk && sleep 5 && adb uninstall test.package
&& sleep 1 && (adb shell lsof | grep "test.package") prints no
system_server references

Bug: 130182148

Change-Id: Ia471d7065e65bd39b535309de6c6da7ec35bdf12
2019-04-10 19:00:35 +00:00
Nikita Ioffe
05305027e1 Improve documentation for getActiveStagedSession API
Addressing API review in b/130224237.

Test: n/a
Bug: 130224237
Fixes: 130224237
Change-Id: Ic543412acdadfd08a0929ebff4b8e36567481e48
2019-04-10 17:26:35 +01:00
Jeff Sharkey
191114330a Merge "Refactor s/TypeInfo/MimeTypeInfo/ per feedback." into qt-dev 2019-04-10 15:09:33 +00:00
Jeff Sharkey
0185ea0802 Refactor s/TypeInfo/MimeTypeInfo/ per feedback.
Bug: 128903949
Test: atest android.content.cts.ContentResolverTest
Change-Id: Idb9e63a68dc9ffe0c35ad3e6bff55aaa10320e81
2019-04-10 00:04:27 -06:00
Mårten Kongstad
c6778e5435 Remove overlay logic from package manager and parser
Consolidate all knowledge about overlays to the overlay manager (except
static RROs that target "android": these are handled from native code in
order to be loaded as part of Zygote boot).

This removes the ability to overlay AndroidManifest.xml. There are some
use-cases where overlaying a manifest makes sense [e.g. changing an
app's label or icon or what components should be enabled by default] but
the opposite is also true [e.g. permissions]. Support for manifests can
be introduced again gradually with these goals in mind:

  - should not happen during parsing [which represents the immutable
    truth as read from disk]

  - should happen during scanning [which applies mutable settings to a
    parsed package]

  - be limited in what can be modified

Bug: 78808368
Test: builds, boots
Change-Id: I12c16fce65b1e68876f0c9acd7e2a61405e64435
(cherry picked from commit 588784dc25)
2019-04-09 22:18:17 +00:00
Jeff Sharkey
7b9b898eb1 Merge "Define a category for "file management" apps." into qt-dev 2019-04-09 20:51:31 +00:00
Todd Kennedy
f332fa8322 Merge "OMS: add internal tests" into qt-dev 2019-04-09 20:20:49 +00:00
Jeff Sharkey
2e4832fd19 Define a category for "file management" apps.
We already have a nice collection of CATEGORY_APP_* constants that
can be used to identify classes of apps.  This change expands that
list to discover file management apps, such as DocumentsUI.

Bug: 130215653
Test: none
Change-Id: I9b5016676ca1526074ba876675f14bf814ea4c09
2019-04-09 09:30:19 -06:00
Mårten Kongstad
1370c0590c OMS: add internal tests
Add unit tests for OMS internal components. These are different from the
OMS public API tests [that reside in core/tests/overlaytest].

Also, fix typo in OverlayInfo#toString.

Bug: 119443459
Test: atest FrameworksServicesTests:com.android.server.om
Change-Id: Icbee70800de5157a1804e0c96101f31c0bad2619
2019-04-09 06:44:34 -07:00
Winson Chung
f883ea697e Merge "Defer broadcasting ACTION_DEFERRED_ACTIVITY_CHANGED until actual change" into qt-dev 2019-04-08 19:05:27 +00:00
TreeHugger Robot
e9d146ec9a Merge "Remove DELEGATION_PACKAGE_INSTALLATION" into qt-dev 2019-04-08 15:10:59 +00:00
Svet Ganov
d8eb8b2690 Restricted permission mechanism - framework
This change adds a mechanism for restricting permissions (only runtime
for now), so that an app cannot hold the permission if it is not white
listed. The whitelisting can happen at install or at any later point.

There are three whitelists: system: OS managed with default grants
and role holders being on it; upgrade: only OS puts on this list
apps when upgrading from a pre to post restriction permission database
version and OS and installer on record can remove; installer: only
the installer on record can add and remove (and the system of course).

Added a permission policy service that sits on top of permissions
and app ops and is responsible to sync between permissions and app
ops when there is an interdependecy in any direction.

Added versioning to the runtime permissions database to allow operations
that need to be done once on upgrade such as adding all permissions held
by apps pre upgrade to the upgrade whitelist if the new permisison version
inctroduces a new restricted permission. The upgrade logic is in the
permission controller and we will eventually put the default grants there.

NOTE: This change is reacting to a VP feedback for how we would handle
SMS/CallLog restriction as we pivoted from role based approach to roles
for things the user would understand plus whitelist for everything else.
This would also help us roll out softly the storage permisison as there
is too much churm coming from developer feedback.

Exempt-From-Owner-Approval: trivial change due to APi adjustment

Test: atest CtsAppSecurityHostTestCases:android.appsecurity.cts.PermissionsHostTest
Test: atest CtsPermissionTestCases
Test: atest CtsPermission2TestCases
Test: atest RoleManagerTestCases

bug:124769181

Change-Id: Ic48e3c728387ecf02f89d517ba1fe785ab9c75fd
2019-04-07 22:39:54 -07:00
Todd Kennedy
6cf751cda5 Merge "fix nullability" into qt-dev 2019-04-05 14:16:37 +00:00
Richard Uhler
82913b7123 Fix rollbacks in multi-user case.
There are a few assumptions in the rollback manager that fail in the
multi-user case that need to be fixed:
* getAllSessions only returns sessions for the specific user.
* Session callbacks are only called on sessions associated with the
  registered user.
* getPackageInfo only returns info for the specific user.

Fix these issues so that rollbacks will work properly, in particular
when the initial install session is owned by a non-system user.

Bug: 129809507
Bug: 129397974

Test: On single user device: atest RollbackTest StagedRollbackTest
Test: On primary user of multi-user device: atest RollbackTest StagedRollbackTest
Test: On multi user device manually:
    adb install RollbackTestAppAv1.apk
    adb install --user 10 --enable-rollback RollbackTestAppAv2.apk
    -- verify the install succeeded --
    adb shell pm rollback-app com.android.tests.rollback.testapp.A
    -- verify the rollback succeeded --

Test: On multi user device manually:
    adb install RollbackTestAppAv1.apk
    adb install --staged --user 10 --enable-rollback RollbackTestAppAv2.apk
    adb reboot
    -- verify the install succeeded --
    adb shell pm rollback-app com.android.tests.rollback.testapp.A
    adb reboot
    -- verify the rollback succeeded --

(cherry picked from commit d81ff97866)

Merged-In: I1a7cf101b3bc3575421629c4bf0ff63418eb8731
Change-Id: I1a7cf101b3bc3575421629c4bf0ff63418eb8731
2019-04-05 11:54:44 +00:00
Winson Chung
b41314be76 Defer broadcasting ACTION_DEFERRED_ACTIVITY_CHANGED until actual change
Bug: 129906577
Test: Change home app, swipe up
Change-Id: I1894cc3b5823dd8468fc41338d2401d97e9b66c2
2019-04-04 17:34:02 -07:00
Todd Kennedy
7ea2e485fe fix nullability
Bug: 126701951
Test: It builds, it runs
Merged-In: I43e02551ced8a6aa51b84dd8df7e57e75e1d58a9
Change-Id: I43e02551ced8a6aa51b84dd8df7e57e75e1d58a9
2019-04-04 18:11:01 +00:00
Rubin Xu
edeb2ffab3 Remove DELEGATION_PACKAGE_INSTALLATION
Bug: 112982695
Test: atest MixedDeviceOwnerTest.testDelegation
Change-Id: I729f27e132e608e81d4971966743b3988e612ab5
2019-04-04 15:39:09 +01:00
Todd Kennedy
605d6b1d46 Merge "Return the update timestamp in getStagedSessions()" 2019-04-03 22:57:48 +00:00
Hyunyoung Song
b5e014a2fc Merge "Fetch roundIcon|icon depending on RRO overlayed config_useRoundIcon" 2019-04-03 22:18:35 +00:00
TreeHugger Robot
7988315b01 Merge "Add support for /odm/overlay" 2019-04-03 21:56:39 +00:00
Ryan Mitchell
e0c0c883aa Merge changes from topic "rro-cts"
* changes:
  RRO CTS Test APIs
  Relax restrictions on non-system overlays
2019-04-03 20:04:41 +00:00
Jeff Sharkey
79a7407e20 Merge "Snapshot arguments before processing." 2019-04-03 17:58:22 +00:00
Dario Freni
56c14ddc53 Return the update timestamp in getStagedSessions()
This CL adds a SessionInfo.getUpdateMillis() call to the API in order
for callers to figure out which session was applied last.

Change-Id: I3eed6c80f4777ee248671d17d9428eed2fe73aa8
Fix: 129546185
Test: atest CtsStagedInstallHostTestCases; atest apex_e2e_tests
2019-04-03 16:18:31 +00:00
Mårten Kongstad
900debd671 OverlayInfo API: fix @Nullable -> @NonNull
OverlayInfo#getTargetPackageName will never return null. Correct
@Nullable annotation to say @NonNull instead.

Fixes: 129853770
Test: builds, boots
Change-Id: I70a9634e4f7da99be5d9044a7884b9ad01a22fd8
2019-04-03 16:09:38 +00:00
Amith Yamasani
282420fe7b Merge "Avoid elevating apps to high proc states on binding" 2019-04-03 05:50:28 +00:00
Ryan Mitchell
4f78297330 RRO CTS Test APIs
Added TestAPIs for CTS tests of overlays.

Bug: 116512274
Test: OverlayableTest
Change-Id: I0dda4f09c06f384bbfe790cb4aaf4140c43533e9
2019-04-02 17:25:12 -07:00
Hyunyoung Song
929de7a446 Fetch roundIcon|icon depending on RRO overlayed config_useRoundIcon
Bug: 120286623

Test: adb shell cmd overlay enable --user 0 com.android.theme.icon.square
Test: builds, manual, used themepicker and checked on launcher, settings

Change-Id: Iafa13bea77f6f035bf6e21565571c5f77f8ef0a1
2019-04-02 16:07:02 -07:00
Jeff Sharkey
4b32a4a39c Snapshot arguments before processing.
Otherwise the underlying provide may mutate the ContentValues
before we log them, meaning we no longer have useful debugging data.

Bug: 129487770
Test: none
Change-Id: Iba3e90bdf0e51681bbe6b7f1cfd992230aee559c
2019-04-02 13:43:00 -06: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
Mårten Kongstad
48c24cf149 Add support for /odm/overlay
Add support for runtime resource overlay (RRO) APKs in /odm/overlay.

Bug: 121033532
Test: manual (adb push apk to /odm/overlay, reboot, cmd overlay list)
Change-Id: I0918d276dfa6a43054068d3f84ecd0d1639f1d0b
2019-04-02 11:07:10 -07: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