• Home
  • History
  • Annotate
  • only in /frameworks/base/services/core/java/com/android/server/pm/
History log of /frameworks/base/services/core/java/com/android/server/pm/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
958fbb9c86a1bad8f11a7bc5b6198a73d571c472 12-Jun-2018 Suprabh Shukla <suprabh@google.com> Allow unsuspending critical packages

PackageManager prevents certain packages from being suspended to ensure
device is in a sane state. It should not disallow unsuspening these
packages for the same reason.

Test: Existing tests:
atest FrameworksServicesTests:SuspendPackagesTest
Manually, changed the default dialer, then
adb shell pm suspend com.android.dialer
change the default dialer to com.android.dialer, then
adb shell pm unsuspend com.android.dialer
should succeeed.

Bug: 79846500
Change-Id: Ie198f61bf3b092e497f978e60a27f9d52cdda9c7
(cherry picked from commit 4d74d50f53882560ac20c06de53b40f030e31fec)
ackageManagerService.java
e0f55c35a5bd4146f14723e215480613ea5e835f 09-Jun-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Revert "Fix DefaultPermissionGrantPolicyTest"" into pi-dev
4b8701138500902054bd8974f20b5ccb89dd2577 08-Jun-2018 Eugene Susla <eugenesusla@google.com> Revert "Fix DefaultPermissionGrantPolicyTest"

This ended up being not the right fix for the bug, and
had a consequence of AiAi permissions becoming fixed.
Per recent email thread, reverting this back to how it was

This reverts commit 0988f24dfff1529552c857fb1c28592070ecc1b8.

Fixes: 109665265
Change-Id: Ibf39c3b788c09f189d941f830ebbe8f371fc6f6a
ermission/DefaultPermissionGrantPolicy.java
bae9b1a71cb271166bf28c52dbd6a2092401f5bc 07-Jun-2018 Andrew Sapperstein <asapperstein@google.com> Merge "Revert "Hide system apps until installed (1/2)"" into pi-dev
afef5daaf969546aecd8d8e7de96ee4d9064240d 06-Jun-2018 Sanry Huang <sanryhuang@google.com> Revert "Hide system apps until installed (1/2)"

This reverts commit 40ede29ed6467d4d85a482e6008b92aa02d50267.

Bug: 74068582
Bug: 80444486
Bug: 80316870
Bug: 109803325
Bug: 109642189
Bug: 109660260
Bug: 109649585
Bug: 109647120
Bug: 109648512
Bug: 109648513
Bug: 109647122
Change-Id: I0e50ceebeaecae89f461f541450e24d9c148527d
ackageManagerService.java
a4155c751f3d96b76800f136b63a999fd0f54fc9 06-Jun-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow instant apps to launch instant apps" into pi-dev
536cb9c4265e8fdb5bd573dc5761f5101203e9bf 06-Jun-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix DefaultPermissionGrantPolicyTest" into pi-dev
0988f24dfff1529552c857fb1c28592070ecc1b8 06-Jun-2018 Eugene Susla <eugenesusla@google.com> Fix DefaultPermissionGrantPolicyTest

Fixes: 109665265
Test: check afterwards that the failure no longer occurs
Change-Id: I8ddb3052fa505ea4cd0a799a9225ca7991657141
ermission/DefaultPermissionGrantPolicy.java
2deec664a258d113838500b949a72e19202aea63 04-Jun-2018 Todd Kennedy <toddke@google.com> Allow instant apps to launch instant apps

Instant apps should be able to launch other instant apps indirectly
using a web URI or with the MATCH_EXTERNAL flag set..

Change-Id: I2566937dd5d47076701c49435365dedd8593067a
Fixes: 92742631
Test: atest CtsAppSecurityHostTestCases:EphemeralTest
ackageManagerService.java
dc0dd242871bf95b574676c0a7434849cd80a699 05-Jun-2018 Winson Chung <winsonc@google.com> Allow the system recents component to fetch info for user and profiles

- The recents component may need to fetch application info for the current
user and its profiles.

Bug: 109660818
Test: atest CtsAppSecurityHostTestCases:ApplicationVisibilityTest
Change-Id: I7017d40fd2a7ac0d4f288bec21a4bc5cd93c446e
ackageManagerService.java
83e162615f022f897d451db914becd6825a69b88 18-May-2018 Hongming Jin <hongmingjin@google.com> Enforce permission check before returning application info
Test: atest CtsAppSecurityHostTestCases:ApplicationVisibilityTest
Bug: 77821568

Change-Id: I7554805c36c0c2552163dad7b07cfc5f552b624e
ackageManagerService.java
ef9acb6ed97ececa4c8554adb693ec948a963db1 30-May-2018 Todd Kennedy <toddke@google.com> Ensure permission held for MATCH_KNOWN_PACKAGES

There's an escape clause that passes the cross user permissions
if the caller UID is identical to the target user ID [eg. we're not
operating across users]. However, the method getInstalledPackagesList()
uses android.permission.INTERACT_ACROSS_USERS to filter the results and
a calling UID check is not sufficient. Ensuure the permission is
actually held, regardless of the calling UID or target user.

Change-Id: Iebf88668766d387a15246d6eea6420610665105a
Fixes: 80435086
Test: atest CtsAppSecurityHostTestCases:ApplicationVisibilityTest
ackageManagerService.java
ermission/PermissionManagerInternal.java
ermission/PermissionManagerService.java
2482315cd526ef49b1eb91d24f7a0149d91d0108 25-May-2018 Chad Brubaker <cbrubaker@google.com> Remove downgrade check for targetSandboxLevel

This is causing issues with apps adopting Instant Apps and the security
requirements that lead to downgrade being disallowed were either
reverted in late O or moved into target API checks.

Change-Id: Ide3913091788d6a37bf2d17ca22769f6bbc6d3c7
Fixes: 80307033
Test: Install v2 sandbox APK, try and upgrade with a v1 sandbox APK.
ackageManagerService.java
56cc567dfd5688c8311b6b82402706a0c68c5b78 24-May-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Hide system apps until installed (1/2)" into pi-dev
24e913e5a84507f0c683ed492d87744c4b5e05af 24-May-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Unsuspending packages when a PO or DO is set" into pi-dev
40ede29ed6467d4d85a482e6008b92aa02d50267 19-Mar-2018 sanryhuang <sanryhuang@google.com> Hide system apps until installed (1/2)

Applying this mechanism for system carrier apps to make visibility
reasonable from the user's perspective. In other words, before
hidden system apps have been installed, they wouldn't be listed
via APIs in PackageManager which are used at all apps list and
search in Settings and so on.

Test: manual
Test: atest CarrierAppUtilsTest
Test: atest PackageManagerTest
Bug: 74068582
Change-Id: Id3ff138ad529b909d9bbf6719af3a553b909ccbb
ackageManagerService.java
77e2245e713a30c81c1ac44a7635c7ffef193461 23-May-2018 Suprabh Shukla <suprabh@google.com> Unsuspending packages when a PO or DO is set

If a profile or device owner is present, package manager does not
support calls to PM#setPackagesSuspended. So if there were already
suspended packages, they need to be unsuspended when a PO or DO is
added.

Test: atest com.android.server.pm.SuspendPackagesTest

Bug: 79980390
Change-Id: Ib79d95ccc25eef534fdcd540d3d6ea75c31982a7
ackageManagerService.java
28ea454824889937b4fd66614df5dfb62aa97f70 23-May-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Populate mPackages with system pkg even if installed is better" into pi-dev
2121fe041378ab18d87381dbe49bf9b411ccf922 23-May-2018 Patrick Baumann <patb@google.com> Populate mPackages with system pkg even if installed is better

System initialization relied on the system package living in mPackages
in order to build the expectingBetter map and successfully recover in
the case that we fail to scan / parse the updated APK. With this change
we properly populate mPackages in this scenario.

Test: manual - artificially force scan failure and reboot
Change-Id: Id86b579722bdfde8d4e660da3b680b0305a1d7e2
Fixes: 79428784
Fixes: 79360948
ackageManagerService.java
7d386fb5d775358925bffd90d0b63e61850170b7 23-May-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Send broadcast to verifier" into pi-dev
b662f94c3740b7a3a4ceae8fc953185345cbb519 23-May-2018 Jovana Knezevic <jovanak@google.com> Merge "Adding hidden APIs for assigning Admin flag to users." into pi-dev
f24ad4993cf02d94f2f732e0db62e7103942f798 18-May-2018 jovanak <jovanak@google.com> Adding hidden APIs for assigning Admin flag to users.

Also fixing method for requiring both MANAGE_USERS
and INTERACT_ACROSS_USERS_FULL permissions.

Fixes: 80001332
Bug: 25935510
Test: unit test
Change-Id: If10166b4379ddc6a5f004eab77fa1f93abf6ac2a
serManagerService.java
4c8de7a60f2d38ce727cbe8890904cd7c4c2cb71 22-May-2018 Todd Kennedy <toddke@google.com> Send broadcast to verifier

If the installer-of-record isn't the verifier, send package added
broadcasts to the verifier

Bug: 80099235
Test: Manual; install an application from 'adb' with an installer-of-record that's the verifier, see that only one broadcast is sent to the installer
Test: Manual; install an application from 'adb' with an installer-of-record that's not the verifier. see that two broadcasts are sent -- one to the installer-of-record and one to the verifier
Change-Id: I2a0ce35b5b1c21fe3f735cbb3cdbd9d42b596523
ackageManagerService.java
a927760cc3e67efd80fbfaa21352eb44d71f7df4 22-May-2018 Suprabh Shukla <suprabh@google.com> canRequestPackageInstalls returns false for instant apps

Instant apps should not be able to request app installs, regardless of
the app op state.

Test: cts-instant-tradefed run cts-instant-dev -m \
CtsExternalSourcesTestCases
cts-tradefed run cts-dev -m CtsExternalSourcesTestCases

Bug: 79485871
Change-Id: I6bee50b57e6820f5786dfbc82d042acce93fc1b4
ackageManagerService.java
d0897f2b6529d54879d811c5dca2cc96f1b11342 21-May-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Remove MANAGE_USERS from setPackagesSuspended" into pi-dev
80f0481628ff46eb6cda795734174d0e7159d0be 21-May-2018 Ye Wen <ywen@google.com> Merge "Allow user to change AiAi's permissions." into pi-dev
3ca67d42b9f3f0d66f08abbf132d2e80a8c58bc5 18-May-2018 Ye Wen <ywen@google.com> Allow user to change AiAi's permissions.

Test: Built on Walleye and verified in app permission settings.

Bug: 79942459

Change-Id: I6e871227ce47f3ed5fbd19a5d36bbc6615aee9a7
ermission/DefaultPermissionGrantPolicy.java
bdd94d9979e28c39539e25fbb98621df3cbe86f2 17-May-2018 Calin Juravle <calin@google.com> Allow adb to pull profile snapshots

The snapshot profile produced with `adb cmd package snapshot-profile`
needs to be readable by the others group so that adb can pull it.

Test: adb shell cmd package snapshot-profile pkg;
adb pull /data/misc/profman/pkg.prof
Bug: 74081010

Change-Id: Ibef8551704116e0b695f725e95f1671acbb82b5d
ackageManagerShellCommand.java
14405c9ac323e09281950e7fad9c8b10515f8e0b 17-May-2018 Suprabh Shukla <suprabh@google.com> Remove MANAGE_USERS from setPackagesSuspended

MANAGE_USERS is a widely used permission and setPackagesSuspended is a
dangerous API. Also having a lot of apps which can use the api can lead
to complications like them suspending each other.

Test: Existing tests with SUSPEND_APPS pass:
atest com.android.server.pm.SuspendPackagesTest

Existing permission tests without SUSPEND_APPS pass:
atest GtsSuspendAppsPermissionTestCases

Bug: 79773970
Change-Id: I49d81c0254c6ba528c50ece960a0db277c0afd7f
ackageManagerService.java
a6862c238039cba1b2f6175beca58f8d76e1bef9 03-May-2018 Patrick Baumann <patb@google.com> Support generic filters when EXTERNAL flag is set

This change opts instant app resolution out of hash prefix matching if
the intent filter being tested does not define an authority only when
the MATCH_EXTERNAL flag is set. This allows for a class of instant apps
that generically handle certain mime types or actions, but aren't tied
to a particular authority / domain.

This also moves the null check for resolution to a higher level,
accounting for connection-related failures to ensure that the installer
always gets a properly formatted intent.

Bug: 63117034
Test: manual - force connection timeouts and observe correct install intent
Test: manual - launch a generic type handler for a made up mime type;
observe correct resolution
Test: atest EphemeralTest
Change-Id: I0101e3219f543897a488ddd3d7c4c884f7d6cac3
nstantAppResolver.java
acae3ef8024773e42f0fbac862c053f3b16c8dc6 09-May-2018 Koji Fukui <Koji.Fukui@sony.com> Combine a message as one string and give it to snet_event_log

snet_event_log gets 3 arguments. Combine a message of revoking
permission when group changed and give it to 3rd argument of
snet_event_log.

Test: Repo'd scenario and looked at log
Bug: 79443138
Change-Id: Iecf0505bb7927891aa879d0cacedcf94872b9452
ermission/PermissionManagerService.java
2808cbc9d6fa70aebdb9fbb21c8bfb86c929736e 10-May-2018 Svet Ganov <svetoslavganov@google.com> Fix an accidentally reverted condition

The conditional was accidentally reversed so bringing it
back to the correct state and also bringing back the security
exception being thrown on violation.

Test: manual

bug:67773960

Change-Id: I1223297b8662e94413cc0bdcbe86089d1af296c2
ermission/PermissionManagerService.java
855694e15b9e6aa075e18c098bb0755ea05f776f 09-May-2018 Calin Juravle <calin@google.com> Merge "Add cmd package shell command for taking profile snapshots" into pi-dev
7e3a8d39856c6eab8fa314016cba19026be4a5b1 05-May-2018 Calin Juravle <calin@google.com> Add cmd package shell command for taking profile snapshots

Test: adb shell cmd package snapshot-profile pkgname
Bug: 74081010

(cherry picked from commit 21216c6a0323b0b63c9c5712f98fc8f7879dd8c1)

Merged-In: I96d73959cb46194667c7801767a9ebd44fd72d90
Change-Id: I96d73959cb46194667c7801767a9ebd44fd72d90
ackageManagerShellCommand.java
792d36c17036e80a587ba910f362e1b4f0b5ea9c 09-May-2018 Victor Hsieh <victorhsieh@google.com> Merge "Allow only selected priv apps to run OOB" into pi-dev
a5f20a8df4900fe846fe74b7182666185223faf5 09-May-2018 Calin Juravle <calin@google.com> Merge "Allow the shell user to snapshot profiles for debuggable apps" into pi-dev
bf22d134cc33b4764194db619853569c0ce17aa9 09-May-2018 android-build-team Robot <android-build-team-robot@google.com> Merge "Print correct version code when skipping outdated system packages" into pi-dev
61554708bac7666390a32dac9c1ad8a2aa035412 09-May-2018 android-build-team Robot <android-build-team-robot@google.com> Merge "Fix NPE in package manager when asserting overlays" into pi-dev
785d618b1a4c66d885cafec34ed1981daee6736d 19-Apr-2018 Victor Hsieh <victorhsieh@google.com> Allow only selected priv apps to run OOB

- Add pm.dexopt.priv-apps-oob-list to allow selecting specific packages
to run OOB, in a comma-separated string of package names. When set to
"ALL" (default), all priv apps will run in OOB.
- Add a global config priv_app_oob_list to persist the state for
experiment.
- Also make background dexopt to respect the config.

Test: 0. Reset previous OOB settings.
1. settings put global priv_app_oob_list \
com.google.android.gms,com.android.vending
2. cmd package compile -m speed -f com.google.android.gms (then
com.android.vending, com.google.android.googlequicksearchbox)
3. dumpsys package dexopt
# .vending and .gms are "verify", .googlequicksearchbox is
# "speed".
Test: settings put global priv_app_oob_list 'ALL' # see the same result
Test: settings delete global priv_app_oob_list # see the same result
Test: atest SettingsBackupTest
Bug: 30972906
Bug: 63920015
Change-Id: Iba47b4763a026cdc94939db0a743822278917269
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceUtils.java
ex/DexManager.java
4d6f581a97c27412ef1faf935679f86e89779b4d 28-Apr-2018 Calin Juravle <calin@google.com> Allow the shell user to snapshot profiles for debuggable apps

This is needed in order to be able to CTS test the profile infrastructure
via adb shell commands.

Test: atest ArtManagerHostTest
Bug: 74081010
Change-Id: I116dee2c36d712c0cd067d42994149c734f9edcd
ex/ArtManagerService.java
5da867597eb31c9e2296928c4a21200610747508 21-Feb-2018 Mårten Kongstad <marten.kongstad@sony.com> Print correct version code when skipping outdated system packages

When a newer version of a package exists on /data, the package manager
will skip scanning the outdated version on /system. As part of this the
following is printed to logcat:

Package <name> at <path> ignored: updated version <new-version>
better than this <old-version>

Teach the package manager to read <new-version> from the correct
variable (it used to be identical to <old-version>).

Bug: 78871949
Test: manual (upgrade a pre-installed app, check logcat on reboot)
Change-Id: Iaa4e43d2f91ca33a0e56e90c233d5d02abed781e
ackageManagerService.java
0b930eeb61b97e19f6345435ab33b3a6e26fca04 21-Feb-2018 Mårten Kongstad <marten.kongstad@sony.com> Fix NPE in package manager when asserting overlays

When a newer version of a package exists on /data, the package manager
will skip scanning the outdated version on /system. This means the
PackageSetting.pkg corresponding to the outdated version will be null.

This will cause an NPE when asserting that an upgraded overlay is
non-static (<overlay isStatic="false">). Prevent the exception by
checking for null, and, if needed, explicitly scan the outdated version
of the overlay within the scope of the assertion.

Bug: 78871949
Test: manual (have a pre-installed overlay, adb install a newer version, reboot)
Change-Id: I74d12c913705309dbb34f837b6806bb0fef25086
ackageManagerService.java
7438dcbfe2f226ffef0dae52ec32e021622595e4 08-May-2018 Patrick Baumann <patb@google.com> Add null check before checking overlay

This change prevents an NPE that was occurring when the package
for a given setting was assumed to be non-null while dumping
package information for e.g. adb shell dumpsys package

Test: manual - adb shell dumpsys package is no longer malformed
Change-Id: Idaf6a6b82f1fb450848faa15f19ee08085605bdb
Fixes: 79268525
ettings.java
ae4a20c75b84debb4f29cd9099a11a822d2e72ee 08-May-2018 android-build-team Robot <android-build-team-robot@google.com> Merge "Store package restriction settings at shutdown" into pi-dev
1b93e623bec0a1f79a5b9878f3728b6a0e85d0ee 08-May-2018 Bryan Henry <bryanhenry@google.com> Merge changes from topic "change-shared-user-apk-cert-pi-dev" into pi-dev

* changes:
Allow changing signing cert for system apps that use shared users
Revert "Allow shared users to rotate signing certs in an OTA"
d24c5de8345ab2d72644a2e3a56d70d246029928 08-May-2018 android-build-team Robot <android-build-team-robot@google.com> Merge "Reset the profile when system application change version." into pi-dev
1b7a2f88160445915b7e8e6f913b5723222751ac 25-Nov-2015 Tetsutoki Shiozawa <tetsutoki.x.shiozawa@sonymobile.com> Store package restriction settings at shutdown

Symptom:
Disabled package was re-enabled by restarting a device.

Root cause:
PMS postpones storing the package restriction settings in 10
seconds by design. When a package gets disabled right before
shutdown, PMS fails to store the last changes.

Solution:
Store package restriction settings at shutdown.

Test: Manually:
1. Run "pm suspend <package-name>"
2. Press power and reboot device within 10 seconds
3. Verify that <package-name> remains suspended

BUG: 73447744, 79209078
Change-Id: I4fe76c1f003e51653304cfaeaa5129d84803ce1e
Merged-In: I4fe76c1f003e51653304cfaeaa5129d84803ce1e
ackageManagerService.java
c6edb1e80c8c3fbc687fa20a0df8e86fa7c3d151 02-Apr-2018 Hyangseok Chae <neo.chae@lge.com> Reset the profile when system application change version.

Background optimization has flag checkProfiles as true,
performDexOptLI check profile is updated with checkProfiles.
(isProfileUpdated() -> mergeProfiles -> analyze_profiles())
analyze_profiles decides if it is need to compile and clear
the profile or not. But analyze_profiles and profman merge
only based on existing profiles. Eventhough checksum of
application dex was changed, profman only check the profile
can be merge or not.

With below TC, the return value of profman is PROFMAN_BIN_
RETURN_CODE_SKIP_COMPILATION(1). Because current profile
has not enough informations than reference profile.
I think ProcessProfilesInternal should consider change
of dex checksum, If there are mismatch checksum of dex
between profiles and dex, then profman should return with
PROFMAN_BIN_RETURN_CODE_BAD_PROFILES (2).
After that analyze_profiles can reset profiles with
PROFMAN_BIN_RETURN_CODE_BAD_PROFILES.

But profman does not have that implemtation for verify
the profile based on checksum. So, It is need to drop
the profile based on change of application version.

Test: System update
1. Factory Image with system application. (vendor, system app)
2. Use Sample application to generage current profile.
3. BackgroundDexOptService optimize with speed-profile.
4. Use Sample application to generage current profile.
5. There are small size of current profile and large size
of reference profile.
6. System update with application change.
7. Reboot.
8. Next background optimization would be fail permanently.

Bug: 77839992

Change-Id: Iac575ae5906498a59b750df0b281fab01df57b3e
ackageManagerService.java
151b21b227eb9da41548f137a3a94d5c7d44eb69 28-Apr-2018 Suprabh Shukla <suprabh@google.com> Unsuspending packages on suspending app data clear

A suspending app loses all app data, jobs, alarms, etc. when its data is
cleared. The packages it suspended should get unsuspended so the device
is not left in an inconsistent state.
Also simplifying the permission check to block any cross user calls not
from system or root.

Test: Manual test by suspending with com.android.frameworks.servicestests
and then clearing data via Settings and also "adb shell pm clear"

Bug: 77801553
Change-Id: I20424322b5917f3b87e2cf48a6444de9f242d311
ackageManagerService.java
ettings.java
ermission/PermissionManagerService.java
ad8a0da6a7b92e244953460068aebd4b40a5614e 06-May-2018 Bryan Henry <bryanhenry@google.com> Allow changing signing cert for system apps that use shared users

This allows changing the signing certificate of system apps that use
shared users across an OTA, but still verifies that all signatures
within a given boot are consistent for a given shared user.

Bug: 72837107
Bug: 77973716
Bug: 74501739
Test: Flashed dev-keys build into slot b and (local) release-keys build
into slot a, booted into b, then successfully booted into a without
wiping userdata.
Test: Same as above, but treated com.android.mtp (uses android.media UID)
as PRESIGNED during release signing so it kept dev-keys. Verified it
wasn't scanned first and that only that package was rejected.
Test: Same as above, but treated com.android.providers.downloads (uses
android.media UID) as PRESIGNED during release signing so it kept
dev-keys. Verified it was scanned first (out of APKs using this UID) and
that only this package was accepted. Verified other APKs using
android.media UID that were scanned after were rejected.

Change-Id: I2076e8358cae22e45a24aa4c32a1b8dd446679ca
ackageManagerService.java
haredUserSetting.java
154991434c8f2982283d688ce0e9b6e3f217cf0b 04-May-2018 android-build-team Robot <android-build-team-robot@google.com> Merge "Grant SharedStorageBackup storage access." into pi-dev
7bfb942e2d240dc1c52bfd0926517a7dbd3942fb 04-May-2018 android-build-team Robot <android-build-team-robot@google.com> Merge "Propagate calling UID to AM from CrossProfileApps" into pi-dev
4b3a1f5fc2813c70703b43b97790dccc1fcb772e 04-May-2018 Anton Philippov <philippov@google.com> Grant SharedStorageBackup storage access.

Shared storage backup had been relying on the WRITE_MEDIA_STORAGE permission to access
files on external storage, but that permission has been locked down,
and we need to use the real WRITE_EXTERNAL_STORAGE permission now.

Bug: 78938482
Test: build && boot && 'adb backup -shared' && 'adb restore backup.ab'
Test: make gts -j32 && gts-tradefed run gts -m GtsPermissionTestCases
Change-Id: Id244a1178936e8ffcccc7f95bcb120809a4b4607
ermission/DefaultPermissionGrantPolicy.java
f8f6e5af75ea57edd83a9b2df9d5b896ec62ab46 03-May-2018 android-build-team Robot <android-build-team-robot@google.com> Merge "Resets system flags when updating PackageSettings" into pi-dev
f4e0438a46e7d9194338933ca5689dc769e43a57 03-May-2018 android-build-team Robot <android-build-team-robot@google.com> Merge "In place split install native support" into pi-dev
a639d142001ce8c8398193e0398781d51168a691 03-May-2018 Patrick Baumann <patb@google.com> Resets system flags when updating PackageSettings

In the case that we're updating a system app, we will in-place
update the PackageSetting object. This works for most fields but
breaks when updating flag fields as we're executing a binary or
on the existing flags, thus not unsetting bits when we should be.

This change resets all system-related flags before setting the new
flag values.

Test: manual - move app from priv-app to app, install update,
verify that app does not receive priv flag
Fixes: 75993951
Fixes: 78265024

Change-Id: I3c88a3583ddb85c4b6b0e3b4d7b6d1d0db93ac17
ettings.java
f5cb5e55250d892bc3b8de9fbe59b7464b1d874f 03-May-2018 android-build-team Robot <android-build-team-robot@google.com> Merge "old paths contains all entries when updating" into pi-dev
b9656a93aac435cefaa4ca0e1b06495d690ba019 02-May-2018 Todd Kennedy <toddke@google.com> old paths contains all entries when updating

In certains circumstances, only the base and split APKs were included in
the "old paths" list when updating the application info. Instead, this
list should contain _all_ elements, including any additional libraries
that may be added to the overall classpath.

Bug: 77342775
Test: Manual. Install a package. Install a split with --dont_kill. See that the path doesn't contain duplicate entries
Change-Id: Id9739cce215ab07bff1b17966583c0cf51a0b34a
ackageManagerService.java
8d9f8440045dd8767224c1ef49e18536c26384f1 03-May-2018 android-build-team Robot <android-build-team-robot@google.com> Merge "Fixes non-matching instant app behavior" into pi-dev
85c7a9a11382994a1d48995b04104139b74f8d4d 02-May-2018 Farid Zare Seisan <faridzs@google.com> Merge "UserDataPrepare: CE storage property set too early." into pi-dev
de32b83499151ad8e0b47bd90cb0a87cdfb7cf01 30-Apr-2018 Tony Mak <tonymak@google.com> Propagate calling UID to AM from CrossProfileApps

Test: atest cts/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CrossProfileAppsHostSideTest.java
Test: atest FrameworksServicesTests:com.android.server.pm.CrossProfileAppsServiceImplTest
Test: Try the API in TestDPC

Fixes: 78869781

Change-Id: I9b8721f6b5189e566345c2afee7d559a57670e71
rossProfileAppsServiceImpl.java
eac8a05d19d0c29f8e4310db62d5ed41bc4773b9 01-May-2018 Makoto Onuki <omakoto@google.com> Merge "Propagate calling UID to AM from LauncherApps" into pi-dev
e4d1cabe457d1e5435377015d5511520ca582a87 01-May-2018 android-build-team Robot <android-build-team-robot@google.com> Merge "Fix an NPE in PackageManagerService (introduced by ag/3819668)" into pi-dev
e7945beff0a33e6d8fc658e880f693c08df101d8 05-Apr-2018 Satoshi Niwa <niwa@google.com> Fix an NPE in PackageManagerService (introduced by ag/3819668)

Since PackageParser.generateApplicationInfo may return null, we need a null check after it.

Bug: 73134482
Bug: 78678911
Test: manually tested on ARC/ChromeOS and confirmed NPE had gone away
Change-Id: I7f91b2cbe29ab7c20758f97501c49e1401ee1e7e
ackageManagerService.java
7f6b8120da3de99bace28eb1c1602016d0e5fbb0 30-Mar-2018 Farid Zare Seisan <faridzs@google.com> UserDataPrepare: CE storage property set too early.

Set sys.user.[userId].ce_available only after CE
storage has been prepared. This property was being set
too early. This will cause a race for first boot between
preparing these folders and writting to them. If CE
storage is not empty before setting encryption policy
then setting encryption policy would fail.

Also, if setting CE storage fails, we should not destroy
DE storage since recovery is only making call to retry
setting up CE.

Only when userId == UserHandle.USER_SYSTEM then mkdri
should fail when CE property isn't set.

Bug: 76222913
Bug: 76102397
Bug: 78514593
Bug: 78515110
Test: Waiting for property and no longer seeing the race.
Verified below cts failures are now passing.
android.appsecurity.cts.ExternalStorageHostTest#testMultiViewMoveConsistenc
android.appsecurity.cts.ExternalStorageHostTest#testExternalStorageWrite
android.appsecurity.cts.ExternalStorageHostTest#testExternalStorageNone

Change-Id: Ied0308ef099090e8f3954e905f78320214e14335
(cherry picked from commit 420e825111ca5c95c6200c1fb4681c315906e71e)
serDataPreparer.java
1bea237aa296a35c263f0c4965ba0f5a140cd848 13-Mar-2018 Patrick Baumann <patb@google.com> In place split install native support

This change makes it possible for apps installed with the DONT_KILL flag
set to obtain access to newly installed native libraries while avoiding
double load of existing native libraries prior to the install when
loaded using System.loadLibrary.

Bug: 72047376
Test: manual - used sample app to verify availability of native libs
Change-Id: I331eaa48da1f8dee424584911317ec3fba92f873
ackageInstallerSession.java
11ee5468763b1c57103390d046581c4358380716 28-Apr-2018 Victor Hsieh <victorhsieh@google.com> Remove package code path for all parsing failure

Instead of only remove for INSTALL_FAILED_INVALID_APK reason, remove if
it is not a success.

This was introduced at 679bba33 in 2010.

Test: adb shell stop, tamper with an apk in /data, start
# see bad apk being removed
Bug: 30972906
Change-Id: I8b468958a7547ce2ed030e78356b2ce3ddd3641d
ackageManagerService.java
1a34274336c19b50173ea60071dfc6427d40dbf6 26-Apr-2018 Makoto Onuki <omakoto@google.com> Propagate calling UID to AM from LauncherApps

- So that AM can perform all the necessary caller checks, except for the cross-profile/user check.

- Note PixelLauncher is the recent app which gets extra privileges. So I used ShortcutLauncherDemo
and a 3p launcher for manual tests.

Fixes: 78635323
Test: manual test, with a 3p launcher. (nova)
- Launch primary profile app -> launches fine
- Launch work profile app-> launches fine
- Launch suspended work profile app -> "can't open this app" dialog is shown.
- Launch the primary counterpart of the suspended work profile app -> launches fine.
- Launch work profile app in quiet mode, with separate work challenge
-> "turn on work profile"? dialog is shown
-> then "cancel" -> nothing happens.
-> then "turn on" -> "re-enter your pin" is shown -> type pin -> work profile app starts fine.
- Launch work profile app without separate work challenge
-> "turn on work profile"? dialog is shown
-> then "cancel" -> nothing happens.
-> then "turn on" -> work profile starts and the app starts fine.
- "App info" on work profile app -> Setting page opens fine.
- "App info" on primary profile app -> Setting page opens fine.

Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest*.java
Test: atest cts/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherApps*.java

Change-Id: Ie665a8890407d05c1d877f04d9c5c3a1caad18e1
auncherAppsService.java
b37e1cd82fcaa7058e9fdf34749fcd19a7e2b2b4 27-Apr-2018 Bryan Henry <bryanhenry@google.com> Revert "Allow shared users to rotate signing certs in an OTA"

This reverts commit ffd979d6b90a2780e8d625f7c65e5a8680ceb6ba.

Reason for revert: Replacing with go/oag/673735
Bug: 74501739
Test: N/A

Change-Id: I9e87b0f815081a196218744653542a29939c82bb
ackageManagerService.java
3e0b8ee39ab3435abd88c03069272da6e605b6a0 26-Apr-2018 Patrick Baumann <patb@google.com> Fixes non-matching instant app behavior

This change ensures that a correctly formatted intent is sent to the
instant app installer when no match can be found. Prior to this change,
the original intent with the installer set as the component would be
sent. After, we send an install intent with a sanitized intent set as an
extra, as expected.

Bug: 63117034
Test: manual - launch non-matching intents with flag set
Change-Id: I70a3e2fab55e8f0524bbc99e88fba98dc2e28aaa
nstantAppResolver.java
d79759a2d720a3d77e2f8d1bae3ce7dc8d8d1521 26-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Makes static shared libs visible to installer" into pi-dev
d6afc52a9c3605a6839553c58ddc01fabed91e8e 24-Apr-2018 Andrew Hsieh <andrewhsieh@google.com> Merge "pm: skip scan-as-privileged for OMR1 vendors" into pi-dev
f22fd65a25c2432e29ae7e3c5d42ca504742384d 24-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "PackageManager: Skip dexopt on install for debuggable apps" into pi-dev
45381e34485a2cad4ce2cdaecd85887f5a3619d6 23-Apr-2018 Justin Yun <justinyun@google.com> pm: skip scan-as-privileged for OMR1 vendors

Skip scan-as-privileged for OMR1 vendors because OMR1 could not
define privileged apps in vendor partition.

Bug: 78105955
Bug: 78134108
Test: Flash P-GSI on OMR1 device and check boot
Change-Id: I968e779ea66587563907589ad22d1191a89fe463
ackageManagerService.java
694f60005e10d6660d829476b9e1b4582203a611 24-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Failing setPackagesSuspended if user has a DO / PO" into pi-dev
c0886002289ce58bffa9d6c2430a7090c19a1136 23-Apr-2018 Andreas Gampe <agampe@google.com> PackageManager: Skip dexopt on install for debuggable apps

To reduce install-to-started latency, skip dexopt at install-time
for debuggable apps. This is a conscious tradeoff, as the app
will run slower, and do repeated work on every startup. However,
for debuggable apps, turnaround time is more important.

(cherry picked from commit 58adf3a8eead2d7594fc1ac15aaed6a5760e7ba4)

Bug: 78200989
Test: m
Test: Device boots
Test: CTS (wrap & JVMTI)
Merged-In: I749934e794b0c89d72ea8ee413b845e7804de184
Change-Id: I749934e794b0c89d72ea8ee413b845e7804de184
ackageManagerService.java
1df26b9b26ba3c6474765e6caf9d2045835995cd 20-Apr-2018 Patrick Baumann <patb@google.com> Makes static shared libs visible to installer

Prior to this change, shared libraries could be installed by, but were
not visible to installers. This made management of them impossible.

Change-Id: Id6e45a2ad8d5b1dbb8b5e0967a035ec53268904d
Fixes: 66673959
Test: manual - installed static lib and verified installer could view it
ackageManagerService.java
7ea5378f8962a58adfb3702bcd9625aec78b3c7d 17-Apr-2018 Suprabh Shukla <suprabh@google.com> Failing setPackagesSuspended if user has a DO / PO

Device or profile owners should be suspending packages via
DevicePolicyManager. If an app with SUSPEND_APPS tries use the
PackageManager api on a user with a DO or a PO, the call should fail

Test: gts-tradefed run gts-dev -m SuspendApps

Bug: 78132137
Change-Id: If478db0726073c2e59dba3a7049cc16c56d9f3d5
ackageManagerService.java
rotectedPackages.java
ddb15c471c708fd2eedc7193099ec80dd205065f 20-Apr-2018 Jeff Sharkey <jsharkey@google.com> Merge "Protect usage data with OP_GET_USAGE_STATS." into pi-dev
0ad6283da79c5f5e7cda0dd10030b9d4be2cb6e8 19-Apr-2018 Jeff Sharkey <jsharkey@android.com> Protect usage data with OP_GET_USAGE_STATS.

APIs that return package usage data (such as the new ArtManager)
must ensure that callers hold both the PACKAGE_USAGE_STATS permission
and the OP_GET_USAGE_STATS app-op.

Bug: 77662908
Test: atest vendor/xts/gts-tests/hostsidetests/dexapis/host/
Change-Id: I7a85d959f1682d2bd5cf3684415e368fece88101
ackageManagerService.java
ex/ArtManagerService.java
c59dfc61b66b31a2cf221a514599ee672604fdfa 19-Apr-2018 Tony Mak <tonymak@google.com> getUserIdLPr should take application id as input

Fixes: 78265824
Test: Setup work profile using TestDPC -> add account into work profile.
Test: Add google.com in personal side to trigger work profile setup.

Change-Id: Ib87301fc98d0ebf1baa043e4badb5144a0f62377
ackageManagerService.java
303c4bbb40945c399647487a98ace75cdedccd3a 10-Apr-2018 Dan Cashman <dcashman@google.com> Add AccountManager key rotation awareness.

Replace checkSignatures() calls in AccountManager with a new,
rotation-aware call to PackageManagerInternal. Also add a new
AUTH cert capability to reflect the distinction between these
permissions and others.

Bug: 77651077
Test: Builds. CtsAccountManagerTestCases
Change-Id: Idd412cd984acf7d37555deb5879f2d6a0a10c2b6
ackageManagerService.java
d688e7b15dd3ee56da34b146ba5ee0271a2cb6cb 17-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Load fallback categories earlier" into pi-dev
a63d57ab65eea9c74c12fde7fd970fd6f67579ae 17-Apr-2018 Todd Kennedy <toddke@google.com> Load fallback categories earlier

At the end of the package manager constructor, we are prepare the data
directories for all installed applications. This creates ApplicationInfo
objects which needs to load categories from the fallback categories provider.
If we're populating the fallback categories during this time, there's a
subtle timing issue where we may return a 'null' category instead of an
Integer.

Change-Id: I974a39029d6c15d3986571e610eb0cd106fdc05c
Fixes: 78128442
Test: Manual. System boots and no crash
ackageManagerService.java
eb59580abd6b26f6d9cf61ea5ea7a58f4652be6f 17-Apr-2018 Patrick Baumann <patb@google.com> Checks that secondary instrumentation ABI matches

This adds checks that the secondary ABI for an instrumentation package
matchs that of its target before using it when forced and warns of
mismatches.

Change-Id: I394427721c83cbd1c3c6af6cee24a93b18d8c65f
Fixes: 77152863
Test: gts-tradefed > run gts -m GtsBackupHostTestCases -a armeabi-v7a do not all fail with NPE
ackageManagerService.java
928b70303c08afda899b23c186b66d0a644bb74c 16-Apr-2018 Dan Cashman <dcashman@google.com> InstantAppRegistry: adjust backwards compat cookie sig check.

InstantAppRegistry used to store cookies based on the hash of only
one of the signing certificates out of potentially multiple signing
certificates. To prevent loss of stored cookie info for an app which
has multiple signing certificates, it needs to check if the stored hash
value corresponded to only one of those certs before this was corrected.
Since the order of signing certificates is not specified, all cert hashes
should be compared to see if one of them matches the stored value.

Bug: 73739156
Test: android.appsecurity.cts.InstantCookieHostTest#testCookieValidWhenSingedWithTwoCerts
Change-Id: I2d616ca7ba60104f0b009d23e8eb4e7f525362fd
nstantAppRegistry.java
7081085d6dc081e74468f11cd80dfd5b66483949 14-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "(P) Revoke permision when group changed" into pi-dev
df88614db2c408a45518bd51a28705b542525c73 13-Apr-2018 Benjamin Franz <bfranz@google.com> Merge "Silently ignore force stop API for protected packages" into pi-dev
fae8a528f1d4a103c644b9d7da6eff3d55cd0b67 10-Apr-2018 Philip P. Moltmann <moltmann@google.com> (P) Revoke permision when group changed

If a run time permission of a group is already granted we grant the
other permission of the group automatically when requested.

Hence if an already granted permission changed its group during an
update suddenly permission of a potentially not approved group will
get auto-granted.

This is undesirable, hence we revoke the permission during the update
process.

Test: atest android.permission.cts.PermissionGroupChange
Fixes: 72710897
Change-Id: Ib2165d1ae53b80455ebe02e07775853e37a2e339
ackageManagerService.java
ermission/PermissionManagerInternal.java
ermission/PermissionManagerService.java
52ae06af4d170b5ccd1453f7584d00b1cf288689 12-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Ensure we do not set seInfoTargetSdkVersion to 0." into pi-dev
aab3304a22ab3778bad9b7fc9a8d113fee9cd727 12-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix broken target SDK checks." into pi-dev
a26e7559003b4f83553bf1d6c3b0d9558ec20005 12-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add stats logging to ServiceManager and NPMS" into pi-dev
49392d335af8559169238bb9cb4fc2911192adea 11-Apr-2018 Makoto Onuki <omakoto@google.com> Add stats logging to ServiceManager and NPMS

ServiceManager:
- Do an event log every N getService() calls with total time spent
in getService().
where N = 100 for core UIDs and 200 for other apps.

- Do an event log if getService() takes longer than N ms.
where N = 10 for core UIDs and 50 for other apps.

... with some extra throttling.

NPMS:
- Do the basic "stats logger" log for updateNetworkEnabledNL() and
isUidNetworkingBlocked()

This CL also enhances StatsLogegr so it now can show the slowest call
and the max # of calls per-second.

Bug: 77853238
Test: Manual test:
- Insert a SIM card
- Set data limit
- toggle airplane mode
- toggle wifi
- toggle mobile data

Then
- "dumpsys netpolicy" and "dumpsys activity processes" and check the stats
- also check "adb logcat -b all | grep ' service_manager'"

Change-Id: I5789541063f95d0eac501189816c8604a4571ba0
hortcutService.java
960a0c6c5761405090e53ba930dec85e93de0ebb 11-Apr-2018 Daniel Cashman <dcashman@google.com> Merge "Add SigningInfo class to expose package signing details." into pi-dev
dfd822be8fff9aeb6bd0c2098708a79380fc0729 03-Apr-2018 Joel Galenson <jgalenson@google.com> Ensure we do not set seInfoTargetSdkVersion to 0.

We saw a bug where after taking an OTA many packages had a
targetSdkVersion of 0, which was potentially causing lots of crashes.
This prevents that from happening.

Bug: 76021094
Test: Flash older build, flash newer build, ensure targetSdkVersion is
not 0.

Change-Id: If2988a17ca71a6c3c867f905700df864fd09b776
(cherry picked from commit feaa1ac0a949dee6553c42adfa8dd78e135d73bf)
haredUserSetting.java
f81bf7fa7582f55a31435f37e02de5c03014cc19 26-Mar-2018 Benjamin Franz <bfranz@google.com> Silently ignore force stop API for protected packages

Bug: 75997475
Test: manual
Change-Id: I804aafe2404eeaac732fed51cf6d3d2e45a3b5bb
ackageManagerService.java
61aebf6d39c1a7a697a7690741b2505e9668bfc0 11-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Revert "Check permissions only against packagesettings"" into pi-dev
c826eec11f09e08d3ffd463df1d7610e918041b1 11-Apr-2018 Chad Brubaker <cbrubaker@google.com> Merge "Allow shared users to rotate signing certs in an OTA" into pi-dev
97b9b5304ce78b237081e48cf1a55bf40e1977f2 11-Apr-2018 Patrick Baumann <patb@google.com> Revert "Check permissions only against packagesettings"

This reverts commit b00eb6459127018ec7641f407d5873a0c417416d.

Reason for revert: Boot issues after OTA
Bug: 76228188
Fixes: 77888575
Change-Id: I5ca2605cb6befea46ce50198bc72bdd4b6e84f1a
ackageManagerService.java
ermission/PermissionManagerService.java
96212bca06842f223a0e9e377e2c00a2008c96a2 11-Apr-2018 Suprabh Shukla <suprabh@google.com> Review of suspend/unsuspend APIs

Clarified the package extras bundle returned from
getSuspendedPackageAppExtras.
Moved the bundle arg to the last in LauncherApps.onPackagesSuspended and
clarified the contents of the Bundle.
isPackageSuspended(String) now throws a NameNotFoundException if the
package is not found.
Also, removed a permission check from isPackageSuspendedForUser.

Test: builds, boots, existing tests:
atest com.android.server.pm.SuspendPackagesTest

Bug: 77518983, 77517955, 77507744, 77801528
Change-Id: I06b5f69f8f8a079c206863cb6122e90be58366cd
ackageManagerService.java
5c9f527e3328c2f3a96cdeb5052b969c1ff66493 04-Apr-2018 Dan Cashman <dcashman@google.com> Add SigningInfo class to expose package signing details.

Attempt to simplify the exposure of package signing information via
PackageInfo by creating a new class and corresponding methods for
querying a package's signing information.

Bug: 74831530
Test: PkgInstallSignatureVerificationTest
Change-Id: Idbc008b41a921f89cefb224b26f910da4d238dea
hortcutPackageInfo.java
2c14da400169013f9a1a4f0f1c76e5842fbec967 10-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't return from loop" into pi-dev
aa1a911d9a0f797748b001c41bd8df2f517b318c 10-Apr-2018 Jeff Sharkey <jsharkey@android.com> Fix broken target SDK checks.

Consider an app targeting the final API 28, but running on an older
build where "P" is still API 10000. Those apps need to be treated as
legacy apps.

In general, the logical pattern that should be used when enforcing
target SDK behaviors is below.

For applying behavior to legacy apps:
// BROKEN
if (targetSdkVersion <= Build.VERSION_CODES.N_MR1) {
// CORRECT
if (targetSdkVersion < Build.VERSION_CODES.O) {

For applying behavior to new apps:
// BROKEN
if (targetSdkVersion > Build.VERSION_CODES.N_MR1) {
// CORRECT
if (targetSdkVersion >= Build.VERSION_CODES.O) {

Bug: 77865751
Test: builds, boots
Change-Id: Ia83bd446a940751d51a6542c7a5b9cca174c5296
ackageManagerService.java
e901d69ea66c990d8ba728a75622e39e9543f397 10-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "setPackagesSuspended now overwrites all the state" into pi-dev
dd9b3f5d92c2485a27bbdd4f8c1f14b8fb367c74 10-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fixes task behavior on AIA launch" into pi-dev
3f345a99f71b922daa5750ba232a84ddaaba222b 10-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Check permissions only against packagesettings" into pi-dev
45b9e40a4f23f36be88f7474660e931b58aedf1e 10-Apr-2018 Suprabh Shukla <suprabh@google.com> setPackagesSuspended now overwrites all the state

Earlier setPackagesSuspended ignored the rest of the paramters when
suspend state did not change. This was a problem because then there was
no good way to update the other parameters without unsuspending the app,
which is not desirable.
Removed setSuspendedPackageAppExtras as now they can be update with this
api.
Also sending broadcasts when packages get unsuspended due to suspending
package removed.

Test: Existing tests pass:
atest com.android.server.pm.PackageUserStateTest
atest com.android.server.pm.SuspendPackagesTest
atest com.android.server.pm.PackageManagerSettingsTests

Bug: 77522553
Change-Id: I72a3c228d3d65c430e242da97b2bc6997ec6a135
ackageManagerService.java
ackageSettingBase.java
2b5affb5de267a874e88649e8a2845ce67d5b4c3 10-Apr-2018 Todd Kennedy <toddke@google.com> Don't return from loop

Change-Id: Ibae513fd1bdc9f9f703a10e5e68e78783079d259
Fixes: 77821842
Test: manual
ackageManagerService.java
b7080e35b720aec68cf4771637f46d9f6e1c7d66 09-Apr-2018 Patrick Baumann <patb@google.com> Fixes task behavior on AIA launch

This change allows the instant app installer to launch on which ever
task it is being called from, resulting in the sucess intent launching
using the flags the original caller intended and avoiding breaking the
flow when the installer is required.

Bug: 62872137
Test: manual - prototype installer no longer results in double tasks
Change-Id: I9e84ec89bc4bcb3c890bda8332d4110ac231382d
nstantAppResolver.java
b00eb6459127018ec7641f407d5873a0c417416d 05-Apr-2018 Patrick Baumann <patb@google.com> Check permissions only against packagesettings

Prior to this change there was a chance that an updating app would not
exist in mPackages and cause a permission check for that app to fail.
This change moves all permission checks to use mSettings and the cached
package it contains to do the checks.

Change-Id: I0717bddbb08b1d0dbab3ea79fa0d2067aa858753
Fixes: 76228188
Test: Manual - system starts, permission checks work before / after update
ackageManagerService.java
ermission/PermissionManagerService.java
ffd979d6b90a2780e8d625f7c65e5a8680ceb6ba 06-Apr-2018 Chad Brubaker <cbrubaker@google.com> Allow shared users to rotate signing certs in an OTA

As part of an OTA we allow system applications to change their signing
certificates however in order to fully support rotating signing certs in
an OTA we must also be able to rotate the sytem shared users to new
signatures.

Bug: 74501739
Test: rotate keys and adb sideloaded update, device now boots
Change-Id: Ic04f1d3dbbe1da6ee723addc9be048f92440dda0
ackageManagerService.java
822ce4f3aa0c6df1b58b66d342694957ba63b4f9 05-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Activity interceptor dialog for suspended apps" into pi-dev
cb331c32db391e1f3518ef873af23ee295a39cad 05-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fixes non-web AIA internal launch" into pi-dev
a4d6570b2fd990d61b68e7bd20f1b917d4715710 05-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Copy ApplicationInfo#versionCode field" into pi-dev
0e650c1c55d22a2721f38759d41a2706721474d2 05-Apr-2018 Mathew Inwood <mathewi@google.com> Merge "Exempt platform-cert signed apps from hidden API checks." into pi-dev
3c3af1406e9fc8afbe9593df6c23fe3d4daa6b42 30-Mar-2018 Suprabh Shukla <suprabh@google.com> Activity interceptor dialog for suspended apps

Added an AlertActivity to intercept the start for an activity belonging
to a suspended app. More details will be shown if the suspending app
also defines an activity to handle the API action
SHOW_SUSPENDED_APP_DETAILS.

Test: Added tests to existing classes. Can be run via:
atest com.android.server.pm.SuspendPackagesTest
atest com.android.server.pm.PackageManagerSettingsTests
atest com.android.server.pm.PackageUserStateTest

Bug: 75332201
Change-Id: I85dc4e9efd15eedba306ed5b856f651e3abd3e99
ackageManagerService.java
ackageManagerShellCommand.java
ackageSettingBase.java
ettings.java
fdc891e2af54dd3a5e23d223350b1509a0fef95d 05-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Completely fill in permission info" into pi-dev
fe99686d8ab57035b0ed06b9e2a0cb5e21b0d400 05-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Hiding windows for suspended packages" into pi-dev
a0ec24cb624e2c6e22b696f0b38fbb442dbdb076 05-Apr-2018 Todd Kennedy <toddke@google.com> Completely fill in permission info

During the refactor, an optimization was made to generatePermissionInfo()
to avoid creating duplicate PermissionInfo objects. However, the logic was
flawed and if a permission's protection level was ever adjusted, we
wouldn't return a properly filled out PermissionInfo object.

Change-Id: I70b3eda199008807182f75a413651d7cb4f4b7fd
Fixes: 74556457
Test: Manual; run app com.kakao.taxi and it doesn't crash
ermission/BasePermission.java
7838027fb089238a6044b9bda4385bf81f90ab50 04-Apr-2018 Patrick Baumann <patb@google.com> Fixes non-web AIA internal launch

This change plumbs the original uid of a startActivity call through to
PackageManagerService#queryIntentActivitiesInternal so that we properly
filter.

Test: manual - launch previously failing instant app
Change-Id: I0a62195f67c2e08315ce2d87f1d8c516c2327ba6
Fixes: 77489209
ackageManagerService.java
ermission/DefaultPermissionGrantPolicy.java
e70b29e81010a871fbc7003eac0d1bd4ceaa7c2d 04-Apr-2018 Makoto Onuki <omakoto@google.com> Fix launcher apps reverse access

Trying to access other profiles from work profile shouldn't throw
security exception.

This is a partial revert of Ia4ddea58f66861ef760865b6d8831563584f85c9.

(Technically we should check the target user-id too, but that part isn't a
regression, so I'm not fixing that part.)

Bug: 77260666
Change-Id: I3f1f6584fcd6b879943d85ab4678b6130def0ba3
Fixes: 77260666
Test: atest /android/pi-dev/cts/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherAppsProfileTest.java#testReverseAccessNoThrow
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
auncherAppsService.java
c2def58ec0ab96c90f6d786526c5446f9d12be70 04-Apr-2018 Patrick Baumann <patb@google.com> Copy ApplicationInfo#versionCode field

This compatibility change ensures that apps built for pre-P that rely
on reflection to access ApplicationInfo#versionCode don't crash. The
move to long version code introduces a new field and all modifications
of the field are wrapped in a method that ensures both the new and old
fields are set appropriately.

Test: manual - impacted app runs
Change-Id: I5fb37c65b0fb04042dda12479d1e1a76590daa3d
Fixes: 74393568
ackageManagerService.java
9d89543d48b1bd286355f3b2730bee954c8dda1f 04-Apr-2018 Mathew Inwood <mathewi@google.com> Exempt platform-cert signed apps from hidden API checks.

This means that APKs signed with the platform cert are allowed to use
hidden APIs, even if they are not on the package whitelist, and if they are
not in the system image. It will also allow a number of packages to be
removed from the package whitelist.

Also remove all platform cert signed apps from the package whitelist, as
there is no longer any need for them to be in there.

Bug: 64382372
Test: device boots
Change-Id: Id805419918de51f946c1f592581bab36ae79de83
ackageManagerService.java
69c71423ecd1858e1dd6407a96ed7609dc379e85 03-Apr-2018 Suprabh Shukla <suprabh@google.com> Hiding windows for suspended packages

Suspended packages get their activities intercepted at start, but they
can still show system_alert or toast_windows from other components.
These need to be hidden when the app goes into suspend and unhidden when
it is unsuspended.

Test: atest com.android.server.wm.WindowStateTests

Bug: 77498821
Change-Id: I9ac446f20feb23e2090ba306b4435c46b9aeec95
ackageManagerService.java
68e89707f449c9859b851e18a3489fd73a6153d2 04-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Bind to DefaultContainerService early for AIA" into pi-dev
b8d46c2c147cbf1951f0db7520cd7ddd9d84f49d 03-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Correct provider filtering" into pi-dev
7ee86d1dbce8afa70ff699c7a8414b160aba8b74 03-Apr-2018 Mathieu Chartier <mathieuc@google.com> Merge "Add dedicated flag to control app image generation" into pi-dev
c4a6070d2442fbe227af6e9d6005b5922d7669c0 03-Apr-2018 Todd Kennedy <toddke@google.com> Correct provider filtering

The provider filtering didn't allow for access by the system server.

Change-Id: Ie939da99714ccb5a281ef0dfb658aaa231bb0c07
Fixes: 76208554
Test: atest -it CtsAppSecurityHostTestCases:EphemeralTest#testEphemeralQuery
Test: atest -it CtsAppSecurityHostTestCases:EphemeralTest#testNormalQuery
ackageManagerService.java
a9c343386d5505d7111aee3c1ffec409c9730f21 13-Mar-2018 Mathieu Chartier <mathieuc@google.com> Add dedicated flag to control app image generation

Also disable the flag for split APKs.

Bug: 72696798
Test: manual

Change-Id: I25007500e221744a218b165dde41ca9db19b1832
nstaller.java
taDexoptService.java
ackageDexOptimizer.java
0594af6dc37f091d62991a6923fb4eeaf8db61f6 03-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add ROLLBACK past signing cert capability." into pi-dev
6d24a1c8bef4c70ac1e646ffb21299ad7fe4a22b 02-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Exit the loop at the right time" into pi-dev
629a5f9705368990515ca4754f58f2d4ffb78a1e 31-Mar-2018 Daniel Cashman <dcashman@google.com> Add ROLLBACK past signing cert capability.

Add a new capability that may be granted to past signing certificates
after changing to a new signing certificate that will allow applications
to go back to a previous signing certificate. This capability is
intended to not be granted, but may be added later in the event that
a signing certificate change caused undesirable behavior.

Bug: 73927694
Test: PkgInstallSignatureVerificationTest
Change-Id: I7453a2da00e740a55de45e7b144f308a9bc33772
(cherry picked from commit a1d0cf74f93bc6cdef054e73c9f09f44cc44d501)
ackageManagerService.java
ackageManagerServiceUtils.java
ce5f2b3e87b3fa296bc5f52ed2847c7f7201db04 02-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Use per user info for seinfo" into pi-dev
a6d6a5aa799b02682820e8be0f1210cf5d53c6df 31-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Adding LauncherApps apis for suspended packages" into pi-dev
19b41f34a5cb29c621848e352220017b46cf66f1 27-Mar-2018 Suprabh Shukla <suprabh@google.com> Adding LauncherApps apis for suspended packages

The suspending app can provide a Bundle of information to be used by the
launcher for handling suspended packages. Added APIs:
- getSuspendedPackageLauncherExtras(String, UserHandle): To retrieve
the launcher extras for the given package and user.
- Callback#onPackagesSuspended(String[], UserHandle, Bundle): A
callback that will be invoked with the package names and the launcher
extras whenever sent packages are suspended.

Test: atest com.android.server.pm.SuspendPackagesTest

Bug: 76119578
Change-Id: I505d134809639a57c3314f994af34d576d905e74
auncherAppsService.java
ackageManagerService.java
a48fb54d2566e44c74e753afbd954f9b2b15a5ee 30-Mar-2018 Todd Kennedy <toddke@google.com> Exit the loop at the right time

Change-Id: I53f4924ed9b33e466adbfd120f3c5f38e5d617ba
Fixes: 74820396
Test: Manual
ackageManagerService.java
7fc0f633bc11c9fd89eb4bd3581ea2e85eaa31c1 30-Mar-2018 Calin Juravle <calin@google.com> Fix BackgroundDexOptTest

Test: atest BackgroundDexOptServiceIntegrationTests
Bug: 76425903
Change-Id: I19b72b95ee19ebe1807e1ce108a39dec6196a097
ackageDexOptimizer.java
ex/ArtManagerService.java
27ccbb12a56fde73b4fa8aa8eb63eead1b6daeed 30-Mar-2018 Todd Kennedy <toddke@google.com> Use per user info for seinfo

The full seinfo context contains a piece that's per application
[eg. target sandbox] and a piece that's per user [eg. if the
application is 'instant' or 'full]. When we reconciled the data
directory for the application, we were only using the static
parts. We now add the user specific parts.

Change-Id: I38f7d6de8969f848976f092264a11b48c542048c
Fixes: 73310114
Test: start nytimes instant app -- adb shell cmd activity start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d https://www.nytimes.com/crosswords/game/mini
Test: install nytimes app -- long press on nytimes icon, select "install"
Test: run nytimes full app -- adb shell cmd activity start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d https://www.nytimes.com/crosswords/game/mini
Test: no crash
Test: atest -it CtsAppSecurityHostTestCases:EphemeralTest#testInstantAppUpgrade
ackageManagerService.java
01a0288ca1e38e82556ff65ad379b01179c2b7d1 30-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix fs-verity per fs-verity spec change" into pi-dev
27c003dcde7b718581b643a1817330ec983cfea4 30-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Revert "Install for all on replace"" into pi-dev
275ea423a3dc18fef235a18f15474ddde1a057ca 29-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Clean up codes holding mInstallLock in PackageParserCallback" into pi-dev
709bfc2cddf20bd75d700e7a85bb26ed7b8692ca 29-Mar-2018 Calin Juravle <calin@google.com> Merge "Add the compilation reason to the dexopt dumps" into pi-dev
540f7adf289585f63509107f629ec7b2de7866a3 29-Mar-2018 Jaekyun Seok <jaekyun@google.com> Clean up codes holding mInstallLock in PackageParserCallback

Bug: 77232370
Test: succeeded building and tested with taimen
Change-Id: Id588cffdcd63684abcb115532bed597d8ca10924
ackageManagerService.java
e71df98e507f4ef85fa2640bfa35e4995045b2e9 28-Mar-2018 Patrick Baumann <patb@google.com> Revert "Install for all on replace"

This reverts commit dccef33d901398b1f39a8fea4dd919d57c5643f2.

Reason for revert: Breaks ADB install disabled setting

Change-Id: Icad438c592eb8e3be2a321e41fd75f9d577b002f
(cherry picked from commit d7b6815d2ca97e06de1594bc91ad7433c3165fe1)
Fixes: 73948872
Bug: 64472557
ackageManagerService.java
4170ab233d068b9f8744aa2d0924059e0a8b7427 29-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix deadlock when ParallelPackageParserCallback is used" into pi-dev
c254de07364ba8adfc1383e8d8d0ae56a1c0f855 29-Mar-2018 Jaekyun Seok <jaekyun@google.com> Fix deadlock when ParallelPackageParserCallback is used

Bug: 77232370
Test: succeeded building and tested with taimen
Change-Id: I425686c65a3cee88c10fceb7b5d0b5d89e49fc70
ackageManagerService.java
ab49fc46e57436f3232337839570a477aabae52e 29-Mar-2018 Calin Juravle <calin@google.com> Add the compilation reason to the dexopt dumps

Knowing why we compiled a package will make some investigations easier.

Test: adb shell dumpsys package dexopt
Bug: 76425903
Change-Id: I67b5bc980d198340aa52affb24fb3ce7e3080d67
ackageDexOptimizer.java
e9b491bd374e8211310435a66952a890f38c1a5d 29-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Intent.ACTION_AIRPLANE_MODE_CHANGED should have a boolean extra." into pi-dev
dedfd8fec770b0c82bfee639a2832c8419aa757f 28-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Convert compilation reason and filter to int-enum before logging" into pi-dev
a21c304be59f84f7d49d1ae5c4b6a5dbf5a84219 28-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Grant CONTACT permissions to IMS package." into pi-dev
f3b9734464a850a10c6ee8cdc66773ac1aed951a 28-Mar-2018 yuemingw <yuemingw@google.com> Intent.ACTION_AIRPLANE_MODE_CHANGED should have a boolean extra.

Bug: 76468718
Test: run cts --module CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.DeviceOwnerTest#testAirplaneModeRestriction
Change-Id: Iec208f744b80e48e29f5a38ee88613e19f0d01b3
serRestrictionsUtils.java
b1adae546c85a136135ee20334c1db2035457c86 28-Mar-2018 Jiuyu Sun <jiuyu@google.com> Merge "Add grant and revoke default permissions to active LUI app." into pi-dev
f0edf03edaaf15a48295ce87baae93e1a7db0122 28-Mar-2018 Andreas Gampe <agampe@google.com> Merge "BgDexopt: Reschedule job on timeout" into pi-dev
6da7d879772ed75520ac925130b9111cae9e397e 28-Mar-2018 Andreas Gampe <agampe@google.com> BgDexopt: Reschedule job on timeout

When the background dexopt job times out, tell the scheduler to
reschedule it, as we have more work to do.

(cherry picked from commit c157be081ebe3b8aba360330fcdaa8b7eeb67024)

Bug: 76425903
Test: m
Test: manual
Merged-In: Ibbdb979bceb1ff0a25f8aed2b3cc26a7f30057e2
Change-Id: Ibbdb979bceb1ff0a25f8aed2b3cc26a7f30057e2
ackgroundDexOptService.java
4836f8b003fa8f13d97019a8d588d82b348eb14e 28-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Call mInstaller.idmap() without holding mPackages" into pi-dev
1c73370df4c6b8399a264923e1f370b64019fca3 28-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Sending MY_PACKAGE_SUSPENDED to suspended apps" into pi-dev
a86783b87d63c5824d379945286c7bf82cda9d94 21-Mar-2018 Calin Juravle <calin@google.com> Convert compilation reason and filter to int-enum before logging

Test: adb logcat -b events | grep sysui_multi_action
Bug: 73102540
Change-Id: I052df3d4e65ef16b43190c14a236421945c86e21
(cherry picked from commit c7a44be7b3faef307f47db479bd6b06846201cf9)
ackageManagerServiceCompilerMapping.java
ex/ArtManagerService.java
aa6e21281a740675804b03ce47915f143ca67ab5 27-Mar-2018 Narayan Kamath <narayan@google.com> Revert "Close print writers"

This reverts commit 390b242367cc17276d74d3a4af2f2bce2f4f7b57.

The reverted change closed the output PrintWriter too early
and led to truncated dumps.

Bug: 74423421
Change-Id: I62902f2aa20be460b6dec42e811b21bf953fcfe3
Test: manual
(cherry picked from commit 1af397c9f7b7d90d6235b72dcfe65a1f5441a09f)
ackageManagerService.java
4c49fbd08cac57a9058c9d6d1b354aa696a1639d 27-Mar-2018 Jaekyun Seok <jaekyun@google.com> Call mInstaller.idmap() without holding mPackages

It isn't expected to call mInstaller.idmap() with holding mPackages
after a system is booted.
So mInstaller.idmap() should be called without that.

Bug: 73263584
Test: succeeded building and tested with taimen
Change-Id: Ib7a7b650862438753a5eafe25e14fb01fbb0482c
ackageManagerService.java
14b3de1cd853ea58ce9043cc53e2714048263c3f 27-Mar-2018 Patrick Baumann <patb@google.com> Bind to DefaultContainerService early for AIA

This change attempts to bind to the default system service on
PackageInstallSession creation instead of waiting until the session is
committed. This potentially saves up to 200ms off of instant app launch
latency.

Change-Id: I6a27c6db3094ddbe2f633f118e4b30182f07647a
Fixes: 72661783
Test: manual - install succeeds and service connection happens on session open
ackageInstallerSession.java
ackageManagerService.java
b5a564a05645cd95ba9833b0fa804cd98f192c6b 27-Mar-2018 Victor Hsieh <victorhsieh@google.com> Downgrade OOB warning of priv app to warning

We can't enforce priv apps to uncompress .dex and .so just yet until all
priv apps from Play have done so.

Also fix the wrong default value.

Test: build
Bug: 76440172
Bug: 63920015
Change-Id: I98ab7272702c1693752f8e4ecb53e1b1eb5e1f35
ackageManagerService.java
ackageManagerServiceUtils.java
c6d9f7ce1d6d152c55431e9ea95302a954bc49b9 27-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "More flexible API enforcement policy." into pi-dev
e3299533b5f07480bf009d3acb42a63a19b7ebac 22-Feb-2018 Mathew Inwood <mathewi@google.com> More flexible API enforcement policy.

This CL adds the basics to set black, dark gray or light gray list
enforcement, rather than just black as before. It's not possible to
actually set the policy per-package yet.

PackageDexOptimizer still uses a single bit, for API checks on/off, rather
than the new enum. It assumes blacklist enforcement internally. This can
be improved in a follow up CL.

(cherry-picked from commit e52130ae4cf3b046b38a09fc7cc7712f5b7fb83d)

Test: m
Test: Boot device

BUG: 73337509
Change-Id: Ieb4bd9cc439c6a5b8fb9424d8902d8b46aec309f
Merged-In: Idd73c9938592c5c4d67cfb9efefdffed0dd5f262
ackageDexOptimizer.java
349e214dc20448c54ca0f906054f6c69678cb481 27-Mar-2018 Holly Jiuyu Sun <jiuyu@google.com> Add grant and revoke default permissions to active LUI app.

Grant the camera permission to the active LUI app since LUI uses QR scanner
to download profile.
Before it, revoke the previously granted permissions first.

Bug: 35068517
Test: test on phone
Change-Id: I2db9597eed423835b9499ef6000579b5ee5b2cb6
ackageManagerService.java
ermission/DefaultPermissionGrantPolicy.java
2fd43ba63ef336f9e0edc9c742b85507c46b3bc9 23-Mar-2018 Suprabh Shukla <suprabh@google.com> Sending MY_PACKAGE_SUSPENDED to suspended apps

Added new broadcast actions MY_PACKAGE_SUSPENDED and
MY_PACKAGE_UNSUSPENDED, which are sent to the package that is affected
by the suspend state change. A suspended package also receives a bundle
of app extras to pass more information. This makes it easier for
packages to deal with being suspended/unsuspended.

Also updated some existing documentation to make it clearer.

Test: atest com.android.server.pm.SuspendPackagesTest

Bug: 75036698
Change-Id: I772cf0c023669bc946e07ced4ebccfa74f6835b2
ackageManagerService.java
8eef782e32e608e48c80a314e2c55e1ba9a89018 26-Mar-2018 Svetoslav Ganov <svetoslavganov@google.com> Merge "Add missing null check" into pi-dev
3ff20e2257c3d7158289ff3252e53cd5dfef85f4 26-Mar-2018 Benjamin Franz <bfranz@google.com> Merge "Expose hidden API to check whether a given package is state protected" into pi-dev
d8308070ab2cadabb68da6f391612c50a395c3ea 24-Mar-2018 Svet Ganov <svetoslavganov@google.com> Add missing null check

Test: manual

Bug: 72442137

Change-Id: Id0dc9b7f624a9ee0061fc735ed0a2f2aefd8a954
ermission/PermissionManagerService.java
cccad1971e4f04db7c8db8b0a9d6afd95937fc5e 19-Mar-2018 Victor Hsieh <victorhsieh@google.com> Fix fs-verity per fs-verity spec change

- Reorder and adjust fields per fs-verity format change.
- Since header + tree is no longer full page size, pass the length with
shared memory (which is full pages).
- Fix offset and padding of patch extension.
- It is now required to issue the measure ioctl (via
assertFsverityRootHashMatches) right after fs-verity is enabled.

Test: adb install a new priv app, saw fs-verity log in dmesg. Read the
whole file successfully.
Bug: 30972906
Change-Id: I480ae2b5debaf76ef24dadf2d79d1903c7967f03
nstaller.java
ackageManagerService.java
775e291c2e4a033ea8f721a1d7eb38391c5bf9ae 24-Mar-2018 Nathan Harold <nharold@google.com> Merge changes from topic "data-service-grant-policy" into pi-dev

* changes:
Add Permissions Grant for TelephonyDataService
Add a Method to Revoke DefaultGrant Permissions
6a0fac4affb2801f49ed97cc3de6cd12d40785b4 23-Mar-2018 Amith Yamasani <yamasani@google.com> Handle null user in deletePackageLIF

Assume null is USER_ALL for checking suspending apps.

Bug: 76170601
Test: atest InstallSessionParamsUnitTest
Change-Id: Idf804dcdd7fe8c8fa02ea5eef524dc1ecd1ad6e1
ackageManagerService.java
4a94e42bedf49bf8ad3d9d97d9713e9b8c95da2a 23-Mar-2018 Ralph Nathan <ralphnathan@google.com> Merge "Permissions: Don't autogrant all permissions on Android Things" into pi-dev
bd111589cd5e3cb4e236a3cd84588d9b7f8039ea 21-Mar-2018 Ralph Nathan <ralphnathan@google.com> Permissions: Don't autogrant all permissions on Android Things

Currently, we're auto granting all requested permissions on Android
Things devices. This cl moves us away from that and allows OEMs to use
the default-permissions flow to explicitly decide which dangerous
permissions they want each app in the OEM partition to have.

Bug: 73007742
Test: manual test
Change-Id: I0c33933c414ccd7b6f766790f2f7ebfebb1ddc4f
ermission/DefaultPermissionGrantPolicy.java
2df6aa4178a70e967c690db53399fbd0a7bab8db 23-Mar-2018 Calin Juravle <calin@google.com> Merge "Add extra checks around the profile file descriptor." into pi-dev
76ad1a3c212d09a2c843c1d845c20a4ec5bfd6e4 20-Feb-2018 Nathan Harold <nharold@google.com> Add Permissions Grant for TelephonyDataService

The Telephony Data Service is a privileged service
that provides Data capabilities *to* Telephony. A
data service that provides IWLAN may also use WiFi
as an underlying connection that tunnels Telephony
data services over WiFi using IPsec. The carrier-
config-driven permissions model causes the
framework to bind to an appropriate Telephony Data
Service, for a given carrier, and that Data Service
is responsible for providing Cellular data. Thus,
The TelephonyDataService needs sufficient
permissions to access cellular info necessary for
performing signalling for IWLAN. This includes
Phone state information and location information
such as the current Wifi access points and the
current cell towers. In addition, a Telephony
Data Service may require access to IPsec if the
data service uses the Android API to establish
IPsec, which is optional today.

Bug: 66955045
Test: wip
Merged-In: Ibe4f7806a47e2a50999376ff0a5a07dc5b332953
Change-Id: Ibe4f7806a47e2a50999376ff0a5a07dc5b332953
ackageManagerService.java
ermission/DefaultPermissionGrantPolicy.java
d66b9f3d0ca8ffe378b75f694dc84fe6e9ca0386 15-Mar-2018 Nathan Harold <nharold@google.com> Add a Method to Revoke DefaultGrant Permissions

Runtime permissions grants for system-bound
services should be revoked when no longer needed.
This ensures that in cases where say, a package
is needed while a user is using a certain cellular
provider, that package will lose its privileges
if the user changes providers.

Bug: 66955045
Test: compilation (still WIP)
Change-Id: I8dc2dd719f3b4af83ebb2b2f4a128f267b26fd91
ermission/DefaultPermissionGrantPolicy.java
ermission/PermissionManagerService.java
6affc07065083468c5580b04d3572ef6acbb138c 22-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "APIs to suspend packages with SUSPEND_APPS permission" into pi-dev
021b57ab8df0927aa1f78a2f3bb01d5e70594b1a 09-Mar-2018 Suprabh Shukla <suprabh@google.com> APIs to suspend packages with SUSPEND_APPS permission

Changed the existing hidden api setPackagesSuspendedAsUser to a system
api setPackagesSuspended that can be called by apps with either
MANAGE_USERS or SUSPEND_APPS permission. Additionally, the suspending
app can now specify optional extra information meant to be used by the
suspended apps and the launcher to deal with this state.

The following other APIs are added:
- isPackageSuspended(): Apps can query whether they are in a suspended
state
- @SystemApi getPackageSuspendedAppExtras(String): Apps with permission
SUSPEND_APPS can get the appExtras passed to PM when suspending the
app.
- @SystemApi setPackageSuspendedAppExtras(String, PersistableBundle):
Apps with permission SUSPEND_APPS can update app extras for a
suspended package.
- getPackageSuspendedAppExtras(): Apps can call to get the appExtras
passed in to PM when they were suspended.

Test: Can be run via:
atest com.android.server.pm.PackageManagerSettingsTests
atest com.android.server.pm.PackageUserStateTest
atest com.android.server.pm.SuspendPackagesTest

Bug: 74336673
Change-Id: I3b9ed2c8478b34ee2e8986f5f5fddb2839d102e3
ackageManagerService.java
ackageManagerShellCommand.java
ackageSettingBase.java
ettings.java
82d55a2fd2b297862483b2698998b6ec4832136d 21-Mar-2018 Calin Juravle <calin@google.com> Add extra checks around the profile file descriptor.

Be prepared for RuntimeExceptions by catching Exception instead of
RemoteException. Also, make an explicit check that the profile fd is not
null and valid.

Test: gts ArtManagerHostTest
Bug: 76028139
Change-Id: Ic8927a69ad8904ddf7f62f0699ebea5aeb30bdac
(cherry picked from commit 06f74f86586313e769cf00d3dbe832c56b02023f)
ex/ArtManagerService.java
7cc9a817d4a0e2d0dc10f982b54f855351432a82 22-Mar-2018 Benjamin Franz <bfranz@google.com> Expose hidden API to check whether a given package is state protected

Bug: 75997475
Test: manual
Change-Id: I5e0da781af6d148aed2247175e8ee5d9f244ebe1
ackageManagerService.java
b2d754ce0fd5ea1f9d221042c0863723cc3a2d04 22-Mar-2018 Victor Hsieh <victorhsieh@google.com> Replace pm.dexopt.priv-apps with existing constant

It was missed before during the rename.

Test: build
Bug: 63920015
Change-Id: Icb20a328b3d8acedca06cf6a781443d5611bb43d
ackageManagerService.java
8e8b2d542a4180cfc02e3116e708f1468eb039e9 14-Mar-2018 Ye Wen <ywen@google.com> Fix default permission granting for system TextClassifier.

The original code calls TCS.getServiceComponentName to get the package
name of the configured system TextClassifier, which does not work before
user logs in. This fixes the problem by using the package name from the
configuration directly.

Test: Manually tested to confirm permissions were granted. Permission
section of the app info are gray.

Bug: 74779259

Change-Id: I6bff7119e174c0e0b17d9736d69075f6df2bc882
ermission/DefaultPermissionGrantPolicy.java
94c2b750e23a380225b9c57abcf133d843bb995e 16-Mar-2018 Todd Kennedy <toddke@google.com> Set application info flags prior to scanning

In the case where an app is updated with a version greater
than what's on the /system partition, we still attempt to
scan the version on the /system partition to ensure we have
the most up-to-date information [since it may have been
changed during an OTA]. However, we mistakenly did not
apply any package policy prior to scanning. This left
package data only partially set [eg. the application info
object in the package was missing the fact that it was a
system package] and prevented us from scanning the package
correctly.

Scanning _should_ be completely self contained. The two
scan methods should be merged and made static. Any writing
or changing of service structures [eg. commiting the
scanned package settings or creating a shared user setting]
should be handled outside of the scan method, in the add()
method.

Change-Id: I8d5404a4f0f074ee02d26449c0b01e7a3c949334
Fixes: 62980149
Test: flash O MR1
Test: install latest chrome pkg [version > than what's on P]
Test: flash P
Test: see that the disabled version of chrome still has its ABI set
(cherry picked from commit fcd5279c9e43c169e52768f1be8bc2e391b027ac)
ackageManagerService.java
bef1457d49d01f383c2a556cd47c83d5a59b20b5 15-Mar-2018 Todd Kennedy <toddke@google.com> Merge "Fix instant app filter" into pi-dev
31c3c1dec6f27afd7bbd62626cce9ed5fac7d566 14-Mar-2018 Todd Kennedy <toddke@google.com> Fix instant app filter

There were two bugs in the filtration:
1) An instant app could query for activity info in another
instant app
2) An instant app could query for activity info from a full
app if the activity was implicitly exposed by having
a VIEW/BROWSABLE intent filter

Fixes: 74986543
Test: atest -it CtsAppSecurityHostTestCases:EphemeralTest#testActivityInfo
Change-Id: I89b2fb661b13b8e8a8abc6f980d9c56eb4d692b7
(cherry picked from commit 9c72a974224a931f093cdba59abc8627570b3aeb)
ackageManagerService.java
d766e212c9982fe18b592b4deee3ad523cc0134c 15-Mar-2018 Michal Karpinski <mkarpinski@google.com> Merge "Allow restoring of apps that rotated key" into pi-dev
662504f941e621e9f871915485cf077aad27628d 14-Mar-2018 Todd Kennedy <toddke@google.com> Enable local search for instant apps

When getting the set of searchable activities, fetch instant
applications. But, this means that the set needs a final
filter to prevent leaking application existence.

Change-Id: I6b9daf031ce54061c4500d9edae1d738848158c4
Fixes: 68211791
Test: atest -it CtsAppSecurityHostTestCases:EphemeralTest#testGetSearchableInfo
(cherry picked from commit 8b9d664cae1681c6107bd6caf807e786f96190ca)
ackageManagerService.java
528c3e572a829c51053532803ff31da123ebfed9 07-Feb-2018 Michal Karpinski <mkarpinski@google.com> Allow restoring of apps that rotated key

Restoring of apps that rotated key wouldn't be possible due to
explicit signature matching.
Amend signature matching strategies to take into account
apps that have rotated key.

Test: atest frameworks/base/services/tests/servicestests/src/
com/android/server/backup/utils/AppBackupUtilsTest.java
Test: atest frameworks/base/services/tests/servicestests/src/
com/android/server/pm/backup/BackupUtilsTest.java
Test: m -j RunFrameworksServicesRoboTests
Test: runtest -p com.android.server.backup frameworks-services
Test: atest frameworks/base/services/tests/servicestests/src/
com/android/server/pm/ShortcutManagerTest1.java
Test: atest frameworks/base/services/tests/servicestests/src/
com/android/server/pm/ShortcutManagerTest2.java
Test: atest frameworks/base/services/tests/servicestests/src/
com/android/server/pm/ShortcutManagerTest3.java
Test: atest frameworks/base/services/tests/servicestests/src/
com/android/server/pm/ShortcutManagerTest4.java
Test: atest frameworks/base/services/tests/servicestests/src/
com/android/server/pm/ShortcutManagerTest5.java
Test: atest frameworks/base/services/tests/servicestests/src/
com/android/server/pm/ShortcutManagerTest6.java
Test: atest frameworks/base/services/tests/servicestests/src/
com/android/server/pm/ShortcutManagerTest7.java
Test: atest frameworks/base/services/tests/servicestests/src/
com/android/server/pm/ShortcutManagerTest8.java
Test: atest frameworks/base/services/tests/servicestests/src/
com/android/server/pm/ShortcutManagerTest9.java
Test: atest frameworks/base/services/tests/servicestests/src/
com/android/server/pm/ShortcutManagerTest10.java
Test: atest CtsShortcutManagerTestCases
Bug: 64686581
Bug: 34345052
Bug: 74208476
Bug: 74159113

Change-Id: Ica23bbfec89648d9348c65db4597188e8c18e1d8
ackageManagerService.java
hortcutPackageInfo.java
hortcutService.java
0989e386fa077bfd673594384ab8a0300bcb477f 13-Mar-2018 Jiyong Park <jiyong@google.com> Allow apps in /odm/app and /odm/priv-app (2/2)

/odm is another vendor partition other than /vendor. So,
duplicating remaining code fragments about /vendor/[app|priv-app] for /odm.

Bug: 71366495
Test: m -j
Change-Id: Ic0db416a02e3fa9a8ae03348449f68062e3d73b3
Teet: cd frameworks/base/tests/OdmApps; atest .
ackageManagerService.java
ermission/DefaultPermissionGrantPolicy.java
d6d55744f2986c6eb2af7e7ab3a72a5983c517b3 12-Mar-2018 Mohamed Abdalkader <abdalkader@google.com> Grant CONTACT permissions to IMS package.

Needed for RCS User Discovery

Section 2.6 here
https://drive.google.com/file/d/0B4dRDALy0Y3HaEpWWTY5WEdQVlE/view


Bug: 73818766
Test: manually check if ims pakage is granted the permission.
Change-Id: I4c709cfc29236dd9c36826c0e0d04ec610ec2c8d
ermission/DefaultPermissionGrantPolicy.java
f85de9616f1ddba0a143b84c79368c4ddabcccb1 12-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow apps in /odm/app and /odm/priv-app" into pi-dev
090c6b1c94f75fb0d2193354ca453d528da0fa99 27-Dec-2017 Jiyong Park <jiyong@google.com> Allow apps in /odm/app and /odm/priv-app

/odm is a vendor partition other than /vendor. Both partitions are for
HW-specific modules such as HALs. The difference is that /odm is owned
by ODM (usually device manufacturer which designs the board), whereas
/vendor is owned by SoC manufacturer. In other words, /odm partition is
for board-specific customization to the /vendor partition.

Since apps can exist in /vendor/app and /vendor/priv-app, the same has
to be supported for /odm partition.

Bug: 71366495
Test: m -j
Teet: cd frameworks/base/tests/OdmApps; atest .
Change-Id: I1ec8b22b080efdefd67a45ce9c7aeaa2aef350e0
ackageManagerService.java
4471849dab0f1b3ada637c46373800041ef99028 10-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "PackageManager: Avoid null access" into pi-dev
9c1b415a20f7967ea6c541485d031a69f686d98d 09-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Check for null pkgList in fixSeInfoLocked()" into pi-dev
38d36e5396f259c8c835d6f0a92d9a04858f6076 06-Mar-2018 Andreas Gampe <agampe@google.com> PackageManager: Avoid null access

In case cache creation fails, mCacheDir may be null. Avoid an
access.

(cherry picked from commit 9f292ce7f241133c6411a89b5a7d97e93dc4b85d)

Bug: 74087079
Test: m
Test: boot under low-space condition
Merged-In: I55836c820ef2c3431e8f06224d6f9edf0e9881ef
Change-Id: I55836c820ef2c3431e8f06224d6f9edf0e9881ef
ackageManagerService.java
041b38479df336bcf92064b9853fcce1475ca76b 09-Mar-2018 Mathieu Chartier <mathieuc@google.com> Merge changes from topic "cdex_commands" into pi-dev

* changes:
Clean up comment
Bump version for OtaDexoptService
Add logic for passing down CompactDex generation flag
54807bb15b1a853ce09bf2ffce4f84f36cc37245 08-Mar-2018 Jeff Vander Stoep <jeffv@google.com> Check for null pkgList in fixSeInfoLocked()

Addresses:
03-08 17:26:18.550 11945 11945 E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: main
03-08 17:26:18.550 11945 11945 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference
03-08 17:26:18.550 11945 11945 E AndroidRuntime: at com.android.server.pm.SharedUserSetting.fixSeInfoLocked(SharedUserSetting.java:129)

Which is triggered during an "adb sync"

Fixes: 74214574
Test: m -j && adb shell stop && adb remount && adb sync && adb shell start
Change-Id: I1908893fae05c70491f7cc776d0df49ec54f283b
(cherry picked from commit acfdfbec2a6a4557fbde96dc2dfb8b4af51a3f63)
haredUserSetting.java
a6d43e429536c964a5f005f7be2a0d67ff5d2a5e 08-Mar-2018 Mathieu Chartier <mathieuc@google.com> Clean up comment

Bug: 63756964
Bug: 74245837
Test: untested

(cherry picked from commit 28c4c9b04a0de99b4994707a499c3fe46c7a9ccd)

Merged-In: I47a0fbab7da9cd87ec9e7dc03b2bc00e5668eae3
Change-Id: Id126490847c2601bb1584c43147acc89dc8baeff
ackageDexOptimizer.java
3cd2723a0fa792cd0f37b5a01b20d990e552d147 07-Mar-2018 Mathieu Chartier <mathieuc@google.com> Bump version for OtaDexoptService

Bug: 63756964
Bug: 74245837
Test: manual

(cherry picked from commit cbe92f735fb6b2cf569e815a97258e5f0c386e59)

Merged-In: I750e38a02710347a03783b820816eda6958ba0c6
Change-Id: I7658114b90232aa885438d69d396fcbd5f5c56d0
taDexoptService.java
fa3e976b8e74811f6efc1bcac351e32fe4a9852a 07-Mar-2018 Mathieu Chartier <mathieuc@google.com> Add logic for passing down CompactDex generation flag

In the cases where we are not install, boot, or first boot, pass down
the flag to generate CompactDex.

Bug: 63756964
Bug: 74245837
Test: manual

(cherry picked from commit f890c3ea5c62fc44aa84fbd011be249accbaff08)

Merged-In: I4a2ff9383251e67b260cff5ec8a326c7a4f7faca
Change-Id: I857ba57d0821442b2d39e19b0102e62ab5f76f0c
nstaller.java
ackageDexOptimizer.java
b1464cd4f8e18d361230d10d02f50f7c74a272d1 08-Mar-2018 Jeffrey Vander Stoep <jeffv@google.com> Merge "pm: Modify getPackage() to only return non-null packages" into pi-dev
cab3639dcb609b70012744029508f7b19e09c24d 07-Mar-2018 Jeff Vander Stoep <jeffv@google.com> Revert "Revert "pm: SharedUserId: Assign seinfo using actual targetSdkVersion""

Commit 042f4bb6 'pm: Modify getPackage() to only return non-null
packages' prevents the NullPointerException. b/
This reverts commit 00b4fa8b138de801b0caf371a950fcda7b98bb83.

Bug: 74214574
Bug: 72290969
Test: Same tests run on original commit.
Test: successfully flash and boot from bild 4504078 to ToT master.
Change-Id: Ia1e900ebe0eb8f9d10fd0eddbf658f52e1ea79b4
(cherry picked from commit 32ef1c2eb0fe32d8fd02a44bc77b40ab7719c433)
ackageManagerService.java
ELinuxMMAC.java
haredUserSetting.java
0a4c63f958d133f15398900a26668d1e2661f783 06-Mar-2018 Jeff Vander Stoep <jeffv@google.com> pm: Modify getPackage() to only return non-null packages

Bug: 74214574
Test: successfully flash and boot from build 4504078 to ToT master
Change-Id: I458db34a441dabed3cad7bd8fc9769bad49b3b30
(cherry picked from commit b6c042f4bb65cf322151e50a3090e4b1f6304b2a)
haredUserSetting.java
1d13eaea8380a43a31b12804f26d888f829feedf 30-Jan-2018 yuemingw <yuemingw@google.com> Block adb from changing certain settings value when corresponding user
restriction is on.

Check calling uid in isSettingRestrictedForUser(which is called by settingsprovider),
and only allow system_uid when certain user restriction is on, so that user won't be
able to change these settings with adb:
Settings.Secure.LOCATION_MODE,
Settings.Secure.PROVIDERS_ALLOWED,
Settings.System.SCREEN_BRIGHTNESS,
Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_OFF_TIMEOUT,
Settings.Global.AUTO_TIME,
Settings.Global.AUTO_TIME_ZONE.
This check also prevents 3rd party apps from modifying system settings value
when corresponding user restriction is on.
In addition, any attempt to change AUTO_TIME will also go through the check
for dpm.getAutoTimeRequired().

Test: manually by running the adb command with restriction set and not set
Bug: 72549013
Bug: 72548203
Bug: 72548533
Bug: 72686466
Bug: 72687105
Bug: 72940551
Bug: 72940562
Change-Id: I1d1fd20d9fa0f76f27905d62873f6a6e9af0224e
serManagerService.java
serRestrictionsUtils.java
9015d243328e68de6e084f1ba30a0582b665559b 06-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Using UserManagerInternal for access control instead of UserManager" into pi-dev
c0f025b253d3caf73f03c20f7170e553880325b8 06-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Adds instant app visibility to instumentation" into pi-dev
ea18c501d4a4ec05e44fac264ea28bce9dc4763a 05-Mar-2018 Patrick Baumann <patb@google.com> Adds instant app visibility to instumentation

This change grants visibility to instant apps of instrumentation
components that are targetting their package name. This allows
instrumentation tests to run just as installed apps do.

Change-Id: I3786390986cf9a65472da888257833f5b294a937
Fixes: 73078297
Test: manual - connected test passes as instant app
Test: atest EphemeralTest passes
ackageManagerService.java
85d1b5c414f094dae92a33b8c709be76aefe4f17 06-Mar-2018 Jeffrey Vander Stoep <jeffv@google.com> Revert "pm: SharedUserId: Assign seinfo using actual targetSdkVersion"

This reverts commit 8196fd9380a8efe2d7fed0652b9e3b5285b02b61.

Reason for revert: b/74214574

Bug: 74214574
Change-Id: I9602872238ccc8a49d8b200e5389995d597f1c3a
(cherry picked from commit 00b4fa8b138de801b0caf371a950fcda7b98bb83)
ackageManagerService.java
ELinuxMMAC.java
haredUserSetting.java
14c716c911dea7eeb28a0040d7807d6ea83464a9 05-Mar-2018 Amith Yamasani <yamasani@google.com> Revert "Allow restoring of apps that rotated key"

This reverts commit 313d225cd19885979596cf690103a8d77e19c3dc.

Reason for revert: b/74159113

Change-Id: I483ecdd80d26fca8451cd270b4fcbe34379839cb
ackageManagerService.java
hortcutPackageInfo.java
hortcutService.java
145c8f80a9ab62800179af03b3272a52c188c61d 15-Feb-2018 Sunny Goyal <sunnygoyal@google.com> Using UserManagerInternal for access control instead of UserManager

Bug: 36067387
Test: for C in {1..10}; do adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest$C \
-w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner; done
atest CtsDevicePolicyManagerTestCases:LauncherAppsSingleUserTest \
CtsDevicePolicyManagerTestCases:LauncherAppsProfileTest \
CtsDevicePolicyManagerTestCases:LauncherAppsMultiUserTest
atest CtsShortcutManagerTestCases
Change-Id: Ia4ddea58f66861ef760865b6d8831563584f85c9
auncherAppsService.java
hortcutService.java
serManagerService.java
57d9eee7d5313e73b0db1fe532ffe31d46354afb 02-Mar-2018 Patrick Baumann <patb@google.com> Removes unnecessary and incorrect instant app installer overrides

This change removes priority overrides made when an intersplit
resolve is being made. It also removes unnecessary overrides
that are already set on the mInstantAppInstallerInfo default
ResolveInfo.

Change-Id: Ifbd7eda2f7df2fb3927447e8e9b8c91f992efe26
Fixes: 72408536
Test: manual - ensured intersplit launches work as expected
Test: atest EphemeralTest passes
ackageManagerService.java
15881d7c0c1ba2640b0571f6170b8d8be94573d8 02-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "pm: SharedUserId: Assign seinfo using actual targetSdkVersion"
f6876df3282ea96873bf9cabf56f6ba4374e2e92 02-Mar-2018 Calin Juravle <calin@google.com> Merge "Ensure the profile descriptor gets closed after posting the result"
2b3c1350002a6ffaf4ca05f82fe1f9556388eae2 02-Mar-2018 Calin Juravle <calin@google.com> Ensure the profile descriptor gets closed after posting the result

We need to close the descriptor after posting the result on the
handler, otherwise we might risk sending in a close descriptor.

Bug: 73505439
Test: gts ArtManagerHostTest
Change-Id: I469683e323940ac88ea9e8c16e3df7a526ca77b3
ex/ArtManagerService.java
656a2a0d49b520fd618839c5760862ee3571c354 01-Mar-2018 Philip P. Moltmann <moltmann@google.com> Read install session attrs before child elements

As otherwise the ATTR_INSTALL_REASON attribute would be read from the
TAG_GRANTED_RUNTIME_PERMISSION element.

Test: Restarted right after SUW was done and saw apps getting restored
after reboot.
Change-Id: I53f37d8fee54b3cc2a000971d7244fa47f3509f2
Fixes: 70826795
ackageInstallerSession.java
c42546ed8a7db56a37a1e4bc673707a4a617dbcc 02-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Attempts to optimistically bind to AIA resolver"
9c4aa5c715604509e0f8f544af2983260f26b161 28-Feb-2018 Patrick Baumann <patb@google.com> Attempts to optimistically bind to AIA resolver

To avoid the first resolve of an Instant App needing to bind to the
Instant App resolver during resolution, we attempt to bind soon after
device boot and subsequently whenever the resolver connection dies (such
as on app kill on upgrade).

Bug: 73771940
Test: manual - attempt resolve soon after boot and observe successful resolve
Test: manual - force-stop com.google.android.gms and observe rebind
Change-Id: Iba13cafd98e3477b1b1fe0288ea83f90dd399aba
nstantAppResolverConnection.java
ackageManagerService.java
701194a72f2d9c22221c5139c4c821729e606779 01-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "lowRamDevice TVs can have multi-user"
18bc79f332d254c89f72305105de458561db94cc 01-Mar-2018 Makoto Onuki <omakoto@google.com> Merge "Fix "app doesn't support backup and restore" bug"
8196fd9380a8efe2d7fed0652b9e3b5285b02b61 22-Feb-2018 Jeff Vander Stoep <jeffv@google.com> pm: SharedUserId: Assign seinfo using actual targetSdkVersion

Assign the targetSdkVersion component of SeInfo using the lowest
targetSdkVersion of all apps within a SharedUserId.

Bug: 72290969
Test: cts-tradefed run cts -m CtsAppSecurityHostTestCases
Test: cts-tradefed run cts -m CtsSelinuxTargetSdk{current,25,27}TestCases
Test: install sharedUserId app with targetSdkVersion=28, then install
app with targetSdkVersion=26. Verify that they share the same domain
and data is correctly labeled.
Change-Id: I9476d10bf3c6a769d63a45a4314aaa91203880b8
ackageManagerService.java
ELinuxMMAC.java
haredUserSetting.java
e3fffa9615286cb88a62b49ac5babaeff8b732db 01-Mar-2018 Makoto Onuki <omakoto@google.com> Fix "app doesn't support backup and restore" bug

Always make sure to scan all packages before back up. There was a case
where SPI.updateFromPackageInfo() wasn't called before backup.

Fix: 72638013
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Test: atest CtsShortcutHostTestCases
Change-Id: I7fd39a62924a2d3724dfbd759ed157933af3f357
hortcutLauncher.java
hortcutPackage.java
hortcutPackageInfo.java
hortcutService.java
hortcutUser.java
5acddc1529cae6bf325ef55cc30d02e88b2e6318 28-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Ignores resolution if installer is disabled"
1e2b7318ba852c50554f3acd927b3bea0cdff445 28-Feb-2018 Alex Chau <alexchau@google.com> Use putIntForUser to turn off ambient display secure settings

- Without forUser we'll be turning off ambient display in primary user instead

Test: Use TestDPC to set DISALLOW_AMBIENT_DISPLAY in secondary users, ambient display is actually turned off
Bug: 72487689
Change-Id: I11a7a5304fcc609ab37594ad5d28814c217bc7f5
serRestrictionsUtils.java
961f409d377e25dba091b065d36190deb56eb84d 28-Feb-2018 Michal Karpinski <mkarpinski@google.com> Merge "Allow restoring of apps that rotated key"
c1674270b588f07ae000237708aabd6871d839a5 21-Feb-2018 Winson Chung <winsonc@google.com> 1/ Fixing docked task animation when entering split screen from home

- Update the minimized state when docking an app from home to ensure that
the animation of the docked task goes to the right bounds
- Temporarily block the invocation of the old recents activity when showing
recents as a part of setting the windowing mode of another task (this is
fine right now because quickstep only allows docking via the UI and not
from the nav bar while another task is open).
- Add proto field so we can determine whether to check the recents activity
from the split screen CTS tests
- Also fix issue with invisible docked task due to wrong bounds calculated
due to launcher not notifying the divider of the first docked frame

Bug: 73118672
Test: go/wm-smoke
Test: atest CtsActivityManagerDeviceTestCases:ActivityManagerSplitScreenTests
Test: atest CtsActivityManagerDeviceTestCases:ActivityManagerTransitionSelectionTests

Change-Id: Ib1208501c311de009a9e706103134865c521cb63
ackageManagerService.java
eb0483ecb5d28961576395d3e9fad5a33e17625f 28-Feb-2018 Patrick Baumann <patb@google.com> Ignores resolution if installer is disabled

This change adds a check to ensure that the instant app installer is
enabled for the resolving user before adding it to resolve infos. This
ensures that the installer isn't launched for a user that has explicitly
disabled it, such as within a work profile or secondary user.

Bug: 73035688
Test: atest EphemeralTest
Test: manual launch AIA link with installer disabled -> no crash
Change-Id: I563747410ff8b51c82f0dbcbe009f15d9625714c
ackageManagerService.java
162ff7bd783b8dfcea4636a9b675d87314d5bf1d 27-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "BackgroundDexOptService: skip low battery check if not present"
313d225cd19885979596cf690103a8d77e19c3dc 07-Feb-2018 Michal Karpinski <mkarpinski@google.com> Allow restoring of apps that rotated key

Restoring of apps that rotated key wouldn't be possible due to
explicit signature matching.
Amend signature matching strategies to take into account
apps that have rotated key.

Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/backup/utils/AppBackupUtilsTest.java
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/pm/backup/BackupUtilsTest.java
Test: m -j RunFrameworksServicesRoboTests
Test: runtest -p com.android.server.backup frameworks-services
Bug: 64686581
Bug: 34345052
Change-Id: I91b5ae0afb6f2714ceae02b4d4dc202d6cd4fe4e
ackageManagerService.java
hortcutPackageInfo.java
hortcutService.java
348bf6254f052e2aa09e421ac999e6f945bc04a0 24-Feb-2018 Yueming Wang <yuemingw@google.com> Revert "Block adb from changing certain settings value when corresponding user"

This reverts commit 4140f6c4e3de454dfbcf060112517408ac69e96c.

Reason for revert: This CL is merged accidentally as it got merged together with another CL.

Change-Id: I043a5872f370775a4261a1ca7ccb00489a588303
serManagerService.java
serRestrictionsUtils.java
1cd7cc85651b4b34314e6ab53765a1eecde0f7c0 21-Feb-2018 Todd Poynor <toddpoynor@google.com> BackgroundDexOptService: skip low battery check if not present

If no battery is present, assume no need to check for low battery.

Do not interpret battery level values if battery is not present.

Bug: 34507420
Test: manual (temporary log messages with battery forced not present)
Change-Id: Iebc64bc890808d583d0bd95a31f17b6363b7ba40
ackgroundDexOptService.java
aa360efee01403f6d10dae9b25d66d1611606a49 23-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes from topic "wipedata"

* changes:
Rename WipeDataWithReason API to wipeData.
Block adb from changing certain settings value when corresponding user restriction is on.
83c79317cc8e000fabc5ce82961a2b5e6f3b0ab3 09-Feb-2018 Robin Lee <rgl@google.com> lowRamDevice TVs can have multi-user

Svelte phones in single-user mode don't pose any problems. TVs in many
regions need multi-user in order to support a restricted profile mode.

Adds a special case for devices with UI_MODE_TYPE_TELEVISION to be able
to enable multi-user (ie. max_users will not be ignored in low_ram cases
as it is on other form factors).

Bug: 71626497
Bug: 67965409
Test: runtest -x frameworks/base/services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java
Change-Id: I6d18b9dca472b9d971d9e51a9d0f4be7403bc26a
serManagerService.java
4140f6c4e3de454dfbcf060112517408ac69e96c 30-Jan-2018 yuemingw <yuemingw@google.com> Block adb from changing certain settings value when corresponding user
restriction is on.

Check calling uid in isSettingRestrictedForUser(which is called by settingsprovider),
and only allow system_uid when certain user restriction is on, so that user won't be
able to change these settings with adb:
Settings.Secure.LOCATION_MODE,
Settings.Secure.PROVIDERS_ALLOWED,
Settings.System.SCREEN_BRIGHTNESS,
Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_OFF_TIMEOUT,
Settings.Global.AUTO_TIME,
Settings.Global.AUTO_TIME_ZONE.
This check also prevents 3rd party apps from modifying system settings value
when corresponding user restriction is on.
In addition, any attempt to change AUTO_TIME will also go through the check
for dpm.getAutoTimeRequired().

Test: manually by running the adb command with restriction set and not set
Bug: 72549013
Bug: 72548203
Bug: 72548533
Bug: 72686466
Bug: 72687105
Bug: 72940551
Bug: 72940562


Change-Id: Idfe0f1758d57958b836207ab3d55b2a292e1ae0d
serManagerService.java
serRestrictionsUtils.java
759fbda51ba6f9d0294ba8c459f73a4370567485 20-Feb-2018 Calin Juravle <calin@google.com> Revert "Revert "Log the apk optimization state in the MetricsLogger""

This reverts commit 203a9ab7665787c94f7d0711a1ad172588070aa6.

Reason for revert: Fix the original issue. There was a race with the
cleanup method which was resetting the app record to null.

Test: manual, adb logcat -b events | grep sysui_multi_action
repeat steps from bugreport reporting the crash
Bug: 73102540

Change-Id: I6d9c6110a9d5dadeb9d4361592711d63563c958a
ex/ArtManagerService.java
7d0fa81bae0d9d8595bb00dcbbd82df54c865c9f 21-Feb-2018 Makoto Onuki <omakoto@google.com> Implement UNLIMITED_SHORTCUTS_API_CALLS permission.

Bug: 73083596

Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Test: atest CtsShortcutManagerTestCases
Change-Id: I2283d105af166acc1a5b34921dd7a9cb50ef2e71
hortcutPackage.java
hortcutService.java
2ebb02123122d6ef3b0cf5c115c2ea4e19319496 21-Feb-2018 Makoto Onuki <omakoto@google.com> Merge "Shortcut permissions for default text classifier"
81945916f14cb47607b15cb1bfc48b98adbee789 21-Feb-2018 Narayan Kamath <narayan@google.com> Merge "Remove uses of libcore.util.Objects.hashCode / equals."
39fadb122c7f2ef46b198ec951971a6f5718dd1e 20-Feb-2018 Mathieu Chartier <mathieuc@google.com> Merge "Pass DEXOPT_INSTALL_WITH_DEX_METADATA_FILE for first boot" am: 0ea144f4bf am: 8deca3f06f
am: 50450452cf

Change-Id: I83f4b209123177012e73bbb9b4ea71bc30365e48
50450452cfc4240ac3728d4dbdd756f6403b6995 20-Feb-2018 Mathieu Chartier <mathieuc@google.com> Merge "Pass DEXOPT_INSTALL_WITH_DEX_METADATA_FILE for first boot" am: 0ea144f4bf
am: 8deca3f06f

Change-Id: Idefc228d35212f4014e9bb204e54b58c904ee94c
700feef8a60e06784d28d1db9502e650df854cad 15-Feb-2018 Makoto Onuki <omakoto@google.com> Shortcut permissions for default text classifier

- Add two shortcut related permissions as SystemAPI for the default
text classifier.

- The default text classifier package name still comes from the
system resource.

Bug: 73083596
Bug: 71555985
Test: atest CtsPermission2TestCases
Test: Manual test with a test package, with the following in config.xml
<string name="config_defaultTextClassifierPackage" translatable="false">com.example.android.pm.shortcutlauncherdemo</string>

Change-Id: I19081d9d6ba0b33eb25d19aa55b4fe2f26a75897
ackageManagerService.java
ermission/BasePermission.java
ermission/PermissionManagerService.java
28ff9ceeeb2aa9f864a0f73e6d3557125042c22a 20-Feb-2018 Narayan Kamath <narayan@google.com> Merge "Revert "Log the apk optimization state in the MetricsLogger""
203a9ab7665787c94f7d0711a1ad172588070aa6 20-Feb-2018 Narayan Kamath <narayan@google.com> Revert "Log the apk optimization state in the MetricsLogger"

This reverts commit 0a8bea818c330d02161322901534992253a2f9ee.


E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: ActivityManager
E AndroidRuntime: java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.android.server.am.ProcessRecord.requiredAbi' on a null object reference
E AndroidRuntime: at com.android.server.am.ActivityMetricsLogger.logAppTransition(ActivityMetricsLogger.java:504)
E AndroidRuntime: at com.android.server.am.ActivityMetricsLogger.access$100(ActivityMetricsLogger.java:62)

Bug: 73626352
Change-Id: Idd50e0d2cf34e5393b4ae76ef8bc48b0067532eb
ex/ArtManagerService.java
6e24ac89485ffc6e05d88850a9f19429ddb35609 19-Feb-2018 Calin Juravle <calin@google.com> Merge "Log the apk optimization state in the MetricsLogger"
607223f3b7a1c4dc3ac995f742f8d2da50d85ffc 19-Feb-2018 Narayan Kamath <narayan@google.com> Remove uses of libcore.util.Objects.hashCode / equals.

Use public API in java.util.Objects instead.

Test: make
Change-Id: I413280f254743a2efa2640a2194693aeb5980605
hortcutUser.java
serManagerService.java
ex/PackageDexUsage.java
42b74fc020d597c331ddf4467ab04e4247ce9840 17-Feb-2018 Calin Juravle <calin@google.com> Merge "Prepare app profiles only for upgrades and first boot"
2eb5b2ab3a8847119f62573ebf810a71e58feb58 17-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Grant default permissions to TextClassifier app."
0a8bea818c330d02161322901534992253a2f9ee 13-Feb-2018 Calin Juravle <calin@google.com> Log the apk optimization state in the MetricsLogger

Log the apk optimization state for app transition events. This will allow
precise measurement of the events based on the level of optimizations
performed.

Test: manual, adb logcat -b events | grep sysui_multi_action
Bug: 73102540
Change-Id: Ia8ccddff4ebe4120e05bb5d1dfb1cd458fa61e8a
ex/ArtManagerService.java
1d96275756cdc68788198e2026182adfc886b332 16-Feb-2018 Adrian Roos <roosa@google.com> Merge "OverlayManager: Add categories"
b7271e19820d11672b4a19eede81fb3d5c9a469e 16-Feb-2018 Todd Kennedy <toddke@google.com> Merge "Remove non-existent command from usage text"
26fd4ce67bed27688c7320b57078e89a9c22124d 14-Feb-2018 Calin Juravle <calin@google.com> Prepare app profiles only for upgrades and first boot

Test: manual, flash and check profiles for system apps
Bug: 72713758
Change-Id: I81327093e16b4fca3fbdbb2e0846c82eee4c7a68
ackageManagerService.java
2c01b6cabab52c6fe5e59f6112cbde77a2aa1a82 13-Feb-2018 Abodunrinwa Toki <toki@google.com> Grant default permissions to TextClassifier app.

Bug: 72746494
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Change-Id: I92ab3a7d3041c7db521c49c0090e6813691341bd
ermission/DefaultPermissionGrantPolicy.java
a7d4901db0942730bc742423a832e3a7a0f3c0aa 16-Feb-2018 Jeff Sharkey <jsharkey@google.com> Merge "Grant DCS storage access; better OBB errors."
e31b7c4d24ba53216793d66faf3a36acb81608fc 16-Feb-2018 Calin Juravle <calin@google.com> Merge "Pass the compilation reason to dexopt" am: b0817b238a
am: 68024999b7

Change-Id: I6a4e3dd19cf612bd698bff0f60de2ef3fac35604
cb581cb536f1cbfd8ba00b2c92f594173ddb0305 16-Feb-2018 Mathieu Chartier <mathieuc@google.com> Pass DEXOPT_INSTALL_WITH_DEX_METADATA_FILE for first boot

Motivation, use dm files in system partition for verifying if they
exist.

Bug: 70934104
Test: manual

Change-Id: I1224101eb830ce7c7bedb3a81b7569df1ef50491
ackageManagerService.java
5a0b4c4c625ba469c8358fdc3c9addc17d0011e1 15-Feb-2018 Calin Juravle <calin@google.com> Merge changes from topic "cp_calin_framework_2017" am: b98102b4dc
am: b3da44d9a1

Change-Id: Ibd848f6803d63da46ae1461b469422c5a6431980
b981617ec752df09e253e760244dd739c4d4cb26 12-Feb-2018 Calin Juravle <calin@google.com> Pass the compilation reason to dexopt

Record the compilation reason in the oat files to enable better
performance monitoring.

Test: DexoptOptionsTest
manual
Bug: 73102540

Change-Id: Ifa487d4bc33dcd06f12af6bdd1d9a9c5f4562f4b
nstaller.java
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
ex/DexManager.java
ex/DexoptOptions.java
aedf031b216615b9d7253a3092363f252dd7041f 15-Feb-2018 Calin Juravle <calin@google.com> Merge "Pass the compilation reason to dexopt"
67f07bee868661ff787029fbcc5d25d34ccc7429 16-Nov-2017 Mårten Kongstad <marten.kongstad@sony.com> Remove non-existent command from usage text

The package manager used to support the 'dump enabled-overlays' command.
It was removed in commit 560830c9f06 "Track both framework and app
overlays per package".

Remove mention of the removed command from the usage text; this should
have been part of 560830c9f06 but was overlooked.

Test: "adb exec-out cmd package dump -h | grep -c -e 'enabled-overlays'" should print 0
Change-Id: I82028025b7271b855a0e8849c61231d00134b93e
ackageManagerService.java
0095a82b14e22cb5283abf210d1e7f106f53aca5 15-Feb-2018 Jeff Sharkey <jsharkey@android.com> Grant DCS storage access; better OBB errors.

DCS had been relying on the WRITE_MEDIA_STORAGE permission to access
OBBs on external storage, but that permission has been locked down,
and we need to use the real WRITE_EXTERNAL_STORAGE permission now.

Rework the OBB error reporting flow to bubble exact error codes up
from internals, so that we can return expected CTS error codes.

Test: cts-tradefed run commandAndExit cts-dev -m CtsOsTestCases -t android.os.storage.cts.StorageManagerTest
Bug: 73424392
Change-Id: Iecbc4132745d56ebf081868ad2f9c3efe1e3735f
ackageManagerService.java
ermission/DefaultPermissionGrantPolicy.java
8d6427d3321fa0a2797a05846bcba2e7dbd17b79 15-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Expose getInstallerPackage to instant apps"
929a326a22c8b7f6863dd88b7f00ddcfa5df558b 15-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "[EBS] Don't disable location when DISALLOW_CONFIG_LOCATION is set"
acc50461bb7cec5012bb9c58acebeae9ad729232 14-Feb-2018 Makoto Onuki <omakoto@google.com> [EBS] Don't disable location when DISALLOW_CONFIG_LOCATION is set

If *any* user has DISALLOW_CONFIG_LOCATION set, don't disable location
on battery saver.

Test: Manual test with TestDPC
Test: atest $ANDROID_BUILD_TOP/cts/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverLocationTest.java

Bug: 73004763
Change-Id: Iea7ddf94703463f0f8f2a92a8e76845b986350c3
serManagerService.java
serRestrictionsUtils.java
cca0dc316cd67fba59721f2801d4329bc098e0fd 14-Feb-2018 Todd Kennedy <toddke@google.com> Expose getInstallerPackage to instant apps

Instant apps can now call this method and _may_ get a non-null
response. The return value could be null if the requested application
is not exposed to instant apps.

NOTE: It's possible for this to leak the installer package name. The
installer may not be exposed to instant applications and may be off
limits for other package manager query APIs.

Change-Id: Ib914bb9a946aad32b42dcbc0543d74007a28c76a
Fixes: 68277134
Test: atest CtsAppSecurityHostTestCases:EphemeralTest#testEphemeralGetInstaller01,testEphemeralGetInstaller02,testEphemeralGetInstaller03
ackageManagerService.java
4bc8f4daf3635b50e25a470c2e07e4d62b5e798f 12-Feb-2018 Calin Juravle <calin@google.com> Pass the compilation reason to dexopt

Record the compilation reason in the oat files to enable better
performance monitoring.

Test: DexoptOptionsTest
manual
Bug: 73102540

Change-Id: Ifa487d4bc33dcd06f12af6bdd1d9a9c5f4562f4b
nstaller.java
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
ex/DexManager.java
ex/DexoptOptions.java
29ec70b9011fbd6ead45e30e3c6067988c4453ed 01-Feb-2018 Calin Juravle <calin@google.com> Allow public profile compilation for primary apks

It is ok to perform a "public" compilation with
profiles comming from dex metdata files.

(cherry picked from commit ff3e4a1b2fb082e8146d00a41f702d0b00d9cab0)

Test: adb install foo.apk foo.dm
Bug: 30934496
Merged-In: I1d15e3281ccc61b19a2aafe3c885285a83ff6115
Change-Id: I1d15e3281ccc61b19a2aafe3c885285a83ff6115
ackageDexOptimizer.java
29c772cb4835794e02084043be7ca139c1fb2171 01-Feb-2018 Calin Juravle <calin@google.com> [framework] Pass .dm files to dexopt at install time

(cherry picked from commit cc65194e8e5a284e915176200a846ec75c037d95)

Test: DexoptOptionsTest
adb install foo.apk foo.dm
Bug: 30934496

Merged-In: If7e705a0efc0954a385ec3bfe7a93921c0d83351
Change-Id: If7e705a0efc0954a385ec3bfe7a93921c0d83351
nstaller.java
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ex/DexoptOptions.java
e4ad74e83491818baf8ce74f4081fa9c365a13cc 22-Jan-2018 Calin Juravle <calin@google.com> Extend the ArtManager profiling API to cover boot image profiling

The boot image profile is available only on userdebug and eng builds and
combines the boot classpath and system server classpath.

Also, update ArtManager API to use Executors instead of Handlers.

(cherry picked from commit fcbb74a4296fd808e1058ecebd91fac56582e799)

Test: gts GtsAndroidRuntimeManagerHostTestCases
Bug: 30934496
Merged-In: Ie501947a659d644acbde04fb46157dd0c7944e81
Change-Id: Ie501947a659d644acbde04fb46157dd0c7944e81
nstaller.java
ex/ArtManagerService.java
ea6c0ffb4a276210b6d971c87a15a7484446d3df 20-Jan-2018 Calin Juravle <calin@google.com> [framework] Extend profile operations to take the profile name

Extend the installd profile interface to take the profile name as
argument. This shifts the responsibility for choosing the names of
profiles for primary apks completely to PackageManager. Each of the
application code paths will get an unique profile name based on their
split name.

All the profile operations will now work on a specific profile name rather
than assuming a default global name.

Also, move dumpProfiles and clearProfiles functionality to the
ArtManagerService so that we can re-use profileName computations easier.

(cherry picked from commit 6ae39fc2e5b4692d092a042816939fd0a5f3e3b8)

Test: manual (dexopt apps, merge profiles, clear profiles)
gts GtsAndroidRuntimeManagerHostTestCases
Bug: 30934496

Merged-In: Ie65d45eed7de0844edf4b7af918d7eaa74ec1f2c
Change-Id: Ie65d45eed7de0844edf4b7af918d7eaa74ec1f2c
nstaller.java
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ex/ArtManagerService.java
362b591a1dc40f0422746887978c43689e1cfff4 24-Jan-2018 Calin Juravle <calin@google.com> Accept UserHandle.USER_ALL during profile preparation

(cherry picked from commit 5bbe26ee01bc9785487fe5e748e624b6fc5bd3a4)

Test: adb install foo.apk
Bug: 72453027
Merged-In: I840d70d47a256c8853bbe1b9b023f51bdd5ddf6b
Change-Id: I840d70d47a256c8853bbe1b9b023f51bdd5ddf6b
ackageManagerService.java
ex/ArtManagerService.java
b62a9045c2dc7f2b373a79e819e7064c88d24bf8 19-Jan-2018 Calin Juravle <calin@google.com> [framework] Prepare profile for app code paths

This CL is an intermediate step to enable the use of profiles shipped in
the dex metadata files.

The preparation consist of:
- creating the current profile
- merging the profile from the dex metadata file (if present) into the
reference profile

and happens:
- after the application data directory is created, to capture system
apps.
- post-install (right before we dexopt), to capture any new code paths

(cherry picked from commit 3621be71d0fe8a349ca468aca99a53a17f6575b3)

Test: manual (install apps and splits, take OTA)
Bug: 30934496

Merged-In: Id36474ab629ad3ffafd24381d30e3d88ac02d576
Change-Id: Id36474ab629ad3ffafd24381d30e3d88ac02d576
nstaller.java
ackageManagerService.java
ex/ArtManagerService.java
011603ab76f55e1d8b62296ac48704b8b032d8e7 12-Dec-2017 Calin Juravle <calin@google.com> Support installation of DexMetadata files (.dm)

Add support in the package installer to install dex metadata files
alongside the application apks (base or splits).

During installation or update the dex metadata files will need to have a
matching apk file. The matching is done by checking the file extension
(e.g. base.apk -> base.dm, split_a.apk -> split.dm).

On disk, the metadata files are placed next to the apks.

The .dm files will be used during install-time optimizations and passed
verbatim to dex2oat.

Test: adb shell am instrument -w \
1) adb shell am instrument -w \
-e class android.content.pm.DexMetadataHelperTest

com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner

2) adb install-multiple CtsClassloaderSplitApp.apk
CtsClassloaderSplitApp.dm CtsClassloaderSplitAppFeatureA.apk
CtsClassloaderSplitAppFeatureA.dm CtsClassloaderSplitAppFeatureB.apk

3) gts-tradefed -m GtsAndroidRuntimeManagerHostTestCases

(cherry picked from commit 3fc56c30000d9b88c2145d4297a97ec5061d60d1)

Bug: 30934496
Merged-In: I86f0a8307705ff3d6a5a85c2fcaae085dd62d4af
Change-Id: I86f0a8307705ff3d6a5a85c2fcaae085dd62d4af
ackageInstallerSession.java
ackageManagerService.java
ackageManagerShellCommand.java
b46b577dc1b5a0c60b8404b051bc89315fad3dba 05-Dec-2017 Calin Juravle <calin@google.com> Rename snapshotProfile to createProfileSnapshot for consistency

(cherry picked from commit 388cd5fffe7564ae364776d7f557e3a301387840)

Test: build
Bug: 30934496
Merged-In: I602262d22509b279383ff2a71e38c8bae059498a
Change-Id: I602262d22509b279383ff2a71e38c8bae059498a
nstaller.java
369fbd29838a98aed84bff16af415da574df9576 30-Nov-2017 Calin Juravle <calin@google.com> Implement ArtManager#snapshotProfile API

Complete the implementation of ArtManager#snapshotProfile. The snapshot is
performed by calling the installer and then return to the caller via the
specified callback.

(cherry picked from commit fd9f8ae973122a50f336e38c386ecbc0095d8adc)

Bug: 30934496
Test: gts-tradefed -m GtsAndroidRuntimeManagerHostTestCases
Merged-In: I87131487846d91d79a56041445420376b61ca8e7
Change-Id: I87131487846d91d79a56041445420376b61ca8e7
nstaller.java
ackageManagerService.java
ex/ArtManagerService.java
1d875ad3ae5bb27016f9650b5bf4c39c08b6570e 08-Nov-2017 Calin Juravle <calin@google.com> Add SystemApis to expose runtime profile information

The API allows a system apps which acquired
{@code android.permission.READ_RUNTIME_PROFILE} to snapshot the runtime
profiles of installed packages.

The API is implemented in a new service class (AndroidRuntimeManager)
accessible from the context using
context().getPackageManager().getAndroidRuntimeManager().

The main functionality is exposed as a one way call into the
AndroidRuntimeManager with the result being posted on a callback. The
profile is available to the caller as a read-only ParcelFileDescriptor.

This CL only adds the API interfaces and validation. It does not fully
implement the functionality.

oneway void snapshotRuntimeProfile(in String packageName,
in String codePath, in ISnapshotRuntimeProfileCallback callback)

(cherry picked from commit 45f8b29ce0ca9f80c586850c4be3a1e552bc6c2f)

Bug: 30934496
Test: gts-tradefed -m GtsAndroidRuntimeManagerHostTestCases

Merged-In: Iaa6be4715840f24508acba3162ea9c1ab725bd38
Change-Id: Iaa6be4715840f24508acba3162ea9c1ab725bd38
ackageManagerService.java
ex/ArtManagerService.java
1b37daa810c929938a642f56cb7aeb75c4f89766 16-Oct-2017 Alan Stokes <alanstokes@google.com> Log SHA256 of secondary dex files during reconcile.

(cherry picked from commit a0023604ddaeef34049f1a245be7c42a66a7d0e8)

Bug: 63927552
Test: Exercised manually. Added unit test for DexManager.

Merged-In: Ic8e9ea4da8eb5c22fbe088a59a406e36bc2eb6fa
Change-Id: Ic8e9ea4da8eb5c22fbe088a59a406e36bc2eb6fa
nstaller.java
ackageManagerService.java
ex/DexLogger.java
ex/DexManager.java
2c426bc3f462791dd74779948424ba4a49ac810c 14-Feb-2018 Nicolas Geoffray <ngeoffray@google.com> Merge "Refactor runtime hidden API flag from negative to positive" am: 46b4862d20
am: d0f327cc60

Change-Id: Iaa313ddff5b22ed22baa916d931befc7a59090ba
b3a4aab310098146e803c5abdc1886f44cb5bee3 13-Feb-2018 David Brazdil <dbrazdil@google.com> Refactor runtime hidden API flag from negative to positive

There are only two situations in which we want to enable hidden API
access flag checks. Turning the flag from DISABLE_ to ENABLE_
simplifies logic in ART and reduces the number places where the flag
had to be passed down to ART.

Bug: 64382372
Test: boot device, install and run apps, check log messages

(cherry picked from commit f7e31c0a2b69e97662e2bdeb7e5b5c6d0a7f995c)

Change-Id: Ib2f70696d98c6e1500d1d419d6acf0a8d0487213
nstaller.java
ackageDexOptimizer.java
145ecabda275e42c9176446240de4fed5c89b71b 14-Feb-2018 David Brazdil <dbrazdil@google.com> Merge "Refactor runtime hidden API flag from negative to positive"
c84df7755c4682d6ff3e47818846d2a2c384f9fb 19-Jan-2018 Adrian Roos <roosa@google.com> OverlayManager: Add categories

Adds the possibility to declare different categories
for resource overlays (e.g. themes, display cutout emulation, ...)

Bug: 72436677
Test: adb shell cmd overlay enable-exclusive --category com.android.internal.display_cutout_emulation android com.android.internal.display.cutout.emulation.narrow
Test: adb shell cmd overlay enable-exclusive --category com.android.internal.display_cutout_emulation android
Change-Id: I23f22113351b3948beb9e3a1fb969700852539cc
ettings.java
ee503da85d8c63924f1470baccb6e43c7313b5ae 13-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Close print writers"
e780433c1674c4d715891b89b905c8c8e5afcc79 13-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't write settings just for install status"
390b242367cc17276d74d3a4af2f2bce2f4f7b57 13-Feb-2018 Todd Kennedy <toddke@google.com> Close print writers

Test: Manual
Change-Id: I4fffa9163b3ad7b0f70e15c1adc65370b70df0d3
ackageManagerService.java
af6f195b15015f8ae5896aa777ff647dfe488114 13-Feb-2018 Todd Kennedy <toddke@google.com> Don't write settings just for install status

This is an obsolete concept and not necessary. Remove the install status
that's part of the package settings.

Change-Id: I20a567145e579c9588d4392d0ac26ef4b5bbe301
Fixes: 62229032
Test: atest FrameworksServicesTests:PackageManagerSettingsTests
ackageManagerService.java
ackageSettingBase.java
ettings.java
f7e31c0a2b69e97662e2bdeb7e5b5c6d0a7f995c 13-Feb-2018 David Brazdil <dbrazdil@google.com> Refactor runtime hidden API flag from negative to positive

There are only two situations in which we want to enable hidden API
access flag checks. Turning the flag from DISABLE_ to ENABLE_
simplifies logic in ART and reduces the number places where the flag
had to be passed down to ART.

Bug: 64382372
Test: boot device, install and run apps, check log messages
Change-Id: Ic5a531834360b614fc93d54221c7395579791184
nstaller.java
ackageDexOptimizer.java
a980e14014d49f324a74180a81532944a42cd7c7 12-Feb-2018 Patrick Baumann <patb@google.com> pm shell command to uninstall system updates

This change introduces a new package manager shell command that
will automatically uninstall any updated system apps, falling back
to the version that is prebaked into the system image.

Change-Id: Ic2952394baadeea6286e0a87343201e564ffdfb9
Fixes: 21088599
Test: manual - run before SUW and after; see updates uninstalled
ackageManagerShellCommand.java
d3905e654452c68390835e31fcb752884e57a67b 12-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix issue #72151749: Lock down 'clear cache' functionality to..."
c0927dd36d902ead4753994fe90234928b0e88e6 10-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Send package to permission check"
1982a10913c0fd3762b024a89166cb0307dfe062 10-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Honor INSTANT_APPS_ENABLED only for web intents"
1b794faeace9e992a33b2d8bbd9a56836c459135 09-Feb-2018 Dianne Hackborn <hackbod@google.com> Fix issue #72151749: Lock down 'clear cache' functionality to...

...only system signature

Apps that hold the original permission are silently ignored. There
is a new internal permission you must hold to actually delete cache
files.

Test: booted and run, can still clear cache in settings.
Bug: 72151749
Change-Id: I47a5cb697e1a4fa3665ac71aaabcda57bef7b561
ackageManagerService.java
e09bcb4b86dacdf89cba218bd075c5f4c4ffb5a5 08-Feb-2018 Patrick Baumann <patb@google.com> Honor INSTANT_APPS_ENABLED only for web intents

Bug: 65959668
Test: manual - toggle setting with test app and verify behavior
Test: atest EphemeralTest
Change-Id: I379a17027abd337610243c1f7c55e9ba733d03fe
ackageManagerService.java
74d0a7963eee2b57e02c5495ee5bcb02b33797aa 09-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't propagate unrequested permissions"
1a3216bbb9faaa8ddd402b80e173c55f784706d7 08-Feb-2018 Todd Kennedy <toddke@google.com> Don't propagate unrequested permissions

When an instant app is re-installed, we attempt to propagate the
previously accepted permissions. Instead of crashing the system_server,
we simply ignore the previously granted permission and forget that
the user ever granted it. If a second update to the instant app
re-requests the permission, the user will again have to accept or
deny.

Test: atest GtsPackageManagerHostTestCases:PackageManagerHostTest
Change-Id: I7bb9fb67159f6c4d4f4e2a24e7913d11713e826e
Fixes: 72698203
nstantAppRegistry.java
40279e54075e0f104ff484d094148f63b59e19cd 09-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes I6993325b,Icb5114fe

* changes:
Frameworks: Annotate trivial @GuardedBy in services/core
Frameworks: Annotate trivial @GuardedBy in core/java
e5844ce13be5996bf22507342874f092a7928b44 08-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Ignores protected broadcasts if not priv-app"
adc58a97a538628f07f7c5adefdc127ec4dca1cd 08-Feb-2018 Patrick Baumann <patb@google.com> Ignores protected broadcasts if not priv-app

Change-Id: I5bd2bf3bd7c38fd9cc563a02b24bc569495d79ed
Fixes: 65423991
Test: manual - system starts without issue
Test: manual - wrote test app to verify only priv-app protected-broadcast can block broadcasts of non-system apps
ackageManagerService.java
dccef33d901398b1f39a8fea4dd919d57c5643f2 07-Feb-2018 Patrick Baumann <patb@google.com> Install for all on replace

Prior to this change, installing for all users that results in a replace
will only install for currently installed users. This change ensures
that when USER_ALL is defined, that we properly update settings for all
users.

Change-Id: Ie2aae958d012e60e002aef84c90c5573bc06b158
Fixes: 64472557
Test: manual - adb install for single user, replace for all works
ackageManagerService.java
a36dc621ef0b86a0bd46f1d4f5a719a466ba1800 06-Feb-2018 Andreas Gampe <agampe@google.com> Frameworks: Annotate trivial @GuardedBy in services/core

Add @GuardedBy for simple functions that require a single lock
and are named XYZLocked.

Derived by errorprone.

Bug: 73000847
Test: m
Test: m javac-check-framework RUN_ERROR_PRONE=true
Change-Id: I6993325b11c71a4ec27c21935fb54a954d95455f
nstantAppResolverConnection.java
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
hortcutService.java
serManagerService.java
ermission/PermissionManagerService.java
ermission/PermissionSettings.java
a54e69a116d8a8581e178bae8c4f9ccecff46874 07-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Increase instant app privacy with dummy data"
4db6bc16d0cc3c3b60a6b5305118f266ab2028a8 06-Feb-2018 Patrick Baumann <patb@google.com> Increase instant app privacy with dummy data

This change adds some additional digest prefixes to instant app
resolution to make inverting the hash more difficult.

Change-Id: Ibf907495019338b5cac5dd22da275799e92f9b60
Fixes: 63445230
Test: manual - resolution still works with current production resolver
nstantAppResolver.java
999ea9fb7e7a80db52e9f701bc69ce9fc14d119d 06-Feb-2018 Vladislav Kuzkokov <vkuzkokov@google.com> Merge "Make printing policy a restriction."
0da8537cf610cff71a2ef9ae946a7d3cb4232de4 03-Feb-2018 Patrick Baumann <patb@google.com> Require only ACTION_VIEW for web instant apps

When generic intent resolution support was added to instant apps, it
added the requirement that web instant app resolution also require the
BROWSABLE category. This change relaxes that requirement.

Test: manual - sent intent without browsable and observed resolution
Change-Id: I7d4d891484f538b46d37f2c8e7c040b370b46b9e
Fixes: 72835413
nstantAppResolver.java
ackageManagerService.java
622b9f921278b308e9497675e63159f926764c91 25-Jan-2018 Vladislav Kuzkokov <vkuzkokov@google.com> Make printing policy a restriction.

Use existing API instead of creating new method.

Bug: 64140119
Test: cts-tradefed run cts-dev --module CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.MixedDeviceOwnerTest#testPrintingPolicy

Change-Id: I9ff94f4d73824e7bf9aedbb64811ad60fccf9779
serRestrictionsUtils.java
96d601bd105213c486ef0964b668f0ff48e60442 23-Jan-2018 Todd Kennedy <toddke@google.com> Revert "Add debug logs"

This reverts commit f996b76623f2b6e958e76d40d17b17f673ed30b5.

Change-Id: I855a61070411b2a1fa8f1add10998aaabcef43f6
Fixes: 72369036
Test: Manual; builds and runs
ackageManagerService.java
ackageSetting.java
3c71449d1a9147e5f32807e2c17a0369d7603c47 27-Oct-2017 Todd Kennedy <toddke@google.com> Send package to permission check

While splitting the permissions from the package manager service,
we adjusted the implementation of checkUidPermission() which queried
for package objects separately from obtaining the package names
belonging to a UID. This caused some subtle timing issue where the
package object sometimes failed to be present.

Instead, send the affected package while in a sycnhronized block
to avoid the timing issue.

Fixes: 68260103
Test: Manual
Change-Id: I0b0e124ffd12a31569a1ed0d8a6a7b82cf824d63
ackageManagerService.java
ermission/PermissionManagerInternal.java
ermission/PermissionManagerService.java
50af9180611fa40e1ab41157c3f2a32ea25dedea 05-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "PackageSignatures: Add close bracket for "past signatures" output."
86684240eb5753bb97c2cfc93d1d25fa1870f8f1 03-Feb-2018 Jeff Sharkey <jsharkey@android.com> Media process should run with "write" access.

The WRITE_MEDIA_STORAGE permission had inadvertently been giving apps
the "default" view of storage. This had worked for a long since,
since we also gave them the "sdcard_rw" permission, but a recent
security patch broke this for secondary users.

Apps holding this permission should have been mounted "write" all
along, and relied on that view to access storage devices. This also
means they no longer need the "sdcard_rw" GID.

Test: builds, boots, secondary user media/camera works
Bug: 72732906, 71737806, 72224817
Change-Id: I5cd687a1e128024f33b4acd93c15e75192ed1c85
ackageManagerService.java
bf5f48e16c105783eca89f1fcdbc74efce610503 02-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Keep the legacy ssaid for apps on SD card"
e55e7216471a2920d7723c259943562d495d8786 02-Feb-2018 Jeff Sharkey <jsharkey@google.com> Merge "Put PackageInstaller in the drivers seat."
ac98b13ecfaac53c732fcf02fbb7ab735fdde3da 02-Feb-2018 Makoto Onuki <omakoto@google.com> Merge "ShortcutService to use StatLogger."
be6c065d2c2ec960a266da88e6cd5bd33f15fde7 02-Feb-2018 Dan Cashman <dcashman@google.com> PackageSignatures: Add close bracket for "past signatures" output.

Test: dumpsys package shows ']', whereas it did not before.
Change-Id: I7575d78cda28f723ef5c2b1e37db21652318a6da
ackageSignatures.java
0451de6254eadafe371df9ba38e2af0f6191c09d 02-Feb-2018 Jeff Sharkey <jsharkey@android.com> Put PackageInstaller in the drivers seat.

openWrite() and openRead() are very flexible APIs, but their design
means they can't take advantage of the recent FileUtils.copy()
optimizations that leverage in-kernel copying.

So add new write() and read() methods where the untrusted caller
hands an FD into the OS, and then PackageInstaller drives the actual
copying process, allowing it to use FileUtils.copy() to speed
up the copying process. (Local benchmarks are showing a 24% speed
improvement.)

We still create a FileBridge to protect the session while an active
copy is happening.

Test: bit FrameworksCoreTests:android.os.FileUtilsTest
Test: vogar --mode app_process --benchmark frameworks/base/core/tests/benchmarks/src/android/os/FileUtilsBenchmark.java
Bug: 71932978, 25510838
Change-Id: Icc237b4c0f80d5d24b74a30f238b7fe505b856ce
ackageInstallerSession.java
ackageManagerShellCommand.java
f6ca8b0cb7e1b5650e8702cf0f694614b7265331 02-Feb-2018 Yueming Wang <yuemingw@google.com> Merge "Rename DISALLOW_CONFIG_LOCATION_MODE to DISALLOW_CONFIG_LOCATION."
ebe0e5f71672d1b01c5bac20b5e078dc8fa3ee0e 17-Jan-2018 Tetsutoki Shiozawa <tetsutoki.shiozawa@sony.com> Keep the legacy ssaid for apps on SD card

Symptom:
After O OS upgrade, LINE application on SD card got crash loop. The
encrypted data depended on the ssaid and it was changed by OS upgrade.

Root cause:
At the 1st boot-time of OS upgrade, StorageProvider migrates the legacy
ssaids.

At that moment, SD card is not mounted yet. The target of migration
depends on the list of PMS#getInstalledPackages() and the list doesn't
contain the apps on unmounted SD card.
As a result, the ssaids for the apps on SD card are not migrated.

Solution:
The target of ssaid migration respects the all known packages of PMS.
To achieve it, getInstalledPackages() with MATCH_UNINSTALLED_PACKAGES
is improved. Now, it can provide the information of package which has
an inaccessible package file.
Even though SD card is not mounted, the package list contains the apps
on SD card.

Bug: 72343790
Change-Id: If5d31e44cf7ec44da6010434515a157b00a5a09a
ackageManagerService.java
84d5934ca0097827cc2ab323b94596064080fd23 02-Feb-2018 Makoto Onuki <omakoto@google.com> ShortcutService to use StatLogger.

Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Test: build and boot.
Change-Id: I63bfea2a66c4d41d9098cde14831b7c58dbf5e95
hortcutPackage.java
hortcutService.java
7810b8b5a1deef711f2a3d83681bf8f23c349fd9 01-Feb-2018 yuemingw <yuemingw@google.com> Rename DISALLOW_CONFIG_LOCATION_MODE to DISALLOW_CONFIG_LOCATION.

Bug: 72732481
Test: CtsVerifier test already in
Change-Id: I6932d08b250546879a77bc11022987a0d44c3135
serRestrictionsUtils.java
ff3e4a1b2fb082e8146d00a41f702d0b00d9cab0 01-Feb-2018 Calin Juravle <calin@google.com> Allow public profile compilation for primary apks

It is ok to perform a "public" compilation with
profiles comming from dex metdata files.

Test: adb install foo.apk foo.dm
Bug: 30934496
Change-Id: I1d15e3281ccc61b19a2aafe3c885285a83ff6115
ackageDexOptimizer.java
cc65194e8e5a284e915176200a846ec75c037d95 01-Feb-2018 Calin Juravle <calin@google.com> [framework] Pass .dm files to dexopt at install time

Test: DexoptOptionsTest
adb install foo.apk foo.dm
Bug: 30934496

Change-Id: If7e705a0efc0954a385ec3bfe7a93921c0d83351
nstaller.java
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ex/DexoptOptions.java
bfbf02f8dded06e9e1970f6300148241f270b832 02-Feb-2018 Fyodor Kupolov <fkupolov@google.com> Merge "Do not call setQuietModeEnabled from the main thread"
850f29a169e771acd889bf78f0a9514aaaf3d309 01-Feb-2018 Jeff Sharkey <jsharkey@google.com> Merge changes Iac97c342,I52518d52

* changes:
Enable sendfile() and splice() optimizations.
Use sendfile() and splice() to speed up copying.
b18f899241231991e314c40990eb8e9f703732d4 01-Feb-2018 Jeff Sharkey <jsharkey@android.com> Use sendfile() and splice() to speed up copying.

There are several places across the OS where Java code is simply
copying data between two points, which requires bringing that data
out into userspace before going back into the kernel. (That's pretty
lame.) The patches for the recent Meltdown/Spectre security issues
have made this overhead even worse, so it's finally time to move this
copying directly into the kernel.

This change adds a couple new FileUtils.copy() methods which inspect
the given streams/FDs, and attempt to do as much optimization as
possible before falling back to a slower userspace-based copy.

Benchmarks are showing typical improvements of 44% for 32KB files,
50% for 32MB files, and 35% for 32MB pipes.

Plenty of tests are included, and there's a simple kill-switch that
can be used to enable/disable the feature if it starts causing any
trouble. (A future CL will enable the optimizations.)

Test: bit FrameworksCoreTests:android.os.FileUtilsTest
Test: vogar --mode app_process --benchmark frameworks/base/core/tests/benchmarks/src/android/os/FileUtilsBenchmark.java
Bug: 71932978
Change-Id: I52518d529da5d961610998b9f61399064d8025cd
ackageManagerServiceUtils.java
daaa0090036098533854558e2e04fe406e26ebaa 01-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes I4a907600,If3205033

* changes:
Marking used instant apps fields as System API
Revert "Revert "Removes EphemrealResolverService and related""
d01ce15111512622e6a9d233a42adcc24c1c4736 31-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "reland: pm: Apps with shared UID must also share selinux domain"
a68a28640fc700624369e07582033b0f5a71572c 31-Jan-2018 Fyodor Kupolov <fkupolov@google.com> Do not call setQuietModeEnabled from the main thread

Call into startUserInBackgroundWithListener->onBeforeStartUser sometimes
can be blocked for a long time if there is an ongoing dexopt operation.

Instead call it from bg thread.

Test: manual
Bug: 72692931
Change-Id: I872c3a2baf6e5ff95aab186f7a8008afec7533d6
serManagerService.java
159cd024d996047ac8caf1ae941d5be80047dedf 11-Jan-2018 Patrick Baumann <patb@google.com> Marking used instant apps fields as System API

Change-Id: I4a907600b9fa75b1789843a9c2e7d2c33aaaff6b
Fixes: 71852699
Bug: 72450666
Bug: 72700831
Test: builds and AIA still functional
nstantAppResolver.java
577d402d0d938c14d415054289a5ecbc613d0046 31-Jan-2018 Patrick Baumann <patb@google.com> Revert "Revert "Adds generic intent Instant App resolution""

This reverts commit 860b8ba71938e9860a31881c1d1431877f9d01a2.

The original change that was reverted contained a bug that allowed an
http view/browsable intent used to query for browsers to be considered
as a candidate for instant apps. This was resulting in an attempt to
bind to the instant app resolver while holding a lock on mPackages.

This change ensures that PMS doesn't bind while checking for the browser
status of a package in both the instant app filtering code and by adding
the FLAG_IGNORE_EPHEMERAL to the canonical browser intent.

Reason for revert: Applying fix

Change-Id: I4896b3a15416a11fdc3f6c191e552c4ce8963623
Fixes: 63117034
Fixes: 71916178
Test: Manual using test app at google_experimental/users/patb/InstantAppsInP
Test: atest android.appsecurity.cts.EphemeralTest passes after modification
phemeralResolverConnection.java
nstantAppResolver.java
ackageManagerService.java
43c97a0e9057e2f7ff34b90cb50692cf56937da2 31-Jan-2018 Patrick Baumann <patb@google.com> Revert "Revert "Removes EphemrealResolverService and related""

This reverts commit 1e0c91968e802d49c26e2e8d6ca6e8d31f451894.

Reason for revert: Original issue fixed

Fixes: 38137176
Fixes: 38121489
Test: manual; builds and instant apps launch
Change-Id: If320503381b21580ac1b127c49f754b39ffcc93b
phemeralResolverConnection.java
nstantAppResolver.java
nstantAppResolverConnection.java
ackageManagerService.java
742ebd45131049a9f231adf37d7bb8710ba8d9b3 29-Jan-2018 Jeff Vander Stoep <jeffv@google.com> reland: pm: Apps with shared UID must also share selinux domain

There are two existing cases where apps that share a sharedUserId
potentially end up in separate SELinux domains.

1. An app installed in /system/priv-app runs in the priv_app domain.
An app installed on the /data partition which shares a
sharedUserId with that priv_app would run in the untrusted_app
domain (e.g. GTS b/72235911). This issue has existed since
Android N.
2. The untrusted_app domain may now deprecate permissions based on
targetSdkVersion, so apps with sharedUserId may have different
permissions based on which targetSdkVersion they use. This issue
has existed since Android O, but is particularly problematic for
feature "Deprecate world accessible app data" which puts every app
targeting P+ into its own selinux domain.

This change fixes #1 and adds a temporary workaround to prevent #2.

Updated version considers both SharedUserSetting.isPrivileged() and
pkg.isPrivileged() for the case where the app has a shared User.

Test: cts-tradefed run cts -m CtsSelinuxTargetSdkCurrentTestCases
Test: cts-tradefed run cts -m CtsSelinuxTargetSdk27TestCases
Test: cts-tradefed run cts -m CtsSelinuxTargetSdk25TestCases
Test: confirm via packages.list that apps end up in the same
selinux domain before and after this patch.
Bug: 72290969
Change-Id: I974bea88004622b70633fdeb54a1372fd04c6eff
ackageManagerService.java
ELinuxMMAC.java
9a1f5baa3e332e8abcc3951a6e169c6b299d7239 31-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Skip extra <pastSigs /> tags."
dd020f6fb9d5037b7560c148b08f46d599851191 31-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add key rotation."
397c38d01711b1fb21882b41f5ced0ba98edab6e 31-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Revert "Adds generic intent Instant App resolution""
4b4539b6b0e1e6c8986aa0127470d1ce8651c124 31-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Revert "Removes EphemrealResolverService and related""
1e0c91968e802d49c26e2e8d6ca6e8d31f451894 31-Jan-2018 Patrick Baumann <patb@google.com> Revert "Removes EphemrealResolverService and related"

This reverts commit 5564f880db3292327872a07df8e230eee78be14b.

Reason for revert: Resolve merge conflict for another revert (ag/3537193)
Bug: 72710855
Change-Id: Id7c3a3993a45c588ee4668d7486d67d764541b1e
phemeralResolverConnection.java
nstantAppResolver.java
nstantAppResolverConnection.java
ackageManagerService.java
3a247b19dd38becf016b0e531fffea92f0b92a5c 31-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Removes EphemrealResolverService and related"
e7a47ab038411e6ce45e73c6355516277aebe88d 31-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix regression: skip verification for apks in /system"
860b8ba71938e9860a31881c1d1431877f9d01a2 31-Jan-2018 Patrick Baumann <patb@google.com> Revert "Adds generic intent Instant App resolution"

This reverts commit 3e8bd0f3b5ffab9a07189ed3ebcc6c4437778a0e.

Reason for revert: b/72710855

Change-Id: I1378ccb5c5c16256e472e1ff7c3ad2460e091300
Fixes: 72710855
phemeralResolverConnection.java
nstantAppResolver.java
ackageManagerService.java
1dbe6d02849cb4af87bbd26b7537e11badead3b1 23-Jan-2018 Dan Cashman <dcashman@google.com> Add key rotation.

Change certificate checks to also consider the possibility of
signing certificate rotation by checking the
SigningDetails#pastSigningCertificates field. In particular, add a
SigningDetails#checkCapability method which reports whether or not
the older SigningDetails is an ancestor of the current one, and
queries whether or not the old one has been granted capabilities,
such as being a sharedUser.

Bug: 64686581
Test: Builds, boots, browser and camera work, all with v3 signing.

Change-Id: I4199ff3f2d9ae959325b117b28e666ae31889800
nstantAppRegistry.java
ackageManagerService.java
ackageManagerServiceUtils.java
ackageSettingBase.java
ELinuxMMAC.java
ermission/DefaultPermissionGrantPolicy.java
ermission/PermissionManagerService.java
6cade96ac50e7f468e902d3c0f95d8abbd6c3372 31-Jan-2018 Jeffrey Vander Stoep <jeffv@google.com> Merge "Revert "pm: Apps with shared UID must also share selinux domain""
244ef2b030e9f0c8d6780be11f8e18003dba2777 31-Jan-2018 Jeffrey Vander Stoep <jeffv@google.com> Revert "pm: Apps with shared UID must also share selinux domain"

This reverts commit 60747d28230c5a78e30fc8836946a8a8806ab738.

Reason for revert: b/72708181
Bug: 72708181

Change-Id: I694f12d769d9ba60201ecb68d3c3b8090fed6593
ackageManagerService.java
ELinuxMMAC.java
5564f880db3292327872a07df8e230eee78be14b 30-Jan-2018 Patrick Baumann <patb@google.com> Removes EphemrealResolverService and related

This change removes deprecated classes and constants that were not
renamed from ephemeral to instant prior to O. There were no
consumers of these APIs as correctly named alternatives existed and were
referenced in docs. No known consumers of these APIs exist on user
builds.

Fixes: 38137176
Fixes: 38121489
Test: manual; builds and instant apps launch
Change-Id: I982f8a6edc5668dd42cea65e52a1433ec8d6f8ef
phemeralResolverConnection.java
nstantAppResolver.java
nstantAppResolverConnection.java
ackageManagerService.java
dd963c63657363871d768a38789bec41878ffb09 29-Jan-2018 Victor Hsieh <victorhsieh@google.com> Fix regression: skip verification for apks in /system

This is a regression caused by I33531a3f6148232b777ea8bfd02f13700649e317

Test: SystemServerTiming_StartPackageManagerService_avg: 789.5 -> 577.5
Bug: 30972906
Bug: 72572541
Change-Id: I6eafc317f3864bf15ac7653bc526e634148d8b00
ackageManagerService.java
250fd72343db0a9e61932289586738333d11fcc1 30-Jan-2018 Jeffrey Vander Stoep <jeffv@google.com> Merge "pm: Apps with shared UID must also share selinux domain"
83a6df5b070dc5dfddb62abf6c40a074ac98410d 30-Jan-2018 Tyler Gunn <tgunn@google.com> Merge "Add handover permission, fill in some missing API gaps." am: 1dfa830bb0
am: ed4dd9fbc6

Change-Id: I2f04ac80df28e45d1bb9f8e55b45317752d61bd6
1dfa830bb02f9b30a510e8c487238e6328d2bebc 30-Jan-2018 Treehugger Robot <treehugger-gerrit@google.com> Merge "Add handover permission, fill in some missing API gaps."
60747d28230c5a78e30fc8836946a8a8806ab738 29-Jan-2018 Jeff Vander Stoep <jeffv@google.com> pm: Apps with shared UID must also share selinux domain

There are two existing cases where apps that share a sharedUserId
potentially end up in separate SELinux domains.

1. An app installed in /system/priv-app runs in the priv_app domain.
An app installed on the /data partition which shares a
sharedUserId with that priv_app would run in the untrusted_app
domain (e.g. GTS b/72235911). This issue has existed since
Android N.
2. The untrusted_app domain may now deprecate permissions based on
targetSdkVersion, so apps with sharedUserId may have different
permissions based on which targetSdkVersion they use. This issue
has existed since Android O, but is particularly problematic for
feature "Deprecate world accessible app data" which puts every app
targeting P+ into its own selinux domain.

This change fixes #1 and adds a temporary workaround to prevent #2.

Test: cts-tradefed run cts -m CtsSelinuxTargetSdkCurrentTestCases
Test: cts-tradefed run cts -m CtsSelinuxTargetSdk27TestCases
Test: cts-tradefed run cts -m CtsSelinuxTargetSdk25TestCases
Bug: 72290969
Change-Id: I211de05ad6f10b69e3e082cfe977f2dd43d90549
ackageManagerService.java
ELinuxMMAC.java
8ed7f2b76930e4e52d222d6c2d55649e66be4c7a 30-Jan-2018 Bowgo Tsai <bowgotsai@google.com> Merge "Add odm sepolicy support to SELinuxMMAC.java" am: 4db2d4690e am: 665737f124
am: 8ea2130cbd

Change-Id: Ib4322166ad2e0eccf3bdaed78b8e94523081a1e7
8ea2130cbd65aa21dd83a5db438aa7b933be0cba 30-Jan-2018 Bowgo Tsai <bowgotsai@google.com> Merge "Add odm sepolicy support to SELinuxMMAC.java" am: 4db2d4690e
am: 665737f124

Change-Id: I0ba64f18d1a1618b370f9df617a2638de5a1d30e
4db2d4690e13cf4596a1def1fc0a4bc78593f388 30-Jan-2018 Treehugger Robot <treehugger-gerrit@google.com> Merge "Add odm sepolicy support to SELinuxMMAC.java"
19e8803ddc1cfc74a9c976250da634140249d734 29-Jan-2018 Dan Cashman <dcashman@google.com> Skip extra <pastSigs /> tags.

Test: Builds, boots.
Change-Id: If4d2b0ef986a4234e97931c62393992b4aeb9c5a
ackageSignatures.java
ef34fad6a724896dac855e959304a99dea7ca3fe 29-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "PackageSignatures: bring back tag skipping on unknown element."
84783905c03d368352fbd05dfb614251a72f1786 29-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Adds generic intent Instant App resolution"
6fa646ab95de0967a79bb9a136e75623de2cc808 29-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Reduce pss collection amount, improve logging."
3e8bd0f3b5ffab9a07189ed3ebcc6c4437778a0e 08-Jan-2018 Patrick Baumann <patb@google.com> Adds generic intent Instant App resolution

Bug: 63117034
Change-Id: Ie3818e913e8e1077f60434a626bc606c0b5015ab
Test: Manual using test app at google_experimental/users/patb/InstantAppsInP
Test: atest android.appsecurity.cts.EphemeralTest passes after modification
phemeralResolverConnection.java
nstantAppResolver.java
ackageManagerService.java
33e17ae146ac6b13a6a1aea040730e86c927bb5a 29-Jan-2018 Dan Cashman <dcashman@google.com> PackageSignatures: bring back tag skipping on unknown element.

Commit: 7ee17aa6b228a007129147c7a6e9ecba2a40d892 moved the
skipCurrentTag call when reading certs into the branch directly
dealing with <cert /> tags to eliminate issues for the <pastSigs />
tag, but in doing so will cause bad parses when encountering unknown
elements. Restore the previous behavior when an unknown tag is
encountered.

Bug: 64686581
Test: Builds, boots.
Change-Id: I3e2850b3dc1660ca43b7b5d01bf345290d11bac0
ackageSignatures.java
f30dc952682a9ab5ef1385b59c6cbdc9935f93d6 29-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "readCertsListXml: fix IndexOutofBoundsException and erroneous skip."
7ee17aa6b228a007129147c7a6e9ecba2a40d892 26-Jan-2018 Dan Cashman <dcashman@google.com> readCertsListXml: fix IndexOutofBoundsException and erroneous skip.

When reading pastCerts, flags are read along with the hex-encoded
certificate, but the index into the array is updated after reading
the cert, before reading the flags. This leads to an
ArrayIndexOutOfBoundsException. Change the iterator update to be
after both arrays have been processed.

Also move the skipCurrentTag call to the <cert /> parsing section.
The pastSigs tag has nested elements so by the time it has finished
processing, it is already at the pastSigs end-tag, which causes the
parser to continue past the <sigs> entry erroneously.

Bug: 64686581
Test: Builds, boots with app with key rotation history.
Change-Id: I3965ffb5f4306eaddc0a3a959ef0f9674068f9d2
ackageSignatures.java
2b894394a5392c9e205a6fa64601b2fee3b9a9ae 27-Jan-2018 Ruchi Kandoi <kandoiruchi@google.com> Merge "Add UID and Service for Secure Element Application" am: b8b7589531
am: 8ee3204c58

Change-Id: I7c74f21e014fb7eb772e2d86cc278fd774ffb8c9
6149b0fa49479dbe8c6208dbd87dc5e39c7f4c13 04-Jan-2018 Ruchi Kandoi <kandoiruchi@google.com> Add UID and Service for Secure Element Application

Bug: 64994044
Test: Boot; Check Service loaded.
Change-Id: I2f48ff204acd29b1a9f6819910aba5f8f3762977
ackageManagerService.java
e17b445b6c813f6f9bc93a5e3811128a197ef50b 10-Jan-2018 Dianne Hackborn <hackbod@google.com> Reduce pss collection amount, improve logging.

Tuned rates that we collect PSS, to reduce how much we do
that heavy operation. Added a new way to determine
whether a process has changed to a state for the
"first" time -- now this is when it has gone to that
state for the first time since it was in a lower state.
This will reduce the amount of time we consider a
process to be first to only when it has previously
gone into a higher state than it had before.

Keep track of more fine-grained information about why we
collect a PSS sample (not just internal, but for a single
process, all processes because of a mem state change, all
processes because of a poll).

Started collecting RSS in various places, so we can start
looking at that w.r.t. PSS and see about transitioning to
it is a new primary metric.

Added logging for many of the places where the system
writes its configuration files, so we can more easily
see any bad behavior going on in those areas.

Added some currently disabled code to read smaps directly
instead of using fgets(). Probably won't help, but want
tot test.

Bug: 70859548
Test: atest CtsAppTestCases
Change-Id: I400dba0f3ae9c024df51c946cfa592561028b598
ackageInstallerService.java
ettings.java
dcf4c6dc2629bef9e05fbc27f034304abd653d10 04-Jan-2018 Ruchi Kandoi <kandoiruchi@google.com> Add UID and Service for Secure Element Application

Bug: 64994044
Test: Boot; Check Service loaded.
Merged-In: I2f48ff204acd29b1a9f6819910aba5f8f3762977
Change-Id: I2f48ff204acd29b1a9f6819910aba5f8f3762977
(cherry picked from commit dfaf4bdd1e7e12caf9bb69c8facc38e879861baf)
ackageManagerService.java
ce6b2d6bb988032e9cfa00ee0d2353c3c09503a6 26-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes from topic "product_partition"

* changes:
Read media files from /product/media/audio
Support /product partition
858bfaf79c97e000af68649970994ee16bdd08ac 23-Jan-2018 Tyler Gunn <tgunn@google.com> Add handover permission, fill in some missing API gaps.

Adding the ACCEPT_HANDOVER runtime permission which an app must have in
order to accept handovers (this is per design).

Adding missing onHandoverComplete method in the android.telecom.Connection
API (per design).

Finishing plumbing for android.telecom.Call#onHandoverComplete API.

Fix issue where the new handover API methods would never get called; the
legacy handover extra was being used in this case when it should not have
been.

Bug: 65415068
Test: Verified using new CTS tests
Change-Id: If1558f6a23911862c02ac5b18fb62d86911ed7e2
Merged-In: If1558f6a23911862c02ac5b18fb62d86911ed7e2
ackageManagerService.java
172814085b7247d7db2b166240c8612524f0a61c 25-Jan-2018 Calin Juravle <calin@google.com> Merge "Extend the ArtManager profiling API to cover boot image profiling"
2b6e24c7e52df47fd35ade619211fa293eca5ad7 25-Jan-2018 Calin Juravle <calin@google.com> Merge "[framework] Extend profile operations to take the profile name"
f1b720c4886b5ea6b6656f9f373ca1ab766585fd 25-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Skip priv app full apk verification if has verify"
d2204db2c686f9691323e24d760c0935d0bce178 25-Jan-2018 Nicolas Geoffray <ngeoffray@google.com> Merge "Rewrite handling of oob priv-apps in framework."
1713d9e97aada3dc695800c18b1025238a11629d 12-Jan-2018 Jaekyun Seok <jaekyun@google.com> Support /product partition

This CL will support the followings.
- installing a RRO package for framework from /product/overlay
- installing apps from /product/app
- installing priv-apps from /product/priv-app
- installing permissions from
/product/etc/[default-permissions|permissions|sysconfig]

Bug: 64195575
Test: `mm` under frameworks/base/tests/[libs|privapp]-permissions
adb sync && adb reboot
adb shell cmd package list libraries
=> confirmed com.android.test.libs.product library
adb shell cmd package dump \
com.android.framework.permission.privapp.tests.product
=> confirmed that the package is a priv-app

And I moved vendor/overlay/framework-res__auto_generated_rro.apk into
system/product/overlay/ on sailfish, and I confirmed that the RRO was
installed properly.

Change-Id: I16175933cebd9ec665d190cc5d564b5414a91827
taDexoptService.java
ackageManagerService.java
ackageManagerShellCommand.java
ackageSetting.java
ettingBase.java
ettings.java
ermission/DefaultPermissionGrantPolicy.java
ermission/PermissionManagerService.java
0271ef98956f0a405aa44393b0cad39a09214957 25-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes I8d43f5bc,I5ca4b0ca

* changes:
OMS: Enable uninstallation of overlays
PackageManager: allow overlays to be installed when signature matches platform cert
5f76124551aa6582bb82034f8423b9d84f633d70 20-Jan-2018 Victor Hsieh <victorhsieh@google.com> Skip priv app full apk verification if has verify

When ro.apk_verity.mode is on, full apk verification is only skipped if
the apk already has verity enabled in the file system, and if the apk
contains the Merkle tree root hash we need.

Since the configuration in the file system is duplicated from the apk
(including the offset and size of Signing Block and the Merkle tree),
in order to prevent offline attacker from changing it, we need to
measure the observed configuration and make sure it matches the kernel's
view.

Test: observed package manager's requeset to installd (only) for updated
priv apps.
Bug: 30972906

Change-Id: I33531a3f6148232b777ea8bfd02f13700649e317
nstaller.java
ackageManagerService.java
ackageManagerServiceUtils.java
d93a795945076ef407542bb6945832e3024ce3d7 25-Jan-2018 Victor Hsieh <victorhsieh@google.com> Merge "Enable verity to updated priv app if root hash exists"
fcbb74a4296fd808e1058ecebd91fac56582e799 22-Jan-2018 Calin Juravle <calin@google.com> Extend the ArtManager profiling API to cover boot image profiling

The boot image profile is available only on userdebug and eng builds and
combines the boot classpath and system server classpath.

Also, update ArtManager API to use Executors instead of Handlers.

Test: gts GtsAndroidRuntimeManagerHostTestCases
Bug: 30934496
Change-Id: Ie501947a659d644acbde04fb46157dd0c7944e81
nstaller.java
ex/ArtManagerService.java
6ae39fc2e5b4692d092a042816939fd0a5f3e3b8 20-Jan-2018 Calin Juravle <calin@google.com> [framework] Extend profile operations to take the profile name

Extend the installd profile interface to take the profile name as
argument. This shifts the responsibility for choosing the names of
profiles for primary apks completely to PackageManager. Each of the
application code paths will get an unique profile name based on their
split name.

All the profile operations will now work on a specific profile name rather
than assuming a default global name.

Also, move dumpProfiles and clearProfiles functionality to the
ArtManagerService so that we can re-use profileName computations easier.

Test: manual (dexopt apps, merge profiles, clear profiles)
gts GtsAndroidRuntimeManagerHostTestCases
Bug: 30934496

Change-Id: Ie65d45eed7de0844edf4b7af918d7eaa74ec1f2c
nstaller.java
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ex/ArtManagerService.java
5bbe26ee01bc9785487fe5e748e624b6fc5bd3a4 24-Jan-2018 Calin Juravle <calin@google.com> Accept UserHandle.USER_ALL during profile preparation

Test: adb install foo.apk
Bug: 72453027
Change-Id: I840d70d47a256c8853bbe1b9b023f51bdd5ddf6b
ackageManagerService.java
ex/ArtManagerService.java
2a21a9c99785ff53fffba69ee12b83c7e247b2db 24-Jan-2018 David Brazdil <dbrazdil@google.com> Merge "Set DEXOPT_DISABLE_HIDDEN_API_CHECKS for system apps" am: 2a8c24be18
am: 6dea42ae0f

Change-Id: I6376e610c575cd7c3f7bf8a72ca4c1a92d9023cc
0dea6c9eab4d76f34b08fe0e2bbbf0bcbed6f136 24-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Turn off ambient settings when DISALLOW_AMBIENT_DISPLAY is set."
e7334975bb8f1917ffb9732c9c1a9270ccd90da6 18-Jan-2018 Adam Lesinski <adamlesinski@google.com> PackageManager: allow overlays to be installed when signature matches platform cert

Test: With ag/3486152, run
Test: atest OverlayHostTests
Change-Id: I5ca4b0ca00dc21c4c0adb9a7680d2be866391b2e
ackageManagerService.java
5673793a5feaffa4c32072053a388491c9cecb37 24-Jan-2018 Calin Juravle <calin@google.com> Merge "[framework] Prepare profile for app code paths"
55f1499592ba632a0166b415a4aa7bf1d33a9c96 13-Jan-2018 Victor Hsieh <victorhsieh@google.com> Enable verity to updated priv app if root hash exists

With the flag ro.apk_verity.mode set to non-zero, on install time,
package manager now tries to enable verity for priv apps if the root
hash is included in the APK's Signing Block.

Test: Install a priv app with verity root hash in the Signing Block.
Saw the tree is built, passed to installd.
Failed on ioctl at the moment since kernel is not ready. (need the final installd patch)
Bug: 30972906

Change-Id: I17b6589b44485fb377d5618da55fb2a4572d4ae8
nstaller.java
ackageManagerService.java
ackageManagerServiceUtils.java
c010951c91588d0bf458eacc6358ec3cf26150b0 21-Jan-2018 yuemingw <yuemingw@google.com> Turn off ambient settings when DISALLOW_AMBIENT_DISPLAY is set.

Bug: 67675787
Test: manual
Change-Id: I2098b1d71ed7dd86e84137219ba4e8fd7020fad1
serRestrictionsUtils.java
11d21a29767cedf62aa9dcc8708a828867491840 24-Jan-2018 Nicolas Geoffray <ngeoffray@google.com> Rewrite handling of oob priv-apps in framework.

- Use 'verify' compiler filter for dexopt.
- Don't pass DISABLE_VERIFIER, instead rely on the oat file status.

This is made possible by:
https://android-review.googlesource.com/#/c/platform/art/+/568546/

Which allows loading oat files, but not executing them.

bug: 30972906
Test: build, set pm.dexopt.priv-apps-oob to true, shell stop && start, see we're not
using the compiled code.

Change-Id: Idb909c68304f74a720499db3a6cc4a457b52f1e1
ackageDexOptimizer.java
7c48e0e074c62eccf0fb6fdad8fd03b4b6107c23 18-Jan-2018 David Brazdil <dbrazdil@google.com> Set DEXOPT_DISABLE_HIDDEN_API_CHECKS for system apps

For now, system apps will be exempt from hidden API access checks.
Pass the appropriate flag to dexopt.

Test: manual
Bug: 64382372
Bug: 72305689
Merged-In: I5676ffa3a5ba680bf5f6bab0b62f0acf4a933097
Change-Id: Idc3067d2c6040f15fe0f051090ba45efe591ebae
nstaller.java
ackageDexOptimizer.java
464ed3d55f18b256ea1db78c9d46b08b54a96ce8 18-Jan-2018 David Brazdil <dbrazdil@google.com> Set DEXOPT_DISABLE_HIDDEN_API_CHECKS for system apps

For now, system apps will be exempt from hidden API access checks.
Pass the appropriate flag to dexopt.

Test: manual
Bug: 64382372
Bug: 72305689
Change-Id: I5676ffa3a5ba680bf5f6bab0b62f0acf4a933097
nstaller.java
ackageDexOptimizer.java
2cf94bf6988a2be160288f92c029082c661590cf 23-Jan-2018 Jeff Vander Stoep <jeffv@google.com> Reland: pm: Scan-as-privileged apps that share a privileged user

Commits 2ede04735081bd8c0e399a280484fb9e6089f33f and
77029c5b16351775cb2333369ef9a4bc1d9acf58 touch the same code in
PackageManager. They landed in master at the same time causing
a build breakage. Reland with fixes to PackageSetting signatures
usage.

Bug: 72235911
Test: build/flash Taimen, verify userdictionary provider
is scanned as priv-app.
Test: gts-tradefed run everything

Change-Id: I57818409fa2f21c4f8f54651dd539790005d3e92
ackageManagerService.java
064f16638be7304e589177386aa09f542a07ff88 24-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add API to expose signing certificate proof-of-rotation."
3621be71d0fe8a349ca468aca99a53a17f6575b3 19-Jan-2018 Calin Juravle <calin@google.com> [framework] Prepare profile for app code paths

This CL is an intermediate step to enable the use of profiles shipped in
the dex metadata files.

The preparation consist of:
- creating the current profile
- merging the profile from the dex metadata file (if present) into the
reference profile

and happens:
- after the application data directory is created, to capture system
apps.
- post-install (right before we dexopt), to capture any new code paths

Test: manual (install apps and splits, take OTA)
Bug: 30934496

Change-Id: Id36474ab629ad3ffafd24381d30e3d88ac02d576
nstaller.java
ackageManagerService.java
ex/ArtManagerService.java
262cdf0f2724aaeade73a6c9e7b7466e0adf1007 24-Jan-2018 Jeffrey Vander Stoep <jeffv@google.com> Merge "Revert "pm: Scan as privileged apps that share a privileged user""
2a31ecf04023660b62a97e7331b6d68fd68bf9f9 24-Jan-2018 Jeffrey Vander Stoep <jeffv@google.com> Revert "pm: Scan as privileged apps that share a privileged user"

This reverts commit 2ede04735081bd8c0e399a280484fb9e6089f33f.

This change + 77029c5b16351775cb2333369ef9a4bc1d9acf58
pass build checks/tests, (with the exception of a known unrelated test failure), but together break the build.
Change-Id: I067da56df7239539e570499347ffaf91d6af2b0d
ackageManagerService.java
2052d01a14c76e3c9c2dacbb22e1067e141ba943 24-Jan-2018 Jeffrey Vander Stoep <jeffv@google.com> Merge "pm: Scan as privileged apps that share a privileged user"
4ec3efce54b14157ce9084faed51be07cbbbe274 24-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add proof-of-rotation information to PackageParser.SigningDetails"
2ede04735081bd8c0e399a280484fb9e6089f33f 23-Jan-2018 Jeff Vander Stoep <jeffv@google.com> pm: Scan as privileged apps that share a privileged user

Bug: 72235911
Test: build/flash Taimen, verify userdictionary provider
is scanned as priv-app.
Test: gts-tradefed run everything

Change-Id: I6b99135e1264a7ad7be818feb9a52c299349e96d
ackageManagerService.java
15e76d620a93eb3a0377da59fdb366b87714f2a1 23-Jan-2018 Jorim Jaggi <jjaggi@google.com> Merge changes I2b6bfca0,I9a854d43

* changes:
Add option to retrieve pending intent result
Fix issue with permission check for shortcuts and pendingIntent
5cdda3425ccf3c62e400a1646615f4479a8266af 19-Jan-2018 Daniel Cashman <dcashman@google.com> Add API to expose signing certificate proof-of-rotation.

With the addition of APK Signature Scheme v3, the platform now can
support key rotation by using the proof-of-rotation provided by the
new scheme. Create a new API which allows checking of the entire
provided history of an APK's signing certificates, not just the
current signer. This should allow for changes of APK signing
certificates without fear of losing access to resources that would
have been provided under the old signing certificate.

Change getPackageInfo(GET_SIGNATURES) to return the oldest signing
certificate in the chain so that apps which do programmatic checks,
but are not updated to use the new API, still get the same information
they would have gotten had there been no rotation.

Bug: 64686581
Test: Builds, boots.
Change-Id: I8982fd4cce60f5d85a6180d157a6e2a661b1a6d7
ackageManagerService.java
ackageManagerServiceUtils.java
4d8d32cb6af4b9ea2f8d320f4a52561413d146bd 19-Jan-2018 Jorim Jaggi <jjaggi@google.com> Fix issue with permission check for shortcuts and pendingIntent

When launching a PendingIntent, we have two sets of activity
options: One supplied from the caller that obtained the
pending intent, and those supplied from the caller that is
sending it. We need to perform the permission check depending
on which caller the options are coming from.

For that, we introduce SafeActivityOptions that records the
callingPid/callingUid when obtaining it and checks for the
permissions with the correct callingPid/callingUid, and
also supports merging both activity options.

In addition to that, fix shortcuts by not clearing caller
identity in LauncherAppsService.

Test: go/wm-smoke
Test: Install custom launcher APK with animation for shortcuts
enabled, make sure launch works properly.
Bug: 64674361

Change-Id: I9a854d43c65c8fa69bf16ccfbed86e8e681a095b
auncherAppsService.java
e36211c2326696398ce1e3080945fb69c28a7794 23-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add update packages permission"
77029c5b16351775cb2333369ef9a4bc1d9acf58 19-Jan-2018 Daniel Cashman <dcashman@google.com> Add proof-of-rotation information to PackageParser.SigningDetails

APK Signature Scheme v3 enables APK signing key rotation by allowing
an APK to embed a proof-of-rotation structure linking past signing
certificates to the current one. This information needs to be exposed
to the system before it can be used to make authorization decisions.

Bug: 64686581
Test: Builds and boots.
Change-Id: I49961f92fcec141d73b36197147d5d8fa64c149e
ackageManagerService.java
ackageManagerServiceUtils.java
ackageSettingBase.java
ackageSignatures.java
ettings.java
83178bc099eaaf65e7c03de710919f391483fb29 22-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow Recents in current user to access APIs in its child profile"
253c5cce46865312692da036186aa5849fc34ae1 22-Jan-2018 Ben Gruver <bgruv@google.com> Merge "Add get-harmful-app-warning shell command"
e839d709c2e53ae11e568fc5ae93030fc11a1a59 22-Jan-2018 Tony Mak <tonymak@google.com> Allow Recents in current user to access APIs in its child profile

At this point, we just need to whitelist Recents for these:
isDeviceLocked
loadTaskDescriptionIcon
getActivityInfo

However, I think in the long run, it may need more than that, so I
modified AMS.handleIncomingUser accordingly. PKMS does not use
handleIncomingUser and hence isRecentsAccessingChildProfiles is
introduced there.

Fix: 71722266

Test: Manual
1. Setup work profile
2. Launch some work and personal apps
3. Swipe up to see the new Recents
3. Can see recent apps are rendered correctly with icons badged
accordingly.
4. Can switch to the task
5. Can remove task

Change-Id: I56b5f6091c232fc8327e01de472467d630570030
ackageManagerService.java
aef1221d259d752c20454f3a03d499a20c5f52ad 19-Jan-2018 Przemyslaw Szczepaniak <pszczepaniak@google.com> Revert "Reject apks targeting deprecated sdk"

This reverts commit ab223112d1a163e641e7c1adb6429e27e37675a6.

Reason for revert: Android P will only show a warning dialog for
deprecated apks.

Test: -
Change-Id: Iff792b9d371cffbb0ba0d2ba53a4758a9779b1c7
ackageManagerService.java
9252b34065809731ea2f6d3ffad91f678f809c93 18-Jan-2018 Jeff Sharkey <jsharkey@android.com> Use data plans for better job scheduling.

Now that we have data plan information from the carrier, we can start
using it to influence when we schedule jobs. As a first pass
algorithm:

-- If the network is congested, and a job is less than 50% through
its runnable window, then we'll defer it for awhile.
-- If the network has a surplus of data, we'll consider using some
of it to improve the user experience by running prefetching jobs.

Provider APIs for carrier apps to override their connections to be
temporarily marked as either "unmetered" or "congested", along with
automatic timeouts if desired.

Flag for developers to indicate which jobs will have a material
positive impact on end users. (We don't want to promote jobs that
are simply doing logs upload; for example.) Glue code to quickly
return targetSdk of a specific package.

More tweaking to the exact algorithms will come in future CLs.

Test: bit FrameworksServicesTests:com.android.server.job.
Bug: 64133169
Change-Id: Iabb9f90a7a65958ad648b091edec378fc3bf785a
ackageManagerService.java
940ba0c8fe9f24e2696f4910262be098bb152fc1 18-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Rename CrossProfileApps API as per API council feedback"
b0d22627e9e11bd40d305742dd4d2fe77f179a22 18-Jan-2018 Tony Mak <tonymak@google.com> Rename CrossProfileApps API as per API council feedback

Three changes:
1. android.content.pm.crossprofile - > android.content.pm
2. getProfileSwitchingIcon -> getProfileSwitchingIconDrawable
3. startMainActivity “user” parameter should be named “targetUser”

Test: atest FrameworksServicesTests:com.android.server.pm.CrossProfileAppsServiceImplTest
Test: atest frameworks/base/core/tests/coretests/src/android/content/pm/CrossProfileAppsTest.java
Test: atest cts/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CrossProfileAppsHostSideTest.java

FIXES: 71818128

Change-Id: Icf9a6d1f8b6808935ffd79b43185c7b12235f349
rossProfileAppsService.java
rossProfileAppsServiceImpl.java
rossprofile/CrossProfileAppsService.java
rossprofile/CrossProfileAppsServiceImpl.java
d5d154efcd058898ab0ce26838a1db11610d7a13 18-Jan-2018 Calin Juravle <calin@google.com> Merge "Support installation of DexMetadata files (.dm)"
c12189b24c7be9b9609062b3dba070b08b6f0335 16-Jan-2018 Alex Chau <alexchau@google.com> Add adb command to get max running users

Bug: 72033601
Test: New command is working
Change-Id: I38746a2c03a6da35e7d8a149e1fb0b3604234dbc
ackageManagerShellCommand.java
70e4d199358377f559c5232e1785d76c97b96ff6 04-Jan-2018 Bowgo Tsai <bowgotsai@google.com> Add odm sepolicy support to SELinuxMMAC.java

Currently there are two mac permission files:
- /system/etc/selinux/plat_mac_permissions.xml
- /vendor/etc/selinux/nonplat_mac_permissions.xml

The change renames nonplat_mac_permissions.xml to
vendor_mac_permissions.xml.
It also adds odm_mac_permissions.xml but allows it to be optional:
- /system/etc/selinux/plat_mac_permissions.xml
- /vendor/etc/selinux/vendor_mac_permissions.xml
- /odm/etc/selinux/odm_mac_permissions.xml (optional)

Also cleans up comments to reflect the change.

Bug: 64240127
Test: boot sailfish normally without odm
Test: boot another device having odm
Change-Id: I87d01215a65e75bf33659ed03797ffda5393d5a4
ELinuxMMAC.java
8127c023b95be3f87e1747ba987dc9e942dba259 17-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "pm: Verify shared-user priv-app install location"
3fc56c30000d9b88c2145d4297a97ec5061d60d1 12-Dec-2017 Calin Juravle <calin@google.com> Support installation of DexMetadata files (.dm)

Add support in the package installer to install dex metadata files
alongside the application apks (base or splits).

During installation or update the dex metadata files will need to have a
matching apk file. The matching is done by checking the file extension
(e.g. base.apk -> base.dm, split_a.apk -> split.dm).

On disk, the metadata files are placed next to the apks.

The .dm files will be used during install-time optimizations and passed
verbatim to dex2oat.

Test: adb shell am instrument -w \
1) adb shell am instrument -w \
-e class android.content.pm.DexMetadataHelperTest

com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner

2) adb install-multiple CtsClassloaderSplitApp.apk
CtsClassloaderSplitApp.dm CtsClassloaderSplitAppFeatureA.apk
CtsClassloaderSplitAppFeatureA.dm CtsClassloaderSplitAppFeatureB.apk

3) gts-tradefed -m GtsAndroidRuntimeManagerHostTestCases

Bug: 30934496

Change-Id: I86f0a8307705ff3d6a5a85c2fcaae085dd62d4af
ackageInstallerSession.java
ackageManagerService.java
ackageManagerShellCommand.java
d1cf49904ba79c70446f27b51e3d736bb1324009 12-Jan-2018 Jeff Vander Stoep <jeffv@google.com> pm: Verify shared-user priv-app install location

Apps that share a UID with a privileged app are privleged and
should live in /system/priv-app. Otherwise, fail
assertPackageIsValid().

On Taimen, this results in two additional apps failing:
com.android.providers.userdictionary
com.android.providers.downloads.ui

Test: Boot Taimen, verify apps are scanned correctly.
Bug: 71593002
Change-Id: I29b4dc8a2fea18248fe1f6aeee87ae3798028c60
ackageManagerService.java
haredUserSetting.java
f24977b523c17f276a236be6fea784f8d4ee32db 17-Jan-2018 David Brazdil <dbrazdil@google.com> Merge "Pass targetSdkVersion to installd" am: 106a915256 am: 77ba6baab5
am: 4bf5b7c59e

Change-Id: I919eb49c4610477565cd85912e88ec135317a0b3
4bf5b7c59e9ebd5af89417940c66657b5343cccb 17-Jan-2018 David Brazdil <dbrazdil@google.com> Merge "Pass targetSdkVersion to installd" am: 106a915256
am: 77ba6baab5

Change-Id: Ic0b3323ee46e0bacffd62bd763da15e3256da783
265c692c8ec5a50054e0279321a98e7af85c2117 11-Jan-2018 yuemingw <yuemingw@google.com> Turn off airplane mode when DISALLOW_AIRPLANE_MODE is set.

Test: run cts --module DevicePolicyManager --test com.android.cts.devicepolicy.DeviceOwnerTest#testAirplaneModeRestriction
Bug: 67675441

Change-Id: I94b6c985fe76cc9601ac6a481beca17966102109
serRestrictionsUtils.java
8eb75d3d74871b9b83bbe5ca1e2cc1ee1fadcc9a 17-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add debug logs"
fc12cc51d34e3a19a2637e0bf9151ade250c180d 17-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add DISALLOW_CONFIG_SCREEN_TIMEOUT."
3d44ed0dfe33da3b9f08d102723d7fc842e18f74 16-Jan-2018 David Brazdil <dbrazdil@google.com> Pass targetSdkVersion to installd

Dex2oat now accepts targetSdkVersion as a parameter to determine
whether ART should treat the app as "legacy" and allow or restrict
access to private APIs.

We also bump arguments of otapreopt to v4 to accommodate the new value.

Bug: 64382372
Test: manual
Change-Id: Iae3867325dfaf8deaba51626ab04b97ad797d3b6
nstaller.java
taDexoptService.java
ackageDexOptimizer.java
619538b7bb19675536beec760078885f15ffbe78 16-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Workaround a bug that causes multiple activity instances are created"
12917c6b8fac65fb1014789cf78b4abcd6936ee0 15-Jan-2018 Tony Mak <tonymak@google.com> Workaround a bug that causes multiple activity instances are created

If Intent A contains both package and component, while Intent B
contains the exact component but without the package, AMS thinks that
they are different and not reusing the existing activity.

Launcher starts app in current user by using startActivity(intent without
package), while CrossProfileAppsService does not.

This bug is tracked in b/64108432. And let's workaround it for now.
There is no harm to not setting package anyway given that the component
is set explicitly.

Fix: 71983351

Test: Manual
1. Start app that integrates with CrossProfileApps API in user 0
2. Start the work profile instance by consuming CrossProfileApps APIs
3. Switch back to user 0 by consuming CrossProfileApps APIs
4. Observe that the same activity instance in #1 is brought up.

Change-Id: I4da6737ed3df589a0acd86ace1a7add3783d4449
auncherAppsService.java
rossprofile/CrossProfileAppsServiceImpl.java
5cda3aefd995dc873fb93aa4b829b33b0a040d48 15-Jan-2018 yuemingw <yuemingw@google.com> Add DISALLOW_CONFIG_SCREEN_TIMEOUT.

Bug: 67675734
Test: cts test will be added in b/67675743.

Change-Id: I75df384acdfe4cb9c259f68ff78214c4fad6410c
serRestrictionsUtils.java
a178144906fa7e2241715779f866d22b8b92a250 10-Jan-2018 yuemingw <yuemingw@google.com> Add DISALLOW_AMBIENT_DISPLAY.

Bug: 67675787
Test: cts will be added in b/67675794

Change-Id: Ic859783e05e54ea88d98db517891d41353ad033d
serRestrictionsUtils.java
82548f4bc32cab54fd8f3959c245659b8e04cae2 13-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Implement DISALLOW_SHARE_INTO_MANAGED_PROFILE"
6b467529bed03998d2fc26c24e3347bbc0ac764b 13-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Change scan flags before applying policy"
f996b76623f2b6e958e76d40d17b17f673ed30b5 13-Jan-2018 Todd Kennedy <toddke@google.com> Add debug logs

Logs are temporary and only used to try to catch problems with
the recent package manager refactoring. They will be reverted.

This reverts commit cdc2e6734e4a40cfb9b5735c428136bc18d401d3.
Bug: 63539144
Test: Manual. Builds, runs and shows debug output

Change-Id: I987e35a86253de04f809797d835bbf6a01dd8d03
ackageManagerService.java
ackageSetting.java
2e4a4af7b46976e8901d710a2c2bec2881a0023a 12-Jan-2018 Todd Kennedy <toddke@google.com> Change scan flags before applying policy

Change-Id: I902e4d8eb4297e1d03ebc6d492773e1e10605689
Fixes: 71891222
Test: sideload GMS core and reboot
Test: notice that GMS core remained system & privileged and kept all of its permissions
ackageManagerService.java
d4f6cecae38ad73aec1854f4294bbecd2bc5bd32 12-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Rename trySetQuietModeEnabled to requestQuietModeEnabled as per ... the feedback from API council"
bece85dd0ee8e43ced3103a75d4bf5250d9cc417 12-Jan-2018 Tony Mak <tonymak@google.com> Rename trySetQuietModeEnabled to requestQuietModeEnabled as per ...
the feedback from API council

trySetQuietModeEnabled will be kept for a while until next
Launcher prebuilt is dropped.

FIXES: 71818127

Test: Build

Change-Id: I3d4fd64862c7d924b8da630522a30a3899676b4b
serManagerService.java
4402aca969045dae3e5c848a6667ae0fbacd1c25 12-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Force verifying updated priv apps on boot if enabled"
c3b6df7e476db5761c1e3c8a3e54587dea496894 12-Jan-2018 Todd Kennedy <toddke@google.com> Merge "Revert "Temporary debugging""
cdc2e6734e4a40cfb9b5735c428136bc18d401d3 12-Jan-2018 Todd Kennedy <toddke@google.com> Revert "Temporary debugging"

This reverts commit c170e20c6f8ff40876887f3d74e2caec0caef6f5.

Change-Id: I251b6e108b386559605973ca0ef21d805ffe00a3
ackageManagerService.java
ackageSetting.java
9ef6009b3876243b1a9f144174c62f9fd9b65361 10-Jan-2018 Ben Gruver <bgruv@google.com> Add get-harmful-app-warning shell command

Bug: 63909431
Test: cts-tradefed run cts -m CtsHarmfulAppWarningHostTestCases
Change-Id: Ida6f15de4006857656989679a806e66c7b7f219f
ackageManagerShellCommand.java
cc391c2c13b30c494908309659509f8426af48ea 02-Jan-2018 Rubin Xu <rubinxu@google.com> Implement DISALLOW_SHARE_INTO_MANAGED_PROFILE

Add a user restriction to allow profile owners to enforce a stronger
isolation of managed profile by preventing users sharing data into
the profile. This is achieved by disabling a subset of built-in cross
profile intent filters added by ManagedProvisioning during profile
inflation.

Implementation wise, DevicePolicyManagerService listens for the restriction
change and notifies ManagedProvisioning to modify the built-in intent
filters. This is needed since ManagedProvisioning has ground truth of all
built-in intent filters and manages them. It also has the advantage that
ManagedProvisioning only needs to run when a policy change happens.

Test: cts-tradefed run cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.ManagedProfileTest#testDisallowSharingIntoProfileFromPersonal
Test: cts-tradefed run cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.ManagedProfileTest#testDisallowSharingIntoProfileFromProfile
Bug: 63911046
Change-Id: Ia6d12a5086627d1280325cd19d6e3a0752dae633
serRestrictionsUtils.java
0c8f2e01064d6c901fcf75fe59c949cd10b0c47f 06-Oct-2017 Victor Hsieh <victorhsieh@google.com> Force verifying updated priv apps on boot if enabled

If ro.apk_verity.mode is non-zero (default 0), package manager
will force verifying updated priv apps in /data, and make sure the
certificate matches the original one in /system, which we trust.

Test: logcat shows force collecting cert only if enabled
Bug: 30972906

Change-Id: I33f98930aaaaf76dbe2c0bc664e841f7892eb00e
ackageManagerService.java
ackageManagerServiceUtils.java
5cb82fd3294ab80568871f4abb3db3109b914fb2 12-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Moves instant app install checks to install time"
e8df5cd9d88cc3f4e34828ee12ddabd10f533245 12-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes I0b5152d7,I00a6f1cd

* changes:
Temporary debugging
Remove scanPackageInternal()
adcb5222266a19ee55a1ef6acd45892164084153 11-Jan-2018 Chad Brubaker <cbrubaker@google.com> Add update packages permission

This subset of INSTALL_PACKAGES allows a privileged application to
install updates to existing applications but not install new
applications.

When combined with INSTALL_SELF_UPDATES this allows privileged apps to
be granted finely scoped install privileges based on their intended
usage instead of the more broad INSTALL_PACKAGES permission.

Test: WIP
Bug: 68731532
Change-Id: Ifbb6f5a18d9e8ff06270fd79ed031b99242c6fa3
ackageInstallerSession.java
c4a5b5010f18aae74f8a556120335bc5e800a679 11-Jan-2018 Ben Gruver <bgruv@google.com> Merge "Implement harmful app warning at activity launch"
c170e20c6f8ff40876887f3d74e2caec0caef6f5 11-Jan-2018 Todd Kennedy <toddke@google.com> Temporary debugging

This is only temporary to catch any possible issues with
the refactoring.

Bug: 63539144
Test: Manual
Change-Id: I0b5152d7d39d8ce64da06f84a4b3bf3fbb5b29a5
ackageManagerService.java
ackageSetting.java
30a23a5a7bcc1264ceaad93303176f1faff2f8c4 04-Jan-2018 Todd Kennedy <toddke@google.com> Remove scanPackageInternal()

The final, major refactoring for this release. Replace
scanPackageInternal() with addForInit(). This new method delegates
all modifications of the package setting object to the existing
scanPackageOnly() method.

There is one block of code where we modify the ApplicationInfo
object in the PackageParser.Package. It could be argued [and I would
agree] that the ApplicationInfo doesn't belong in the Pacakge
object at all. But, regardless, updating this info is being done
in addForInit(). It would be ideal if we could push this down to
scanPackageOnly(). Unfortunately, we expect the ApplicationInfo
to be updated correctly prior to scanPackageOnly().

Bug: 63539144
Test: Manual.
Test: w/ base image
Test: 1] upgrade OTA
Test: 2] clean flash
Test: w/ image containing additional applications
Test: 1] add a system application
Test: 2] add a system application w/ version installed on /data. version on /data has greater version code
Test: 3] add a system application w/ version installed on /data. version on /data has lower version code
Test: 4] add a system application w/ version installed on /data. version on /data has signature mis-match
Test: 5] remove a system application
Test: 6] remove a system application w/ upgrade installed on /data
Test: 7] update a system application
Test: 8] update a system application w/ upgrade installed on /data. version on /data has greater version code
Test: 9] update a system application w/ upgrade installed on /data. version on /data has lower version code
Change-Id: I00a6f1cd056d9e5ee81154a522b7d50ea9174273
ackageManagerService.java
ELinuxMMAC.java
ettings.java
1ab3d6e56b56fe0cfe31e437326b5cbc66bdb361 07-Dec-2017 Ben Gruver <bgruv@google.com> Implement harmful app warning at activity launch

Bug: 63909431
Test: manual

Change-Id: I8a5497421cb8130af8cdd5129b0f6e1707a01e36
ackageManagerService.java
ackageManagerShellCommand.java
ackageSettingBase.java
ettings.java
2aede854ff1c4be134dd3118a88d10b6a6576de1 04-Jan-2018 Patrick Baumann <patb@google.com> Moves instant app install checks to install time

This is the final change needed to remove the PARSE_IS_EPHEMERAL
flag and do instant app validation at install time instead of at
parse time.

Fixes: 68860689
Test: manual - Installed valid and invalid instant apps
Change-Id: I4d2de8e09d53e2fc3397e60700e7fa4d31b7bb29
ackageInstallerSession.java
ackageManagerService.java
a665af32cb2e07aec4fdedb5044f54b85aa6c55c 11-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Move signing data into SigningDetails container"
b1e9df92899c95b839af0adc53556b85e9aeef9b 11-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add DISALLOW_CONFIG_BRIGHTNESS."
84c699a4b97afdde27e9ebb0da78e14e47a51b5f 10-Jan-2018 Dianne Hackborn <hackbod@google.com> Merge "Swap "foreground service" and "bound foreground service" proc states."
c6ac29d34fcebf3d392dfb729f0085a87bceb6c9 10-Jan-2018 yuemingw <yuemingw@google.com> Add DISALLOW_CONFIG_BRIGHTNESS.

Bug: 67675654
Test: cts test will be added in b/67675678.

Change-Id: Iaaeb1a19aed89cdbb139c33939923d0bb675d212
serRestrictionsUtils.java
10fc4fdd133c89347c38155475a3863bd12b94c4 20-Dec-2017 Dianne Hackborn <hackbod@google.com> Swap "foreground service" and "bound foreground service" proc states.

It has become apparent that apps running foreground services is
a much more important (and less common) state than all the various
ways apps run in the foreground because of the system being bound
to them or whatever else. So push this up about the bound foreground
service state, right after the explicit TOP state. Then we can
keep these together as "the app is explicitly running in the
foreground for some reason", etc.

Bug: 70808931
Test: CtsAppTestCases
Change-Id: Icfc1905b8e3eb60ddf26118c61ec1ef095659436
hortcutService.java
420d58a9d867a3ce96fb4ea98bd30ee4d44eab4d 19-Dec-2017 Patrick Baumann <patb@google.com> Move signing data into SigningDetails container

This change replaces fields from Package that relate to signing
with a single SigningDetails container. It does the same with
InstallArgs and InstallParams. This simplifies much of the code
that would have otherwise relied on synchronizing many fields and
will enable PackageManagerService to make install-time descisions
based on package data instead of forcing it to be part of package
parsing.

This is a retake of ag/3382280

Test: android.appsecurity.cts.PkgInstallSignatureVerificationTest passes.
Test: atest google/perf/boottime/boottime-test to ensure no startup regression.
Bug: 68860689
Change-Id: I0df45ce537df5552a7e60e4d727a4dcef23c2252
nstantAppRegistry.java
eySetManagerService.java
ackageInstallerSession.java
ackageManagerService.java
ackageManagerServiceUtils.java
ackageSignatures.java
ELinuxMMAC.java
ettings.java
ermission/DefaultPermissionGrantPolicy.java
ermission/PermissionManagerService.java
d4fed0ae1949a69aa8e43a575419d49b071d5c14 09-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add hidden APIs that return user start/unlock time."
de47b9b418ef895499aff7694a14030cb490b1d1 09-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix WTF in shortcuts."
6ca624dcf8a41e95dee22fec5fcf4fd4672b6c34 09-Jan-2018 Todd Kennedy <toddke@google.com> Merge "Add patb to owners" am: a2525e506d am: d14b30205c
am: 536078de96

Change-Id: I6f78e74d559f5720b19fc89fb7c477734d66d9eb
73dded28afb3be3aebcd698434d17cf4f796153b 20-Dec-2017 Makoto Onuki <omakoto@google.com> Add hidden APIs that return user start/unlock time.

Bug: 69456806
Test: Manual test with "watch dumpsys-user"
Change-Id: I68ed4ef53c707ed7c8cb8be4165052f942ea8ccd
serManagerService.java
536078de967ece638b7b407df8ef7c284c9af2c7 09-Jan-2018 Todd Kennedy <toddke@google.com> Merge "Add patb to owners" am: a2525e506d
am: d14b30205c

Change-Id: Idc8607b6a377a560a1a713de8153068ab25594ea
a2525e506de9b7a5f099010af9bd916908c164f5 09-Jan-2018 Todd Kennedy <toddke@google.com> Merge "Add patb to owners"
3b13dab158851cff2c36a173f4dea986a9f085a7 09-Jan-2018 Todd Kennedy <toddke@google.com> Add patb to owners

Test: None
Change-Id: I70429cd02fac901efd16e47e6566358c78ae0e23
ermission/OWNERS
3d70a03aa9e10382f385da0a26592d56eaf9cc96 09-Jan-2018 Patrick Baumann <patb@google.com> Revert "Move signing data into SigningDetails container"

This reverts commit 47117fcd7878ae75600cf95075fbdbec58be5da6.

Reason for revert: boot time regression (b/71718267)

Change-Id: Ice00e63a68ea3aede847c17cc3acda2d0a6b2f24
Bug: 71718267
Bug: 68860689
nstantAppRegistry.java
eySetManagerService.java
ackageInstallerSession.java
ackageManagerService.java
ELinuxMMAC.java
ettings.java
ermission/DefaultPermissionGrantPolicy.java
ermission/PermissionManagerService.java
47117fcd7878ae75600cf95075fbdbec58be5da6 19-Dec-2017 Patrick Baumann <patb@google.com> Move signing data into SigningDetails container

This change replaces fields from Package that relate to signing
with a single SigningDetails container. It does the same with
InstallArgs and InstallParams. This simplifies much of the code
that would have otherwise relied on synchronizing many fields and
will enable PackageManagerService to make install-time descisions
based on package data instead of forcing it to be part of package
parsing.

Test: android.appsecurity.cts.PkgInstallSignatureVerificationTest passes.
Bug: 68860689
Change-Id: I53bc8c6908b61a54004d1b1d45637be9710ae72f
nstantAppRegistry.java
eySetManagerService.java
ackageInstallerSession.java
ackageManagerService.java
ELinuxMMAC.java
ettings.java
ermission/DefaultPermissionGrantPolicy.java
ermission/PermissionManagerService.java
cc74ecb26ceb3139745bd520c5deab383b069f3e 05-Jan-2018 Jeff Sharkey <jsharkey@google.com> Merge "Intent to manage subscription plans."
e92d9e11564d400ef017acd51867c8f3afa05e30 05-Jan-2018 Philip P. Moltmann <moltmann@google.com> Merge changes from topic "BackupManagerModernInstallInterface"

* changes:
Disable installation via adb restore
Use modern install method in backup service
717f52f2dd8920d387c4d5143c7646787cec13bf 05-Jan-2018 Jeff Sharkey <jsharkey@android.com> Intent to manage subscription plans.

Define an API for carrier apps to provide a deep-link into their app
for the user to see more details about their billing relationship,
such as upgrading plans.

The createManageSubscriptionIntent() method is ready for OS
components to use when deciding if they should show a "MANAGE"
button in their UI, and the returned Intent is fully constructed
and ready to roll.

Test: builds, boots
Bug: 64133169
Change-Id: I9b2775b7cba5313f517996870135eb4682082873
serRestrictionsUtils.java
79c238ada6e7072f62f807781d58d314ed2f17a9 14-Dec-2017 Philip P. Moltmann <moltmann@google.com> Use modern install method in backup service

Test: adb backup -apk myApp -f backup ; adb restore backup
Change-Id: I2bbcb0487ecc525a6dc8a2693b15ce624db275b0
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
3157acc3184436495cb8d6c5e5dff36e79add6e9 04-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Default grant coarse loc perm to use-open-wifi app"
fe214f5cc8a5e7a6fb3537ad6048a1078137e84d 04-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix wrong attribute name used to restore databaseVersion."
1e423b950abc044d2f18a1771af19e42a5ea2022 18-Dec-2017 Eric Enslen <enslen@google.com> Default grant coarse loc perm to use-open-wifi app

Bug: 70843697
Test: flashed onto walleye and confirmed permission granted when WFA is
enabled.

Change-Id: Ic53886478ec6b8bef311f2f94e0976f7870c8cd1
ackageManagerService.java
ermission/DefaultPermissionGrantPolicy.java
d390ae9c7e2b115c47bee8a9cac924fd76e22c65 28-Dec-2017 Tony Mak <tonymak@google.com> Adjust permission checking of ensureCanModifyQuietMode

Two changes:
1. Verify caller package matches with calling UID before checking
is it default launcher.

2. If IntentSender is specified, only caller with MANAGED_USERS
can call through it.

Test: run cts-dev --module DevicePolicyManager --test com.android.cts.devicepolicy.QuietModeHostsideTest

Bug: 70212757

Change-Id: Iac118d988eb05097a56f343552c0b8845cf96749
serManagerService.java
80bdce0f59aa9f700e0768c223a9b80a3d205b72 03-Jan-2018 khmel <khmel@google.com> Fix wrong attribute name used to restore databaseVersion.

As described.

Bug:N/A
Test: databaseVersion attribute of version tags in packages.xml contain
correct value on next boots.

Change-Id: Ifbd158b21353985d895ccae9021da9311a7924f5
ettings.java
42d61605d803abf5c7d5348b5b4008fb57c41ac5 12-Dec-2017 Todd Kennedy <toddke@google.com> Auto udpate package list

Change-Id: I4e4f1666f5cdfb74800435642f564bc98e1fad4e
Fixes: 69963506
Test: Manual. Can add users w/o blocking
ackageManagerService.java
ermission/DefaultPermissionGrantPolicy.java
5c74af9498c51b3f789adae6796938789d3b2740 22-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes I902b2816,I284d421e

* changes:
Add DISALLOW_AIRPLANE_MODE.
Add DISALLOW_CONFIG_LOCATION_MODE.
edf829f41bd9147525e88eeef9828951fa44cc0d 22-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Enforce platform level animation in CrossProfileApps.startMainActivity"
5fe75dc26d55a86f223fa5571b64e30731341564 29-Nov-2017 yuemingw <yuemingw@google.com> Add DISALLOW_AIRPLANE_MODE.

Bug: 67675441
Test: cts test will be added for b/67675455

Design doc: https://docs.google.com/document/d/1rvEg5jE3lMhjH-OA0iTLBUY2opM96fg7BrP81MoPnmg/edit#

Change-Id: I902b281695a7e734639c9d6d4852a0e96fea8305
serRestrictionsUtils.java
7cc2c4c2ee8543e0a04dc1378db2be7224535d22 28-Nov-2017 yuemingw <yuemingw@google.com> Add DISALLOW_CONFIG_LOCATION_MODE.

Bug: 67674888
Test: cts test will be added in b/67674901

Design doc: https://docs.google.com/document/d/1rvEg5jE3lMhjH-OA0iTLBUY2opM96fg7BrP81MoPnmg/edit#

Change-Id: I284d421eedfb238084fa61e7661638c22b28734f
serRestrictionsUtils.java
3c631aa137d49a3c6ab31e3b1245ccce86a51a13 21-Dec-2017 Zhi An Ng <zhin@google.com> Merge "Fix over-granting permission on low ram"
da8d32efbbd582705b859eef0d935e5620099ee8 21-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes from topic "work_mode_api1"

* changes:
Add access control to trySetWorkModeEnabled and make it public
Merge setQuietModeEnabled and trySetQuietModeDisabled into one API
202372de4e46d2ba990dd7623c98b7dbbb1d1708 19-Dec-2017 Ng Zhi An <zhin@google.com> Fix over-granting permission on low ram

Bug: 69258381
Bug: 69587247
Test: cts-tradefed run gts-dev -m GtsPermissionTestCases
Change-Id: Id51723dfaa711c18962a9ba1caa9cfc35e6cc53d
ermission/DefaultPermissionGrantPolicy.java
089c35e9311386844332dbe2ca09076f845a604c 18-Dec-2017 Tony Mak <tonymak@google.com> Enforce platform level animation in CrossProfileApps.startMainActivity

With this change, whenever apps start an activity in another profile
using CrossProfileApps.startMainActivity, an animation will be enforced.
For now, we are showing the "open task" animation.
We may put something fancier if we have time in P.

Test: cts-tradefed run cts-dev --module DevicePolicyManager --test - com.android.cts.devicepolicy.CrossProfileAppsHostsideTest
Test: atest services/tests/servicestests/src/com/android/server/pm/crossprofile/CrossProfileAppsServiceImplTest.java
Bug: 70799822

Change-Id: I03525080151c6112633108419d69d64e76a511f3
rossprofile/CrossProfileAppsServiceImpl.java
e3d1f65ab684faf4a1194bde2618543d71697b46 12-Dec-2017 Tony Mak <tonymak@google.com> Add access control to trySetWorkModeEnabled and make it public

Test: Quick Settings -> Toggle work mode
Test: Settings -> Work profile settings -> Toggle work mode
Test: Turn off work mode -> Settings -> Turn on work mode in the suggestion
Test: Turn on work mode through tapping on work app

Test: cts-tradefed run cts-dev --module DevicePolicyManager --test com.android.cts.devicepolicy.QuietModeHostsideTest

BUG: 70212757

Change-Id: I335c3ab2306a3eb794cd35a3a7b0d184dc31f85e
serManagerService.java
47ed171802abbf0570e28fd99c7aa7cd38e1910a 20-Dec-2017 Makoto Onuki <omakoto@google.com> Fix WTF in shortcuts.

Bug: 69003626
com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Change-Id: Ie65ee2ebffedeaad60ce24cddb63278e03a1c1b6
hortcutPackage.java
41b745ca0d117c07419f9255485b8ca5094c653d 15-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Dump services permissions on 'package' service."
947802e0b9842c48102153ef26373a21b6742145 15-Dec-2017 Erik Wolsheimer <ewol@google.com> For loop condition fix

Change-Id: I5bddde2ea0bbbcfb4d16c91fc4ddc98a49040e10
ackageManagerService.java
f35375b56c39006182d572791c80c4e79f6e24ee 15-Dec-2017 Felipe Leme <felipeal@google.com> Dump services permissions on 'package' service.

Test: adb shell dumpsys package
Test: adb shell dumpsys package services-permissions
Test: adb shell dumpsys package android

Fixes: 70681510

Change-Id: I63be1df5276613193f5b079441d402a5382fdfde
umpState.java
ackageManagerService.java
b7e6fd49a5500c6182484335b03343bfdbd6b70b 05-Dec-2017 Tony Mak <tonymak@google.com> Merge setQuietModeEnabled and trySetQuietModeDisabled into one API

This is the first step to introduce a public API to toggle work mode.

All the callers actually have the similar bit of logic like this:
if (workModeOn) {
trySetQuietModeDisabled(..)
} else {
setQuietModeEnabled(...)
}
So, let's merge them into one API.

Test: Quick Settings -> Toggle work mode
Test: Settings -> Work profile settings -> Toggle work mode
Test: Turn off work mode -> Settings -> Turn on work mode in the suggestion
Test: Turn on work mode through tapping on work app

TODO: Allow foreground default Launcher to call the API
TODO: Allow privileged apps to call the API
TODO: Remove @hide
TODO: Write a CTS to toggle the work mode once it is public API

BUG: 70212757

Change-Id: Ibcdd43458c236eca929c5f934fea61be2e2be863
serManagerService.java
601816dee7f447802e63e7a0bd3ebc56bcaee17c 15-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Refactor scanPackagesDirtyLI()"
c4f87e9ceb4d5ce78c1663912bc166e0d41554aa 26-Oct-2017 Pavel Grafov <pgrafov@google.com> Introduce DISALLOW_UNIFIED_PASSWORD.

When DISALLOW_UNIFIED_PASSWORD is enforced by managed profile
owner, the user is disallowed to user single lock for both primary
user and the profile.

DMP.isUsingUnifiedPassword() can be called by DPC to check if
this restriction is obeyed.

Test: make cts-verifier
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases -t
com.android.cts.devicepolicy.ManagedProfileTest#testIsUsingUnifiedPassword
Test: cts-tradefed run cts -m CtsAdminTestCases -t
android.admin.cts.DevicePolicyManagerTest#testIsUsingUnifiedPassword_failIfNotProfileOwner
Bug: 63909482
Change-Id: Ib758e32d4bf4012d805185bce874f481e17576ba
serRestrictionsUtils.java
161614e12c6d3a5f17acd530417e7439326427d2 13-Dec-2017 Przemyslaw Szczepaniak <pszczepaniak@google.com> Merge changes from topic "deprecated_sdk_1"

* changes:
Reject apks targeting deprecated sdk
Add Build.Version.MIN_SUPPORTED_TARGET_SDK_INT field.
05e90071ecdcb1c1c0d1b2e6f3ae451195636035 13-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add getDisallowedSystemApps to DevicePolicyManager"
b6a9f94d6718894fdd382708a9d87696f055e71e 07-Nov-2017 Alex Chau <alexchau@google.com> Add getDisallowedSystemApps to DevicePolicyManager

- The getDisallowedSystemApps is based on OverlayPacakgesProvider which
is moved from ManagedProvisinoing
- getDisallowedSystemApps will be used by ManagedProvisioning
- createAndManageUser will now use getDisallowedSystemApps to disable
disallowed system apps when creating users
- LEAVE_ALL_SYSTEM_APPS_ENABLED can be passed to createAndManageUser to
enable all system apps
- ACTION_MANAGED_USER_CREATED will be broadcasted to ManagedProvisioning
after managed user is created to take a system app snapshot

Bug: 65842187
Test: OverlayPackagesProviderTest passes
Test: Disallowed system apps does not appear in device owenr, managed
profile, and managed users
Test: System app snapshot is created after provisinoing device owner,
managed profile and managed users
Change-Id: I86f870f7814b5700cf5539e889fb6998514d110f
serManagerService.java
0f877fab392154c77251dbac321b732a2a747911 07-Dec-2017 Todd Kennedy <toddke@google.com> Refactor scanPackagesDirtyLI()

Just a small drop in a larger sea of refactorings. This time we
break up scanPackagesDirtyLI(). It's now in three sections:
1) data setup
2) package scan
3) data commit

The goal is to not dramatically change the behaviour of the platform,
but, to provide some structure for future changes.

Ideally, only data commit would modify the running system. But,
all three still modify some part of the system. The scan
is the closest to being fully hermetic as only the PackageSetting
object is modified. A future task is to remove the dependency
of a singular PackageSetting object [with integer equality!] which
will finally make the scan independent.

The data setup and commit both modify the running system. We need to
continue to push on making the data setup section hermetic. Or, at
least track the allocations and be able to rewind if something goes
wrong.

The next refactoring will be rectify the difference between the
new scan method and scanPackageInternalLI.

Bug: 63539144
Test: bit FrameworksServicesTests:com.android.server.pm.
Change-Id: I59d401a81de2aed3309b99d663afdfa91316bc0a
ackageManagerService.java
ackageSettingBase.java
ELinuxMMAC.java
ettings.java
886c140b49385f05e0adf6e6ad4f924010de801c 12-Dec-2017 Todd Kennedy <toddke@google.com> Merge "Block the upgrade of persistent apps" am: 0b30d95dc8 am: 6de91158d7
am: 3175c621da

Change-Id: I5319cc775e7381e697ae365cdf7433d4bfdf56bd
3175c621da50f3596a6daaf42906887e00f81a3e 12-Dec-2017 Todd Kennedy <toddke@google.com> Merge "Block the upgrade of persistent apps" am: 0b30d95dc8
am: 6de91158d7

Change-Id: I729df40376b972461908d22593b63f4f5399e356
0b30d95dc8670514647c50e6f4bee89370eac2d2 12-Dec-2017 Todd Kennedy <toddke@google.com> Merge "Block the upgrade of persistent apps"
ab223112d1a163e641e7c1adb6429e27e37675a6 06-Dec-2017 Przemyslaw Szczepaniak <pszczepaniak@google.com> Reject apks targeting deprecated sdk

As part of deprecation policy enforcement for android apps, minimum
supported targetSdkVersion will be 17. Apks targeting values lower that
one set in PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION will fail to install.

PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION is currently set to 0 and
will be set to 17 in a following cl.

Installation of deprecated apks can be forced using adb install
--force-sdk flag.

More details in http://go/android-platform-deprecation-policy.

Test: tests are in complementary Cts cl.
Bug: 63926630
Change-Id: I8e55bdebf1fb2cfd951e2c6703ccc87b8d4e9a09
ackageManagerService.java
c0d9aa1633a3c78475fd3cb2345a68462f6735df 12-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix missed use of old int version code in shortcut manager."
cb02b7f0ea9839d5396d755c2870c71ef37251a7 12-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Avoid strict mode violation in shortcut manager on user-unlock"
6dea99f8c530333e91b063cd037bcd1cdc1e6cc7 12-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't take mLock in handleUnlockUser()."
708703bf39801027b616bcc43c650889bf0ef571 12-Dec-2017 Makoto Onuki <omakoto@google.com> Avoid strict mode violation in shortcut manager on user-unlock

- The issue is the shortcut host information was stored in ShortcutUser, which
is per-user shortcut information that's persisted in the disk. Even though in
the onUnlockUser sequence we only need to "set" a package name, in order to
access the ShortcutUser instance for the target user, we'd need to load the
per-user information from the disk.

- Luckily the host packages don't need to be persisted, so let's just move
it to another structure which is just kept in memory.

Bug: 70526858
Test: Manual test (boot, unlock user, unlock secondary user)
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutManagerTestCases
Change-Id: Ic4b842c4a3a08a7f0e678ce328e9d4ee08fd4069
hortcutNonPersistentUser.java
hortcutService.java
hortcutUser.java
efdede0f4a04dda8eb1a3e527962f727e4725839 12-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Cancel alarms & jobs when an app's data is cleared"
449479757fc138be3b15b10e2da66eb793eae389 12-Dec-2017 Dianne Hackborn <hackbod@google.com> Fix missed use of old int version code in shortcut manager.

Bug: 64459786
Test: manual
Change-Id: If0f8a19e72e259cceec71ba3490204298e38a478
hortcutPackageInfo.java
e63b04ad3259956a7d3f61ec930b64ae33376534 11-Dec-2017 Makoto Onuki <omakoto@google.com> Don't take mLock in handleUnlockUser().

Bug: 64303666
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Change-Id: I3afb814714aae404e4f07d8b179f4598cf507af5
hortcutService.java
e5634eeba63e975f8d69f7673596a5dc59908438 11-Dec-2017 luozhanwei <luozhanwei@xiaomi.com> Merge "[DeadLock]AMS PMS MountService" am: 998ac99db4 am: 41fb54b955
am: 81544d2a71

Change-Id: Ib92a19bce9fd9086c302c2cf4606b5d10161fe85
81544d2a71709a8c1105a616882e214125a7c8d4 11-Dec-2017 luozhanwei <luozhanwei@xiaomi.com> Merge "[DeadLock]AMS PMS MountService" am: 998ac99db4
am: 41fb54b955

Change-Id: I15056a18d70a1d17c52799f71e8faf5c565bb8aa
998ac99db4b421181791beffbfd9de22987dc472 11-Dec-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "[DeadLock]AMS PMS MountService"
1d99c391ecd30c27be2e8f61aa9ec64546d15d4b 08-Dec-2017 Christopher Tate <ctate@google.com> Cancel alarms & jobs when an app's data is cleared

In the same bit of code, fix a system restore issue: in the
course of setup + restore, we reestablish permission grants and
notification state up front for the to-be-restored app, and
then bring in its data. However, a data wipe is part of the
prologue for that data delivery -- so we were inadvertently
unwinding the permission grants and notification state restore
that we'd just performed. Now, we distinguish the restore flow
from other clear-data operations so we don't unwind that operation.

Finally take the opportunity to elide a lot of copypasta code into
a single predicate-driven implementation.

Bug: 67508896
Bug: 69538432
Test: atest android.app.cts.AlarmManagerTest

Change-Id: I15c912c3c99645599ae9bd6fb7337fa86b4e5757
ackageManagerShellCommand.java
82a6467cd812f0b97089d701172b23161e6c1d03 08-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Broadcast lifecycle events for instant apps"
0e1209bedf9b93e550084ff1bb71d36c8ff9cfa8 08-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Introduce isForegroundDefaultLauncher in ShortcutServiceInternal"
ed6ef62bda7345c135c3954253aea7b52af93c73 07-Dec-2017 Tony Mak <tonymak@google.com> Introduce isForegroundDefaultLauncher in ShortcutServiceInternal

BUG: 70212757

Test: bit FrameworksServicesTests:com.android.server.pm.ShortcutManagerTest{1..10}

Change-Id: Ia85cf990e3fcf1dae129ca9b1fc4c3af2838a284
hortcutService.java
a2d29527ac801c6cf6aace7d1850314e3b56c53e 08-Dec-2017 liulvping <liulvping@xiaomi.com> Merge "fix system app's abi error after uninstall updated version." am: a863c7f6b7 am: b9f9a5b672
am: 128335413a

Change-Id: Iea121bfaa29e04bbaa9f9bc1747292ff98a824a3
10e5eeb68d4a3c55d761e13016994a537c703c63 05-Dec-2017 luozhanwei <luozhanwei@xiaomi.com> [DeadLock]AMS PMS MountService

Umount externel srotage when phone boot.
It may trigger below dead lock in system_server in the board with external adoptable storage
as below stack:

"Binder_6" prio=5 tid=57 Blocked
| group="main" sCount=1 dsCount=0 obj=0x12fa7fa0 self=0x7f9674d000
| sysTid=3218 nice=0 cgrp=default sched=0/0 handle=0x7f941a3440
| state=S schedstat=( 450091692 353243785 1757 ) utm=30 stm=15 core=8 HZ=100
| stack=0x7f940a7000-0x7f940a9000 stackSize=1013KB
| held mutexes=
at com.android.server.MountService.getVolumeList(MountService.java:3014)
- waiting to lock <0x064315bf> (a java.lang.Object) held by thread 14 B
at android.os.storage.StorageManager.getVolumeList(StorageManager.java:918)
at android.os.storage.StorageManager.getStorageVolume(StorageManager.java:853)
at android.os.Environment.isExternalStorageEmulated(Environment.java:742)
at android.os.Environment.isExternalStorageEmulated(Environment.java:730)
at com.android.server.pm.PackageManagerService.isExternalMediaAvailable(PackageManagerService.java:10378)
at com.android.server.pm.PackageManagerService.nextPackageToClean(PackageManagerService.java:10385)
- locked <0x05b654c7> (a android.util.ArrayMap) A
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:1636)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:2937)
at android.os.Binder.execTransact(Binder.java:458)

"android.fg" prio=5 tid=14 Blocked
| group="main" sCount=1 dsCount=0 obj=0x12da1f90 self=0x7fa9ad8800
| sysTid=1792 nice=0 cgrp=default sched=0/0 handle=0x7f9867f440
| state=S schedstat=( 79482537 29476078 684 ) utm=4 stm=4 core=5 HZ=100
| stack=0x7f9857d000-0x7f9857f000 stackSize=1037KB
| held mutexes=
at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:19159)
- waiting to lock <0x074b3319> (a com.android.server.am.ActivityManagerService) held by thread 98 C
at android.app.ContextImpl.sendBroadcastAsUser(ContextImpl.java:942)
at com.android.server.MountService.onVolumeStateChangedLocked(MountService.java:1424)
at com.android.server.MountService.onEventLocked(MountService.java:1134)
at com.android.server.MountService.onEvent(MountService.java:1039)
- locked <0x064315bf> (a java.lang.Object) B
at com.android.server.NativeDaemonConnector.handleMessage(NativeDaemonConnector.java:135)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:207)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)

"Binder_F" prio=5 tid=98 Blocked
| group="main" sCount=1 dsCount=0 obj=0x13f740a0 self=0x7f96ab6400
| sysTid=3483 nice=0 cgrp=default sched=0/0 handle=0x7f8dbb7440
| state=S schedstat=( 472520780 311910624 1572 ) utm=35 stm=12 core=6 HZ=100
| stack=0x7f8dabb000-0x7f8dabd000 stackSize=1013KB
| held mutexes=
at com.android.server.pm.PackageManagerService.queryContentProviders(PackageManagerService.java:5974)
- waiting to lock <0x05b654c7> (a android.util.ArrayMap) held by thread 57 A
at com.android.server.am.ActivityManagerService.generateApplicationProvidersLocked(ActivityManagerService.java:10786)
at com.android.server.am.ActivityManagerService.attachApplicationLocked(ActivityManagerService.java:7405)
at com.android.server.am.ActivityManagerService.attachApplication(ActivityManagerService.java:7577)
- locked <0x074b3319> (a com.android.server.am.ActivityManagerService) C
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:513)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2764)
at android.os.Binder.execTransact(Binder.java:458)

Change-Id: Iec16ae1353cba7879838e3116d50f7cdeaee285c
Signed-off-by: luozhanwei <luozhanwei@xiaomi.com>
ackageManagerService.java
128335413aa5a73d937c9e1fc37631fa3cf6984e 07-Dec-2017 liulvping <liulvping@xiaomi.com> Merge "fix system app's abi error after uninstall updated version." am: a863c7f6b7
am: b9f9a5b672

Change-Id: I8b8d09a28f0640cffc11228eef662a3ad4380ff8
f5854f1695fa63279fecafda54c045a7265ecec8 06-Dec-2017 Bo Hu <bohu@google.com> Revert "Add odm sepolicy support to SELinuxMMAC.java"

This reverts commit fffa6d238a31ac5e7b30a6e1d852c8c2cc22af1d.

Reason for revert: broke mac build

b/70273082

FAILED: out/target/product/generic_x86/obj/ETC/vendor_sepolicy.cil_intermediates/vendor_sepolicy.cil
/bin/bash -c "(out/host/darwin-x86/bin/version_policy -b out/target/product/generic_x86/obj/FAKE/selinux_policy_intermediates/plat_pub_policy.cil -t out/target/product/generic_x86/obj/ETC/vendor_sepolicy.cil_intermediates/vendor_policy_raw.cil -n 10000.0 -o out/target/product/generic_x86/obj/ETC/vendor_sepolicy.cil_intermediates/vendor_sepolicy.cil.tmp ) && (grep -Fxv -f out/target/product/generic_x86/obj/ETC/plat_pub_versioned.cil_intermediates/plat_pub_versioned.cil out/target/product/generic_x86/obj/ETC/vendor_sepolicy.cil_intermediates/vendor_sepolicy.cil.tmp > out/target/product/generic_x86/obj/ETC/vendor_sepolicy.cil_intermediates/vendor_sepolicy.cil ) && (out/host/darwin-x86/bin/secilc -m -M true -G -N -c 30 out/target/product/generic_x86/obj/ETC/plat_sepolicy.cil_intermediates/plat_sepolicy.cil out/target/product/generic_x86/obj/ETC/plat_pub_versioned.cil_intermediates/plat_pub_versioned.cil out/target/product/generic_x86/obj/ETC/10000.0.cil_intermediates/10000.0.cil out/target/product/generic_x86/obj/ETC/vendor_sepolicy.cil_intermediates/vendor_sepolicy.cil -o /dev/null -f /dev/null )"
Parsing out/target/product/generic_x86/obj/FAKE/selinux_policy_intermediates/plat_pub_policy.cil
Parsing out/target/product/generic_x86/obj/ETC/vendor_sepolicy.cil_intermediates/vendor_policy_raw.cil
grep: out of memory

(cherry picked from commit 11f214d8f3b52dccb231990b5ac04c1e0f05617b)

Change-Id: If48fffc0bd9a208363fd11fb359a1e68cb59de62
ELinuxMMAC.java
a863c7f6b7360452a5a03a8cb84b9b5f50b04ace 07-Dec-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "fix system app's abi error after uninstall updated version."
383668cab47b556791dc839c0b071d74ec78fb91 07-Dec-2017 Bo Hu <bohu@google.com> Merge "Revert "Add odm sepolicy support to SELinuxMMAC.java"" am: 0e8440632a
am: 6c7981ebf2

Change-Id: I3033faed5edf11c2e918c23028031132dc24cff0
e2437036a653261aadd2b28f524386340f96b66d 06-Nov-2017 liulvping <liulvping@xiaomi.com> fix system app's abi error after uninstall updated version.

When uninstall an updated system app, we always did as
following steps. First we delete data structure by calling
deleteInstalledPackageLIF(), then enable it from disabled
system packages and re-adding to PackageSettings map by
calling addPackageLPw(). At last re-installing apps in
system partition with scanPackageTracedLI().

But if an package with sharedUserId readded failed with
exception of 'Adding duplicate shared id: xxx', then we
cann't reuse it's derived CPU Abis from settings, others
we could get CPU Abis uninitialized errors.

Test: Manual; Update an system app with sharedUserId
Test: Manual; Uninstall and ensure it run ok

Change-Id: Icfda17c5004d291c664ed80d578aca4b7cf4a975
Signed-off-by: liulvping <liulvping@xiaomi.com>
ackageManagerService.java
11f214d8f3b52dccb231990b5ac04c1e0f05617b 06-Dec-2017 Bo Hu <bohu@google.com> Revert "Add odm sepolicy support to SELinuxMMAC.java"

This reverts commit fffa6d238a31ac5e7b30a6e1d852c8c2cc22af1d.

Reason for revert: broke mac build

b/70273082

FAILED: out/target/product/generic_x86/obj/ETC/vendor_sepolicy.cil_intermediates/vendor_sepolicy.cil
/bin/bash -c "(out/host/darwin-x86/bin/version_policy -b out/target/product/generic_x86/obj/FAKE/selinux_policy_intermediates/plat_pub_policy.cil -t out/target/product/generic_x86/obj/ETC/vendor_sepolicy.cil_intermediates/vendor_policy_raw.cil -n 10000.0 -o out/target/product/generic_x86/obj/ETC/vendor_sepolicy.cil_intermediates/vendor_sepolicy.cil.tmp ) && (grep -Fxv -f out/target/product/generic_x86/obj/ETC/plat_pub_versioned.cil_intermediates/plat_pub_versioned.cil out/target/product/generic_x86/obj/ETC/vendor_sepolicy.cil_intermediates/vendor_sepolicy.cil.tmp > out/target/product/generic_x86/obj/ETC/vendor_sepolicy.cil_intermediates/vendor_sepolicy.cil ) && (out/host/darwin-x86/bin/secilc -m -M true -G -N -c 30 out/target/product/generic_x86/obj/ETC/plat_sepolicy.cil_intermediates/plat_sepolicy.cil out/target/product/generic_x86/obj/ETC/plat_pub_versioned.cil_intermediates/plat_pub_versioned.cil out/target/product/generic_x86/obj/ETC/10000.0.cil_intermediates/10000.0.cil out/target/product/generic_x86/obj/ETC/vendor_sepolicy.cil_intermediates/vendor_sepolicy.cil -o /dev/null -f /dev/null )"
Parsing out/target/product/generic_x86/obj/FAKE/selinux_policy_intermediates/plat_pub_policy.cil
Parsing out/target/product/generic_x86/obj/ETC/vendor_sepolicy.cil_intermediates/vendor_policy_raw.cil
grep: out of memory

Change-Id: I186f7bc68a76d7b2d717875791ee2fe1828c3598
ELinuxMMAC.java
388cd5fffe7564ae364776d7f557e3a301387840 05-Dec-2017 Calin Juravle <calin@google.com> Rename snapshotProfile to createProfileSnapshot for consistency

Test: build
Bug: 30934496
Change-Id: I602262d22509b279383ff2a71e38c8bae059498a
nstaller.java
fd9f8ae973122a50f336e38c386ecbc0095d8adc 30-Nov-2017 Calin Juravle <calin@google.com> Implement ArtManager#snapshotProfile API

Complete the implementation of ArtManager#snapshotProfile. The snapshot is
performed by calling the installer and then return to the caller via the
specified callback.

Bug: 30934496
Test: gts-tradefed -m GtsAndroidRuntimeManagerHostTestCases
Change-Id: I87131487846d91d79a56041445420376b61ca8e7
nstaller.java
ackageManagerService.java
ex/ArtManagerService.java
9e33289902f160fd91d2952632f5407f3e33284a 06-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Adds metadata to InstantAppResolveInfo"
709ee1551db935adb2026fae9dd799e60f784499 05-Dec-2017 Patrick Baumann <patb@google.com> Adds metadata to InstantAppResolveInfo

This change introduces a metadata Bundle to the InstantAppResolveInfo
type to be passed along to the Instant App installer in the case of
resolution. This can be used by the resolver and installer to improve
launch by avoiding IPC to fetch needed data that lives in the resolver.

Change-Id: I0b9c168dd8803f5398d222384ebd436c787e1a48
Fixes: 68223794
Test: manual - modified resolver to populate data, verified in installer
nstantAppResolver.java
04337a632308cd11a72b34d6e296c0962be11458 06-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix inadvertent paste in the middle of a comment."
7742160e39096d5f94c22992d404170931f72854 06-Dec-2017 kaichieh <kaichieh@google.com> Merge "Add odm sepolicy support to SELinuxMMAC.java" am: a0c52a8ace am: 5f2f65239b
am: 89720a2c83

Change-Id: I60d8ce635f3e1a4c3eac9f7fd1c1ecb2adc86c33
89720a2c83bdffe00f58e4074dda040baad05bea 06-Dec-2017 kaichieh <kaichieh@google.com> Merge "Add odm sepolicy support to SELinuxMMAC.java" am: a0c52a8ace
am: 5f2f65239b

Change-Id: Ib09918bd84ae40701b30aebe31ef71ffeecdea7e
5f2f65239b4883bfa563b5ddac3d098d509f1939 06-Dec-2017 kaichieh <kaichieh@google.com> Merge "Add odm sepolicy support to SELinuxMMAC.java"
am: a0c52a8ace

Change-Id: I5cc7ab8916901e1b3622a17676debe023578f1eb
a0c52a8acec8714917c52fdb72d514895feaa4c3 06-Dec-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "Add odm sepolicy support to SELinuxMMAC.java"
8cb0cf0aa9794136ded49cf19802af8e6b6d5ebb 06-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow caller to specify target to start in setQuietModeEnabled"
8ac4f724af73f3194fe6c4173ff1ab2fe293739b 06-Dec-2017 Donald Chai <dchai@google.com> Fix inadvertent paste in the middle of a comment.

Change-Id: I62f574379dcf51f42ea8d0705e273f931c0a430e
Test: N/A
ackageManagerService.java
d5b9266f013f917dc314bb2151164a5a752fa548 05-Dec-2017 Dianne Hackborn <hackbod@google.com> Merge "Add major version code to platform."
d3392daa3bec3ed4986c1e3e5714f379537793ae 05-Dec-2017 Calin Juravle <calin@google.com> Merge "Add SystemApis to expose runtime profile information"
64fd8c0bdd6d9304562f22ba87a864733b0da183 01-Dec-2017 Tony Mak <tonymak@google.com> Allow caller to specify target to start in setQuietModeEnabled

So, UMS can start the target once user is unlocked.

Test: No secure lock. Try turn off and on work mode by tapping work app.
Test: Have secure lock. Try turn off and on work mode by tapping work app.
Test: Turn off work mode. Reboot. Try to tap on any work app to turn on work mode.

BUG:69926710

Change-Id: Iaaccd5d763f7e36e5a43bad5261f1eb16060f9d6
serManagerService.java
7780e80d2ae47bac582548ad9837e47d4e726e9e 05-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Sends resolving action to Instant App installer"
b4165d7267cd298df20257dd8f9991fc056e5847 04-Dec-2017 Patrick Baumann <patb@google.com> Sends resolving action to Instant App installer

This change adds the action being resolved to an installing Instant
App to the installer so it may increase friction for untrusted or
potentially dangerous sources (NFC, nearby, etc.)

Change-Id: If6c47a219e4ddf453fb406e2b212b024aa24ade6
Fixes: 63102749
Test: manual - debugged the ephemeral installer to ensure extra
nstantAppResolver.java
45f8b29ce0ca9f80c586850c4be3a1e552bc6c2f 08-Nov-2017 Calin Juravle <calin@google.com> Add SystemApis to expose runtime profile information

The API allows a system apps which acquired
{@code android.permission.READ_RUNTIME_PROFILE} to snapshot the runtime
profiles of installed packages.

The API is implemented in a new service class (AndroidRuntimeManager)
accessible from the context using
context().getPackageManager().getAndroidRuntimeManager().

The main functionality is exposed as a one way call into the
AndroidRuntimeManager with the result being posted on a callback. The
profile is available to the caller as a read-only ParcelFileDescriptor.

This CL only adds the API interfaces and validation. It does not fully
implement the functionality.

oneway void snapshotRuntimeProfile(in String packageName,
in String codePath, in ISnapshotRuntimeProfileCallback callback)

Bug: 30934496
Test: gts-tradefed -m GtsAndroidRuntimeManagerHostTestCases

Change-Id: Iaa6be4715840f24508acba3162ea9c1ab725bd38
ackageManagerService.java
ex/ArtManagerService.java
3d68f53d6df439b209418bad3b249bd260456dad 04-Dec-2017 Todd Kennedy <toddke@google.com> Broadcast lifecycle events for instant apps

Originally, lifecycle events weren't being broadcast for instant
applications. This was done to prevent leaking the fact that
certain instant applications were installed [and thus exposing
web browsing history]. However, this breaks parts of the system
that rely on the broadcasts in order to change internal structure.

We now broadcast all of the lifecycle events for instant applications,
but, require the receiver to hold the permission ACCESS_INSTANT_APPS.
This permission is only given to the installer, verifier or the
system itself.

Change-Id: Ic008964db2ce1aa9e9c69351fd919a2244a94592
Fixes: 69558578
Test: bit FrameworksServicesTests:com.android.server.pm.
ackageManagerService.java
3accca05ddcad9d0b1b313eae49f273e39121d3c 20-Sep-2013 Dianne Hackborn <hackbod@google.com> Add major version code to platform.

It turns the version code into almost a 64-bit integer, with the
new major part being the upper 32 bits.

The only tricky part about this is the backup manager, since it
stored 32-bit version codes in its backup data sets. This is dealt
with by, when the major version code is not 0, writing MIN_INT as
the version code and following that by the full long version code,
which we can detect when reading. Note that this makes backup sets
containing apps with major version codes incompatible with older
versions of the platform.

Bug: 64459786
Test: Added in Change-Id: Iab8a682b62103babd6c16a56b8dc1e97d7078658
Change-Id: Ibfffe235bbfcf358b3741abd3f7197fdb063d3f3
nstantAppResolver.java
ackageInstallerSession.java
ackageManagerService.java
ackageManagerShellCommand.java
ackageSetting.java
ackageSettingBase.java
ettings.java
hortcutPackage.java
hortcutPackageInfo.java
hortcutPackageItem.java
a933349be06e4616b99bffe1c6b3b9e7ec27516c 29-Nov-2017 Patrick Baumann <patb@google.com> Makes adb install -r the default behavior

This change ignores the -r indicator and only enforces that the
install be non-replacing when the -R flag is provided.

Change-Id: I9034ca06acbdaa99b458d4e6d8c3b379582b2bf0
Fixes: 30566724
Test: manual - ensured -r replaces and -R does not
ackageManagerShellCommand.java
70de9728d22f017be27da5b439222f2e344fe3d2 04-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes from topic "priv_vendor_app"

* changes:
BIND_IMS_SERVICE is exposed to vendors
Support privileged vendor apps
c5533865eb56433f884ddf6ce003c2028e7c7013 02-Dec-2017 wangmingming1 <wangmingming1@xiaomi.com> Merge "Prevent system app upgrading from multi-arch to single-arch" am: 5cac6ed047 am: 58a0809802
am: 791507db22

Change-Id: I3e0605d8d6e9dcc6ecc68bb7af58afc3ee8f7b33
791507db2293a4118b407e77b205b35cd95432f5 02-Dec-2017 wangmingming1 <wangmingming1@xiaomi.com> Merge "Prevent system app upgrading from multi-arch to single-arch" am: 5cac6ed047
am: 58a0809802

Change-Id: I406ed219fcf24745bde9c7fe45570d62378fbd85
58a0809802cf4cd05de77bf44bcf937bdf27760d 02-Dec-2017 wangmingming1 <wangmingming1@xiaomi.com> Merge "Prevent system app upgrading from multi-arch to single-arch"
am: 5cac6ed047

Change-Id: I0e7c6fbea14dcf401076994fa53b9ce66324bb4a
03b74909efb0f613b9b3eaca698c55c6f7a163f8 21-Nov-2017 wangmingming1 <wangmingming1@xiaomi.com> Prevent system app upgrading from multi-arch to single-arch

We should not let user to manully upgrade a system app which supports
multi-arch to a newer version which supports only one cpu abi. Take
webview as an example, if the user upgraded the webview to a version
supports only armeabi-v7a on Nexus 5X by mistake, then any app supports
only arm64-v8a and uses webview to display web contents would not work
properly then as loading a 32bit native lib inside a 64bit mode process
is not allowed.

Test: Manual

Change-Id: I567be7707fc18421ff686c1e8b1110dec517e06d
Signed-off-by: wangmingming1 <wangmingming1@xiaomi.com>
ackageManagerService.java
74964ffb8a5ba2415d5ca3fad6384aeda2de3392 01-Dec-2017 Calin Juravle <calin@google.com> Merge changes I80504f43,Ifc372eef am: de7be840a7
am: 991da81069

Change-Id: I7adfdd87dc63d5ab3a34e152cf1066f4498036e8
991da81069ce3c33783916f4a32aaf9d53a9c4e1 01-Dec-2017 Calin Juravle <calin@google.com> Merge changes I80504f43,Ifc372eef
am: de7be840a7

Change-Id: Id86c979498e13f5e382c5a448becee8f7bfe72f0
de7be840a78e479c790f8d528a802d7837dbffe9 01-Dec-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge changes I80504f43,Ifc372eef

* changes:
Fix package install flow w.r.t. dexopt
Do not apply app-link autoVerify policy to instant app installs
216d1748686a0f355babdc842ba29d69ffe6013a 29-Nov-2017 Patrick Baumann <patb@google.com> Fixes NPE when system update couldn't be parsed

Change-Id: I9034ea2e9411dff79657b86fbfd2418c073621ea
Fixes: 67235938
Test: manual - update system with already installed app and reboot
ackageManagerService.java
b4236711af8950402a1947de807d4220eed0f2da 16-Nov-2017 Calin Juravle <calin@google.com> Fix package install flow w.r.t. dexopt

Calling dexopt before the applicationInfo gets the uid is wrong.
Dexopt needs to be able to set the GID of the odex file to the
UserHandle.getSharedAppGid(pkg.applicationInfo.uid) and that is
possible only with a valid uid.

Move the dexopt logic after installNewPackageLIF/replacePackageLIF
to ensure that we get a valid uid.

Bug: 69331247
Test: adb install & check the GID of the compiler artifacts

(cherry picked from commit c6540daf8388ce1ebd2e4157ec70b9651ae14b4f)

Merged-In: I2434a1a0b9015091a9af2009b3f785b7a16e1256
Change-Id: I80504f434e1507f30f366d1122224ff959bec4a1
ackageDexOptimizer.java
ackageManagerService.java
d5d79a9f0d5fc62c6d2a110ec2b0d16513336b27 05-Oct-2017 Christopher Tate <ctate@google.com> Do not apply app-link autoVerify policy to instant app installs

Bug: 66698768
Test: manual

(cherry picked from commit 05941b396a44bd81c143b727e5c4c630212228e0)

Merged-In: Ib9bea22bf8096e708eef93934e0e972be3a2a4c5
Change-Id: Ifc372eef9bc2a140b9252c85f9be0c2ff9cdbb4c
ackageManagerService.java
f01dd5e6261b032fb0728fafc595e6c8dff0610f 30-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix package install flow w.r.t. dexopt"
3dd076b065c2fcf95d963288d09effb635f966e1 30-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow secondary user POs on affiliated devices more DPM APIs"
dabae88659901d135ef807bff5dec49d86f91961 08-Aug-2017 Benjamin Franz <bfranz@google.com> Allow secondary user POs on affiliated devices more DPM APIs

- DevicePolicyManager.setKeyguardDisabled
- DevicePolicyManager.setStatusBarDisabled
- DevicePolicyManager.setDeviceOwnerLockScreenInfo
- PackageInstaller install and uninstall apps

Bug: 64383519
Test: Can set keyguard disabled, status bar disabled and lock screen message in
affliated PO
Test: Can install and uninstall apps in affiliated PO
Test: CTS tracked in b/68925683

Change-Id: I71be25098436ba0b42050478c049850c2b21f6f4
ackageInstallerService.java
ackageInstallerSession.java
002fdbdb950ebbf40331a27de33b80db33e40d30 13-Feb-2017 Jiyong Park <jiyong@google.com> Support privileged vendor apps

Privileged apps can now be located in the vendor partition. This is
mainly to move SoC-dependent apks to the vendor partition so that the
system partition becomes more generic.

Like existing privileged apps in the system partition, the list of
privileged apps in the vendor partition and the permissions they are
using must be white-listed. The whitelist can be specified via
<privapp-permissions> tags in one of /vendor/etc/permissions/*.xml
files. Note: vendors can only white-list the apps in vendor partition,
but not the apps in system partition.

This change also introduces a new flag 'vendor-privileged' to the
permission protection level. It is used to expose platform-defined
permissions to the privileged vendor apps. If a platform permission does
not have this flag, it is not granted to vendor apps even when the app
is privileged and white-listed.

Bug: 35301609
Test: `mm` under frameworks/base/tests/privapp-permissions
adb sync && adb reboot
adb shell cmd package \
com.android.framework.permission.privapp.tests.vendor
shows that the app is installed.
android.permission.BIND_IMS_SERVICE is in the installed permissions list
android.permission.MANAGE_USE is not in the installed permissions list,
but is in the requested permissions list.

Change-Id: I196375aaaa9ea3a2ba15686ef08cf3f70ade7046
ackageManagerService.java
ackageManagerShellCommand.java
ackageSetting.java
ettingBase.java
ettings.java
ermission/BasePermission.java
ermission/PermissionManagerService.java
c6540daf8388ce1ebd2e4157ec70b9651ae14b4f 16-Nov-2017 Calin Juravle <calin@google.com> Fix package install flow w.r.t. dexopt

Calling dexopt before the applicationInfo gets the uid is wrong.
Dexopt needs to be able to set the GID of the odex file to the
UserHandle.getSharedAppGid(pkg.applicationInfo.uid) and that is
possible only with a valid uid.

Move the dexopt logic after installNewPackageLIF/replacePackageLIF
to ensure that we get a valid uid.

Bug: 69331247
Test: adb install & check the GID of the compiler artifacts
Change-Id: I2434a1a0b9015091a9af2009b3f785b7a16e1256
ackageDexOptimizer.java
ackageManagerService.java
3e654843d55a292b337eb661389fb44e05a6e7a7 29-Nov-2017 Todd Kennedy <toddke@google.com> Fix if clauses

During a refactor, we introduced updated the method used to
verify signatures. The "&& additionalTest" clauses were added
to the wrong if statement [off-by-one]. So, we were performing
a compat signature check when we shouldn't and not throwing
an exception when we should.

Change-Id: Ie479be5b254b9b13451ab07a07d20a68c7b828ad
Fixes: 69053002
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AppSecurityTests#testSharedUidDifferentCerts
ackageManagerServiceUtils.java
96cb94bab4d366fa3f9c90b162482d750debbe37 29-Nov-2017 Todd Kennedy <toddke@google.com> Update error text

Text was updated to be slightly more readable, but, wound up breaking
the tests. Reverting the word change.

Change-Id: I299245fc05f15ff6f7979c4c0365fe885b3c2e15
Fixes: 69056838
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.PkgInstallSignatureVerificationTest#testCorrectCertUsedFromPkcs7SignedDataCertsSet
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.PkgInstallSignatureVerificationTest#testV1SchemeSignatureCertNotReencoded
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.PkgInstallSignatureVerificationTest#testV2SchemeSignatureCertNotReencoded
ackageManagerServiceUtils.java
fffa6d238a31ac5e7b30a6e1d852c8c2cc22af1d 31-Aug-2017 kaichieh <kaichieh@google.com> Add odm sepolicy support to SELinuxMMAC.java

Currently there are two mac permission files:
- /system/etc/selinux/plat_mac_permissions.xml
- /vendor/etc/selinux/nonplat_mac_permissions.xml

The change renames nonplat_mac_permissions.xml to vendor_mac_permissions.xml.
It also adds odm_mac_permissions.xml but allows it to be optional:
- /system/etc/selinux/plat_mac_permissions.xml
- /vendor/etc/selinux/vendor_mac_permissions.xml
- /odm/etc/selinux/odm_mac_permissions.xml (optional)

Also cleans up comments to reflect the change.

Bug: 64240127
Test: boot sailfish normally without odm
Test: boot another device having odm
Change-Id: I9c8cb6feb9ee51d6fe83e324bc05aebaa10b4a24
ELinuxMMAC.java
ddaaf4cf483d392e78a31885a410dc9dcaf646c4 07-Nov-2017 Todd Kennedy <toddke@google.com> Remove scanFile argument

In several locations we were passing both a parsed Package object
and a scanFile File object. But, the Package object was parsed from
the scanFile! Instead, just pass the singular Package object and
pull the scanned file from it.

Bug: 63539144
Test: bit FrameworksServicesTests:com.android.server.pm.
Change-Id: Ibd200fb567e005869de61d9c123f211fa9a38f0a
ackageManagerService.java
ackageManagerServiceUtils.java
ettings.java
2b0b50d25657078ed22430069ae13cb34eecd9d1 20-Nov-2017 Alan Stokes <alanstokes@google.com> Add unit tests for DexLogger.

Bug: 63927552
Test: runtest frameworks-services -c com.android.server.pm.dex.DexLoggerTests --install=".*FrameworksServicesTests.apk"
Change-Id: I5f775b5309060c78cb6aaf0c28c4aa777ff11e8e
ex/DexLogger.java
a732f014c5743af0dbb7eb2e63474a7147576f9d 27-Oct-2017 Christopher Tate <ctate@google.com> The job scheduler now backs off jobs based on standby bucketing

The default parameters here translate to roughly this rate limiting:

ACTIVE: run jobs whenever
WORKING: ~ hourly
FREQUENT: ~ every 6 hours
RARE: ~ daily

Bug: 63527785
Test: cts & manual (WIP)
atest CtsJobSchedulerTestCases
Change-Id: I58f8e53e5bdf40601823e5a10a9f2383a6f67ae5
ackageManagerService.java
916c83d2271d6d536e3ca2ea2b57892d9a15470c 22-Nov-2017 Todd Kennedy <toddke@google.com> Merge "Make sense out of scan & parse flags"
232d29e0cdfd906da6b23c328c132bfc30607142 06-Nov-2017 Todd Kennedy <toddke@google.com> Make sense out of scan & parse flags

Parse flags are often used confusingly to control policy during
APK parsing. Additionally, some flags [such as PARSE_IS_PRIVILEGED
or PARSE_IS_SYSTEM] aren't always determined based upon APK location
[they change based upon which apps are installed]. This means we
have to perform some gymnastics to set them correctly _before_
parsing a package.

Instead, these should be scan flags that can be determined at a
later point during package parsing. Then, based upon the scan flag
we apply policy on the package object to create the resulting
data structures.

Bug: 63539144
Bug: 69663125
Test: Manual; it builds, runs and applications can be installed / removed
Test: bit FrameworksServicesTests:com.android.server.pm.
Change-Id: I53fb18e58544e0a39f35eb6fb53c950e5c696aee
ackageManagerService.java
780482475c189792d482dff2d35dc732d7b3bd87 22-Nov-2017 tiansiming <tiansiming@xiaomi.com> Merge "Avoid clearing default browser setting when unnecessary" am: ef32746fc5 am: 3ee9594a27
am: 3c59e35788

Change-Id: Ifd4dcbc6f3ea6473ff212ad46bb8dc8197e3e35d
3c59e3578862c8a5d59319870e25b9a346725894 21-Nov-2017 tiansiming <tiansiming@xiaomi.com> Merge "Avoid clearing default browser setting when unnecessary" am: ef32746fc5
am: 3ee9594a27

Change-Id: If8d39e9cb350861913deda62b1351d8a4e52607a
3ee9594a27d05a2310ace3ceb9434d85a3108388 21-Nov-2017 tiansiming <tiansiming@xiaomi.com> Merge "Avoid clearing default browser setting when unnecessary"
am: ef32746fc5

Change-Id: I647c96b9a96612c4745e6ebec5d44cebd6d42767
ef32746fc527f69b3a4b2ef89b63844b3406e509 21-Nov-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "Avoid clearing default browser setting when unnecessary"
bcfa5f7fab54beee633f60949b8841a51daa8b49 21-Nov-2017 Andreas Gampe <agampe@google.com> Merge "PackageManager: Extend cmd interface feedback" am: d66bc0aaae
am: 362a3b9e2a

Change-Id: I7b3ba7adde559c66ed9b8c02d5dd8134a9aa2b38
362a3b9e2a831f81ec8c8858e77772c127935eca 21-Nov-2017 Andreas Gampe <agampe@google.com> Merge "PackageManager: Extend cmd interface feedback"
am: d66bc0aaae

Change-Id: Ic89e1e9e4b5e250bc867d288cf4870690926248c
9253eeadbd6323a7f5accc7ba86e6bd224c9e848 21-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "The pm command is no more."
1704e3cf0c445512f0a9644485dd3449e874556b 31-Oct-2017 Dianne Hackborn <hackbod@google.com> The pm command is no more.

It is now just a shell of itself. :)

Also brings in a few fixes to never try to open files from the system
process.

Test: manual
Change-Id: Ia8187196af597046fd2e7092dbf19ce1dc1ea457
ackageManagerShellCommand.java
df0673c953139275180b567e3431dbc6ffe25f91 21-Nov-2017 Andreas Gampe <agampe@google.com> PackageManager: Extend cmd interface feedback

When running cmd package compile -a, print the progress, as this
may be a long-running operation.

Test: m
Test: manual
Merged-In: Ic5c8123f972656b722da882d6a19d555b8c60832
Change-Id: Ic5c8123f972656b722da882d6a19d555b8c60832
ackageManagerShellCommand.java
cbd08d45f20cc7dca0bb30c66bd62a552c1d06db 21-Nov-2017 Andreas Gampe <agampe@google.com> PackageManager: Extend cmd interface feedback

When running cmd package compile -a, print the progress, as this
may be a long-running operation.

Test: m
Test: manual
Change-Id: Ic5c8123f972656b722da882d6a19d555b8c60832
ackageManagerShellCommand.java
a0023604ddaeef34049f1a245be7c42a66a7d0e8 16-Oct-2017 Alan Stokes <alanstokes@google.com> Log SHA256 of secondary dex files during reconcile.

Bug: 63927552
Test: Exercised manually. Added unit test for DexManager.

Change-Id: Ic8e9ea4da8eb5c22fbe088a59a406e36bc2eb6fa
nstaller.java
ackageManagerService.java
ex/DexLogger.java
ex/DexManager.java
0f02aeb66c1d97be773f105ac78c9c6e606e935c 18-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow "cmd package bg-dexopt-job" to take a list of package names"
09dd1ec4b2dedb862b6276763268380ec037a58e 15-Sep-2017 Arthur Eubanks <aeubanks@google.com> Allow "cmd package bg-dexopt-job" to take a list of package names

Modify "cmd package bg-dexopt-job" to accept an optional list of
packages to run bg-dexopt on to help with testing.

Test: make && flashall && automated tests (ag/2959616)
Test: adb shell cmd package bg-dexopt-job
Test: adb shell cmd package bg-dexopt-job pkg_name

BUG: 64807719
Change-Id: Ibf1fda88810dd4ec19fbbfe3322c35b201727707
ackgroundDexOptService.java
ackageManagerService.java
ackageManagerShellCommand.java
a6b3dc3c42062da6d5c93b0fa46d84353515e6fb 17-Nov-2017 Calin Juravle <calin@google.com> Merge "Workaround to get passed the broken install flow" am: b0e6508a5b
am: af657ae978

Change-Id: I57ba9c85e4d5b4e301cb14ba068430c4454a4978
af657ae978d04445d15c66f82cac5eb420f7e616 17-Nov-2017 Calin Juravle <calin@google.com> Merge "Workaround to get passed the broken install flow"
am: b0e6508a5b

Change-Id: Icbad0d985b4d8d3e206ee5e426cdd1f58955aec1
b0e6508a5b1ededcdb335e659d6b5109c86fd77f 17-Nov-2017 Calin Juravle <calin@google.com> Merge "Workaround to get passed the broken install flow"
db968d20857b9e4ad499eea7858402282bdadad3 17-Nov-2017 Jakub Pawlowski <jpawlowski@google.com> Merge "Add getProfileParentId (1/2)" am: 7a2c66359a am: b6946d8563
am: 447e453e58

Change-Id: Idd087f45d5fba325f347a8bb0391745ccd0593a0
447e453e587eb095ef1be2ad3410cfb9931d079b 17-Nov-2017 Jakub Pawlowski <jpawlowski@google.com> Merge "Add getProfileParentId (1/2)" am: 7a2c66359a
am: b6946d8563

Change-Id: I3fe6f4300c9321fc57479fc4a9e952d2aa0c73cc
b6946d8563f7f1002ef597868ce2b27fe5b4ff66 17-Nov-2017 Jakub Pawlowski <jpawlowski@google.com> Merge "Add getProfileParentId (1/2)"
am: 7a2c66359a

Change-Id: Iea965e42bb79f939381971e8dd9466b824606ee0
5f44aa798bdfdaf219e01447743ee2204a9de46b 16-Nov-2017 Jeff Sharkey <jsharkey@android.com> Workaround to get passed the broken install flow

For fresh installs the PM does not set the app uid before invoking
dexopt; so we would always get a bogus GID.

This is a temporary workaround which fixes the GID of newly
installed apps to an arbitrary UNKNOWN gid.

Test: adb install
Bug: 64548938
Bug: 69331247

(cherry picked from commit a73e165c2ea0bb6499b89dd335d6ef878c92b8e9)

Change-Id: I6438ec8cfca88df813e166f9ef5821e62faf524a
ackageDexOptimizer.java
a73e165c2ea0bb6499b89dd335d6ef878c92b8e9 16-Nov-2017 Jeff Sharkey <jsharkey@android.com> Hack.

Test: none
Bug: 69331247
Change-Id: I65807b7e8994746a80e06a8530d9aeb967ea04ca
ackageDexOptimizer.java
0f1f5b79530e6dbdc7bd66ebf49fe05e4ea3a763 15-Nov-2017 Jakub Pawlowski <jpawlowski@google.com> Add getProfileParentId (1/2)

Bluetooth service needs to natively access id of parent profile. Add
method exposing it.

Test: cts-tradefed run cts-dev -m DevicePolicyManager --test
com.android.cts.devicepolicy.ManagedProfileTest#testBluetooth
Bug: 69284968
Change-Id: I697906f2959b0736c1d3cc6af7560c27d77ce11b
serManagerService.java
07201a792257fee77287c280919c5a6c5ad0a8dd 15-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Enforce REQUEST_DELETE_PACKAGES for PackageInstaller.uninstall()"
d9bb39abdfeb62c36edee7e5e6a155e5d611eea3 05-Sep-2017 Philip P. Moltmann <moltmann@google.com> Enforce REQUEST_DELETE_PACKAGES for PackageInstaller.uninstall()

Fixes: 64576642
Test: Uninstalled apps
Change-Id: Ia7f3c047bb9c725228ca45e4c34e51a2d9177120
ackageInstallerService.java
220871a697290529278ed16db508eda8e12f3fc7 14-Nov-2017 Xin Li <delphij@google.com> Merge commit '98e12851336b7db16e583f9afac63ecc97465980' from
oc-mr1-dev-plus-aosp-without-vendor into stage-aosp-master.

Change-Id: Ia7b8da4a00d215160e4a4fa40f6044208d1297b7
Merged-In: I19846d2a3ee27aecbae2367a74ee49082eea154d
a379f499c8e27d2c18b7089feb18c7f0a44e0433 14-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow assistant app to access any shortcuts"
2a64dbce69cbea3a79c153596faa1bdd1de5f6eb 14-Nov-2017 Fyodor Kupolov <fkupolov@google.com> Merge "Additional System APIs for restricted profiles"
2dd2cbcb12a21adccd3c349590a01e7ed009f679 13-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Sync PRIV_APP_OOB_ENABLED setting to pm.dexopt.priv-apps-oob"
12633114d97c425c4d974efa075ab20ee11f1345 07-Nov-2017 Victor Hsieh <victorhsieh@google.com> Sync PRIV_APP_OOB_ENABLED setting to pm.dexopt.priv-apps-oob

The settings value is used as a proxy for server side experiment to
populate configuration to the device. This is only for experiment and
should be removed later.

Test: adb shell settings put global priv_app_oob_enabled 0
# saw pm.dexopt.priv-apps-oob changed to false
Test: adb shell settings put global priv_app_oob_enabled 1
# saw pm.dexopt.priv-apps-oob changed to true
Bug: 67415855
Bug: 63920015

Change-Id: I4eb2beb14cd2c86c4bfc439d9742e95d3aba45a9
ackageManagerService.java
3bba35111e844fbc906255e2dead386a96520ae4 13-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Introduce CrossProfileApps API"
e465e608e41dde7716aa2437aad0b5cdc2d73a03 10-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Change pm.dexopt.priv-apps to .priv-apps-oob"
cf0583e2290bd21e443d82c659363c2273e583c8 09-Nov-2017 Victor Hsieh <victorhsieh@google.com> Change pm.dexopt.priv-apps to .priv-apps-oob

Other than the renaming, the meaning is now opposite.

(cherry-picked from aosp/533101)

Test: build
Bug: 67415855
Bug: 63920015

Change-Id: I349c0b233079b5958e4a308d6c7ad9b3a54f157a
(cherry picked from commit 66a285d9d7afe197a5a562525641400db80edcef)
ackageDexOptimizer.java
ackageManagerService.java
ca1775623e811d2921969bc477ee5967d650b0e5 10-Nov-2017 Fyodor Kupolov <fkupolov@google.com> Additional System APIs for restricted profiles

- isRestrictedProfile - whether the caller is running
as restricted profile.
- hasRestrictedProfiles - whether the calling user has at least one
restricted profile associated with it.

Bug: 64122169
Test: UserManagerTest
Change-Id: I178b02a48abc32e126613e0320c4950f455364df
serManagerService.java
66a285d9d7afe197a5a562525641400db80edcef 09-Nov-2017 Victor Hsieh <victorhsieh@google.com> DO NOT MERGE Change pm.dexopt.priv-apps to .priv-apps-oob

Other than the renaming, the meaning is now opposite.

Test: build
Bug: 67415855
Bug: 63920015

Change-Id: I349c0b233079b5958e4a308d6c7ad9b3a54f157a
ackageDexOptimizer.java
ackageManagerService.java
fde6ea8d29da5f9c6b321df64c8f0722d1173586 09-Nov-2017 Christine Franks <christyfranks@google.com> Merge "Add DISALLOW_CONFIG_LOCALE user restriction"
922b13a4a828418f8a63728becb272aee857cf6f 09-Nov-2017 Andreas Gampe <agampe@google.com> Merge "Revert "PMSCompilerMapping: Hardcode a value for pm.dexopt.inactive"" am: 08efd36872 am: 8249a5d677
am: e640dd1fd8

Change-Id: I7cc9deb80122ca587d5c711fd84ad8c217aaa438
e640dd1fd8189f88a7ea05723fb8afe861db9ada 09-Nov-2017 Andreas Gampe <agampe@google.com> Merge "Revert "PMSCompilerMapping: Hardcode a value for pm.dexopt.inactive"" am: 08efd36872
am: 8249a5d677

Change-Id: I28aa38d66ab9c59c269157aff71edec5bd440942
08efd36872e0dd671f420b324af6f125ec21d060 09-Nov-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "Revert "PMSCompilerMapping: Hardcode a value for pm.dexopt.inactive""
35559d6125045a38a01ba30a32f7ca36abfeebac 07-Nov-2017 Makoto Onuki <omakoto@google.com> Allow assistant app to access any shortcuts

Bug: 68760723
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutManagerTestCases
Change-Id: I8c0f0ba1f01c1da7df44bb235abdaa94c36d86d3
hortcutPackage.java
hortcutService.java
42e0ab0651f0bcaf4dc9750ac3dbcff8f3d7591c 08-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Create a new user restriction to disallow user switching"
ac4e8f325e18124456b75b9490a85922ec4a8191 08-Nov-2017 Andreas Gampe <agampe@google.com> Merge "Revert "PMSCompilerMapping: Hardcode a value for pm.dexopt.shared"" am: f597ad5106 am: 41c52377ed
am: 1fb4c9a48a

Change-Id: If003333607b55f06bc6e2324464bf2195861278d
1fb4c9a48a47d2eff40762f305475ca05a970e87 08-Nov-2017 Andreas Gampe <agampe@google.com> Merge "Revert "PMSCompilerMapping: Hardcode a value for pm.dexopt.shared"" am: f597ad5106
am: 41c52377ed

Change-Id: I9058f70565327fe772b966a2fc3d55f187e267a2
5583adf1bc2513bbf0cdf2714da6ba5d71731e7c 08-Nov-2017 Andreas Gampe <agampe@google.com> Revert "PMSCompilerMapping: Hardcode a value for pm.dexopt.inactive"

This reverts commit 84bf6b809d5b1d80137f1653ab2346ebe0b08ca6.

Reason for revert: ART default properties are now in /system.

Bug: 68755013
Change-Id: I8f13fbb3afe91da54afafbafc758df4e194def11
ackageManagerServiceCompilerMapping.java
f597ad51064eebbf65936c21e1f0c4831790a001 08-Nov-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "Revert "PMSCompilerMapping: Hardcode a value for pm.dexopt.shared""
1b55ccb1b2131c10b125c6c041ee15f67151ee0f 08-Nov-2017 Andreas Gampe <agampe@google.com> Revert "PMSCompilerMapping: Hardcode a value for pm.dexopt.shared"

This reverts commit e131dac848cb4d0998e1dee2219382250c71d277.

Reason for revert: ART default properties are now in /system.

Bug: 68755013
Change-Id: I32d938abb73c8d8df74716ede8032d9874086fda
ackageManagerServiceCompilerMapping.java
ff66fa9ef2e12654b5869cae844a9747dfc441eb 10-Aug-2017 Benjamin Franz <bfranz@google.com> Create a new user restriction to disallow user switching

For multi-user session implementation, we want to block the user from
going back to user 0. Therefore, we block the user switcher in the
secondary user, as well as swtiching via user section in Settings app.

Bug: 64382189
Test: Manually verify user switcher is not displayed in QuickSettings
Test: Manulaly verify not able to remove or switcher user in user
section in Setting app
Change-Id: I84bc9e67e3fe7fccb75edf0fc49b775b902f5290
serRestrictionsUtils.java
d72e3a66daec08050cadec9be1d7671358db5e84 06-Nov-2017 Todd Kennedy <toddke@google.com> Merge "Move code"
d477903f19888cd163b4a7434ff11e593b0b01ed 05-Nov-2017 tiansiming <tiansiming@xiaomi.com> Avoid clearing default browser setting when unnecessary

If the priority parameter of a browser app's intent-filter in Manifest
is less than 0, it can not be selected by user. So it shoult not clear
default browser settings.

Bug: Install more than one browser apps, and pick one as default,
then install com.taobao.taobao. Default settings will be cleared.
Test: N/A

Change-Id: Ib24d80a025ae848cb90ada436cf65bf8cbed785f
Signed-off-by: tiansiming <tiansiming@xiaomi.com>
ackageManagerService.java
c7acb439bb980732d401a775736e79322ebfd837 03-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Use multi-field logs to log permissions"
145993eb25cceb9a463dad0c6a4ddc55d05f401d 05-Sep-2017 Shubham Ajmera <shubhamajmera@google.com> Handle '&' in DexoptUtils#encodeClassLoader

For system apps, we pass '&' for CLC.
The method was treating this as a path as a result we were getting
wrong encoding for CLC.
This was causing dexopt failures for A/B OTA.

Removed the secondary dex file dexopt till we fixed it.

(cherry picked from commit 727aaa36b6914be3f340c97c991c93314d25c617)

Bug: 65067046
Test: runtest.py -x \
frameworks/base/services/tests/servicestests/src/com/android/server/pm/dex/DexoptUtilsTest.java
(cherry-picked from commit 557c054935c0864b42ce49541d12d32ae6a797bc)
Merged-In: I9aa440750c811676c86d8c6d0d451077d0edf5a0
Change-Id: I9aa440750c811676c86d8c6d0d451077d0edf5a0
taDexoptService.java
ex/DexoptUtils.java
9d6cad5a4aa6f9dd717b1e4d6ab0b7294e44094c 02-Nov-2017 Andreas Gampe <agampe@google.com> Merge "PMSCompilerMapping: Hardcode a value for pm.dexopt.shared" am: eb3bff53f6 am: 6f8a3cee0e
am: 36f6ccfdde

Change-Id: If4954cd3058264492cf9e84f898b928da39c6fd4
90a789e122a364da6659e27c314ffc859b5a59b1 02-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Give VoiceInteractionService access to shortcuts."
36f6ccfdde2bea24f965634995896c1cfd69f231 02-Nov-2017 Andreas Gampe <agampe@google.com> Merge "PMSCompilerMapping: Hardcode a value for pm.dexopt.shared" am: eb3bff53f6
am: 6f8a3cee0e

Change-Id: Ic2399e02d2102f984defb92c29b3568b94ebb244
7c4c55dcb6d386fb3843069a02c177df66df09c7 02-Nov-2017 Todd Kennedy <toddke@google.com> Move code

No functional changes. Moving code from PackageManagerService to
other classes where it makes more sense. Make some methods static
when they could easily be made so.

Bug: 63539144
Test: bit FrameworksServicesTests:com.android.server.pm.
Change-Id: If515315d27d9bf3d19cde0062deade5d05924b6d
eySetManagerService.java
ackageManagerService.java
ackageManagerServiceUtils.java
serDataPreparer.java
ermission/DefaultPermissionGrantPolicy.java
ermission/PermissionManagerService.java
8cff8b9312d35a18965432a725e6431858972a2f 25-Oct-2017 Philip P. Moltmann <moltmann@google.com> Use multi-field logs to log permissions

Before this change each permission+action combo had it's own ID. This
was very fragile and did not work for non-system permissions.

Now the action is the log-type and the permission is just a field in the
log.

Test: Used API 23 and API 26 apps to grant and revoke permission and
confirmed logs are as expected

Change-Id: I51f038dd7ab0a9ea269cafca23bfe3e5b181feb1
ackageManagerService.java
ermission/PermissionManagerService.java
c160fa4cc4f0ae85b3dd4169a0cd1165c183b0cf 02-Nov-2017 Dianne Hackborn <hackbod@google.com> Give VoiceInteractionService access to shortcuts.

The shortcut manager now has a set of additional packages that
have access, which the voice interaction system service feeds in
to.

Bug: 68760723
Test: CtsVoiceInteractionTestCases
Change-Id: I2a69f83569eb350f405bdd548998570ceef9ea7e
hortcutService.java
hortcutUser.java
8a5a708df18c2377c7ec3cb03d406bdc9cb99bd6 04-Oct-2017 Calin Juravle <calin@google.com> [framework] Compile secondary dex files in isolation

The class loader context adds the overhead of extracting in-memory and
possibly extra verification which is being frowned upon when the loading
happens on the UI thread. Revert the correct fix of compiling secondary
dex files with their loading context until b/64530081 is done.

Partial revert of commit f1ff36f0f99ebb41d0c7e0f3248506a56998fa3f.

(cherry picked from commit 27f926212483e8291a63884e60fa44de4d0df17c)

Test: adb shell cmd package compile -m quicken -f --secondary-dex
com.google.android.gms
Bug: 64530081
Bug: 66984396
Merged-In: Ib2815ce67b224883fe95c28d1424103e56342c6e
Change-Id: Ib2815ce67b224883fe95c28d1424103e56342c6e
ackageDexOptimizer.java
e131dac848cb4d0998e1dee2219382250c71d277 02-Nov-2017 Andreas Gampe <agampe@google.com> PMSCompilerMapping: Hardcode a value for pm.dexopt.shared

This is a temporary hack while we sort out the larger issues.

Test: make & flash
Bug: 68755013
Change-Id: I59caf79027dd8be2fd698606822a20b19c0d942a
ackageManagerServiceCompilerMapping.java
5e507fad89f1e130c1fc351d35c792a4dec5e778 15-Sep-2017 Calin Juravle <calin@google.com> Add an explicit reason for the compilation of shared apks

Some devices might find it more beneficial to compile shared apks like gms
or gms modules with quicken rather then speed.

(cherry picked from commit f53201f8c796e8500b76b72e4fad6269d8547369)

Bug: 65591595
Test: build
Merged-In: I90b79e9f6bc4b4d6b3f5c0b90ab95e8880c4ac9d
Change-Id: I90b79e9f6bc4b4d6b3f5c0b90ab95e8880c4ac9d
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
527a2b205c879a72514e98c01af7b383f71804b3 26-Sep-2017 Calin Juravle <calin@google.com> Fix spelling mistake in dumpsys output

(cherry picked from commit 94837e35e3c149e81da90f312fbb37f22c8bc90e)

Bug: 65843255
Test: build
Merged-In: Icc748dd14b52641e37b149f51d61a4086e55ed41
Change-Id: Icc748dd14b52641e37b149f51d61a4086e55ed41
ackageDexOptimizer.java
9aab3b513d7a224270a578c128f334ad7c0334ff 02-Sep-2017 Calin Juravle <calin@google.com> Handle configuration splits when creating the class loader context

Configuration splits have no dependencies which can lead to exceptions
when computing their class loader context.

In general, we do not need to compute the class loader context for apks
without code.

This CL addresses the issue by ignoring "code" paths with no actual code.

(cherry picked from commit da09815e2cd3d3968c66a8d52e620ee07d8204dd)

Bug: 65159159
Test: adb install-multiple config_splits
runtest -x
services/tests/servicestests/src/com/android/server/pm/dex/DexoptUtilsTest.java

Merged-In: Ida1eb901eecba4a4266de73022f6ee4659367873
Change-Id: Ida1eb901eecba4a4266de73022f6ee4659367873
ackageDexOptimizer.java
ex/DexoptUtils.java
563a5cad666555b8bed26fb4eb01c9bd20c2421a 11-Aug-2017 Calin Juravle <calin@google.com> Ensure dexopt is executed only with consistent package data

The main objects bookkeeping packages (PackageParser.Package and its
corresponding ApplicationInfo) may be updated at different times. This
creates a window where the data stored in the ApplicationInfo is out of
date with respect to the data stored in PackageParser.Package.

During install, the two objects are "synced" during doRename which updates
the package code paths.

This CLs moves the dexopt invocation from the install flow after doRename
to ensure that dexopt logic gets a consistent view of the package.

(cherry picked from commit 4c2b9555b7b52359ea14e201d7ec61b8edaf6232)

Bug: 64493351

Test: run cts-dev -t android.appsecurity.cts.ClassloaderSplitsTest -m
CtsAppSecurityHostTestCases
inspect oat files after
adb install-multiple CtsClassloaderSplitApp/CtsClassloaderSplitApp.apk
CtsClassloaderSplitAppFeatureA/CtsClassloaderSplitAppFeatureA.apk
CtsClassloaderSplitAppFeatureB/CtsClassloaderSplitAppFeatureB.apk

Merged-In: I9131bcf49eb473a8fdc5eb0032d94080d4e9e94b
Change-Id: I9131bcf49eb473a8fdc5eb0032d94080d4e9e94b
ackageDexOptimizer.java
ackageManagerService.java
c0aa880922e4abe1f3af1be7bf3ce45168bb0984 02-Nov-2017 Andreas Gampe <agampe@google.com> Merge "Frameworks: Fix idle-background-job flag" am: 3a16db62ec am: 83419c750f
am: 64f4a15a87

Change-Id: I657a946fd67a44697a51df4b43a60de0cc69c8be
64f4a15a87b91650f929f1ae14acc3a9dd7274f9 02-Nov-2017 Andreas Gampe <agampe@google.com> Merge "Frameworks: Fix idle-background-job flag" am: 3a16db62ec
am: 83419c750f

Change-Id: I78676a68b624813870bd100577969dbbea66b635
3a16db62ec0dd1385755755aa74b6d23578d9149 02-Nov-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "Frameworks: Fix idle-background-job flag"
84d9a81c7df07609e5e77cce1baafb3730cc4133 19-Sep-2017 Calin Juravle <calin@google.com> Fix dexopt dump

Dexopt dump prints the status of primary oat file instead of secondary.
We cannot get the secondary dex file status without an installd call so
this CL just removes the status line.

(cherry picked from commit cf72222f41f4ce73302274d2e8b4fcc735c3bd00)

Bug: 65843255
Test: adb shell dumpsys package dexopt
Merged-In: I76028704267eed68ba8c51f45ce8b54f403cc255
Change-Id: I76028704267eed68ba8c51f45ce8b54f403cc255
ackageDexOptimizer.java
c041c33c029df0bf4f19638dec6634d4c1c310c9 02-Nov-2017 Andreas Gampe <agampe@google.com> Frameworks: Fix idle-background-job flag

Correctly pass flag to installd.

Bug: 68025088
Test: m
Test: manual test
Change-Id: Ia5b19b1f1375a3c8b0c8e19b1978dcba29c83470
ackageDexOptimizer.java
d7fb51a483de028d437f22c02d9b78fe907ee14c 02-Nov-2017 Andreas Gampe <agampe@google.com> resolve merge conflicts of 20d9ae562062 to oc-mr1-dev-plus-aosp

Test: I solemnly swear I tested this conflict resolution.
Change-Id: I73cd9a9198ef5640a6b3dced713fcbb17563dd8b
b3145221ae6b1c8c770f46d7b4423234e7792005 01-Nov-2017 Calin Juravle <calin@google.com> Merge "[framework] Add check that classpath is up to date to getDexOptNeeded" am: 945b1dc43e
am: 8952f058ff

Change-Id: Iad6377ad17a93948ae41b23d7f49669577869669
e538e7045553223b388321eececdf84d03a21dc2 01-Nov-2017 Narayan Kamath <narayan@google.com> Merge "PMSCompilerMapping: Hardcode a value for pm.dexopt.inactive" am: dc616ab11c am: cfb01b3f3f
am: 7dc51259cd

Change-Id: Ie72e549707b50d2b9b419e6fc2fbc82301ad3805
7dc51259cdb9b51d4aa8de81277ea3a655715337 01-Nov-2017 Narayan Kamath <narayan@google.com> Merge "PMSCompilerMapping: Hardcode a value for pm.dexopt.inactive" am: dc616ab11c
am: cfb01b3f3f

Change-Id: I69346b88c5ae62d4e520de25334fe9056a817994
11c22e3ce0310510f31811e39c32e864bd7cc8d1 25-Oct-2017 David Sehr <sehr@google.com> Use dex2oatd when available on debug builds

Enable use of dex2oatd for background dexopt service for eng and
userdebug builds. This allows us to have more extensive checking
on dogfood devices.

(cherry picked from commit 2118ec4d7e176b0ea96a79ca3b45e1cca9724eed)

Bug: 68025088
Test: runtest -x services/tests/servicetests/src/com/android/server/pm/dex/DexoptOptionsTests.java
Merged-In: I292ac7f355350edc8cf06f417740226ee6bac65d
Change-Id: I292ac7f355350edc8cf06f417740226ee6bac65d
ackgroundDexOptService.java
nstaller.java
ackageDexOptimizer.java
ex/DexoptOptions.java
b130d470a22a7729850b6b41d7eaa99eaa268ac6 07-Aug-2017 Calin Juravle <calin@google.com> Add package use info to dexopt dump

(cherry picked from commit 41a57a65b2a4fb51faa55bcba57ebe544e9f799f)

Bug: 64153885
Test: adb shell dumpsys package dexopt
Merged-In: I57768076de821980b1de84d5fe44ab642ceebeba
Change-Id: I57768076de821980b1de84d5fe44ab642ceebeba
ackageDexOptimizer.java
ackageManagerService.java
943d1e76542bac686bb1164cb792f59f844eaf56 04-Aug-2017 Calin Juravle <calin@google.com> Record usage information per split

Increase the granularity of usage information to store data on each split
separately.

Now, splits get their own useByOtherApps flag and can be compiled
speed-profile when only the primary apk is loaded by other apps.

(cherry picked from commit 52a452cf685c56dc6872dbb19e822736484f672f)

Bug: 64124380
Test: runtest -x
services/tests/servicestests/src/com/android/server/pm/dex/*

Merged-In: Ibf9e7b9e67db9c6f0f45dc695bce8fbeb7be20ae
Change-Id: Ibf9e7b9e67db9c6f0f45dc695bce8fbeb7be20ae
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceUtils.java
ex/DexManager.java
ex/PackageDexUsage.java
fad6dc10b0e723f81a264ce608a47f2b7c279b2a 04-Aug-2017 Calin Juravle <calin@google.com> Use PackageUseInfo in DexOptimizer

Pass the PackageUseInfo directly to DexOptimizer and use it to detect if a
package is used by other apps. Move the usage checks closer to dexopt so
that they can be easily adapted when we add usage info for each of the
app's code paths separately.

This is a refactoring CLs to reduce the size and complexity of the
upcoming CLs which record the usage info for each of the application
splits.

(cherry picked from commit 3b74c41776da66562a68b12a0fed8d20b6952868)

Bug: 64124380
Test: runtest -x
services/tests/servicestests/src/com/android/server/pm/dex/*

Merged-In: I8031590cdaff81ab1792ca19baddb6cb36dc021d
Change-Id: I8031590cdaff81ab1792ca19baddb6cb36dc021d
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceUtils.java
ex/DexManager.java
ex/DexoptOptions.java
a18e992770149989311c23b5222791be50b49a5d 22-Jul-2017 Calin Juravle <calin@google.com> Use the class loader context when optimizing secondary dex files

Record the class loader context for secondary dex loads and pass it to
dexopt during compilation.

The class loader context is passed from libcore every time a
BaseDexClassLoader is created and its recorded in the package dex usage
file.

Note that the context may be:
- unknown: if the dex file was not use after the the upgrade and its
context was not yet updated
- unsupported: if any of the class loaders from the loading context is
unsupported (only PathClassLoader and DelegateLastClassLoader are
supported).
- variable: if it changes over time, form one run to another.

In all the above cases the old compilation behavior is preserved for
now.(i.e. the dex file with be compiled with SKIP_SHARED_LIBRARY_CHECK)

(cherry picked from commit f1ff36f0f99ebb41d0c7e0f3248506a56998fa3f)

Bug: 38138251
Test: runtest -x
services/tests/servicestests/src/com/android/server/pm/dex/
adb shell cmd package compile -f -m quicken ^Csecondary-dex
com.google.android.gms

(cherry picked from commit 3bec94d78b0a66c4fa5cebd851ea33bcc51916b0)

Merged-In: Ie8b78c7c0d5de43733b3d116f8dcb3a65324cca8
Change-Id: Ie8b78c7c0d5de43733b3d116f8dcb3a65324cca8
ackageDexOptimizer.java
ackageManagerService.java
ex/DexManager.java
ex/DexoptUtils.java
ex/PackageDexUsage.java
c1fe2ce8493b0750aaa210531fda0766b73bad16 29-Jul-2017 Calin Juravle <calin@google.com> Save PackageDexUsage on PMS shutdown

This ensures that we persist the in memory data between restarts (makes
testing much easier).

(cherry picked from commit 14876bd21a4a4e7d78d36f910493269f14b2e905)

Bug: 64151900
Test: Manual, flash + restart + check the dex usage file

(cherry picked from commit 6ef7f0b8c6e72e849a220513425a9fd37804af90)

Merged-In: I7bd99fc03c3a40cbbf5d615886f857b5f84f438c
Change-Id: I7bd99fc03c3a40cbbf5d615886f857b5f84f438c
ackageManagerService.java
ex/DexManager.java
ex/PackageDexUsage.java
09844b54266f8ebd3a6d60082204b60e45404c6f 04-Feb-2017 Calin Juravle <calin@google.com> Record dex files users in the dex-usage list

Add the users of the dex files in the package-dex-usage.list. This will
provide more data on why a package is marked as shared and not optimized
using profiles.

(cherry picked from commit 535a4753e313bdc2ae3e8be9f50606b82edcce0c)

Test: runtest -x .../DexManagerTests.java
users of the dex files are recorded in package-dex-usage.list

Bug: 63778376
Merged-In: I329bc929b17fa0afe1531f3e6879f6160157a787
Change-Id: I329bc929b17fa0afe1531f3e6879f6160157a787
ex/DexManager.java
ex/PackageDexUsage.java
945b1dc43e897985b5532e1f676dca6ca94e226e 01-Nov-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "[framework] Add check that classpath is up to date to getDexOptNeeded"
7ba73dd509c39a073bc59901df78b24632c77fd7 12-Sep-2017 Calin Juravle <calin@google.com> [framework] Add check that classpath is up to date to getDexOptNeeded

(cherry picked from commit 576e6c0cbb0231d6650dee70319d7443c601fa1b)

Bug: 62269291
Test: manual, install new apk/splits and force updates.
I used com.android.cts.classloadersplitapp as the test app.
1) install-multiple split apks with dependency: Base -> A -> B
2) push an update for A
3) adb shell cmd package compile
4) check that A & B got recompiled and that B was because a class loader
context mismatch (e.g. "ClassLoaderContext classpath element checksum
mismatch for position 1.").

Merged-In: I4092562966413dc8976c9d41b26a90bbb9e37e1e
Change-Id: I4092562966413dc8976c9d41b26a90bbb9e37e1e
ackageDexOptimizer.java
84bf6b809d5b1d80137f1653ab2346ebe0b08ca6 01-Nov-2017 Narayan Kamath <narayan@google.com> PMSCompilerMapping: Hardcode a value for pm.dexopt.inactive

This is a temporary hack while we sort out the larger issues.

Test: make & flash
Bug: 68755013

Change-Id: I39f2e7f2e39f4d886ea5fa3d91648404347485ef
ackageManagerServiceCompilerMapping.java
1b708e68b3cc1eedecd6201286393edbc7a8aa73 12-Oct-2017 Tony Mak <tonymak@google.com> Introduce CrossProfileApps API

CTS will be in next CL.
APIs for labels/ icons of profile switching are not implemented yet.

Test: Wrote a test app to play around the APIs
Test: bit FrameworksServicesTests:com.android.server.pm.crossprofile.CrossProfileAppsServiceImplTest
BUG: 67765768

Change-Id: I27714aa4a8d61c6df398cbc5112cb4c35316a3fb
rossprofile/CrossProfileAppsService.java
rossprofile/CrossProfileAppsServiceImpl.java
2141c451711664892a105009f3a3b60e4cad1452 31-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add READ_PHONE_STATE to MediaProvider."
e534b2c6f439e2d64d5b3a95b640766c56e5995c 15-Jul-2017 Calin Juravle <calin@google.com> Fix splits class loader context for non dependant splits

If the app doesn't request for splits to be loaded in isolation or does
not declare inter-split dependencies, then all the splits are loaded in
the base apk class loader (in the order of they are defined).

Fix the class loader context passed to dex2oat to reflect the runtime
loading logic.

(cherry picked from commit 305aeea38f96f0b94ad4be5cb979dd9cf98cf7df)

Bug: 38138251
Test: runtest -x
services/tests/servicestests/src/com/android/server/pm/dex/DexoptUtilsTest.java

Merged-In: Ia0623d38883ae244fd16c0afb053fef016bf260a
Change-Id: Ia0623d38883ae244fd16c0afb053fef016bf260a
ex/DexoptUtils.java
0a267a884ed04d3baf77ed7e5f6467879d035d33 13-Jul-2017 Calin Juravle <calin@google.com> Encode the entire class loader context for dex2oat

Until now the split dependencies were passed as a flatten list to dex2oat.
In the presence of DelegateLastClassLoaders this is no longer enough to
ensure the correctness of the compilation.

This CL encodes the split dependencies together with their declared class
loader in a format accepted by dex2oat.

(partially cherry picked from commit 19da1cf72e8c448743a8c27ac6d73424ae42c7ec)

Bug: 38138251
Test: runtest -x
services/tests/servicestests/src/com/android/server/pm/dex/DexoptUtilsTest.java

Merged-In: Iaabd5d8bd5e6d027a8de5a408777fd517063d9f1
Change-Id: Iaabd5d8bd5e6d027a8de5a408777fd517063d9f1
ackageDexOptimizer.java
ex/DexoptUtils.java
1b901ca77379e1f6d360100a3ef521100594e742 31-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Set updated system package's mExtra"
caed6000be0ebd32b5eb0ffb09757b891ae5c2ed 18-Jul-2017 Calin Juravle <calin@google.com> Add a command line option to optimize individual splits

The new option is "--split SplitName" and applies to "adb shell cmd
package compile" command.

Usage example:
adb shell cmd package compile -m speed --split split_feature_a.apk
com.android.cts.classloadersplitapp

(cherry picked from commit b6f844d28cc7a7bf2b477a904263fcbe9b26d2c4)

Bug: 38138251

Test: adb install-multiple CtsClassloaderSplitApp.apk
CtsClassloaderSplitAppFeatureA.apk CtsClassloaderSplitAppFeatureB.apk
adb shell cmd package compile -m speed --split split_feature_a.apk
com.android.cts.classloadersplitapp
check the status of split_feature_a
runtest -x
services/tests/servicestests/src/com/android/server/pm/dex/DexoptOptionsTests.java

Merged-In: I579bb12fa6699f99cd3824f185bd9352fb8007c5
Change-Id: I579bb12fa6699f99cd3824f185bd9352fb8007c5
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerShellCommand.java
ex/DexoptOptions.java
dea3fd8cf1000d786ff40e1036a8bf76a55d5fcd 18-Jul-2017 Calin Juravle <calin@google.com> Refactor the arguments passed to dexopt invocations

Wrap the arguments passed to the various performDexopt calls into the
DexoptOptions object.

This will make adding extra arguments (like compile only a split) much
easier and avoid extending quite a few internal methods.

(cherry picked from commit 1d0e83d2cee794ba576d573119e826905a4422cd)

Bug: 38138251
Test: adb shell cmd package compile ....
adb shell cmd package bg-dexopt-job ...
install new apps and check that they compiled
runtest -x
services/tests/servicestests/src/com/android/server/pm/dex/DexoptOptionsTests.java

Merged-In: Ia9930edd2dceb7535d6168eceb8e3199c82b6306
Change-Id: Ia9930edd2dceb7535d6168eceb8e3199c82b6306
ackgroundDexOptService.java
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ex/DexManager.java
ex/DexoptOptions.java
3aeca17aa911394e7a4d2c1536b28423cb135b53 25-May-2017 Shubham Ajmera <shubhamajmera@google.com> Reduce app size by downgrading inactive apps

This will trigger when the device will have low space.
Active apps here refer to the apps which were either active
in foregrond or in background and also used by other packages.
Apps which are inactive for X days downgraded to verify. X is
determined by sysprop pm.dexopt.unopt_after_inactive_days

If the system properties are not set, no effect will take place.

The above operations will take place in background dexopt service.
If user uses the app again, it will again be speed-compiled when
background dexopt service starts next time.

(cherry picked from commit 246dccf9327631597767afe418ce43ae6d07d102)

Bug: 36598475
Test: manual
* Remove the check in the code that allows downgrade only when
the space is low on the device.
* adb root
* Set pm.dexopt_unopt_after_inactive_days to 600
* Make sure the current time of the device is correctly set
* Install 2 non system apps - B, C
* Downgrade B to extract
* Upgrade a system apps to speed-profile - E
* Downgrade a system app to quicken - G
* adb shell cmd package bg-dexopt-job

Expected Results:
* Extract - B
* Verify - C
* There should not be any entries for apps E an G
in dalvik_cache

Merged-In: I68f9f617d6722a7ba8b00aa2181cb38a165cfc51
Change-Id: I68f9f617d6722a7ba8b00aa2181cb38a165cfc51
ackgroundDexOptService.java
nstaller.java
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
ackageManagerServiceUtils.java
ex/DexManager.java
5f2faaa7ed71a3d1aa862c37e27ebf817f094dc5 31-Oct-2017 Todd Kennedy <toddke@google.com> Set updated system package's mExtra

While scanning system packages, we abort the process in the
middle of the scan and leave our internal structures in an
ill defined state. This change is not about making the structures
consistent; rather unblocking a build breakage. We'll look
at data consistency during a later refactoring stage when
the process of package scanning is fixed.

A reboot is necessary for the bug to exhibit itself because
the permissions are re-granted [or denied] on every boot.

Change-Id: I96cc2f76623911f2cf93727e9f1787b42210a8d6
Fixes: 68328870
Test: Manual.
Test: Add a new priv-app that take a privieleged permission.
Test: See that the permission is granted.
Test: Update the app and reboot
Test: See that the permission is still granted.
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.PermissionsHostTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermissionTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermission2TestCases
Test: bit FrameworksServicesTests:com.android.server.pm.PackageManagerSettingsTests
ackageManagerService.java
1bade5d62974544639f2b1656a7e2785b0338a6f 11-Oct-2017 Christine Franks <christyfranks@google.com> Add DISALLOW_CONFIG_LOCALE user restriction

Bug: 67586452
Test: make cts && cts-tradefed run cts-dev -m DevicePolicyManager \
-t com.android.cts.devicepolicy.UserRestrictionsTest

Change-Id: Icaf78dec5527c57c00e2b9854ba17ec1982bfac4
serRestrictionsUtils.java
ca3872ce36c94090ae18519dc7fe0cf39d834c4a 30-Oct-2017 Dianne Hackborn <hackbod@google.com> Fully implement "install" and "install-write" in PackageManagerShellCommand.

We can use the new mechanism to ask the calling shell to open
a file in order to implement the rest of these commands, allowing
you to give the path to an apk to install. That API is thus
extended to allow you to open readable files, not just opening
file for writing.

Doing this however means we no longer can pass a file path to
AssetManager for the apk to parse, we only have an already open
fd for that. Extending AssetManager to allow adding apks from
fds is not that hard, however, since the underlying zip library
already supports this.

This main thing this changes is in AssetManager.cpp where we
retrieve the open zip file for a particular apk that has been
added. This used to look up the zip file by path every time
it was needed, but that won't work anymore now that we can have
things added by fd. Instead, we keep track of each opened zip
in the AssetManager, so we can just directly retrieve it from
the asset_path representing the item that was added. As a
side-effect, this means for normal paths we no longer need to
look up by name, but just have the opened zip file directly
accessible. (This is probably good, but it does mean that we
no longer run the logic of seeing if the zip file's timestamp
has changed and re-opening it if it has. We probably shouldn't
be relying on that for an active AssetManager anyway, and maybe
it is even good that we don't allow the zip file to change
under it?)

A follow-up change will finally remove the Pm.java implementation
and turn the pm "command" into a simple shell script that runs
cmd package.

Test: manual

Change-Id: Ie103e3bdaa5b706796cc329254f2638151a3924f
ackageManagerShellCommand.java
e523aa4f6bf24d3f65ec9a8a79fa8ae23a62b8ed 10-Jun-2017 Shubham Ajmera <shubhamajmera@google.com> Compile secondary dex at boot after OTA

(cherry picked from commit ce54397368dc98182d7b4eb2ff3c142bbd87e39d)

Bug: 38413085
Test: build successful
Merged-In: If080281fb3147fea625bcafce91167e8c1439736
Change-Id: If080281fb3147fea625bcafce91167e8c1439736
taDexoptService.java
ackageManagerService.java
ex/DexManager.java
1285cfd48f5a9bff4b0e7796c0629360760b33af 06-Jul-2017 Jeff Sharkey <jsharkey@android.com> Change storage migration to use quota APIs.

New quota APIs are much faster than trying to measure manually, and
removing this last user of calculateDirectorySize() means we can
remove it once and for all.

(cherry picked from commit c8b29ac6f0340bd0c3c9eb388c4be2d446de9a59)

Bug: 36056324
Test: builds, boots
Merged-In: Ibdf1ee4e8885680e106df6a9269b6309ddc61af8
Change-Id: Ibdf1ee4e8885680e106df6a9269b6309ddc61af8
nstaller.java
d877f14834292c0ae24404b492c6f023667cd8a3 30-Oct-2017 Jeff Sharkey <jsharkey@android.com> Merge "Define OWNERS for permission grant changes." am: 8d2a5bd42a am: 4ab5a3f8cd
am: e2ef47f1bd

Change-Id: I32c2ddf0f6c5f21651750579e045198438045d12
e2ef47f1bdc88883ae6c48e252bf97d2e4691961 30-Oct-2017 Jeff Sharkey <jsharkey@android.com> Merge "Define OWNERS for permission grant changes." am: 8d2a5bd42a
am: 4ab5a3f8cd

Change-Id: Ie27d6ee76a7ab6585881d5f83c197ab99f7d26f4
e40d8409bded6fc0d0a6b6e1c1127f3b50842f75 27-Oct-2017 Jeff Sharkey <jsharkey@android.com> Define OWNERS for permission grant changes.

Permission grant changes need explicit approval from product and
SWE leadership to ensure that CTS/CDD requirements are met.

Change-Id: I0a84712b5c5b4e11e72bf5921b72ef6a47e7fdc1
ermission/OWNERS
5593322a2e5ac7d5bea36da99aa3db43de1d43ee 27-Oct-2017 Yueming Wang <yuemingw@google.com> Merge "Add DISALLOW_CONFIG_DATE_TIME user restriction."
02bdfabac13ce812328595faf7dfa3f53195dd34 27-Oct-2017 David Sehr <sehr@google.com> Merge "Use dex2oatd when available on debug builds"
2118ec4d7e176b0ea96a79ca3b45e1cca9724eed 25-Oct-2017 David Sehr <sehr@google.com> Use dex2oatd when available on debug builds

Enable use of dex2oatd for background dexopt service for eng and
userdebug builds. This allows us to have more extensive checking
on dogfood devices.

Bug: 68025088
Test: runtest -x services/tests/servicetests/src/com/android/server/pm/dex/DexoptOptionsTests.java
Change-Id: I292ac7f355350edc8cf06f417740226ee6bac65d
ackgroundDexOptService.java
nstaller.java
ackageDexOptimizer.java
ex/DexoptOptions.java
a9772f360202b05858fa199088bfe94697a3f623 23-Oct-2017 yuemingw <yuemingw@google.com> Add DISALLOW_CONFIG_DATE_TIME user restriction.

Test: cts test for bug 67627542 in following cl
Bug: 67497909

Follow design doc: https://docs.google.com/document/d/1NV93mr2CT157S_haru1QbKo9HLeP9iPM9eMiGfVmfCM/edit#
Change-Id: Iee3c2fbf88b4958dde81330c2e4d60dfce09197f
serRestrictionsUtils.java
cfacf37c32cb5a0ad2eacd8f707152eb348807a1 27-Oct-2017 Chad Brubaker <cbrubaker@google.com> Merge "Allow internal services access to instant apps" into oc-mr1-dev am: d70982ad7e
am: de3dcb6b31

Change-Id: Ic538aa79706ff65842c2d2e38a82999c57e0dcd8
de3dcb6b31054165fbd3a344f8a211520f305d0c 27-Oct-2017 Chad Brubaker <cbrubaker@google.com> Merge "Allow internal services access to instant apps" into oc-mr1-dev
am: d70982ad7e

Change-Id: Ic799df1e5abbbe113ddc0d54f79140e952f8d314
0ef0ac9c21f569cba6aa763855b9b5292548d86e 27-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Only log on error"
68533018e748ae7fa881cdb933ec18f9273cfc1e 27-Oct-2017 Fyodor Kupolov <fkupolov@google.com> Merge "Only log a warning if it's an actual violation"
b8ce9f09e3172b9fcaf1e4153378cdf540e81dec 26-Oct-2017 Todd Kennedy <toddke@google.com> Only log on error

Bug: 68260103
Test: Manual
Change-Id: I81ec2b98f33e2876a6469e56955b516c1dacf0ed
ermission/PermissionManagerService.java
1ab4384c57efd63e166c9480d0cc7e8171aed595 26-Oct-2017 Todd Kennedy <toddke@google.com> Don't blindly reference package object

This is a workaround for the bug that prevents the device from
booting. Will keep the bug open to address the core issue.

Also added some debug logs to try to catch this in the wild.

Bug: 68260103
Test: Manual. Device boots.
Change-Id: Ifed80c74897cc54eff2ee73df6dcc3b1e6f79170
ermission/PermissionManagerService.java
f5e600d073e7b3c7a6ba36c904c9d51acfaaf6ff 26-Oct-2017 Fyodor Kupolov <fkupolov@google.com> Only log a warning if it's an actual violation

Otherwise the message can be confusing if deny-permission is used or
app is updated.

Test: manual
Bug: 64693550
Change-Id: I19943d8cbd13a5173356a32565db88856428009e
ermission/PermissionManagerService.java
1efb833c72be205805a4a70218ccac2785201062 26-Oct-2017 Todd Kennedy <toddke@google.com> Fix NPE

Accidentally removed a check for whether or not the disabled
package setting was null

Bug: 68260103
Test: Manual
Change-Id: I6a634f2292948283153659eb4ef64524cbf53a78
ermission/PermissionManagerService.java
4193d0e135c75eba1d38f63df29a3fa5ba6cfa8d 25-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Start removing remaining pm code to package manager"
7b9f2637811765a96be8bbe82f79adecabe442c7 25-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Move grantPermission to permission manager"
c81983a0c3d7bfe8384dbf48909f4bcf300e36d2 21-Oct-2017 Dianne Hackborn <hackbod@google.com> Start removing remaining pm code to package manager

Everything is now moved out of the pm command except for
the various install commands. I am going to hold of on
those since they require doing some resolution with the
current implementations in the package manager to make
sure they match and behave identically to the implementations
currently in the pm command. But other than that, everything
in pm is now just redirecting over to "cmd package".

Also fix up some of the dumpsys output of a few other sevices
when asking to print the data for a particular package, so
the "pm dump" command gives a little more sane result.

Test: manual

Change-Id: I139e06e560203b72243d7eea9543c2240db0f8f8
ackageManagerShellCommand.java
17e40d2fb6d5ad2be3b71d3bc1232ea84f6596b6 25-Oct-2017 Todd Kennedy <toddke@google.com> Allow internal services access to instant apps

Any system UID [those with a UID < Process.FIRST_APPLICATION_UID] should be
able to see instant applications. These are trusted processes and will often
need to verify permissions of the calling instant app.

Change-Id: I4ec899ffd45d931a17d4ea0bfacf3004d3e074ef
Fixes: 67849834
Test: Manual.
Test: Install hellozip_base.apk from bug:
Test: $ adb install --instantapp -i com.android.vending hellozip_base.apk
Test: Run hellozip
Test: $ adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d https://hello.samples.androidinstantapps.com/hello
Test: Try to capture a photo and see that the app crashes with a SecurityException before the patch and that a photo is taken after the patch
Test: Try to record audio and see that the app crashes with an IllegalStateException before the patch and that the app doesn't crash after the patch
ackageManagerService.java
f59e96663739a1210d100ba514c8a833ccca9435 25-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "vold now deletes misc_ce/misc_de"
4b8a624224a792758a1cb7cc0dd258a7e31adce9 17-Oct-2017 Paul Crowley <paulcrowley@google.com> vold now deletes misc_ce/misc_de

Bug: 25861755
Test: create user, populate vold subdirectory, delete user, check logs
Change-Id: I95f2d8d52ea9cdb621b6bf0b18d6151721dcf8d9
serDataPreparer.java
c29b11a5f65829dc87b5f234c4d3c1fff7ef5a36 24-Oct-2017 Todd Kennedy <toddke@google.com> Move grantPermission to permission manager

Last major movement of permission logic from the
package manager to the permission manager.

Bug: 63539144
Test: Manual. Builds and runs
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.PermissionsHostTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermissionTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermission2TestCases
Test: bit FrameworksServicesTests:com.android.server.pm.PackageManagerSettingsTests
Change-Id: I3225405fad4334917b8df0b08bb1936a58744480
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ackageSetting.java
ackageSettingBase.java
ettings.java
ermission/BasePermission.java
ermission/DefaultPermissionGrantPolicy.java
ermission/PermissionManagerInternal.java
ermission/PermissionManagerService.java
ermission/PermissionSettings.java
3bc947266638b8d2c2e10a80d1e8eb9348b6dd8a 10-Oct-2017 Todd Kennedy <toddke@google.com> Move mGlobalGids and mSystemPermissions

This is the last tiny move before moving methods to grant/update
permissions.

Bug: 63539144
Test: Manual. Builds and runs
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.PermissionsHostTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermissionTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermission2TestCases
Test: bit FrameworksServicesTests:com.android.server.pm.PackageManagerSettingsTests
Change-Id: Ic2138cf1e442d9d10e8a3ad6dfa24c403aaeca67
ackageManagerService.java
ermission/PermissionManagerInternal.java
ermission/PermissionManagerService.java
460f28c2f017dcef9c34a93c7bd5b18e97c6e15f 06-Oct-2017 Todd Kennedy <toddke@google.com> Move mPermissionGroups

Bug: 63539144
Test: Manual. Builds and runs
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.PermissionsHostTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermissionTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermission2TestCases
Test: bit FrameworksServicesTests:com.android.server.pm.PackageManagerSettingsTests
Change-Id: I3b019babc81997d1d70c14675a34b6a8bec5387d
ackageManagerService.java
ermission/PermissionManagerInternal.java
ermission/PermissionManagerService.java
ermission/PermissionSettings.java
e74db7c7e26d93827acf7841f530babffdd5d7de 24-Oct-2017 Paul Duffin <paulduffin@google.com> Merge "Preserve order of shared library files"
am: 596bb64796

Change-Id: I95c1cd65ded3b3d14b7f916c8a10825399e7b8ec
14062f2382388a3a15802bf8b8b24d1f41d548c6 02-Oct-2017 Paul Duffin <paulduffin@google.com> Preserve order of shared library files

Shared libraries are stored in a list so order is preserved. However,
when they are resolved to files, e.g. for use as a class path the
file names are added to an ArraySet which loses the order. Presumably
they are added to a Set to eliminate duplicates. This switches to a
LinkedHashSet which will preserve the order in which the files are
added while still avoiding duplicates.

It is possible that this could cause app compatibility issues as the
order in which shared libraries is being added is changing. Problems can
only arise if two libraries whose order changes have duplicate classes
and/or resources. In that case the app was only working by luck, as the
order provided by ArraySet is based on the numerical order of hash
codes.

This was found while investigating performance regressions in
GoogleDialer, unfortunately it does not fix the regressions.

Bug: 65552462
Test: flash -w and systrace GoogleDialer to ensure correct order
Change-Id: I0e94471cc481437712f7cf0dab63d88f50cf3b14
Merged-In: Ia01ce4821fa53e4785716b72c4f87a0b0ab4dcc8
ackageManagerService.java
9ec4897a3dd622fa35813191a63c8dae5770e95a 19-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fail only if CONTROL_PRIVAPP_PERMISSIONS_ENFORCE"
4f41e849f1b7d6d037439d60eace1b134165a148 19-Oct-2017 Fyodor Kupolov <fkupolov@google.com> Fail only if CONTROL_PRIVAPP_PERMISSIONS_ENFORCE

Previously the error was also thrown if ro.control_privapp_permissions=log

Test: manual
Bug: 64693550
Change-Id: Ia87984e2e5902dd885feeb37f676956fa56b421c
ackageManagerService.java
4b11fce4a44721cebe207a92ae57f3fadc62d20b 19-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "getPinnedShortcuts() shouldn't crash with shortcuts with..."
40dc2114dde504287e98bb7cba05ecce646bf5da 18-Oct-2017 Makoto Onuki <omakoto@google.com> getPinnedShortcuts() shouldn't crash with shortcuts with...

... no activities.

Bug 67931644

Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutManagerTestCases
Change-Id: Icea651cf7880c5389467285e9cae3a52c4993669
hortcutPackage.java
301bf35e2df9e3f2efa5dbf1c2df69e10be7f6e8 19-Oct-2017 Tobias Thierer <tobiast@google.com> resolve merge conflicts of 5c9e47d28b24 to oc-mr1-dev-plus-aosp

Test: This merge conflict was automatically resolved by meld.
The automatic resolution of the same merge conflict by meld
from cherrypicking this CL into internal-master has passed
Treehugger (and was already submitted).
Exempt-From-Owner-Approval: Resolving merge conflicts with no deltas
Change-Id: I61f15aeb79c1ad26cc7c51be2af59ecb7b672a7b
6f0e008318f61ec5cd4e75ead485fb888a643617 19-Oct-2017 Svet Ganov <svetoslavganov@google.com> Merge "Preserve ranking attrs of resolve infos for installing a feature split" into oc-mr1-dev am: 8f231b7aa6
am: 9a7a6e2000

Change-Id: I4e359a54b1eb6a681e4e6fabe31e0cf20a1c87a9
07efe116b1055ebead525cc365f22114913a4e9a 19-Oct-2017 Tobias Thierer <tobiast@google.com> Merge "Framework: Prefer android.system.Os over libcore.io.Libcore.os"
am: 5f04db96b3

Change-Id: If85216d03022708787a7218e494434453d5548e3
208f0970d57808a346acf79cdeb8bbcd1a060fb8 19-Oct-2017 Joachim Sauer <jsauer@google.com> Merge "Framework: Prefer android.system.Os over libcore.io.Libcore.os"
9a7a6e20009c4e21062ed8e2e8b6a726e4dc56f5 19-Oct-2017 Svet Ganov <svetoslavganov@google.com> Merge "Preserve ranking attrs of resolve infos for installing a feature split" into oc-mr1-dev
am: 8f231b7aa6

Change-Id: Id85257c481a7d4e387ffc6ee628bfd2986ab5b3c
8f231b7aa6622c4add467c7145910936acf33d66 19-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Preserve ranking attrs of resolve infos for installing a feature split" into oc-mr1-dev
d96953ad7ab13ec988585dcb93a2a3e2120b23f5 19-Oct-2017 Svet Ganov <svetoslavganov@google.com> Preserve ranking attrs of resolve infos for installing a feature split

If an intent resolves to an activity in a fearture split not on the device
we create a synthetic resolve info to involve the installer that replaces
the resolve info for the missing activity. The synthetic resolve info was
not inheriting the priority/preferred order/default status resulting in a
different result ranking than what original resolve info would produce,
hence affecting resolution. Activities in a feature split should resolve
as if they are present on the device.

Also when downloading a feature split we involve the instant app installer
which resuls in a disabmiguation UI item "Instant app" with an instant app
icon despite that in this case the synthetic resolve info is for downloading
a piece of an already installed app (standard or instant). When installing
a feature spluit the user should see UI as if the piece of the app would
handle the intent.

Test: manual

bug:67710878

Change-Id: I8dd356c7b2c9742144f10e5b48daf5b28f6934ad
ackageManagerService.java
6bf609439467f101a2c7bc61bcdcc83c381a89bd 19-Oct-2017 Makoto Onuki <omakoto@google.com> Merge "DO NOT MERGE getPinnedShortcuts() shouldn't crash with shortcuts with..." into oc-mr1-dev
am: c63c9f8ae1

Change-Id: Ib006982c87cc4378c697e213504adc05cf2c0658
c401bac0d7b381c20ebdef9b881fb16dd7a61d84 18-Oct-2017 Makoto Onuki <omakoto@google.com> DO NOT MERGE getPinnedShortcuts() shouldn't crash with shortcuts with...

... no activities.

Bug 67931644

Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutManagerTestCases
Change-Id: Icea651cf7880c5389467285e9cae3a52c4993669
hortcutPackage.java
27067df9aa05df825bccc11fa3e3fc5be451944d 18-Oct-2017 Jerry Zhang <zhangjerry@google.com> Add READ_PHONE_STATE to MediaProvider.

Needed to use Build.getSerial()

Test: no securityexception
Bug: 67945990
Change-Id: Id3b1704785d332243f94beb44d0fe43ae6bd3363
ermission/DefaultPermissionGrantPolicy.java
6217e37d30042fd78d17a8d5145f578279d60808 17-Oct-2017 Tobias Thierer <tobiast@google.com> Framework: Prefer android.system.Os over libcore.io.Libcore.os

This is a pure refactoring with no a behavior change other than
that these calls now go through android.system.Os, which immediately
delegates to Libcore.os.

This is a first step towards separating framework (via
android.system.Os) vs. libcore (via Libcore.os) clients of these
low level APIs. Separating these is a prerequisite towards moving
the API parts of android.system into framework, and moving the
rest into a different package in libcore.

Test: Treehugger
Bug: 67901714

Change-Id: Ifd8349ec5416e5693f40dba48fdf2bef651b7d81
Merged-In: Ifd8349ec5416e5693f40dba48fdf2bef651b7d81
ackageInstallerSession.java
ackageManagerServiceUtils.java
96aac9b3754b9f85b3db87435d890c43092be20d 17-Oct-2017 Tobias Thierer <tobiast@google.com> Framework: Prefer android.system.Os over libcore.io.Libcore.os

This is a pure refactoring with no a behavior change other than
that these calls now go through android.system.Os, which immediately
delegates to Libcore.os.

This is a first step towards separating framework (via
android.system.Os) vs. libcore (via Libcore.os) clients of these
low level APIs. Separating these is a prerequisite towards moving
the API parts of android.system into framework, and moving the
rest into a different package in libcore.

Test: Treehugger
Bug: 67901714

Change-Id: Ifd8349ec5416e5693f40dba48fdf2bef651b7d81
ackageInstallerSession.java
ackageManagerServiceUtils.java
8874f5c824e1ff9a181bd908dbd08b7c9f8cb273 18-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Relax checks on dynamic permissions."
4dc50527d87a0f5a05a35caf5398eb7aec162213 17-Oct-2017 Jeff Sharkey <jsharkey@android.com> Relax checks on dynamic permissions.

We'll have to circle back to enforce this once we do more
investigation.

Test: none
Bug: 67371907
Change-Id: Ib2f73b6e52d56cf080f3a6f224ab4bf452d91a48
ermission/PermissionManagerService.java
117f89176081f653d31ead7fa8b51932fe1b5f9a 17-Oct-2017 Yi Jin <jinyithu@google.com> Merge "Enable dumpsys package in incidentd"
1ed4bb59b1e56c4af1999ab6adf1f7941483ba2b 17-Oct-2017 Calin Juravle <calin@google.com> Merge "Revert "When updating a split app, copy compiled files from base.apk only."" am: 154535317e am: 4a69261500 am: f3ef1f09ef
am: d37ded95d9

Change-Id: Ie89a664bcc2e53f7a0b1d7c015c177670af3fddc
d37ded95d9c110d8b102cbde5a5c1f193687bcc8 17-Oct-2017 Calin Juravle <calin@google.com> Merge "Revert "When updating a split app, copy compiled files from base.apk only."" am: 154535317e am: 4a69261500
am: f3ef1f09ef

Change-Id: I0fff716c3dcc1ce699666b4cd0794930c188400b
7282f37ca840aa5dc6e6279b83dc7d06ebb5506c 17-Oct-2017 Mathieu Chartier <mathieuc@google.com> Merge "Move stub APK profile logic to performDexOptUpgrade" into oc-mr1-dev am: 4f1844cb2d
am: dd26b955be

Change-Id: I9e7f17824e592505ae5b7d51b5dff72edc6dbc3b
d6759d46f96fe2c8955751b0fe8037d6c8a75464 13-Oct-2017 Yi Jin <jinyithu@google.com> Enable dumpsys package in incidentd

Test: manually tested on device.
Change-Id: I963fd42684d9e2302f64fdd6cd729e077a9b37ac
ackageManagerService.java
ettings.java
haredUserSetting.java
dd26b955be5e8062eb53c8e20a1429f225bb552d 17-Oct-2017 Mathieu Chartier <mathieuc@google.com> Merge "Move stub APK profile logic to performDexOptUpgrade" into oc-mr1-dev
am: 4f1844cb2d

Change-Id: I09c82246b6f61045c2e1911f96f995d309ea4978
4a69261500f1e3bc1883f5c16bc75c1c8620bdf1 17-Oct-2017 Calin Juravle <calin@google.com> Merge "Revert "When updating a split app, copy compiled files from base.apk only.""
am: 154535317e

Change-Id: Ia91f126900e3c52016af233f33c47b0a3c38d111
154535317eaa84a50d70cb3af8697ab4e2c89a25 17-Oct-2017 Calin Juravle <calin@google.com> Merge "Revert "When updating a split app, copy compiled files from base.apk only.""
c7c051961864c497a2bae2d24b30636507ff6fdb 14-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add signature permission to allow access to shortcuts for sysui"
634cecb899f4dabccf57411f48838d99650a9479 14-Oct-2017 Makoto Onuki <omakoto@google.com> Add signature permission to allow access to shortcuts for sysui

Bug 34715012
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutManagerTestCases
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutHostTestCases

Change-Id: I922f9fb872e27b25d1016b3894165a0e63faa9b5
auncherAppsService.java
hortcutPackage.java
hortcutService.java
4a4a4e8e186a0030126002eaa7f74010e1b23810 14-Oct-2017 Calin Juravle <calin@google.com> Revert "When updating a split app, copy compiled files from base.apk only."

This reverts commit d1235f54d4943a0a3a920013a5875b5193bd0490.

Reason for revert: We now include the classpath when asking the runtime
if we need to dexopt. This hack is no longer needed.

Bug: 62269291
Change-Id: I396778f6db0acbbe9017168b35e6023ff97f36fe
ackageInstallerSession.java
576e6c0cbb0231d6650dee70319d7443c601fa1b 12-Sep-2017 Calin Juravle <calin@google.com> [framework] Add check that classpath is up to date to getDexOptNeeded

Bug: 62269291
Test: manual, install new apk/splits and force updates.
I used com.android.cts.classloadersplitapp as the test app.
1) install-multiple split apks with dependency: Base -> A -> B
2) push an update for A
3) adb shell cmd package compile
4) check that A & B got recompiled and that B was because a class loader
context mismatch (e.g. "ClassLoaderContext classpath element checksum
mismatch for position 1.").

Change-Id: I4092562966413dc8976c9d41b26a90bbb9e37e1e
ackageDexOptimizer.java
a96f6a0a14be7d8e46fb7ba6237b7168ae17ac3b 13-Oct-2017 Makoto Onuki <omakoto@google.com> Merge "Return canned messages from getDisabledMessage for..."
478edb7604c3824b27ee7457483731ad55d93d24 13-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Do not line-wrap dexopt status"
b1588c0d3955a8574c3ae588568b2c393c7b5665 13-Oct-2017 Makoto Onuki <omakoto@google.com> Return canned messages from getDisabledMessage for...

shortcuts that haven't been restored.

Bug 62451035
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutManagerTestCases
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutHostTestCases

Change-Id: I8678adbbb7074bc28fe4b1b440fb11a6acfc9fdf
hortcutPackageItem.java
7dfb00c12f0a72885145572bdc2123753ea31724 12-Oct-2017 Mathieu Chartier <mathieuc@google.com> Move stub APK profile logic to performDexOptUpgrade

It used to be done in decompressPackage but this was too early during
first boot and caused an error copying since the profile directories
were not set up yet.

Test: flash with wipe, confirm profile is used
Bug: 64550394

Change-Id: If06c30f3f74ab172b0e7d57998cda73de9bbdcc4
ackageManagerService.java
96a30ab84c9e856cd7152d66d603205c3daff36e 12-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Improve shortcut backup & restore."
a4f89b1251235a7373996d0dda0d888673d8e941 05-Oct-2017 Makoto Onuki <omakoto@google.com> Improve shortcut backup & restore.

From http://go/p-shortcut-restore :

Currently on pre-P builds, there are 6 cases where shortcuts won't be restored.

Launcher issue:
A: Launcher is downgraded
B: Launcher has allowBackup="false"
C: Launcher's signature changed.
A-C would result in not restoring any shortcuts from any apps.

App issue:
D: App is downgraded
E: App has allowBackup="false"
F: App's signature changed.
D-F would result in not restoring any shortcuts from individual apps.

In P, we'll restore all pinned shortcuts anyway except in case B and C.

The new behavior would be:
A: We'll restore all pinned shortcuts anyway even if the launcher is downgraded.
B: If the launcher doesn't support backup&restore, we still don't restore shortcuts.
C: If the launcher has a different signature, we still don't restore shortcuts.

D, E, F: All pinned shortcuts will be restored, but are disabled.

In case of D, E, F, shortcuts would be:
1. ShortcutInfo.isEnabled() will return false. They are not launchable.
2. If it's case D (downgrade), shortcuts will be re-enabled once a publisher app
is updated to the original version or higher.
3. getDisabledMessage() will return a special, canned message explaining why
they're disabled.
4. A new API getDisabledReason() will return one of the following values:
- DISABLED_REASON_NOT_DISABLED (for non-disabled shortcuts)
- DISABLED_REASON_BY_APP (for shortcuts disabled by apps)
- DISABLED_REASON_APP_CHANGED (for shortcuts disabled when a manifest shortcut is gone.)
- DISABLED_REASON_VERSION_LOWER (case D)
- DISABLED_REASON_BACKUP_NOT_SUPPORTED (case E)
- DISABLED_REASON_SIGNATURE_MISMATCH (case F)
- (DISABLE_REASON_OTHER_RESTORE_ISSUE for future use)
Launcher can opt to use this API to show a custom error message, rather than
using the canned system message from getDisabledMessage().

5. This spec change is completely transparent to publisher apps.
In case D,E,F, the disabled shortcuts will only be visible to the launcher,
and from the publisher app's point of view, they still don't exist.
APIs such as getPinnedShortcuts() will not return them, and updateShortcuts()
will not affect them. The enableShortcut() will not enable them either.

Bug 62451035
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutManagerTestCases
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutHostTestCases

Change-Id: Ib4d73aa44a0395f5e37c8ad0c9cd041a9038fb66
hortcutLauncher.java
hortcutPackage.java
hortcutPackageInfo.java
hortcutPackageItem.java
hortcutParser.java
hortcutRequestPinProcessor.java
hortcutService.java
hortcutUser.java
c5df65697c49295b6f90ba105d424b66d2482b6e 11-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't trigger strict mode for shortcut manager bitmap compression"
c03127e83317009fa8430325e72555cdba47f3b7 11-Oct-2017 Makoto Onuki <omakoto@google.com> Don't trigger strict mode for shortcut manager bitmap compression

Bug 65179362
Test: manual

Change-Id: Ic4540e96959244a932142b978681cd2750aae6f1
hortcutBitmapSaver.java
f73f9ed57068d8256ae386f7a8be6ee2dda7cbf2 11-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add system property to allow testing OTA with the same build image"
af60534c97fd91d283a8171aa82e5cef78f757d8 10-Oct-2017 Charles He <qiurui@google.com> Merge "Add user restriction to suppress error dialogs."
a27be6072e94ffc90892004378a91f0f60ecc74f 06-Oct-2017 Shubham Ajmera <shubhamajmera@google.com> Add system property to allow testing OTA with the same build image

The property can be used to test post boot stage without needing
to change the build signature.

Test: make
Change-Id: Ic132da7fda346f0cced4fd9417a34f59501ae7ee
ackageManagerService.java
faa5840f06c914b62bd853b4ebc7a07834d598b3 10-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Move mPermissionTrees to permission settings"
15c84348b906211d0180a121f6cd235c222c91a0 09-Oct-2017 Makoto Onuki <omakoto@google.com> Don't take a lock on the UI thread.
am: d4b7862785

Change-Id: Iae6c7832c7ac1c853b3e7aee19c23442e87cebfb
c56106a13edde7404275bcf97ae143f600857d7c 07-Oct-2017 Fyodor Kupolov <fkupolov@google.com> Crash if not all privileged permissions are whitelisted

Test: reboot device - no crashes
Test: Ran privapp_permissions.py for fugu/marlin/taimen
Bug: 64693550
Change-Id: I9522ccaa75858b9a3d153c95c529eff70cd13994
ackageManagerService.java
d4b7862785f14d591f13f4a1bd547b65d8e5c479 23-Sep-2017 Makoto Onuki <omakoto@google.com> Don't take a lock on the UI thread.

Bug 66719356

Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutManagerTestCases
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutHostTestCases
Change-Id: I1045eda4910e3c7d3172038a1efd31cdf9346729
hortcutService.java
22ff6f9df0b1e195f4d9daee0c7f4ba8f7ad6c9a 05-Oct-2017 Charles He <qiurui@google.com> Add user restriction to suppress error dialogs.

Bug: 66125576
Test: cts-tradefed run cts-dev --module DevicePolicyManager -t com.android.cts.devicepolicy.UserRestrictionsTest
Test: bit FrameworksServicesTests:com.android.server.pm.UserRestrictionsUtilsTest
Change-Id: I1c4cf4a107f47e9b5543607e57b76dd2e5acfba5
serRestrictionsUtils.java
93d703a44afaa9f1fb6934f3717a6ab7a40f3d98 06-Oct-2017 Paul Duffin <paulduffin@google.com> Merge "Preserve order of shared library files"
c842393bc55509b094d3a71f164fcdbadf5c7997 05-Oct-2017 Todd Kennedy <toddke@google.com> Move mPermissionTrees to permission settings

Move more state / logic into the permission sub-package. We're
close to being able to wholesale move large amounts of code from
package manager into the permission manager.

Bug: 63539144

Test: Manual. Builds and runs
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.PermissionsHostTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermissionTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermission2TestCases
Test: bit FrameworksServicesTests:com.android.server.pm.PackageManagerSettingsTests
Change-Id: Id292441ff22b14665fd77f700ad934bf2c5a3357
ackageManagerService.java
ettings.java
ermission/BasePermission.java
ermission/PermissionManagerInternal.java
ermission/PermissionManagerService.java
ermission/PermissionSettings.java
e985a02bb66bdaf26474d93a4709b902fafbbf4f 06-Oct-2017 Chris Tate <ctate@android.com> Merge "Do not apply app-link autoVerify policy to instant app installs"
695c8ac7f030d1ad8fd6a4622aa064ff9ac8b46e 06-Oct-2017 Calin Juravle <calin@google.com> Do not line-wrap dexopt status

It makes the output pretty ugly and hard to parse by tools.

Test: adb shell dumpsys package dexopt
Change-Id: If94424c028f4f6205c4905982bfeb4ff787233df
ackageManagerService.java
b1b3a1c346af74942e89144bc7da3a0238900ca0 05-Oct-2017 Todd Kennedy <toddke@google.com> Remove synchronization

This isn't necessary and was added purely defensively. Remove
it because it causes a deadlock.

Change-Id: Ia83536d86dd9390f89c8016097161b53c99612ce
Fixes: 67466611
Test: build, runs and the device doesn't hang
ackageManagerService.java
05941b396a44bd81c143b727e5c4c630212228e0 05-Oct-2017 Christopher Tate <ctate@google.com> Do not apply app-link autoVerify policy to instant app installs

Bug: 66698768
Test: manual
Change-Id: Ib9bea22bf8096e708eef93934e0e972be3a2a4c5
ackageManagerService.java
e0fa2c04089c3e3bec38d84ae8905388190a4462 05-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes I616184fa,Ibc1500f5

* changes:
Move mPermissions from package settings
Move DefaultPermissionGrantPolicy
0eb9738d1708d9aa7846782046e6828ffc9fe901 04-Oct-2017 Todd Kennedy <toddke@google.com> Move mPermissions from package settings

Create a settings class only for use with permissions. It's
subservient [and should only be accessed directly by] package
settings or the permission manager. The rest of the permission
related data needs to be moved to permission settings. At
which point we can start pulling the permission methods out of
the package manager service and into the permission manager.

We still have a somewhat tight relationship between package
manager and the permission manager. It's unclear how far we need
to separate them and if relying entirely on an internal
interface is sufficient.

Bug: 63539144
Test: Manual. Builds and runs
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.PermissionsHostTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermissionTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermission2TestCases
Test: bit FrameworksServicesTests:com.android.server.pm.PackageManagerSettingsTests
Change-Id: I616184fa2135a11687e4ce615884f861466fdebe
nstantAppRegistry.java
ackageInstallerService.java
ackageManagerService.java
ackageManagerServiceUtils.java
ackageSetting.java
ackageSettingBase.java
ettings.java
haredUserSetting.java
hortcutService.java
serManagerService.java
ermission/DefaultPermissionGrantPolicy.java
ermission/PermissionManagerInternal.java
ermission/PermissionManagerService.java
ermission/PermissionSettings.java
ee405a2cfd597848e1e7521089de9b852f4f88bb 02-Oct-2017 Paul Duffin <paulduffin@google.com> Preserve order of shared library files

Shared libraries are stored in a list so order is preserved. However,
when they are resolved to files, e.g. for use as a class path the
file names are added to an ArraySet which loses the order. Presumably
they are added to a Set to eliminate duplicates. This switches to a
LinkedHashSet which will preserve the order in which the files are
added while still avoiding duplicates.

It is possible that this could cause app compatibility issues as the
order in which shared libraries is being added is changing. Problems can
only arise if two libraries whose order changes have duplicate classes
and/or resources. In that case the app was only working by luck, as the
order provided by ArraySet is based on the numerical order of hash
codes.

This was found while investigating performance regressions in
GoogleDialer, unfortunately it does not fix the regressions.

Bug: 65552462
Test: flash -w and systrace GoogleDialer to ensure correct order
Change-Id: Ia01ce4821fa53e4785716b72c4f87a0b0ab4dcc8
ackageManagerService.java
e805aa265f6b41ad7c7a19dfff449acd6ca96acd 05-Oct-2017 Calin Juravle <calin@google.com> Merge "[framework] Compile secondary dex files in isolation" into oc-mr1-dev am: 446e8babd6
am: 31ef7f3ab6

Change-Id: I547b7c8a1755b83811c09ad33aea6c5c2fe9b5aa
31ef7f3ab69d62c6820f9d56a68f0b5a4c277cf8 05-Oct-2017 Calin Juravle <calin@google.com> Merge "[framework] Compile secondary dex files in isolation" into oc-mr1-dev
am: 446e8babd6

Change-Id: I341efd5d36021b29a84fed72a715c6babb324e68
20b8221c9fd279d3cc48ef876a7fbe5fff29ef67 05-Oct-2017 Makoto Onuki <omakoto@google.com> dumpsys shortcut can now dump specific users/packages.

Test: manual
Change-Id: Iaf32ba17cd14fea61ab1ff1d4620b89f73538e81
hortcutLauncher.java
hortcutPackage.java
hortcutService.java
hortcutUser.java
27f926212483e8291a63884e60fa44de4d0df17c 04-Oct-2017 Calin Juravle <calin@google.com> [framework] Compile secondary dex files in isolation

The class loader context adds the overhead of extracting in-memory and
possibly extra verification which is being frowned upon when the loading
happens on the UI thread. Revert the correct fix of compiling secondary
dex files with their loading context until b/64530081 is done.

Partial revert of commit f1ff36f0f99ebb41d0c7e0f3248506a56998fa3f.

Test: adb shell cmd package compile -m quicken -f --secondary-dex
com.google.android.gms
Bug: 64530081
Bug: 66984396
Change-Id: Ib2815ce67b224883fe95c28d1424103e56342c6e
ackageDexOptimizer.java
82b0842051a93764e96a68072da1a220f00c2c27 28-Sep-2017 Todd Kennedy <toddke@google.com> Move DefaultPermissionGrantPolicy

Move this class to the permission sub-class. No longer depends upon
PackageManager's lock and adds some internal interfaces so it can
get back to the PackageManager.

Bug: 63539144
Test: Manual. Builds and runs
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.PermissionsHostTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermissionTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermission2TestCases
Change-Id: Ibc1500f56cfb67722e68b258ea59118603508912
efaultPermissionGrantPolicy.java
ackageManagerService.java
ackageSetting.java
ermissionsState.java
ettingBase.java
ettings.java
ermission/DefaultPermissionGrantPolicy.java
ermission/PermissionsState.java
c92d97c450e7a571fa62db5e129da186fc428142 03-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Shortcut: Avoid long lines in dumpsys"
6208c675fd83b074bda80c59b3b981f72b94f4b0 03-Oct-2017 Makoto Onuki <omakoto@google.com> Shortcut: Avoid long lines in dumpsys

Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Change-Id: Iaf758860cb492436685f177fcc9dc68cb341a462
hortcutPackage.java
1186eb3fad0b61f9a6dbf027e933fd778cbad4b2 27-Sep-2017 Edward Savage-Jones <edward.savage-jones@sony.com> Block the upgrade of persistent apps

Currently when upgrading a persistent app the persistent flag will
be silently stripped from the newly installed app, resulting in
inconsitent app behaviour.

Persistent apps by definiton should not be possible to upgrade via
adb or any 3rd party installer. This commit adds a check which will
fail the upgrade of an app marked as persistent.

Bug: 66889554
Test: Manual
- Create an app with the persistent flag set to true,
push to /system/priv-app and reboot
- Increment the app versionCode, build and install using
adb install -r
The attempted adb install should fail with:
INSTALL_FAILED_INVALID_APK
Change-Id: Iaa00addcfbbb2adba319bea96b37e8bfb6e11372
ackageManagerService.java
e5f03a6607b76db05327277b7ea0c9ed489e6091 29-Sep-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Move BasePermission to own package"
f8bb2445ff28d64d12d81d91539bb419f69e7874 22-Sep-2017 Jeff Sharkey <jsharkey@android.com> Finish removing ASEC.

Awhile back we explicitly blocked any new ASEC installs, with the
expectation that we'd eventually remove the logic entirely. We've
had them disabled for about a week now without incident, so let's
rip out the remaining code.

Test: bit FrameworksCoreTests:android.content.pm.PackageHelperTests
Test: bit FrameworksCoreTests:android.content.pm.PackageManagerTests
Bug: 32913676
Change-Id: I1ecc35487420731f5c4bdf03bca5751548ce51b3
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
ackageManagerShellCommand.java
6985405bd8eef0fff6e0dd4aef8240e04f5222da 28-Sep-2017 Mathieu Chartier <mathieuc@google.com> Merge "Revert "Revert "Add preopt profile logic for compiling during first boot""" into oc-mr1-dev am: 00579bd49a
am: 7fe00cc2e7

Change-Id: I99f84825f0a3bcbc584fffff84ba67cdc24ba9d5
7fe00cc2e7ce21b883243cd7b9f487342ac04b26 28-Sep-2017 Mathieu Chartier <mathieuc@google.com> Merge "Revert "Revert "Add preopt profile logic for compiling during first boot""" into oc-mr1-dev
am: 00579bd49a

Change-Id: I5ddd1386683cab62754147cdbbdf6196c45ac271
91a39d126d1f6efa47948ca1039ca347c1bd19e6 27-Sep-2017 Todd Kennedy <toddke@google.com> Move BasePermission to own package

This is the first of many changes. Moving permissions to their own package.

Change-Id: I60e94e2da3c96788fc165e97e813ab5b9ee51586
Bug: 63539144
Test: Manual. Builds and runs
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.PermissionsHostTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermissionTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermission2TestCases
asePermission.java
efaultPermissionGrantPolicy.java
umpState.java
nstantAppRegistry.java
eySetManagerService.java
ackageManagerService.java
ackageSetting.java
ackageSettingBase.java
ermissionsState.java
ettings.java
ermission/BasePermission.java
c5d1b90f41cc3b33d1bed149df2f735481fe66cb 26-Sep-2017 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Add preopt profile logic for compiling during first boot""

Disabled the logic for first boot profile compilation for non-extracted APKs.
This prevents going from speed-profile->speed-profile if things are preopted.

Test: build, flash, verify no speed/speed-profile compilation during first boot

Bug: 66903791

This reverts commit 4a299d56e613ab85c0e732020e0041e566b21e84.

Change-Id: Iaa526e605cf57b2f24ba72d6786b35d5347cd3c5
ackageManagerService.java
a0791db4d77257b76d3fb532c33c13942a5001b1 27-Sep-2017 Calin Juravle <calin@google.com> Merge "Fix spelling mistake in dumpsys output" into oc-mr1-dev am: 1198bec925
am: b22e7a2efd

Change-Id: I8a1019d737bf543c47473f91c97816918aa21ea7
b22e7a2efd130d00f277bfe4d07211960996741f 27-Sep-2017 Calin Juravle <calin@google.com> Merge "Fix spelling mistake in dumpsys output" into oc-mr1-dev
am: 1198bec925

Change-Id: I21837cdcdc44c8bc8496ed699b3e8420534fd9c4
1198bec925d25b3a8f5373cfa94352a765eb72c0 27-Sep-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix spelling mistake in dumpsys output" into oc-mr1-dev
2f8eb6cb00c083a0965f6d0992f0149bae67a36b 27-Sep-2017 Calin Juravle <calin@google.com> Merge "Remove obsolete & broken handling of precompiled sys apps" into oc-mr1-dev
am: 3e00e3bd92

Change-Id: Id5a92c8f49d07896327cba7c63f06392026909d9
3e00e3bd921438d4eb7122e8f64ea4399729fbc3 27-Sep-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Remove obsolete & broken handling of precompiled sys apps" into oc-mr1-dev
4f475cc140ca3127770fbfd4f37ccf0603dc2c2a 26-Sep-2017 Calin Juravle <calin@google.com> Remove obsolete & broken handling of precompiled sys apps

During the times we used verify-profile for OTAs we had to ensure that
prebuilds do not regress by verifying at runtime. For that we added a
hackish check in PMS.

Now, we no longer use verify-profile and we have no configuration which
will leave the prebuilds unverified (assume-verify does not count here).
So, we can remove this check which blocks system apps to be compiled with
speed-profile.

(Also worth mentioning that
!Environment.getReferenceProfile(pkg.packageName).exists() was broken...
most likely because of an SElinux policy update which we did not handled
:/ )

Bug: 66903791
Test: build & boot

(cherry picked from commit efc022768eba2f33d3fadbda7eaa6adf1730d3fc)

Merged-In: I981e463d61c42ab8455d489ff86cc300632a2a90
Change-Id: I981e463d61c42ab8455d489ff86cc300632a2a90
ackageManagerService.java
94837e35e3c149e81da90f312fbb37f22c8bc90e 26-Sep-2017 Calin Juravle <calin@google.com> Fix spelling mistake in dumpsys output

Bug: 65843255
Test: build
Change-Id: Icc748dd14b52641e37b149f51d61a4086e55ed41
ackageDexOptimizer.java
efc022768eba2f33d3fadbda7eaa6adf1730d3fc 26-Sep-2017 Calin Juravle <calin@google.com> Remove obsolete & broken handling of precompiled sys apps

During the times we used verify-profile for OTAs we had to ensure that
prebuilds do not regress by verifying at runtime. For that we added a
hackish check in PMS.

Now, we no longer use verify-profile and we have no configuration which
will leave the prebuilds unverified (assume-verify does not count here).
So, we can remove this check which blocks system apps to be compiled with
speed-profile.

(Also worth mentioning that
!Environment.getReferenceProfile(pkg.packageName).exists() was broken...
most likely because of an SElinux policy update which we did not handled
:/ )

Bug: 66903791
Test: build & boot
Change-Id: I981e463d61c42ab8455d489ff86cc300632a2a90
ackageManagerService.java
f4b8915efd3905642db1e2134879f01febf6e100 26-Sep-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Special handling of priv-apps in PMS." am: 107899c599 am: 15b0493360 am: 35455f2553
am: 61dc6ffcbd

Change-Id: I21e1683250d43cbc4c95ec748623b7368f8d4b28
61dc6ffcbd917f4b39821a0dcc9266d349343a6a 26-Sep-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Special handling of priv-apps in PMS." am: 107899c599 am: 15b0493360
am: 35455f2553

Change-Id: I8bfe46aad8166d4d4b7346fe10f3e148a34ccf0b
69fbdcae71c43114a98bcad1900e7df9df53160b 26-Sep-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Move code around for deleting oat artifacts."
am: a7bf2a21d9

Change-Id: I63ef9f2a730dbe6ad37ce750be3a6a47636c14d6
15b0493360c04ec67f4a2dbc145a83f29655c869 26-Sep-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Special handling of priv-apps in PMS."
am: 107899c599

Change-Id: I43de972b520dcfab7d103ce77ea1539e341825b3
f006217aaa8a5e9feff2815e89311599bb7f025d 26-Sep-2017 Mathieu Chartier <mathieuc@google.com> Merge "Revert "Add preopt profile logic for compiling during first boot"" into oc-mr1-dev am: 213b5c742f
am: 364ea009c0

Change-Id: Icfd1899886b051931ffeeffc68023c0c6676b719
4a299d56e613ab85c0e732020e0041e566b21e84 25-Sep-2017 Mathieu Chartier <mathieuc@google.com> Revert "Add preopt profile logic for compiling during first boot"

Test: flash build and forrest
Bug: 66903791

This reverts commit 20ad4b92a7528f24adf6e4f6d23d9d3a02a8792a.

Change-Id: I2c0f22f2a7c04221ed7b1562e516be98d27c7a50
ackageManagerService.java
dc3f6d1c52ba062842dcc85cef5f9867e8589f79 23-Sep-2017 Makoto Onuki <omakoto@google.com> Don't take a lock on the UI thread.

Bug 66719356

Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutManagerTestCases
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutHostTestCases
Change-Id: I1045eda4910e3c7d3172038a1efd31cdf9346729
hortcutService.java
a7bf2a21d99b5044af3262d806509153899777e5 25-Sep-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Move code around for deleting oat artifacts."
d15621bef2c206c2161559feaae91fbef95cbb83 23-Sep-2017 Mathieu Chartier <mathieuc@google.com> Merge "Add preopt profile logic for compiling during first boot" into oc-mr1-dev am: 28e0dd177a
am: 1b192d95c7

Change-Id: I245a6ff2fb5220bf0ffcca475ea2ec0ffa597bd8
20ad4b92a7528f24adf6e4f6d23d9d3a02a8792a 15-Sep-2017 Mathieu Chartier <mathieuc@google.com> Add preopt profile logic for compiling during first boot

Allows pushing profiles on device that are used to optimize apps
during first boot.

Added logic to copy profiles to reference location for compressed APKs.

Bug: 38032017
Bug: 64503246
Test: adb shell rm -rf /data/app/*
Test: adb shell rm /data/system/package*
Test: adb shell stop && adb shell start
Test: look at apps in /data/app to make sure they are profile compiled

Change-Id: I30452098a19a65a331d098107d37498e5b10c10f
ackageManagerService.java
20a894ed549a66786c3ca999f1a0083970b7e59c 08-Sep-2017 Nicolas Geoffray <ngeoffray@google.com> Special handling of priv-apps in PMS.

If pm.dexopt.priv-apps is set to false, don't do any dexopt on it, and
check the APKs have uncompressed and aligned code.

bug: 30972906
bug: 63920015

Test: works as expected when pm.dexopt.priv-apps is true or false
Change-Id: I72a322defb459549617028e030f1aec997223af5
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceUtils.java
575697a574e8ef398e1aeb87f8a9044fc46002a8 22-Sep-2017 Nicolas Geoffray <ngeoffray@google.com> Move code around for deleting oat artifacts.

Test: make and boot
(partially cherry-picked from commit 246dccf9327631597767afe418ce43ae6d07d102)

Change-Id: Id3ce5fdee116df264241dfdee95734ac4bbad7ce
taDexoptService.java
ackageManagerService.java
63fa3f19f45bae4b57de7755ac6d46d1b0561083 21-Sep-2017 Shubham Ajmera <shubhamajmera@google.com> Merge "Fix compiler filter for downgrading unused apps" into oc-mr1-dev am: 15f814e36e
am: 9f2baf1853

Change-Id: I7295e91cdcc8dbe3251b3ab93add1e26207c703c
d3e97a5a27e269ebc268e1507db89f2fc5bb47dd 21-Sep-2017 Ray Essick <essick@google.com> Merge "packagemanager_native access to package installer, version" into oc-mr1-dev am: 71ab6f6555
am: 81799dce0b

Change-Id: Iab1d843e997854747b1275991c7a3a6cf5a1fc03
15f814e36e33c4c178b9fdd7c21ba5511029c255 20-Sep-2017 Shubham Ajmera <shubhamajmera@google.com> Merge "Fix compiler filter for downgrading unused apps" into oc-mr1-dev
71ab6f6555c4bb6b88982b78be8d355350f8ff36 20-Sep-2017 Ray Essick <essick@google.com> Merge "packagemanager_native access to package installer, version" into oc-mr1-dev
8c85e5ffe65f7ff2e30e405e61a9e64ef3b69b78 20-Sep-2017 Shubham Ajmera <shubhamajmera@google.com> Merge "Partially revert ce54397368dc98182d7b4eb2ff3c142bbd87e39d" into oc-mr1-dev am: 2cdfda1232
am: d4083dc339

Change-Id: Ic4b97b9d378f379bfbc00c6d2566c1712a2edf07
2cdfda1232417637341e2a08c43049045f3db350 20-Sep-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Partially revert ce54397368dc98182d7b4eb2ff3c142bbd87e39d" into oc-mr1-dev
e54975ad94b520db6bf3adf0597c3b5f735c3510 20-Sep-2017 Calin Juravle <calin@google.com> Merge "Fix dexopt dump" into oc-mr1-dev am: 479af339de
am: 97de54bdda

Change-Id: Iaeb4ce6d248ae988ffd68a609bb572d600bc1698
a115080422432b185b79725e849fbd871cd8ec41 20-Sep-2017 Calin Juravle <calin@google.com> Merge "Add an explicit reason for the compilation of shared apks" into oc-mr1-dev am: d78d269650
am: 3489d1900b

Change-Id: I274b9c580e1e399e9575ba7de23925666f2e9276
479af339de4fce8355a317ab6bd368d13a17e867 19-Sep-2017 Calin Juravle <calin@google.com> Merge "Fix dexopt dump" into oc-mr1-dev
d78d269650015ac0cb29da90e64d5aa6d1c693ae 19-Sep-2017 Calin Juravle <calin@google.com> Merge "Add an explicit reason for the compilation of shared apks" into oc-mr1-dev
1ba0b8ac2bffae0406427fe7a09e1526e190ee2a 19-Sep-2017 Shubham Ajmera <shubhamajmera@google.com> Partially revert ce54397368dc98182d7b4eb2ff3c142bbd87e39d

We have already reverted A/B dexopt for secondary dex files in commit
7c1471197427b59f99578fd2483b1e113ba4b7f1. This removes secondary dex
opt during boot after OTA.

Bug: 65067046
Test: make and boot.
Change-Id: I76009ed609a608e009a50860b53a8dfed9d57334
ackageManagerService.java
d8200866ae2d0289e855d257b4d0c6c24aa09478 19-Sep-2017 Shubham Ajmera <shubhamajmera@google.com> Fix compiler filter for downgrading unused apps

Bug: 65861247
Test: Verified manually that dex files are getting downgraded for \
unused packages.

Change-Id: Ice2b111ab5bfd231a592ac5ed416362b95d27e8a
ackgroundDexOptService.java
42a65abd1abec6c8004f952776f1306d73748676 19-Sep-2017 Ray Essick <essick@google.com> packagemanager_native access to package installer, version

implementation of getInstallerForPackage() and
getVersionCodeForPackage() to support native media.metrics needs.

Bug: 65027506
Test: watch logs for various package combinations
Change-Id: I8a262799867cffe45922f21a237ad2af3d99a39b
ackageManagerService.java
cf72222f41f4ce73302274d2e8b4fcc735c3bd00 19-Sep-2017 Calin Juravle <calin@google.com> Fix dexopt dump

Dexopt dump prints the status of primary oat file instead of secondary.
We cannot get the secondary dex file status without an installd call so
this CL just removes the status line.

Bug: 65843255
Test: adb shell dumpsys package dexopt
Change-Id: I76028704267eed68ba8c51f45ce8b54f403cc255
ackageDexOptimizer.java
f53201f8c796e8500b76b72e4fad6269d8547369 15-Sep-2017 Calin Juravle <calin@google.com> Add an explicit reason for the compilation of shared apks

Some devices might find it more beneficial to compile shared apks like gms
or gms modules with quicken rather then speed.

Bug: 65591595
Test: build
Change-Id: I90b79e9f6bc4b4d6b3f5c0b90ab95e8880c4ac9d
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
80e8e399d0aa3327a1b0a7785e7a7a3971af32c0 18-Sep-2017 Philip P. Moltmann <moltmann@google.com> Use 1MB buffer for install cmds

Similar to Package Installer App. This reduces the overhead of each
chunk and slighly speeds up package installation.

Test: Installed app via 'adb install' and 'adb shell pm install'
Change-Id: Ic8f67087e578bf0696e3d55ad3d7f3892ca2bf90
ackageManagerShellCommand.java
ca048a52751a19e4d4ba39212831a60e941d4c13 14-Sep-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add new OEM permission flavor"
304d2670663f3ad6042f2e1702dcb30bf83ffb14 14-Sep-2017 Philip P. Moltmann <moltmann@google.com> Merge "Do not fail session.commit on current thread" into oc-mr1-dev
087dce20e3a7137e94607c060fd825d1f8952572 08-Sep-2017 Svet Ganov <svetoslavganov@google.com> Add new OEM permission flavor

The new OEM permission flavor of signature protected perissions
can be granted only to apps on the OEM partition if they are:

1. Signed as the one declaring the permission

2. The requesting app is on OEM partition of the system image and
declares the permission used and the OEM explicitly granted this
permission by adding an entry in /oem/permission/*.xml
with the following format:

<permissions>
<oem-permissions package="foo.bar.baz">
<permission name="android.permission.ACCESS_FOO" granted="true"/>
</oem-permissions>
</permissions>

All OEM permissions requested by any app on the OEM partition
must be declared granted or not to force the OEM making a well
though out explicit choice. If that condidtion is not met the
system server restarts - this prevents shipping a device with
OEM permissions for which no opition was explicitly expressed.

Normal apps requesting an OEM permission has no effect, i.e the
permission is only granted on a signature match.

Change-Id: I345bb0b56368ee03e4bd768faab540ee4e0571ae
Bug: 65497745
Test: Manual
ackageManagerService.java
ackageManagerShellCommand.java
ackageSetting.java
ettingBase.java
ettings.java
32242a06e88801d9a0a7c903fcca6525d2c0f522 13-Sep-2017 Philip P. Moltmann <moltmann@google.com> Do not fail session.commit on current thread

The adb install command calls session.commit() requires the failure to
be delivered on a different thread than the one that calls
session.commit().

Test: Tried to install invalid package via adb install
Change-Id: I8b616c750afa81f126fa3d3576d21df8274b1432
Fixes: 65555295
ackageInstallerSession.java
0e4ac4c8ca8cee0936d983fdda04b76c2f40f343 14-Sep-2017 Philip P. Moltmann <moltmann@google.com> Delay onPackageInstalled callback

Bug: 65555295
Test: Installed invalid packages via adb install and package installer
app
Change-Id: I8b616c750afa81f126fa3d3576d21df8274b1432
ackageInstallerSession.java
6d17e6586e77e1f2409df469c2c4ddfeb64e2369 14-Sep-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "One final attempt at patching over ASEC mess."
a983528f600b6df4f1dfa3146949288d2f63cbcf 13-Sep-2017 Jeff Sharkey <jsharkey@android.com> One final attempt at patching over ASEC mess.

Test: builds, boots multiple times, runtime permissions grantable
Bug: 65544665
Change-Id: Ia6a7b2c30e36c72e61ad201e2d8eb8de4d0fd110
ackageManagerService.java
0dd17aa5a78da5790eec517ebbf5549546ebbc7b 13-Sep-2017 Patrik Torstensson <totte@google.com> Merge "Add default permissions for GLOBAL_SEARCH" into oc-mr1-dev am: f876e789fd
am: 0b15e684ec

Change-Id: Ie4d78ad7c8d75d24965474f1eab2bc844d922f57
f876e789fd9638838273ee71a925ca4a63ea05c1 12-Sep-2017 Patrik Torstensson <totte@google.com> Merge "Add default permissions for GLOBAL_SEARCH" into oc-mr1-dev
e14a95a1b4efaccdb684fd86a513bf74e585511c 12-Sep-2017 Jeff Sharkey <jsharkey@google.com> Merge "Explicitly update permissions after pre-grants."
bd36ab83e7271b440ae13432019d57068f812a99 11-Sep-2017 Jeff Sharkey <jsharkey@android.com> Explicitly update permissions after pre-grants.

Up until now, the OS had been implicitly relying on the
scanAvailableAsecs() method kicked off by StorageManager to actually
update any pre-granted permissions.

This was uncovered as part of ripping out ASECs, so now we need to
explicitly update permissions after pre-grants have been applied.

Test: builds, boots, Camera permissions can be granted
Bug: 65544665
Change-Id: I51e6bc81d9cf40c681094ee6069bc84a2edefea3
ackageManagerService.java
7c1471197427b59f99578fd2483b1e113ba4b7f1 08-Sep-2017 Shubham Ajmera <shubhamajmera@google.com> Remove broken secondary dexopt during OTA

This is interim until the selinux policies get fixed.

Bug: 65067046
Test: make
(cherry-picked from commit b6156ca0f53d933b427d30e69aa2f638d4ecb88f)
Change-Id: Iea69e987ae451c80fa67065e08939e389efd2814
taDexoptService.java
727aaa36b6914be3f340c97c991c93314d25c617 05-Sep-2017 Shubham Ajmera <shubhamajmera@google.com> Handle '&' in DexoptUtils#encodeClassLoader

For system apps, we pass '&' for CLC.
The method was treating this as a path as a result we were getting
wrong encoding for CLC.
This was causing dexopt failures for A/B OTA.

Removed the secondary dex file dexopt till we fixed it.

Bug: 65067046
Test: runtest.py -x \
frameworks/base/services/tests/servicestests/src/com/android/server/pm/dex/DexoptUtilsTest.java
(cherry-picked from commit 557c054935c0864b42ce49541d12d32ae6a797bc)
Change-Id: I9aa440750c811676c86d8c6d0d451077d0edf5a0
taDexoptService.java
ex/DexoptUtils.java
98c840942d54b9a5fd7d3d0652d12aff17d3cef0 11-Sep-2017 Shubham Ajmera <shubhamajmera@google.com> Merge "Remove broken secondary dexopt during OTA"
cdbae800b4a665572ef3105d4187082a8586c49e 11-Sep-2017 Shubham Ajmera <shubhamajmera@google.com> Merge "Handle '&' in DexoptUtils#encodeClassLoader"
32889f4d7550d1e7bff535a79d4043c8a56081cd 11-Sep-2017 Todd Kennedy <toddke@google.com> Merge "also verify existence of a package" into oc-mr1-dev am: 8cfb2f6310
am: 9de79308bd

Change-Id: I65a667022753cb91db678227ea212de53fc25ec6
810e1f9064252a5146201ef97a5fa5ef89faf2be 07-Sep-2017 Patrik Torstensson <totte@google.com> Add default permissions for GLOBAL_SEARCH

Adding default permissions for packages which respond to
android.search.action.GLOBAL_SEARCH on low RAM devices.

This change is specifically for the Android Go platform where devices
will return true for ActivityManager.isLowRamDevice().

Test: gts & test on gobo device
Bug: 64997899
Change-Id: I8ba27ec2150c5747a9accd1853b117c11578507e
efaultPermissionGrantPolicy.java
ece83b0afc72135a1fde81198508b2572c500f70 11-Sep-2017 Todd Kennedy <toddke@google.com> Merge "Don't install package if it's required to be known" into oc-mr1-dev am: 57d42ed0f9
am: 420bd8ff5c

Change-Id: I22c1dcf0faf5997f6660a54500ec59ffd6291b2e
8cfb2f6310bf8d655c9e9addb5f1ae2efa209ca3 11-Sep-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "also verify existence of a package" into oc-mr1-dev
57d42ed0f9fab0f30d15cd2e50d7521d58693879 11-Sep-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't install package if it's required to be known" into oc-mr1-dev
4466373ec66eb3d4e5da33eda62b0948128627d1 09-Sep-2017 Philip P. Moltmann <moltmann@google.com> Merge "Sealed sessions need to be destroyed or validated" into oc-mr1-dev am: c0e306bf03
am: 2da5f3f027

Change-Id: I83f2668f3f93eb869c97711cdc9fa5c52dbb22d7
c0e306bf032fb62a1dcddb85fd6f1aa3c90ada8f 09-Sep-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Sealed sessions need to be destroyed or validated" into oc-mr1-dev
acef92cde7ebef6d1e49955a8cf48ff3e3560bdf 09-Sep-2017 Calin Juravle <calin@google.com> Merge "Handle configuration splits when creating the class loader context" into oc-mr1-dev am: ed54b41e3c
am: b2e1a3cbc2

Change-Id: I9c36d6cd44a6f65a3bbd6ea89f1f328e7fbfcfc6
37dd1ba0f09e46d807cc3a4a0315fc65eaa09606 08-Sep-2017 Philip P. Moltmann <moltmann@google.com> Sealed sessions need to be destroyed or validated

- Always destroy session on validate failure.
- Always validate session when restoring a sealed session.
- Never persist destroyed sessions

Fixes: 65456964
Test: cts-tradefed run singleCommand cts-dev -m CtsContentTestCases --test=android.content.pm.cts.InstallSessionTransferTest
Installed apps via Google Play Store
Installed apps via Package installer
Change-Id: I38940608eca6d32a9a454937d273706f3ce57d79
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerException.java
ed54b41e3c992036db997f40178584c423c8659b 08-Sep-2017 Calin Juravle <calin@google.com> Merge "Handle configuration splits when creating the class loader context" into oc-mr1-dev
02cecae02901c86334e09b162c09a6e99187f171 08-Sep-2017 Todd Kennedy <toddke@google.com> Don't install package if it's required to be known

During package scaning, we can require packages to be known. This
allows us to determine if an install was interrupted by checking
the previously known path with the current scanned path. However,
if the package wasn't known at all, we allowed the newly scanned
package to be installed. Instead, these completely unknown
packages should be removed as incomplete installs.

One side effect of the existing code is when new apps randomly
appear on /data/app, they will be installed. This is not behaviour
we want to support. Instead, applications should always be
installed through "adb install".

Change-Id: I3169482ab9ead252c0e91b415fa4da056abeed4a
Fixes: 65162907
Test: Manual
Test: cherry-pick ag/2863255
Test: adb install Foo.apk
Test: adb shell setprop fw.poke com.android.foo
Test: adb shell stop && adb shell start
Test: see entries in persistent package manager logs for removing app & data [adb shell dumpsys package messages]
ackageManagerService.java
b6156ca0f53d933b427d30e69aa2f638d4ecb88f 08-Sep-2017 Shubham Ajmera <shubhamajmera@google.com> Remove broken secondary dexopt during OTA

This is interim until the selinux policies get fixed.

Bug: 65067046
Test: make
Change-Id: Iea69e987ae451c80fa67065e08939e389efd2814
taDexoptService.java
79b121eaa68f91b447ef1a3db7660c0c5302344e 08-Sep-2017 Todd Kennedy <toddke@google.com> also verify existence of a package

During an OTA, if a system app is replaced, keeping the same
directory but changing the package name, it's possible to have
a phantom disabled system package setting. In this scenario,
check that the disabled system package is actually backed by
a package.

Change-Id: Ifdaa3b3202256f3b039b0281ba6ab9d669d4b359
Fixes: 65367640
Test: Manual
Test: Create /system/app/Foo/Foo.apk
Test: upgrade app [adb install -r com.foo]
Test: Replace /system/app/Foo/Foo.apk w/ a new package name
ackageManagerService.java
557c054935c0864b42ce49541d12d32ae6a797bc 05-Sep-2017 Shubham Ajmera <shubhamajmera@google.com> Handle '&' in DexoptUtils#encodeClassLoader

For system apps, we pass '&' for CLC.
The method was treating this as a path as a result we were getting
wrong encoding for CLC.
This was causing dexopt failures for A/B OTA.

Removed the secondary dex file dexopt till we fixed it.

Bug: 65067046
Test: runtest.py -x \
frameworks/base/services/tests/servicestests/src/com/android/server/pm/dex/DexoptUtilsTest.java

Change-Id: I9aa440750c811676c86d8c6d0d451077d0edf5a0
taDexoptService.java
ex/DexoptUtils.java
5248ce6123a732a646b2e725cc122e77f027062c 08-Sep-2017 Todd Kennedy <toddke@google.com> Merge "skip filtered entries instead of returning" into oc-mr1-dev am: 5ead92fd93
am: a15eb27487

Change-Id: Ic8bb63ebcd9c274559aa7954f6984d79084b3f13
5ead92fd93cd5285696f185acad5edb0d56b36d0 08-Sep-2017 Todd Kennedy <toddke@google.com> Merge "skip filtered entries instead of returning" into oc-mr1-dev
44c6e0d5e480d9938cf638f150fcde876ad471de 08-Sep-2017 Fyodor Kupolov <fkupolov@google.com> Merge "Introduced AppRestrictionsLock" into oc-mr1-dev am: f6b8e4fda5
am: bb40e2ff1b

Change-Id: Ibc0b413f220726b97b8419212df9b9d4a52ec9e0
03e5215708d498221f024641cd0f58a395f1df4b 07-Sep-2017 Todd Kennedy <toddke@google.com> skip filtered entries instead of returning

When retrieving all packages / apps on the system, we should just
skip over any filtered entries rather than returning 'null'.

Change-Id: If874be3904b6d5a1103e099eb2ddff839091121e
Fixes: 65389431
Test: Manual:
Test: bit FrameworksCoreTests:android.content.pm.PackageManagerTests\#testGetInstalledPackages ; passes
Test: adb install --instantapp somepackage.apk
Test: bit FrameworksCoreTests:android.content.pm.PackageManagerTests\#testGetInstalledPackages ; passes
ackageManagerService.java
da09815e2cd3d3968c66a8d52e620ee07d8204dd 02-Sep-2017 Calin Juravle <calin@google.com> Handle configuration splits when creating the class loader context

Configuration splits have no dependencies which can lead to exceptions
when computing their class loader context.

In general, we do not need to compute the class loader context for apks
without code.

This CL addresses the issue by ignoring "code" paths with no actual code.

Bug: 65159159
Test: adb install-multiple config_splits
runtest -x
services/tests/servicestests/src/com/android/server/pm/dex/DexoptUtilsTest.java

Change-Id: Ida1eb901eecba4a4266de73022f6ee4659367873
ackageDexOptimizer.java
ex/DexoptUtils.java
d31cee9aae9fe73e82bfe0140440306cb24231ae 06-Sep-2017 Fyodor Kupolov <fkupolov@google.com> Introduced AppRestrictionsLock

It is used to serialize access to app restrictions state and reduce
contention on PM lock.

Bug: 65096648
Test: com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testApplicationRestrictions
Change-Id: I87c364e641e511f6cbe1e55f4fa3aa12c453c08f
serManagerService.java
19d18524a4ec1677f245ca9abb0928e5b4429efa 06-Sep-2017 Todd Kennedy <toddke@google.com> Merge "resolve stage dir before validation" into oc-mr1-dev am: 40f9beb589
am: 1e2855971e

Change-Id: Icd3b0a097b2e603f02b7104942c83e013a119877
40f9beb58909f186c3d1222fb210ccff4b744eeb 05-Sep-2017 Todd Kennedy <toddke@google.com> Merge "resolve stage dir before validation" into oc-mr1-dev
6de494dfb36ba5677996c844198210fe392a1ba7 05-Sep-2017 Todd Kennedy <toddke@google.com> resolve stage dir before validation

We rely on the stage directory being correctly resolved
in order for validation to occur. This forcably happens
when commiting [after validation], reading or writing
to the session. For normal installs, this isn't an issue
since the session will be written to, thus, resolving
the stage directory.

Instead of waiting until the commit, resolve the stage
directory just prior to package validation.

Change-Id: I667b9d27749405d24e3a3c6666e9591ce3e883df
Fixes: 65369970
Test: bit FrameworksCoreTests:android.content.pm.PackageManagerTests\#testInstallNonexistentFile
ackageInstallerSession.java
bdb4bc4fc06511a0f70d0db1b0ed112be3586630 05-Sep-2017 Todd Kennedy <toddke@google.com> Merge "Add internal implementation for notifyPackageUse" into oc-mr1-dev am: 8bb58a145c
am: ad64df2bac

Change-Id: I7fab82efe230dea393fa4b12c9c7ea71c44243fe
df113c36a70474584bc9ef5bc1b3008a25fa86e0 01-Sep-2017 Todd Kennedy <toddke@google.com> Add internal implementation for notifyPackageUse

We have checks that prevent applications from modifying the usage
times of instant apps [and vice versa]. However, it's critical for
internal components such as the ActivityManager to be able to upate
this for all packages. Add an internal implementation of this
method that skips the checks.

Change-Id: Ib890296065024104cdaf7c8d64a5a7583d9062c1
Fixes: 65228752
Test: Manual. Run an application installed as an "instant app" and notice the usage time goes up
ackageManagerService.java
5bd27d25e3a37172cfcbc1642b2201233e542851 30-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Set CPU Abis for updated system packages" into oc-mr1-dev am: f4a484064b
am: 269cdab3bb

Change-Id: I6e03aaa9fdc44dd3ceda2d27a946af0dd66f7dd1
f4a484064bd015c3762f06b4563c5fc34586f2c5 30-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Set CPU Abis for updated system packages" into oc-mr1-dev
3317b17ed6a1ad7928f6ec70a273977c0776c3ce 22-Aug-2017 Koji Fukui <koji.fukui@sony.com> Set CPU Abis for updated system packages

Symptom:
If Chrome package is updated and is disabled after reboot, all apps are
crashed when they use WebView.

Root cause:
CPU Abis for updated system packages are not set when newer version
exist. Updated system packages are not fully scanned.
But WebView can use WebViewProvider in the system Chrome package. It
refers CPU Abis and crash happens.

Solution:
Set CPU Abis even if the system package has newer updated version.

Fixes: 64926227
Fixes: 62980149
Test: Manual
Change-Id: I1ddc7be5a5b8928189410e30a0506d11279d0279
ackageManagerService.java
dd0f38c8423cace05fa75defc153d9610ee0998d 29-Aug-2017 Svetoslav Ganov <svetoslavganov@google.com> Merge "Grant location to default launcher" into oc-mr1-dev am: 25e5a3446e
am: 6da0a2b8a6

Change-Id: Icd2e83f4a8d3b4803d7d8e2b1cd9e8f836c9d46e
25e5a3446ef6273fe52eebc344bacb5128337f9d 29-Aug-2017 Svetoslav Ganov <svetoslavganov@google.com> Merge "Grant location to default launcher" into oc-mr1-dev
5bb6bc6e52de2ee4442bf65fae2b8d6534bf33a6 28-Aug-2017 Svet Ganov <svetoslavganov@google.com> Grant location to default launcher

Test: updated DefaultPermissionGrantPolicy test which passes

bug:62959599

Change-Id: Ifaac04758348049dd170a7e7b7ac234dced5f759
efaultPermissionGrantPolicy.java
b3ce96ea9498994e5edfaecc71a8fa19d9369c5e 26-Aug-2017 Fyodor Kupolov <fkupolov@google.com> Merge "Use synchronization when accessing mPackages state" into oc-mr1-dev am: 9d656d0305
am: ac81767800

Change-Id: Ide64dc5a7a1e6fbd017660b081470fd9c3ba4f91
f1b34a584aa2e77c489914f5853553145639b0e3 25-Aug-2017 Fyodor Kupolov <fkupolov@google.com> Use synchronization when accessing mPackages state

In the context of this bug, enableComponentLPw was concurrently
modifying arraylist.

Test: manual - multiple reboots
Bug: 64986285
Change-Id: Ifab137c9572a2eb4ec7417309f6674a08425833c
ackageManagerService.java
4a82f72efe6ff1f8942905221dd70b448d178c05 24-Aug-2017 Svetoslav Ganov <svetoslavganov@google.com> Merge "Use all certs for computing package signing sha256" into oc-mr1-dev am: ee580764ad
am: 58d7ef66c5

Change-Id: If59ded7ac42c8277d12b8f65865806e8ffb9f036
ee580764adfcd1efbfeedb0036a0a95365c59358 24-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Use all certs for computing package signing sha256" into oc-mr1-dev
cdd685c07504223e37e7831ce592446ec4ac6f6a 22-Aug-2017 Svetoslav Ganov <svetoslavganov@google.com> Use all certs for computing package signing sha256

In several places we compute the sha256 of the app's signing certificate
(instant cookie storage, backup account permission grants, static shared
lib matching). It is possible that an app is singed with multiple certs
which unfortunately can appear in a random order. We were using only the
first certificate to compute the hash which may be problematic for apps
signed with multiple certs which are later reordered. If an app update's
certs are reordered for cookie storage the app would not be able to
access the cookie, for account grants the app would not get the grant,
and for shared libs the app would fail to install due to a missing lib.

Test: all cookie CTS tests pass
all static shared lib CTS tests pass
added test that cookie data not lost on sha256 computation change
added test that lib install works when specifying
multiple certs

bug:64270295

Change-Id: Ib6b55f25da735ff5c2762faf6e9b5888e749041d
nstantAppRegistry.java
ackageManagerService.java
e83ab7fc07fa24f43f40f17428ae4b9c20d64b5f 23-Aug-2017 Todd Kennedy <toddke@google.com> Merge "make sure package info is non-null" into oc-mr1-dev am: 63b3eff31a
am: f716244802

Change-Id: Ifd73501b25b8487dd036abb56252feae6ef96d94
63b3eff31a48b45f785a383093455863f0ef93f5 23-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "make sure package info is non-null" into oc-mr1-dev
675e99ac6e65cf673307c376318db22b61988d84 23-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Only log resolution when starting activities" into oc-mr1-dev am: e4de49140d
am: d10454ecc3

Change-Id: I179996d5c4b79b19fdacd08049ee5fdc047fe1bf
50f75df6349b1ac7ac442e28cf512b48173257a2 23-Aug-2017 Svet Ganov <svetoslavganov@google.com> Merge "Allow clearing instant app meta-data" into oc-mr1-dev am: e391175330
am: a80370745b

Change-Id: I719169bc27017a8e8c4d6a858c14ca2a458acc95
e4de49140d4c74c85fd1bf4e403a625251d08dcf 23-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Only log resolution when starting activities" into oc-mr1-dev
e3911753300aea359c5288233e0d29769303ac17 23-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow clearing instant app meta-data" into oc-mr1-dev
544b3835ddf97dfb982b532e957094ea806c8bc4 22-Aug-2017 Todd Kennedy <toddke@google.com> make sure package info is non-null

Change-Id: Ib867075a79712de36c46f862d13e5fc1d0958f00
Fixes: 64812776
Test: manual
ackageInstallerSession.java
ceb68e06bfffeb7d5724cddfe06937423c1ec3d9 22-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Use the installer package name for broadcasts" into oc-mr1-dev am: 0862898a34
am: 4c7117af59

Change-Id: Ia2f756d0e26be2758bf5e63a4eec458af2e2fd8d
0862898a34014389fa6657eb75098510c1bc0d7e 22-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Use the installer package name for broadcasts" into oc-mr1-dev
f935a703985a921447df023d6f91dd0bbf967d9b 22-Aug-2017 Svet Ganov <svetoslavganov@google.com> Allow clearing instant app meta-data

The package manager has an API to clear the data of an app
which does not work for uninstalled instant apps for which
we store some meta-data (icon, title, cookie). This change
allows clearing the data of an uninstalled instant app.

Test: Instant cookie CTS tests use this API

bug:64517837

Change-Id: Ia929fead71b5ae786e88ddd0fa8e8a490d970dd0
nstantAppRegistry.java
ackageManagerService.java
6ebabca5471dd036914505dd0ee074c3e35f4af8 22-Aug-2017 Todd Kennedy <toddke@google.com> Only log resolution when starting activities

Change-Id: I406af40953f3d6ade39e1bab18a35c534e308f3e
Fixes: 63804529
Test: Manual. Query web intent, notice no logs are emitted
Test: Manual. Start activity via web intent, notice logs are emitted
nstantAppResolver.java
ackageManagerService.java
0dba101b15e45310c7579bd33765a03b0d793315 22-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add self update permission"
225c7b3744b012675c0a6aa6b16e9fd439b18dba 22-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Handle compressed APK enable/disable" into oc-mr1-dev am: 93721c3a8a
am: 2a339ad52c

Change-Id: Icdb58e4075b9eef157826a9cd1fb6e85b2573447
cfdc1eeacf6e84da919772d95c26d3a0b31a3ae9 18-Aug-2017 Chad Brubaker <cbrubaker@google.com> Add self update permission

This permission is a subset of INSTALL_PACKAGES that only allows a
package to update itself. Many of the users of INSTALL_PACKAGE claim to
be using it solely for self updating but INSTALL_PACKAGES gives a lot
more power than is needed. This limits those priv apps to what they
intend to do.

Test: manual
Change-Id: I3442ad1a285df660b8c2635e3db59d7bc0662324
ackageInstallerSession.java
93721c3a8a4dc82a13c495f034b8d46ef7f3fcdf 21-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Handle compressed APK enable/disable" into oc-mr1-dev
7098c1cbec6801f4301bd00d4acd4788e99e602d 18-Aug-2017 Todd Kennedy <toddke@google.com> Handle compressed APK enable/disable

There are two scenarios handled with this change:

* When updates are removed for a compressed APK, we re-scan
the stub and disable the package. The stub must never be
enabled by its own

* When a stub is enabled programatically [eg. via settings],
extract the compressed APK to the data partition, scan
the extracted APKs and only then enable the application

Bug: 64386107
Test: Manual; create a test stub app and verify enable/disable work as expected from the settings UI
Test: Manual; chagne the code to trigger various failures and verify the system remains stable
Change-Id: Ia4cb8e25ce8da11edc910d531eedaa37a9093002
ackageManagerService.java
87505bb58a49768703fde504b7eb4a40429d7721 21-Aug-2017 Todd Kennedy <toddke@google.com> Use the installer package name for broadcasts

We would send the broadcast to the installer of record for
the _removed_ package [ie. replaced]. There was no value
containing the installer of record for the _installed_
package. Now prefer to send the broadcast to the installer
of record for the install. Otherwise, use the installer of
record for removal.

Change-Id: Idb1a7fa522a19273eb3641746e1966aa7af97e7c
Fixes: 62905206
Test: Manual. 'adb install test.apk' doesn't fire broadcast to the installer.
Test: Manual. 'adb install -i com.foo test.apk' fires broadcast to "com.foo".
Test: Manual. 'adb install -r test.apk' fires broadcast to "com.foo" installer.
Test: Manual. 'adb install -r -i com.foo2 test.apk' fires broadcast to "com.foo2".
ackageManagerService.java
96a91f11c1f5783c673dc7486cea72c9728b9025 18-Aug-2017 Bryce Lee <brycelee@google.com> Merge "Don't resume activity if user is locked and encryption is unsupported" into oc-mr1-dev am: 1327cdc53d
am: 004f9a3066

Change-Id: Ifcbb0d3fbde8f87052509d5ef0a0b57e013e2245
1327cdc53de0d557bddeac8dabd07a2d197def3b 18-Aug-2017 Bryce Lee <brycelee@google.com> Merge "Don't resume activity if user is locked and encryption is unsupported" into oc-mr1-dev
8558ec7dbe7733a36b621b24309e7a9dd9deec8c 18-Aug-2017 Bryce Lee <brycelee@google.com> Don't resume activity if user is locked and encryption is unsupported

Previously we were not checking if to see if this condition was met
when determining the top running activity. As a result we could get
in a loop where we force stop the process since the app doesn't
support encryption yet try to start it again due to the
ActivityRecord being on top.

This changelist addresses the issue by checking this condition when
determining whether it is okay to show.

Change-Id: I868f97ce8b3ea4220019b8570407e33f27ea88bc
Fixes: 64259425
Test: go/wm-smoke
ackageManagerService.java
88bf767525b7dd8e7959d8aab18136754ccc2745 17-Aug-2017 Dianne Hackborn <hackbod@google.com> Merge "Small fix to pm dumpsys formatting." into oc-mr1-dev am: 2d80887e19
am: 2eccf4a443

Change-Id: Id2451237d87c6903ef135323754042969a11254a
2d80887e19917b1605a67f55b9e5b5b1d12fa22f 17-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Small fix to pm dumpsys formatting." into oc-mr1-dev
c50a108d097d61a035d51a16469c114c4ea838da 15-Aug-2017 Dianne Hackborn <hackbod@google.com> Small fix to pm dumpsys formatting.

Get rid of a spurious newline.

Test: builds and runs and prints.
Bug: 64770628

Change-Id: I2b7657ada5e8eb0a2ef90b1bc2e1027493c808a3
ettings.java
519b589300a5ad87d5dc1bae1b7f9a10129c9fa9 17-Aug-2017 Todd Kennedy <toddke@google.com> resolve merge conflicts of d22603ebd295 to master

Test: I solemnly swear I tested this conflict resolution.
Change-Id: Iab4443f6a8b996ea9f28f4e68c6ec3bb708526e6
dfff1c772374c4c3a5aa63e55816e4fedd936315 16-Aug-2017 Narayan Kamath <narayan@google.com> Merge "PackageManagerService: Change getCompressedFiles to reflect the new layout." into oc-mr1-dev am: 169a65169d
am: 51432796dd

Change-Id: Ic69735aeed4140bbb06bd77cf31e6a1bae9820bd
7fc53a11f839b1cbe779d4132f10aaa495ab3176 16-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow explicit permission denial" into oc-mr1-dev
74629e3183b275b87e54387ff620cfa377d314b6 15-Aug-2017 Todd Kennedy <toddke@google.com> Allow explicit permission denial

Change-Id: I5d348ed555f249d210253dab60ae11d4831c4f0a
Fixes: 63675512
Test: Manual
ackageManagerService.java
ackageManagerShellCommand.java
190440d62fc8c5ab24498178cd2ce6901bec2852 07-Aug-2017 Narayan Kamath <narayan@google.com> PackageManagerService: Change getCompressedFiles to reflect the new layout.

Stubs are compressed artifacts are installed in sibling directories.

The layout of a compressed package on a given partition is as follows :

Compressed artifacts:

/partition/ModuleName/foo.gz
/partation/ModuleName/bar.gz

// Stub artifact:

/partition/ModuleName-Stub/ModuleName-Stub.apk

In other words, stub is on the same partition as the compressed artifacts
and in a directory that's suffixed with "-Stub".

Bug: 63802184
Test: Manual

Change-Id: If7154c985956ae982ce40c8ede763b1c8e0175a9
ackageManagerService.java
2aed5e9b30868c380f05a3190ad92e868c8b3e10 15-Aug-2017 Svetoslav Ganov <svetoslavganov@google.com> Merge "Don't modify cached permission info" into oc-mr1-dev am: 827782af8d
am: af8a844216

Change-Id: I1d00e2fcc22ad45b0efff20eb128f212cdda77b7
9467febacf168d5b9cf63d18ce14978dd0f42dc5 15-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Change protection level from ephemeral to instant" into oc-mr1-dev am: ef2e7d27ae
am: a1f2f3eb7b

Change-Id: If8801cd35c71e35cbb11881dca18a58bab1b4aff
827782af8d4ac788ddae8ae3ed1a553364184675 15-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't modify cached permission info" into oc-mr1-dev
ef2e7d27aecf5f1f86171ffe77c98b14bdaa4f6d 15-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Change protection level from ephemeral to instant" into oc-mr1-dev
c1b94282116da0fccc39950c569ea1b55f25a762 15-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Always invoke callback" into oc-mr1-dev am: 71b304f6ff
am: 5c6c1c9c0b

Change-Id: I61e560b9196ea08b7119a6aed69a2aa355f7f6f3
bf2a79b053ed207c9745a2094ab9a6e6e7cb8c32 15-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Remove using package name" into oc-mr1-dev am: 941fab312c
am: c6326b9fe4

Change-Id: I0f0c9ee21ff7c91fce68edafcefe5dfa79dbb40e
71b304f6ff304787b31b586c1d31d406d20d6dee 14-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Always invoke callback" into oc-mr1-dev
941fab312c2aca5993a4b044be95b1c36d71c8f4 14-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Remove using package name" into oc-mr1-dev
0aef1c98c9b55d18c91216e03b4a53675756e80c 14-Aug-2017 Fyodor Kupolov <fkupolov@google.com> Merge "Log timings for shutdown stages" into oc-mr1-dev am: fe97799d5d
am: 34cac26ea4

Change-Id: Ifedc47b10e7542a0f28bbee1ac00490513cc0e5f
c80b3b75df6b3840e173d1653ddbf6854954a626 09-Aug-2017 Svetoslav Ganov <svetoslavganov@google.com> Don't modify cached permission info

Test: manual

bug:64454312

Change-Id: Ie2f61da8a145e71164205ec7c26c20d9d512447d
ackageManagerService.java
6e3461b67cae27a42a4d77fa277ba2d844ea0cde 11-Aug-2017 Fyodor Kupolov <fkupolov@google.com> Log timings for shutdown stages

Renamed BootTimingsTraceLog to TimingsTraceLog. It is now used for
boot and shutdown logging.

Added measurements for main stages of shutdown in the system server:
ShutdownTiming: SendShutdownBroadcast took to complete: 734ms
ShutdownTiming: ShutdownActivityManager took to complete: 203ms
ShutdownTiming: ShutdownPackageManager took to complete: 17ms
ShutdownTiming: ShutdownBt took to complete: 533ms
ShutdownTiming: ShutdownRadio took to complete: 534ms
ShutdownTiming: ShutdownNfc took to complete: 1536ms
ShutdownTiming: ShutdownRadios took to complete: 1538ms
ShutdownTiming: ShutdownStorageManager took to complete: 906ms
ShutdownTiming: SystemServerShutdown took to complete: 3918ms

Bug: 64569080
Test: shutdown/reboot and check logs
Change-Id: I636c045852cd1ed6be1c58af6608f70e95756389
ackageManagerService.java
e74314451194ba78a9667cc8b3f288a5332ba69f 12-Aug-2017 Jeff Sharkey <jsharkey@android.com> Merge "Only destroy the storage area that had trouble." into oc-mr1-dev am: 9aa5b26aed
am: 5ccd3466a2

Change-Id: If9763a55ae5890b3a425cf1dc2b6ec01b1029025
5ac717315f94af7635334271f5c8c7dc1212aec2 12-Aug-2017 Michal Karpinski <mkarpinski@google.com> Merge "Removing non-preferred activity from resolution set should not disrupt the preferred resolution" into oc-mr1-dev am: 0b4b9f9c02
am: 116ae427e6

Change-Id: I7a38ec63bef300e1fb0a6c49d4b9ee9553ec93a0
9aa5b26aed3e51043827dab82d64ee2bd1e2e576 12-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Only destroy the storage area that had trouble." into oc-mr1-dev
0b4b9f9c02e4401c93ca4af08d3f0d31b64c8778 12-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Removing non-preferred activity from resolution set should not disrupt the preferred resolution" into oc-mr1-dev
db01c43523eed9d435df2a0832ccc58d1e219fa3 12-Aug-2017 Calin Juravle <calin@google.com> Merge "Ensure dexopt is executed only with consistent package data" into oc-mr1-dev am: 5ba8e3dc78
am: f4f8058c51

Change-Id: I61c9c853b2e3173bff00daa8b2c8d89ddea0bd44
c247fa136639dd07278b1954e5fba78ade60614c 02-Jun-2017 Todd Kennedy <toddke@google.com> Change protection level from ephemeral to instant

Change-Id: If4b01e5f0728f1d1d7e6903b362dcbedc67a9b3f
Fixes: 62264194
Test: Manual. install an instant app and see that it still works
asePermission.java
ackageManagerService.java
e66fd7dbd0958d47dbc9601532034a319e64680e 11-Aug-2017 Todd Kennedy <toddke@google.com> Remove using package name

Change-Id: I2fd38654d3694784ef39ac8b78f8970adf5627fc
Fixes: 63597788
Test: manual
ackageManagerService.java
a0c5ee1b322b579da25a2f433fd91734f5b07818 11-Aug-2017 Jeff Sharkey <jsharkey@android.com> Only destroy the storage area that had trouble.

Consider the case where CE failed to prepare; we'd destroy both DE
and CE, but then only recreate CE. This change makes sure we only
destroy something we're willing to recreate.

Bug: 62338545
Test: builds, boots
Change-Id: I566791b59b35a30db70b0de3acfe624b239bf5d2
serDataPreparer.java
5ba8e3dc788f858615a2efd6c3dead2ce515fe36 11-Aug-2017 Calin Juravle <calin@google.com> Merge "Ensure dexopt is executed only with consistent package data" into oc-mr1-dev
09d4d1fd09410ba72f9c9a431163de3511300c6c 11-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Save observer in call to commit" into oc-mr1-dev am: 20c2641ad4
am: f567dd46da

Change-Id: Ic3c9beaff7aca8e9a46595b1511ef7023fe980ac
4c2b9555b7b52359ea14e201d7ec61b8edaf6232 11-Aug-2017 Calin Juravle <calin@google.com> Ensure dexopt is executed only with consistent package data

The main objects bookkeeping packages (PackageParser.Package and its
corresponding ApplicationInfo) may be updated at different times. This
creates a window where the data stored in the ApplicationInfo is out of
date with respect to the data stored in PackageParser.Package.

During install, the two objects are "synced" during doRename which updates
the package code paths.

This CLs moves the dexopt invocation from the install flow after doRename
to ensure that dexopt logic gets a consistent view of the package.

Bug: 64493351

Test: run cts-dev -t android.appsecurity.cts.ClassloaderSplitsTest -m
CtsAppSecurityHostTestCases
inspect oat files after
adb install-multiple CtsClassloaderSplitApp/CtsClassloaderSplitApp.apk
CtsClassloaderSplitAppFeatureA/CtsClassloaderSplitAppFeatureA.apk
CtsClassloaderSplitAppFeatureB/CtsClassloaderSplitAppFeatureB.apk

Change-Id: I9131bcf49eb473a8fdc5eb0032d94080d4e9e94b
ackageDexOptimizer.java
ackageManagerService.java
beec8e2b68aa285aabd6fc0e954e6f9916d67fb7 11-Aug-2017 Todd Kennedy <toddke@google.com> Save observer in call to commit

The observer used to be saved in a round-about way; being passed
to the "commit" message handler and set there. The idea was that
if there were multiple calls to commit() with different observers,
it would be strange to wipe out the first observer during the
second call to commit. However, setting the observer only in the
commit handler means there are other methods [namely abandon()
and setPermissionsResult()] where the observer will either not
be called unless the commit message handler was run or the first
observer might be wiped out with multiple commit calls.

The only way to track this properly would be to generate a
commit ID and assign an observer with that commit ID. However,
there doesn't appear to be a legit use case for a caller to invoke
commit multiple times on the same session with different observers.
So, we just set the observer directly in the commit() method.

Change-Id: I5e0d6c163ea84d1f49780aa899afb2e1cdf17584
Fixes: 64564511
Test: cts-tradefed run commandAndExit cts-dev -t android.appsecurity.cts.PkgInstallSignatureVerificationTest#testInstallEphemeralRequiresV2Signature -m CtsAppSecurityHostTestCases
ackageInstallerSession.java
8ec374d28e6bc7ae68742c3f486434392d3182be 10-Aug-2017 Narayan Kamath <narayan@google.com> Merge "PackageParser: Parse android:classLoader during the full parse." into oc-mr1-dev am: af706b40de
am: b51eae5825

Change-Id: Idf542e9ee44362617ac247aa6c85921c76778e37
af706b40de30a8623e18a585dfac35cc8b8a4be8 10-Aug-2017 Narayan Kamath <narayan@google.com> Merge "PackageParser: Parse android:classLoader during the full parse." into oc-mr1-dev
c45b0859bfe363980c273eae22cdc1752698c647 10-Aug-2017 Todd Kennedy <toddke@google.com> Always invoke callback

Change-Id: I5673aaab7381cad56408aa0094007ac10c14d169
Fixes: 62820142
Test: Manual
ackageManagerService.java
a9ba866927c210d64935b8c155f55b5ccddd6f1a 09-Aug-2017 Christine Franks <christyfranks@google.com> Merge "Merge "Allow SMS and calling for demo users" into oc-dr1-dev am: 4387d3a523 am: 966f37ae23" into oc-mr1-dev-plus-aosp
am: cf86c068d0

Change-Id: I61c22ce2336a2eb95796ef4f655afae1ea374ebf
966f37ae239bfcb0864dda826c557047c4061f85 09-Aug-2017 Christine Franks <christyfranks@google.com> Merge "Allow SMS and calling for demo users" into oc-dr1-dev
am: 4387d3a523

Change-Id: I163963c15c009eaf70907203cf941e182409eafc
e5bad6eb251f1b7d7d969b7cfe4da34d46874393 09-Aug-2017 Christine Franks <christyfranks@google.com> Merge "Allow SMS and calling for demo users" into oc-dr1-dev
am: 4387d3a523

Change-Id: I78128f2a9acdbbd2ccd10f2ee12cbe100000fb1a
4387d3a523fde808e6bd9d301102cfb06aea7d87 09-Aug-2017 Christine Franks <christyfranks@google.com> Merge "Allow SMS and calling for demo users" into oc-dr1-dev
273f9c432a387950bdddb3cfd41b8ccf4bbfba67 09-Aug-2017 Justin Klaassen <justinklaassen@google.com> Merge "Grant default ringtone picker storage permissions" into oc-dr1-dev am: 8039ac418f am: afcdba9ef9
am: 31493817de

Change-Id: I7ae8831ba6f8691c3305026cdd75478b1feec8f5
afcdba9ef94ac7570f15a55658fa5aaef2f72050 09-Aug-2017 Justin Klaassen <justinklaassen@google.com> Merge "Grant default ringtone picker storage permissions" into oc-dr1-dev
am: 8039ac418f

Change-Id: I8c3575d974a5266b62d560508df1253ba80fb0e4
f5bf6f14d38be4c74859087f2caf6b6546d8b984 09-Aug-2017 Justin Klaassen <justinklaassen@google.com> Merge "Grant default ringtone picker storage permissions" into oc-dr1-dev
am: 8039ac418f

Change-Id: Id788315e6ad9a5fe72287fb922c77d7df03ea82b
8039ac418f7c6d8964b5924c167f0c9b8fe49309 09-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Grant default ringtone picker storage permissions" into oc-dr1-dev
97a5480a1d81f399c07b3142d2809203047a5c1c 09-Aug-2017 Christine Franks <christyfranks@google.com> Allow SMS and calling for demo users

Bug: 62712426
Test: manual - restrictions are unset in demo mode
Change-Id: I151fbfb8222e768403a7e5ba1fcf868ba35a1f22
serManagerService.java
fab8fa6b8111c929554fefc3d28e8acd1f2bba5a 09-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Allow applications to define failure handlers" into oc-mr1-dev am: e551d361ac
am: 4cb468814c

Change-Id: Idc4d9eec433255f653a8cc842ce73f2d436973e4
e551d361ac960f0f0e87c85d6975a994f8dbd1f0 09-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow applications to define failure handlers" into oc-mr1-dev
96c11c58c9ba1f90a4aace44912711bbce77ad0f 09-Aug-2017 Narayan Kamath <narayan@google.com> PackageParser: Parse android:classLoader during the full parse.

There's no need to do this during a "lite" parse. Moreover, we don't
resolve resource references during a lite parse, which means that we
lose a lot of flexibility.

Test: CtsAppSecurityTestCases
Bug: 64339642

Change-Id: I7d02faab6bd226d96d63d2edd8c06b94e15e14ad
ackageInstallerSession.java
ackageManagerShellCommand.java
7dfb4ee44174abaefddcada9762a8bdee0855119 09-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow ephemeral user creation via createAndManageUser"
04ea52ec834ab7fcbde8b6bb85b0eb42c4a2fa3e 09-Aug-2017 Calin Juravle <calin@google.com> Merge "Add package use info to dexopt dump" into oc-mr1-dev am: 0c62487d4b
am: 811fdcaefe

Change-Id: Ib7a4f0fb643e27f426195fc8dc11387667e044ac
46a72248a2560b6c79358e2a68b6606f1e696f7b 09-Aug-2017 Philip P. Moltmann <moltmann@google.com> Merge changes from topic 'ClosebySystem' into oc-mr1-dev am: 81021c77c8
am: 560d56500c

Change-Id: I171672bc56b845f87e602c84043ff90b59f25797
07dac4304e03be5185251f14344d55b3d136d80c 09-Aug-2017 Philip P. Moltmann <moltmann@google.com> Prevent closing by prev owner after transfer. am: 3306c0d76b
am: 804563c1af

Change-Id: I41f1737c2db17b877fc6bbf7772d18ae708e44e0
a064b6d12b8c0aef2dc347e654e4ebedd5628835 09-Aug-2017 Philip P. Moltmann <moltmann@google.com> Revert "Revert session-transfer change" am: 7460c5917b
am: ccf0225c38

Change-Id: I30cc91c765e05e33f9b60005d29ad5f954a2fd23
0c62487d4b849f3b279a42ce451c6471a099233f 09-Aug-2017 Calin Juravle <calin@google.com> Merge "Add package use info to dexopt dump" into oc-mr1-dev
804563c1af7aa406bb9d902b9e1d902754010eb0 09-Aug-2017 Philip P. Moltmann <moltmann@google.com> Prevent closing by prev owner after transfer.
am: 3306c0d76b

Change-Id: I8c033bbfda3177467878b6a456a790237730634d
ccf0225c38567b4b65c798c221bab3a864220f5e 09-Aug-2017 Philip P. Moltmann <moltmann@google.com> Revert "Revert session-transfer change"
am: 7460c5917b

Change-Id: I9f7927993fb3166cc6aeca751dd97aebc277a5db
81021c77c842323a5b7aff0693b686300f4bd36f 09-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes from topic 'ClosebySystem' into oc-mr1-dev

* changes:
Allow to close session from wrong context.
Prevent closing by prev owner after transfer.
Revert "Revert session-transfer change"
f39e0569ca64c054644d6c87afb6b15086d5c751 09-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Add virtual preload bit to ApplicationInfo" into oc-mr1-dev am: 6bf2990e28
am: bc0e1e2766

Change-Id: Ie127f827fc1879dcb04f64810ff5c20446e4905a
6bf2990e28307502dfca5c567a4608c9c17cdf0d 09-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add virtual preload bit to ApplicationInfo" into oc-mr1-dev
b17969be5f0cccd56148cd83284e29780f9979df 09-Aug-2017 Calin Juravle <calin@google.com> Merge changes from topic 'info-per-split' into oc-mr1-dev am: df421a8b47
am: fe8ff8215f

Change-Id: I2ae4dd9455f34a10ddfdb368edd62f048b230d99
41a57a65b2a4fb51faa55bcba57ebe544e9f799f 07-Aug-2017 Calin Juravle <calin@google.com> Add package use info to dexopt dump

Bug: 64153885
Test: adb shell dumpsys package dexopt
Change-Id: I57768076de821980b1de84d5fe44ab642ceebeba
ackageDexOptimizer.java
ackageManagerService.java
df421a8b471bfe9998bad94ceccb73d839f90206 09-Aug-2017 Calin Juravle <calin@google.com> Merge changes from topic 'info-per-split' into oc-mr1-dev

* changes:
Record usage information per split
Use PackageUseInfo in DexOptimizer
d0084f75837c145466fe26016b09c59b7b270c02 28-Jul-2017 Todd Kennedy <toddke@google.com> Allow applications to define failure handlers

Fixes: 37956764
Test: Manual
Test: Create a test app with no handler, see it's not passed to the installer
Test: Create a test app with a handler, see it's passed to the installer
Test: Create a test app with multiple handlers, see one is passed to the installer
Test: Create a test app with a handler defined in a split, see it's not passed to the installer
Change-Id: Idfc3648154afca7ec300019d9695417274118d6f
nstantAppResolver.java
ackageManagerService.java
5eb5a7db835a7b152690410e03f3d3a8baacde33 01-Aug-2017 Todd Kennedy <toddke@google.com> Add virtual preload bit to ApplicationInfo

Change-Id: I2735b3823a8709b2ffb65cc8085ffcd952d3e1f2
Fixes: 64205417
Test: Manual
Test: Create a sample app and install it as a normal app
Test: See that it returns 'false' for "isVirtualPreload"
Test: Create a sample app and install it as a virtual preload ["--preload"]
Test: See that it returns 'true' for "isVirtualPreload"
Test: Run sample apps after reboot and see they return the correct value
ackageManagerService.java
ackageSettingBase.java
ettings.java
f46edf5bbe1dc29101b3279b37af37ed49571082 08-Aug-2017 Philip P. Moltmann <moltmann@google.com> Allow to close session from wrong context.

commitLocked runs on a handler, thereby as system. It will call close()
if the package installer is popped-up to confirm the installation. Hence
we have to allow this use case without checking the caller.

Bug: 64467704
Test: gts-tradefed run singleCommand gts -m GtsPackageInstallSessionTestCases
Change-Id: I0bd0329c0485c50afa459d90c3372d7bf7408287
ackageInstallerSession.java
3306c0d76b75f6aa9319d058bd9b0dfd95186748 08-Aug-2017 Philip P. Moltmann <moltmann@google.com> Prevent closing by prev owner after transfer.

Bug: 64467704
Test: gts-tradefed run singleCommand gts -m GtsPackageInstallSessionTestCases
Change-Id: I81fb1b641295cbb9e36504eb3e40f51ce6b2de94
ackageInstallerSession.java
7460c5917b47a5ba183517b5459c254130fc85b5 08-Aug-2017 Philip P. Moltmann <moltmann@google.com> Revert "Revert session-transfer change"

This reverts commit 9890f8b426550485aaab164a7bedbcd545862b85.

Bug: 64467704
Test: cts-tradefed run singleCommand cts-dev -m CtsContentTestCases --test=android.content.pm.cts.InstallSessionParamsUnitTest
cts-tradefed run singleCommand cts-dev -m CtsContentTestCases --test=android.content.pm.cts.InstallSessionTransferTest
Change-Id: I0cc7e1129d85e4d0de16ade44232a9bd381d6c04
ackageInstallerService.java
ackageInstallerSession.java
3cb46e1a867eb88eaae7b0bc8590b51c3269322d 08-Aug-2017 Philip P. Moltmann <moltmann@google.com> Merge "Revert session-transfer change" into oc-mr1-dev am: 7bec053dff
am: ddeb0a578a

Change-Id: I1dd82bedd35f297931608595da7f8b1e496e8285
7bec053dffb90f7cd0e39eec7f56fb33d847c3eb 08-Aug-2017 Philip P. Moltmann <moltmann@google.com> Merge "Revert session-transfer change" into oc-mr1-dev
52a452cf685c56dc6872dbb19e822736484f672f 04-Aug-2017 Calin Juravle <calin@google.com> Record usage information per split

Increase the granularity of usage information to store data on each split
separately.

Now, splits get their own useByOtherApps flag and can be compiled
speed-profile when only the primary apk is loaded by other apps.

Bug: 64124380
Test: runtest -x
services/tests/servicestests/src/com/android/server/pm/dex/*

Change-Id: Ibf9e7b9e67db9c6f0f45dc695bce8fbeb7be20ae
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceUtils.java
ex/DexManager.java
ex/PackageDexUsage.java
3b74c41776da66562a68b12a0fed8d20b6952868 04-Aug-2017 Calin Juravle <calin@google.com> Use PackageUseInfo in DexOptimizer

Pass the PackageUseInfo directly to DexOptimizer and use it to detect if a
package is used by other apps. Move the usage checks closer to dexopt so
that they can be easily adapted when we add usage info for each of the
app's code paths separately.

This is a refactoring CLs to reduce the size and complexity of the
upcoming CLs which record the usage info for each of the application
splits.

Bug: 64124380
Test: runtest -x
services/tests/servicestests/src/com/android/server/pm/dex/*

Change-Id: I8031590cdaff81ab1792ca19baddb6cb36dc021d
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceUtils.java
ex/DexManager.java
ex/DexoptOptions.java
9890f8b426550485aaab164a7bedbcd545862b85 08-Aug-2017 Philip P. Moltmann <moltmann@google.com> Revert session-transfer change

This reverts:
5d74493f64493cd506d7458b810095259287f623
94deaf7725c418ec1950d810ab86f0d157ddf518

Bug: 64467704
Test: none, 100% revert
Change-Id: I6534c19c594dadfa41457725988485a67f0ed45f
ackageInstallerService.java
ackageInstallerSession.java
b6ff3774fce0079745814ca0928de832ce8153c3 08-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Add native bindings for getNamesForUids" into oc-mr1-dev am: 8c18e1faf8
am: 3ff3e75fb2

Change-Id: I21a656cd60896a73dd0ca07b47f09af92f874dff
1f3c3376e64ced5fec20959603fd159633b7271c 08-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Always populate the ApplicationInfo object" into oc-dr1-dev
am: bb6653c404

Change-Id: I7224af4db28368292609a6c7728bcfd9a299b784
8c18e1faf8020d55a08b1a9094202e91c621babe 08-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add native bindings for getNamesForUids" into oc-mr1-dev
615fefc04aa780dae36dfd8003d54c4a497b9dd4 08-Aug-2017 Philip P. Moltmann <moltmann@google.com> Merge changes from topic 'TransferInstallSession-oc-mr1-dev' into oc-mr1-dev am: fdaad13803
am: f288de8421

Change-Id: Ia429dfd3ee1f44094ba519d22300297326f3421e
fdaad1380348370adaad0656d14bc2a278fc4748 08-Aug-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes from topic 'TransferInstallSession-oc-mr1-dev' into oc-mr1-dev

* changes:
Allow to read all params used to create session.
Allow to transfer+seal a install session
763312228571fa8fb32404603d38babf193aca3c 08-Aug-2017 Justin Klaassen <justinklaassen@google.com> Grant default ringtone picker storage permissions

Bug: 64112806
Test: DefaultPermissionGrantPolicyTest#testDefaultGrants
Change-Id: Iad058464388f20ad6aefb9fdf3fc2b641fc39967
efaultPermissionGrantPolicy.java
c7421baee7064e6e2537ff8a37b12428d1b2f606 07-Aug-2017 Makoto Onuki <omakoto@google.com> Merge "Reduce duplicate strings due to the package cache." into oc-mr1-dev am: ce3e863f31
am: a0518fb7ac

Change-Id: I02cfeba937fac4815c55ea158dfdc9723a2a2031
5d74493f64493cd506d7458b810095259287f623 03-Aug-2017 Philip P. Moltmann <moltmann@google.com> Allow to read all params used to create session.

So that they can be verified by the app calling commit().

This really only makes sense if the app calling commit is different from
the app that created the session.

Bug: 37281396
Test: cts-tradefed run cts-dev -m CtsContentTestCases --test=android.content.pm.cts.InstallSessionTransferTest
Installed and uninstalled packages via the PackageInstaller app

Change-Id: I5c954ca59b7582555bea847f3ddbba0aeefba301
ackageInstallerSession.java
94deaf7725c418ec1950d810ab86f0d157ddf518 19-Jul-2017 Philip P. Moltmann <moltmann@google.com> Allow to transfer+seal a install session

... so that one package can supply the data and another one can issue
the commit.

Also allow reading of sealed sessions.

Also lock more in PackageInstallerSession so that we can be sure the
session is not used by the old package anymore once transferred and that
all calls into the session work on consistent data.

Bug: 37281396
Test: cts-tradefed run cts-dev -m CtsContentTestCases --test=android.content.pm.cts.InstallSessionTransferTest
Installed and uninstalled packages via the PackageInstaller app
Installed and uninstalled packages via the Google Play Store

Change-Id: Id4b7a0071d703b7d18c9f5bf2bd15ebf67086d07
ackageInstallerService.java
ackageInstallerSession.java
4501c61d65f0590bdc4e6a8a6f3a1b0cf2165b9f 28-Jul-2017 Makoto Onuki <omakoto@google.com> Reduce duplicate strings due to the package cache.

Change from the previous attempt:
- Fixed the helper class. The original version had a few bugs.
- Bundle.readFromParcel() now handles a Parcel with a read-write helper
properly.

** Comparison **
The following charts are the actual measurement with and without the fix,
using "dumpsys system".
- The red bar is "total private dirty".
- The X axsis is time since boot.

Without fix:
- #1 First boot:
-- https://docs.google.com/spreadsheets/d/1CbmU8cQQQw7n7tyqbZi3beRHNuzqcmJgdvzDpi40Q1I/edit#gid=1971317391
-- Private dirty stabilizes at ~16.8M.
-- Loading system packages took 1.8 seconds.

- #2 Second boot:
-- https://docs.google.com/spreadsheets/d/1CbmU8cQQQw7n7tyqbZi3beRHNuzqcmJgdvzDpi40Q1I/edit#gid=982210726
-- Private dirty stabilizes at ~17.5M.
-- Loading system packages took 0.5 seconds.

With fix:
- #3 First boot:
-- https://docs.google.com/spreadsheets/d/1R6lL0AnAp93HnrqWujJFNgOjj6wvGicgDlbDAevbc3g/edit#gid=791764875
-- Private dirty stabilizes at around the same level as #1.
-- Loading system packages took 1.9 seconds.

- #4 Second boot:
-- https://docs.google.com/spreadsheets/d/1CbmU8cQQQw7n7tyqbZi3beRHNuzqcmJgdvzDpi40Q1I/edit#gid=1820894299
-- Private dirty stabilizes at around the same level as #1.
-- Loading system packages took 0.7 seconds.

Package manager start up time with and without the fix:
- (Ignored ones that are too fast; probably the thermal throttling didn't kick in.)
- https://docs.google.com/spreadsheets/d/1CbmU8cQQQw7n7tyqbZi3beRHNuzqcmJgdvzDpi40Q1I/edit#gid=499396796
- Before: 3.5 seconds (average of 5 reboots)
- After: 3.6 seconds (average of 5 reboots)

Package scan speed comparison:
- With the fix, first boot.
08-03 08:49:56.851 1000 779 779 I PackageManager: Finished scanning system apps. Time: 2133 ms, packageCount: 143 , timePerPackage: 14 , cached: 0
08-03 08:49:56.971 1000 779 779 I PackageManager: Finished scanning non-system apps. Time: 121 ms, packageCount: 11 , timePerPackage: 11 , cached: 0

- With the fix, second boot.
08-03 08:53:29.387 1000 779 779 I PackageManager: Finished scanning system apps. Time: 484 ms, packageCount: 143 , timePerPackage: 3 , cached: 143
08-03 08:53:29.424 1000 779 779 I PackageManager: Finished scanning non-system apps. Time: 37 ms, packageCount: 11 , timePerPackage: 3 , cached: 11

** Conclusion **
- This CL wil slightly slow down the boot time (0.2 seconds on a thermal-throttled bullhead), but
the system server's ram consumption will go down to the no-cache level.

- Using the package cache is still faster than not using it.

Test: build, boot, reboot, adb-install, reboot
Test: bit FrameworksCoreTests:android.content.pm.PackageParserTest
Test: bit FrameworksServicesTests:com.android.server.pm.PackageParserTest
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsOsTestCases -t android.os.cts.BundleTest

Bug: 64112468
Change-Id: I30691a032cb1dd1c7f6c1966a096c2f0d07a09cb
ackageManagerService.java
ad192a392bb51dc71863eab61cb8d415fef4d54f 02-Aug-2017 Todd Kennedy <toddke@google.com> Add native bindings for getNamesForUids

A new API [getNamesForUids] was recently added to the PackageManager
and this API needs to be accessible to native code. However, there
were two constraints:
1) Instead of hand-rolling the binder, we wanted to auto generate
the bindings directly from the AIDL compiler.
2) We didn't want to expose/annotate all 180+ PackageManager APIs
when only a single API is needed.
So, we chose to create a parallel API that can be used explicitly
for native bindings without exposing the entirety of the
PackageManager.

Bug: 62805090
Test: Manual
Test: Create a native application that calls into the new service
Test: See the call works and data and returned
Change-Id: Ia571ab1607c6c88fef44eb0de6a313a28906c732
ackageManagerService.java
23a2a0dae0b10d12cbf5f79bdcaa6fba537779bf 19-Jul-2017 Todd Kennedy <toddke@google.com> Always populate the ApplicationInfo object

While scanning system apps, we abort package/application info setup
if an app on /system is not a higher version than an upgrade on /data.
Instead, we need to still fully populate these objects because they
can be retrievd using the MATCH_FACTORY_ONLY flag.

Change-Id: I0262b46f446eace60ce94f1428f3fb15d785a89c
Fixes: 62980149
Test: Manual
Test: Create a sample application that dumps the contents of an ApplicationInfo object for a given package
Test: Install the sample application on the /system partition and "upgrade" the sample application so it's also on the /data partition
Test: Create a secondary user and disable the sample application
Test: Reboot the device
Test: Run the sample application as the primary user and see that the ApplicationInfo object is correctly populated
(cherry picked from commit c606627e6c931d4d1e60ce29f7802d7bd9f4403d)
ackageManagerService.java
1882302d4341c675d631b0264bd93aef4419059b 04-Aug-2017 Benjamin Franz <bfranz@google.com> Allow ephemeral user creation via createAndManageUser

Ephemeral users where initially created for split system users. Make
them available on all systems. This CL is initially for evaluation
purpose to see how advanced they are in the current system.

Test: manual
Bug: 64381943
Change-Id: Ia9caa8e07037a64055f2033113806b8c559a75af
serManagerService.java
14876bd21a4a4e7d78d36f910493269f14b2e905 29-Jul-2017 Calin Juravle <calin@google.com> Save PackageDexUsage on PMS shutdown

This ensures that we persist the in memory data between restarts (makes
testing much easier).

Bug: 64151900
Test: Manual, flash + restart + check the dex usage file

(cherry picked from commit 6ef7f0b8c6e72e849a220513425a9fd37804af90)

Change-Id: I7bd99fc03c3a40cbbf5d615886f857b5f84f438c
ackageManagerService.java
ex/DexManager.java
ex/PackageDexUsage.java
2a9cc53e71cbc5896cf65a59f251effc54250a1c 02-Aug-2017 Calin Juravle <calin@google.com> Merge "Save PackageDexUsage on PMS shutdown"
355931b85bb933e61ac00c3f4d53fbb1d4bdcdb9 02-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Fix deadlock between AMS and EphemeralResolverConnection" into oc-mr1-dev am: a3735dc42e
am: 7a8c6a39f5

Change-Id: I1d9e4b8d4aec4f9a81d5a0a4d0d520327321f79f
a3735dc42e6d8177e28feba2d5dac0f0cd6de5a6 02-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Fix deadlock between AMS and EphemeralResolverConnection" into oc-mr1-dev
0681d29966f93cf98c0d6f3ee27b6a7d428140c5 02-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Add new API to retrieve app names in a batch" into oc-mr1-dev am: 5e049eb884
am: a1cb029caf

Change-Id: I9454b85835e0deb8264f7371748aad90cf04a42d
5e049eb884d371ba54f084a63a707133b4d3a828 02-Aug-2017 Todd Kennedy <toddke@google.com> Merge "Add new API to retrieve app names in a batch" into oc-mr1-dev
e2612eb3f59b2586273fd52a211ee430b0ccf8c2 14-Jun-2017 Snild Dolkow <snild@sony.com> Fix deadlock between AMS and EphemeralResolverConnection

The ActivityManagerService lock may be taken when calling into ERC
through ActivityStarter.startActivityMayWait().

At the same time, a PackageManagerService.getLastChosenActivity() call
could take the ERC lock and call unbindService(), requesting the AMS
lock.

Deadlock.

Solved by making sure to drop the ERC lock before calling into AMS.
This necessitated an extra state to prevent multiple callers from
clobbering the binding, so mIsBinding became mBindState.

The IDLE state means that nothing is currently binding.

The BINDING state means someone is initiating a bind, including the
wait() call thereafter.

The PENDING state means that bindService() has been called, but the
caller's timeout expired (i.e. the new caller may want to rebind).

Fixes: 63150916
Test: for x in $(seq 100); do adb shell am start http://127.0.0.1/does-not-exist.html; adb shell input keyevent 3; done
Change-Id: I2cb5610a2277ef641f8e2d7f5ad1c4a72bb4f026
phemeralResolverConnection.java
565cab11ff5b45f2f729e48fe9784f7efb4199ee 01-Aug-2017 Calin Juravle <calin@google.com> Merge changes from topic 'class-loaders-mr1' into oc-mr1-dev

* changes:
Use the class loader context when optimizing secondary dex files
Add DexClassLoader to the list of supported class loaders
4ff5defa5328411035183b785a77db41778bc272 26-Jul-2017 Michal Karpinski <mkarpinski@google.com> Removing non-preferred activity from resolution set should
not disrupt the preferred resolution

We used to show disambiguation whenever the resolution set
was different in any way from the preferred activity's one.
Now we force disambiguation only when the new state isn't
a preference-inclusive subset of the prior state.

Test: manual, various scenarios with installing, uninstalling, reinstalling multiple launcher apps
Bug: 38387746
Bug: 31955881
Change-Id: I60d963127bc2eb75340b47f2b54e9554549a921b
ackageManagerService.java
referredComponent.java
f41e51d14939f4af04b14fdea655a0851b62436c 07-Jul-2017 Garrett Boyer <gboyer@google.com> Privapp permissions inheritance.

Make child apps inherit privapp permission whitelist entries of the
parent.

Test: Ran gmscore with multi-uid enabled, expected behavior.

Change-Id: I703e0ef4bc45558fd617c118300904614c9db933
ackageManagerService.java
9da8b8a7fc8c68c17e1bf8cce24e2f73abe5138e 26-Jul-2017 Todd Kennedy <toddke@google.com> Add new API to retrieve app names in a batch

Change-Id: I57e5c132bc58a32d70007a7a105775b526ff7bb9
Fixes: 62805090
Test: cts-tradefed run commandAndExit cts-dev -m CtsContentTestCases -t android.content.pm.cts.PackageManagerTest#testGetNamesForUids_null
Test: cts-tradefed run commandAndExit cts-dev -m CtsContentTestCases -t android.content.pm.cts.PackageManagerTest#testGetNamesForUids_empty
Test: cts-tradefed run commandAndExit cts-dev -m CtsContentTestCases -t android.content.pm.cts.PackageManagerTest#testGetNamesForUids_valid
ackageManagerService.java
567fe364d43579f5d807b18facdcc4e2d2e896bf 29-Jul-2017 Jeff Sharkey <jsharkey@google.com> Merge "Add a missing null check" into oc-dev am: 101fca656d
am: ea99954804

Change-Id: If4d45586afd4dde05a3aad10d25f73afdcc3e92d
a8f3b3d7747c363445c777f0e3702a54a21d6523 29-Jul-2017 Jeff Sharkey <jsharkey@google.com> Merge "Add a missing null check" into oc-dev am: 101fca656d
am: ea99954804

Change-Id: I3c81e5f426d6f4e41914b5f35803dd35ccc47710
ea999548045f722f007451c174237e97c766710d 29-Jul-2017 Jeff Sharkey <jsharkey@google.com> Merge "Add a missing null check" into oc-dev
am: 101fca656d

Change-Id: Iab72d9b62042ab5ceb0d32425b43796d3bdeb1ca
a47ba5f72a57ed58663ccde9c82a6398d6f8e8e4 29-Jul-2017 Svet Ganov <svetoslavganov@google.com> Add a missing null check

Test: manual

bug::62755026

Change-Id: Icf719d0e62986febd4d31f22be3e59d83c8e6e09
ackageManagerService.java
6ef7f0b8c6e72e849a220513425a9fd37804af90 29-Jul-2017 Calin Juravle <calin@google.com> Save PackageDexUsage on PMS shutdown

This ensures that we persist the in memory data between restarts (makes
testing much easier).

Bug: 64151900
Test: Manual, flash + restart + check the dex usage file
Change-Id: I23a7715de63af31405fabbdf4fcc03b8fbb41096
ackageManagerService.java
ex/DexManager.java
ex/PackageDexUsage.java
d585b026aea2c6e492da133aeedf2fac9e3e9f52 29-Jul-2017 Svet Ganov <svetoslavganov@google.com> Merge "Handle case for missing permissions - fix NPE am: 39cc33f192 am: 6e527d0ec5 am: 88414961ab" into oc-mr1-dev-plus-aosp
am: 7dd964c656

Change-Id: Ic20500fcd0d7055c8b7ada6f7c4c061fee803976
0ae9570c9925603a04d5a78775a68cc9d437542b 29-Jul-2017 Svet Ganov <svetoslavganov@google.com> Add a missing null check

Test: manual

bug::62755026

Change-Id: Icf719d0e62986febd4d31f22be3e59d83c8e6e09
ackageManagerService.java
46bbd79b0eb23fc4c86c860c8536fc8c89d5b57d 29-Jul-2017 Svet Ganov <svetoslavganov@google.com> Handle case for missing permissions - fix NPE am: 39cc33f192 am: 6e527d0ec5
am: 88414961ab

Change-Id: I6102ea1698eaa2e249deb9e64f8ec166e27d6eed
a2ab662f9b203d349cb912d0a49657e63fe9e98d 28-Jul-2017 Svet Ganov <svetoslavganov@google.com> Handle case for missing permissions - fix NPE am: 39cc33f192
am: 6e527d0ec5

Change-Id: I1ac6a0714fe2b466e313c337183097640deb4d58
88414961abc06e2b845e78aa017c85c013820179 28-Jul-2017 Svet Ganov <svetoslavganov@google.com> Handle case for missing permissions - fix NPE am: 39cc33f192
am: 6e527d0ec5

Change-Id: Ic15a4d3e5c71cf73957c10789e1cfb8c9353ea78
6e527d0ec5ea361419b51a6a8de3a709571605d7 28-Jul-2017 Svet Ganov <svetoslavganov@google.com> Handle case for missing permissions - fix NPE
am: 39cc33f192

Change-Id: I8fd46e293a25ddf83346950e8e700ec9d61e2263
39cc33f192d528f250818446ea0418aaf0cfe41f 28-Jul-2017 Svet Ganov <svetoslavganov@google.com> Handle case for missing permissions - fix NPE

Test: manual

Bug:62755026

Change-Id: Ie4dddffdb055f6084d9420ae94d0de2a61574bd8
ackageManagerService.java
95184e150624ce145899cb35a4056f4304c6c688 28-Jul-2017 Todd Kennedy <toddke@google.com> Merge "Allow the launcher to get all instant apps" into oc-mr1-dev am: f8c35ac848
am: 381c79336c

Change-Id: I3bb21131fdb44f755c88c3e55f74c5a388c46e4d
2cfc752278cc564d516f95a4475ba279fc54b562 28-Jul-2017 Svetoslav Ganov <svetoslavganov@google.com> Merge "Report permission flags for all protections based on SDK am: adb8c522a8 am: fc862c9f86" into oc-dr1-dev-plus-aosp am: bccc7625ec
am: bd0cf0ab06

Change-Id: I5bdb9b5d5ff91652a2bd4395bc4f7f783e25eb66
f8c35ac8484ae7e41dad047a4080fb36eaa63453 28-Jul-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow the launcher to get all instant apps" into oc-mr1-dev
bd0cf0ab06c4e27c60bc0093799a1c742ce036cd 28-Jul-2017 Svetoslav Ganov <svetoslavganov@google.com> Merge "Report permission flags for all protections based on SDK am: adb8c522a8 am: fc862c9f86" into oc-dr1-dev-plus-aosp
am: bccc7625ec

Change-Id: Idf1e289d5e70246433e5eccf286026b48e57282f
899f54da720011d02c802958c232e1baa2941378 28-Jul-2017 Svetoslav Ganov <svetoslavganov@google.com> Report permission flags for all protections based on SDK am: adb8c522a8
am: 436b901dbb

Change-Id: Ibe7cecd60242f1895434d586af30c2081d451f0b
70ec94fd12587f1402845e11e03b9885297bc3c0 28-Jul-2017 Svetoslav Ganov <svetoslavganov@google.com> Report permission flags for all protections based on SDK am: adb8c522a8
am: fc862c9f86

Change-Id: Ie08845d6e5afa8f75e1cc5392a1f5c2166d06d20
436b901dbb67d580468d0f78a95faffa40d74f64 28-Jul-2017 Svetoslav Ganov <svetoslavganov@google.com> Report permission flags for all protections based on SDK
am: adb8c522a8

Change-Id: Ia30269ec2097d5978ae3e0b3930a38b3f4441ea4
fc862c9f86d6a5fd946d3f58818f9a9ee194304f 28-Jul-2017 Svetoslav Ganov <svetoslavganov@google.com> Report permission flags for all protections based on SDK
am: adb8c522a8

Change-Id: I259df147b8345f6bdba5a1ed31d01d3c42e90518
c7df7d7dcb1059dd3ca8a30616076e5cd1fc1405 28-Jul-2017 Todd Kennedy <toddke@google.com> Allow the launcher to get all instant apps

Change-Id: Ie0381d01fe8cd5293a0a3671c1bdf497ca5c5783
Fixes: 63814920
Test: Manual
Test: Make and install a launcher that calls the protected APIs
Test: Run launcher, see that it gets a security exception
Test: Make the launcher the default, see that it gets a security exception
Test: Install the launcher as a system app
Test: Run the launcher, see that it gets a security exception
Test: Make the launcher the default, see that the API works
ackageManagerService.java
adb8c522a84b5c7531b009b7a8d4c854ca7dee08 28-Jul-2017 Svetoslav Ganov <svetoslavganov@google.com> Report permission flags for all protections based on SDK

We added a couple of protection flags that also apply to
normal and dangerous permissions. These flags are folded
in the protection level breaking apps that directly and
compare against the protection constants. Apps that target
older than O SDK don't get protection flags folded into
the protection level.

Test: All permission tests pass
Added a new test to ensure no protection flags reported
for normal and dangerous permissions

Change-Id: I87b10a7695d8ecfa7156525d6f3d101fc0639513
bug:62755026
ackageManagerService.java
a65dd2515a3b4730d74098ffe98f7a9a7d66f7a6 28-Jul-2017 Bart Sears <bsears@google.com> Revert "Report permission flags for all protections based on SDK" am: 784b56e1e6 am: 1a5a9be9ad am: 20c93bfe75
am: 6f1fa441be

Change-Id: I6f1fea5f5c0ede0fe3579f7419a3aee1af065900
6f1fa441be1b4640f9467a184c41c69fda3acfb4 28-Jul-2017 Bart Sears <bsears@google.com> Revert "Report permission flags for all protections based on SDK" am: 784b56e1e6 am: 1a5a9be9ad
am: 20c93bfe75

Change-Id: Ie4791e7740eba35e0b171c11a424364a45358117
7a8044dc6717c11c0db3fe12a6d91eedbd62a567 28-Jul-2017 Bart Sears <bsears@google.com> Revert "Report permission flags for all protections based on SDK" am: 784b56e1e6
am: 076d6f7669

Change-Id: I6034405a465919b5e4fc75b4eb109b6ae5259fe0
20c93bfe756075c28f3928c6dc3640c227abee1f 28-Jul-2017 Bart Sears <bsears@google.com> Revert "Report permission flags for all protections based on SDK" am: 784b56e1e6
am: 1a5a9be9ad

Change-Id: Iac6546b48308836b7a4bf41295a363032326d990
076d6f76698b90903496c8da55cc7bfc72fd72c3 28-Jul-2017 Bart Sears <bsears@google.com> Revert "Report permission flags for all protections based on SDK"
am: 784b56e1e6

Change-Id: Ice7dde53c5613f48d013424a7e99203fd854e532
1a5a9be9ad2a362ee3ab1490717cca73e9303abd 28-Jul-2017 Bart Sears <bsears@google.com> Revert "Report permission flags for all protections based on SDK"
am: 784b56e1e6

Change-Id: I80086249438fff193dc64d9c4d1a6b1468f8c4a1
784b56e1e64049d3bf81b7d8fa8c1ae3408c5886 28-Jul-2017 Bart Sears <bsears@google.com> Revert "Report permission flags for all protections based on SDK"

This reverts commit 852cf98cb8a4b9b56da84a96708c087996e119d2.

Change-Id: I62763bf85ec95a02a245c6b503aa34bb0e9d997a
ackageManagerService.java
c44bccd588d2b02b6f9fc512f60d922fed7a8b3c 28-Jul-2017 Svetoslav Ganov <svetoslavganov@google.com> Merge "Report permission flags for all protections based on SDK am: 852cf98cb8 am: 3cf283558a am: 2dfbbb3aa4" into oc-mr1-dev-plus-aosp
am: df55e3ce42

Change-Id: Icaa464dc5f064605f555c3b9bb09b9443a2eb028
2dfbbb3aa460fd01719eec1b42219e0715f02e2e 28-Jul-2017 Svetoslav Ganov <svetoslavganov@google.com> Report permission flags for all protections based on SDK am: 852cf98cb8
am: 3cf283558a

Change-Id: Iba5b20a777e4cf8953b73e523f25175d7b274a34
31cab0e52f5323d89bb49c03625021c1dded431b 28-Jul-2017 Svetoslav Ganov <svetoslavganov@google.com> Report permission flags for all protections based on SDK am: 852cf98cb8
am: 3cf283558a

Change-Id: I09b1f8573c6e2103fa66ae56352173e64b5ed8b7
3cf283558a4f05cca01af4bb8de71b411995146e 28-Jul-2017 Svetoslav Ganov <svetoslavganov@google.com> Report permission flags for all protections based on SDK
am: 852cf98cb8

Change-Id: I6e87c8f40fa466f2a50f41549be41ea4fb598824
546320e506b58ff97675ec6910c167165f5a8a50 28-Jul-2017 Svetoslav Ganov <svetoslavganov@google.com> Report permission flags for all protections based on SDK
am: 852cf98cb8

Change-Id: Id83fa00277f6262139024eee46312bf18cd7b691
852cf98cb8a4b9b56da84a96708c087996e119d2 27-Jul-2017 Svetoslav Ganov <svetoslavganov@google.com> Report permission flags for all protections based on SDK

We added a couple of protection flags that also apply to
normal and dangerous permissions. These flags are folded
in the protection level breaking apps that directly and
compare against the protection constants. Apps that target
older than O SDK don't get protection flags folded into
the protection level.

Test: All permission tests pass
Added a new test to ensure no protection flags reproted
for normal and dangerous permissions

bug:62755026

Change-Id: I72547b0146e6b6919803e33ff64b7208c4a255ad
ackageManagerService.java
df5a209d18af51d6d9a177ac716495d4d42c6348 27-Jul-2017 Todd Kennedy <toddke@google.com> Merge "Add cross user permission checks" into oc-mr1-dev am: 2a896e9074
am: 5b98a40d73

Change-Id: Ib8156b8b23520340b4d443831ebf5486ea0e2ecd
2a896e9074290d36372bd9d341ffb6e427305791 27-Jul-2017 Todd Kennedy <toddke@google.com> Merge "Add cross user permission checks" into oc-mr1-dev
92f9f98ec0576b21a2ca26ec1e94a2e7778fdd72 26-Jul-2017 Todd Kennedy <toddke@google.com> Merge "compressed images on system partition" into oc-mr1-dev am: 94902c46ba
am: 513125a7e3

Change-Id: I9f51ddc342b92c4e8a0c82eac50433d7394118ed
94902c46ba7684c938422a086a47cd101c803a1d 26-Jul-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "compressed images on system partition" into oc-mr1-dev
f1ff36f0f99ebb41d0c7e0f3248506a56998fa3f 22-Jul-2017 Calin Juravle <calin@google.com> Use the class loader context when optimizing secondary dex files

Record the class loader context for secondary dex loads and pass it to
dexopt during compilation.

The class loader context is passed from libcore every time a
BaseDexClassLoader is created and its recorded in the package dex usage
file.

Note that the context may be:
- unknown: if the dex file was not use after the the upgrade and its
context was not yet updated
- unsupported: if any of the class loaders from the loading context is
unsupported (only PathClassLoader and DelegateLastClassLoader are
supported).
- variable: if it changes over time, form one run to another.

In all the above cases the old compilation behavior is preserved for
now.(i.e. the dex file with be compiled with SKIP_SHARED_LIBRARY_CHECK)

Bug: 38138251
Test: runtest -x
services/tests/servicestests/src/com/android/server/pm/dex/
adb shell cmd package compile -f -m quicken ^Csecondary-dex
com.google.android.gms

(cherry picked from commit 3bec94d78b0a66c4fa5cebd851ea33bcc51916b0)

Change-Id: Ie8b78c7c0d5de43733b3d116f8dcb3a65324cca8
ackageDexOptimizer.java
ackageManagerService.java
ex/DexManager.java
ex/DexoptUtils.java
ex/PackageDexUsage.java
7eb1eee0e3ad6aef3f7b4ef78c3ceeb3d0e0c033 25-Jul-2017 Calin Juravle <calin@google.com> Merge "Use the class loader context when optimizing secondary dex files"
3072aa76c9ee475bdc76d16987855a7b7feffff6 25-Jul-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "dynamically install all missing splits" into oc-mr1-dev
7c8addfef09c118c5052c9a9e9f8f83a61044870 27-Jun-2017 Todd Kennedy <toddke@google.com> compressed images on system partition

Change-Id: I43c8c331883b5b381fb0f133fff448f3a57d0fe5
Bug: 36446542
Test: Manual
Test: Create a stub and a compressed application; put on the /system partition
Test: Restart the system and see that it decompresses the full application onto the /data partition
Test: Restart again and see that we skip decompression
Test: Create an invalid compressed application [eg. empty file]
Test: Restart the system and see that the stub is disabled
Test: Restart again and see that we skip decompression
ackageManagerService.java
78a72501af2e874868c6885d5af4f9253ce92255 19-Jul-2017 Todd Kennedy <toddke@google.com> Add API for virtual preloads

Virtual preloads are applications that aren't actually on the
/system partition, but, act as if they were. One such distinction
is that these apps receive Intent.ACTION_BOOT_COMPLETED and start
out of the stopped state.

Change-Id: I812d3e7008b9d87e84aa33dbc4b3d8e8b334533c
Fix: 34855677
Test: Manual
Test: Install an app with "--preload"
Test: See that it receives Intent.ACTION_BOOT_COMPLETED
ackageInstallerService.java
ackageManagerService.java
ackageManagerShellCommand.java
0abf6a84853027ec8e26c1c07777b10fa05b3988 25-Jul-2017 Shubham Ajmera <shubhamajmera@google.com> Update DexFile#getDexOptNeeded usages to reflect API change am: 52c8620c19
am: 51b9a824d5

Change-Id: I40cb970c53220f42558cb8b968efc97b8c7408d6
51b9a824d5f9553bd6767119827ee3bff49d290b 25-Jul-2017 Shubham Ajmera <shubhamajmera@google.com> Update DexFile#getDexOptNeeded usages to reflect API change
am: 52c8620c19

Change-Id: I31b2aec15ace15e159eaeaafdd55d10767aaca0f
52c8620c1945de45f22c1e62dcb69ddadca07675 25-Jul-2017 Shubham Ajmera <shubhamajmera@google.com> Update DexFile#getDexOptNeeded usages to reflect API change

Test: make and boot
Merged-in: I68f9f617d6722a7ba8b00aa2181cb38a165cfc51
Bug: 36598475
(partially cherry-picked from commit 246dccf9327631597767afe418ce43ae6d07d102)

Change-Id: Idfc9276eb2b61244bbd634f49a3912dab6fcabfa
ackageDexOptimizer.java
3bec94d78b0a66c4fa5cebd851ea33bcc51916b0 22-Jul-2017 Calin Juravle <calin@google.com> Use the class loader context when optimizing secondary dex files

Record the class loader context for secondary dex loads and pass it to
dexopt during compilation.

The class loader context is passed from libcore every time a
BaseDexClassLoader is created and its recorded in the package dex usage
file.

Note that the context may be:
- unknown: if the dex file was not use after the the upgrade and its
context was not yet updated
- unsupported: if any of the class loaders from the loading context is
unsupported (only PathClassLoader and DelegateLastClassLoader are
supported).
- variable: if it changes over time, form one run to another.

In all the above cases the old compilation behavior is preserved for
now.(i.e. the dex file with be compiled with SKIP_SHARED_LIBRARY_CHECK)

Bug: 38138251
Test: runtest -x
services/tests/servicestests/src/com/android/server/pm/dex/
adb shell cmd package compile -f -m quicken ^Csecondary-dex
com.google.android.gms

Change-Id: I2486522fb811f9fc58a44b92642f43a41e7d5bac
ackageDexOptimizer.java
ackageManagerService.java
ex/DexManager.java
ex/DexoptUtils.java
ex/PackageDexUsage.java
dbaef6dc62507b0e0623e76882e31e68413d469d 24-Jul-2017 Todd Kennedy <toddke@google.com> Add cross user permission checks

Change-Id: I5d46248fafe52dea66a33c416fbe151776b73679
Fixes: 62348076
Test: Manual
ackageManagerService.java
2dd3ad06d6413928448f0735c937a414018520ba 21-Jul-2017 Todd Kennedy <toddke@google.com> dynamically install all missing splits

In O, we allowed Instant Apps to dynamically install missing
splits. We removed that limit and allow any application [ie.
full applications] to dynamically install missing splits.

This functionality only works on activities. Missing splits
will not be dynamically installed when referencing other
components such as receivers, providers or services.

Change-Id: Iab1db1ebc80f517d711ae113e68d7adcc2a39d9f
Fixes: 63112542
Test: Manual.
Test: Install a app that references a split that isn't installed
Test: Invoke the missing split and see that the installer is launched
ackageManagerService.java
6c315479a3cd82ef1fd1ac02acfc270ef69b7956 20-Jul-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix splits class loader context for non dependant splits"
2b594992635b94332a5e541c335d27af51401bb0 20-Jul-2017 Calin Juravle <calin@google.com> Merge "Encode the entire class loader context for dex2oat"
305aeea38f96f0b94ad4be5cb979dd9cf98cf7df 15-Jul-2017 Calin Juravle <calin@google.com> Fix splits class loader context for non dependant splits

If the app doesn't request for splits to be loaded in isolation or does
not declare inter-split dependencies, then all the splits are loaded in
the base apk class loader (in the order of they are defined).

Fix the class loader context passed to dex2oat to reflect the runtime
loading logic.

Bug: 38138251
Test: runtest -x
services/tests/servicestests/src/com/android/server/pm/dex/DexoptUtilsTest.java

Change-Id: Ia0623d38883ae244fd16c0afb053fef016bf260a
ex/DexoptUtils.java
2b8d44f907d92941b74d12c3abf7a41e8eff893d 20-Jul-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add a command line option to optimize individual splits"
11ed01b4b2a279dc16ea30c9aa8f7b0b0e2be502 20-Jul-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Refactor the arguments passed to dexopt invocations"
19da1cf72e8c448743a8c27ac6d73424ae42c7ec 13-Jul-2017 Calin Juravle <calin@google.com> Encode the entire class loader context for dex2oat

Until now the split dependencies were passed as a flatten list to dex2oat.
In the presence of DelegateLastClassLoaders this is no longer enough to
ensure the correctness of the compilation.

This CL encodes the split dependencies together with their declared class
loader in a format accepted by dex2oat.

Bug: 38138251
Test: runtest -x
services/tests/servicestests/src/com/android/server/pm/dex/DexoptUtilsTest.java

Change-Id: Iaabd5d8bd5e6d027a8de5a408777fd517063d9f1
ackageDexOptimizer.java
ex/DexoptUtils.java
b6f844d28cc7a7bf2b477a904263fcbe9b26d2c4 18-Jul-2017 Calin Juravle <calin@google.com> Add a command line option to optimize individual splits

The new option is "--split SplitName" and applies to "adb shell cmd
package compile" command.

Usage example:
adb shell cmd package compile -m speed --split split_feature_a.apk
com.android.cts.classloadersplitapp

Bug: 38138251

Test: adb install-multiple CtsClassloaderSplitApp.apk
CtsClassloaderSplitAppFeatureA.apk CtsClassloaderSplitAppFeatureB.apk
adb shell cmd package compile -m speed --split split_feature_a.apk
com.android.cts.classloadersplitapp
check the status of split_feature_a
runtest -x
services/tests/servicestests/src/com/android/server/pm/dex/DexoptOptionsTests.java

Change-Id: I579bb12fa6699f99cd3824f185bd9352fb8007c5
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerShellCommand.java
ex/DexoptOptions.java
1d0e83d2cee794ba576d573119e826905a4422cd 18-Jul-2017 Calin Juravle <calin@google.com> Refactor the arguments passed to dexopt invocations

Wrap the arguments passed to the various performDexopt calls into the
DexoptOptions object.

This will make adding extra arguments (like compile only a split) much
easier and avoid extending quite a few internal methods.

Bug: 38138251
Test: adb shell cmd package compile ....
adb shell cmd package bg-dexopt-job ...
install new apps and check that they compiled
runtest -x
services/tests/servicestests/src/com/android/server/pm/dex/DexoptOptionsTests.java

Change-Id: Ia9930edd2dceb7535d6168eceb8e3199c82b6306
ackgroundDexOptService.java
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ex/DexManager.java
ex/DexoptOptions.java
3599a28121cc354d853eea7940867743d0ea4e1d 19-Jul-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Always populate the ApplicationInfo object"
c606627e6c931d4d1e60ce29f7802d7bd9f4403d 19-Jul-2017 Todd Kennedy <toddke@google.com> Always populate the ApplicationInfo object

While scanning system apps, we abort package/application info setup
if an app on /system is not a higher version than an upgrade on /data.
Instead, we need to still fully populate these objects because they
can be retrievd using the MATCH_FACTORY_ONLY flag.

Change-Id: I0262b46f446eace60ce94f1428f3fb15d785a89c
Fixes: 62980149
Test: Manual
Test: Create a sample application that dumps the contents of an ApplicationInfo object for a given package
Test: Install the sample application on the /system partition and "upgrade" the sample application so it's also on the /data partition
Test: Create a secondary user and disable the sample application
Test: Reboot the device
Test: Run the sample application as the primary user and see that the ApplicationInfo object is correctly populated
ackageManagerService.java
d480015b602c6d1d7c1ac99920944b1e3a73c1e0 19-Jul-2017 Shubham Ajmera <shubhamajmera@google.com> Merge "Fix: handle null value for packageUsageInfo while deciding unused apps"
9cc0a8f2dd1948325a0b1fa7e8b737c5db365a42 19-Jul-2017 Calin Juravle <calin@google.com> Merge "Record dex files users in the dex-usage list"
2e565e6d6ec1a8be52f9d2b5a67597cf4791434d 19-Jul-2017 Shubham Ajmera <shubhamajmera@google.com> Fix: handle null value for packageUsageInfo while deciding unused apps

Bug: 36598475
Test: Verified for AOSP calculator
Change-Id: I86633a729ae34c621f9026fcf0486f2c0a5c7e4c
ackageManagerServiceUtils.java
535a4753e313bdc2ae3e8be9f50606b82edcce0c 04-Feb-2017 Calin Juravle <calin@google.com> Record dex files users in the dex-usage list

Add the users of the dex files in the package-dex-usage.list. This will
provide more data on why a package is marked as shared and not optimized
using profiles.

Test: runtest -x .../DexManagerTests.java
users of the dex files are recorded in package-dex-usage.list

Bug: 63778376
Change-Id: I329bc929b17fa0afe1531f3e6879f6160157a787
ex/DexManager.java
ex/PackageDexUsage.java
91936a1d06641c26158bf074a135363082fd4213 18-Jul-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add a system property support to disable background dexopt job"
7cb10dd76ef9b81ddfc95fc7a9344b7d14e54f1d 18-Jul-2017 Svetoslav Ganov <svetoslavganov@google.com> Merge "Don't reset review state until no permission requires a review."
3067a1dd8bf7faf7f03b2e23dd25369a7f441a1a 14-Jul-2017 Shubham Ajmera <shubhamajmera@google.com> Add a system property support to disable background dexopt job

Bug: 34812714
Test: Verified the property value on the device
Change-Id: Ibfa46f90a8df772eb684c0e5bd421e46a5798a85
ackgroundDexOptService.java
0b1a7a35b5b66be732555e140441f9e679b89337 18-Jul-2017 Shubham Ajmera <shubhamajmera@google.com> Merge "Reduce app size by downgrading inactive apps"
246dccf9327631597767afe418ce43ae6d07d102 25-May-2017 Shubham Ajmera <shubhamajmera@google.com> Reduce app size by downgrading inactive apps

This will trigger when the device will have low space.
Active apps here refer to the apps which were either active
in foregrond or in background and also used by other packages.
Apps which are inactive for X days downgraded to verify. X is
determined by sysprop pm.dexopt.unopt_after_inactive_days

If the system properties are not set, no effect will take place.

The above operations will take place in background dexopt service.
If user uses the app again, it will again be speed-compiled when
background dexopt service starts next time.

Bug: 36598475
Test: manual
* Remove the check in the code that allows downgrade only when
the space is low on the device.
* adb root
* Set pm.dexopt_unopt_after_inactive_days to 600
* Make sure the current time of the device is correctly set
* Install 2 non system apps - B, C
* Downgrade B to extract
* Upgrade a system apps to speed-profile - E
* Downgrade a system app to quicken - G
* adb shell cmd package bg-dexopt-job

Expected Results:
* Extract - B
* Verify - C
* There should not be any entries for apps E an G
in dalvik_cache

Change-Id: I68f9f617d6722a7ba8b00aa2181cb38a165cfc51
ackgroundDexOptService.java
nstaller.java
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
ackageManagerServiceUtils.java
ex/DexManager.java
587512a0cfc88ba2e114a30554fc232d9b2c5a4f 15-Jul-2017 Svet Ganov <svetoslavganov@google.com> Don't reset review state until no permission requires a review.

In a permission review mode we have a per user flag whether a
permission review is required for an app to avoid iteration
over all permissions on an activity start. This state was
incorrectly cleared if a permission review flag is cleared
despite the fact that there may me other permissions requiring
a review.

Test: manual

bug:63720758

Change-Id: I3391c9d7e419e2e22f7b053de8e6ed977b6eba91
ermissionsState.java
747613f1fce72792a0e39395ea63bee483052169 13-Jul-2017 Fyodor Kupolov <fkupolov@google.com> Additional metrics for PM init

Test: simulated build fingerprint change and checked logs
Bug: 62462279
Change-Id: I8446fcc9beed461a4554e79ab2b820839ced7c2f
ackageManagerService.java
6de68dfa4ea4276d152146e2c261710deed76fd1 11-Jul-2017 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #34471029: Don't allow audio use from background apps."
06815d6023f03f0169d67634b3ba10d60c33c7e2 10-Jul-2017 Shubham Ajmera <shubhamajmera@google.com> Merge "Keep track of primary dexopt"
71e6a7fda9f35d223a5a39343e35d4ffe4517d83 08-Jul-2017 Shubham Ajmera <shubhamajmera@google.com> Keep track of primary dexopt

In commit ce54397, the results of both secondary dexopt and
primary dexopt were clubbed. This CL partially reverts the change
to not aggregate the two dexopt in single stat. A TODO has been
added to store stats for secondary dexopt.

Bug: 38413085
Test: build successful
Change-Id: I7ab437c694d5eb7df5f03706ace26380f513489e
ackageManagerService.java
3e99f654fbf56d3b7ef7130658b8ef83d2d0cdbd 06-Jul-2017 Dianne Hackborn <hackbod@google.com> Fix issue #34471029: Don't allow audio use from background apps.

This is becoming a common pattern (keeping track of which processes
are cached and not allowing them to do stuff in that state), so I
am turning this in to a general mechanism for monitoring this state
through the activity manager's IUidObserver. Now we can just have
AudoService implement its own IUidObserver to get this state and
update which uids it is blocking.

This required making some changes to uid change reports so that
the integer is now a bit mask instead of an enumerations, but that
is what it was already turning in to anyway. (This gets rid of
the crazy GONE_IDLE constant that we'd needed to add before because
it wasn't a bit mask).

Eventually the power manager should be changed to be told about
these changes to cached state instead of listening to every proc
state change, but we'll do that later, it is more disruption than
I want to take for now. However, while working on this, I noticed
that the power manager had regressed in the cached uids it would
actually block, because the activity manager was no longer telling
it about all uids that are idle. (I think this happened when I had
to change the default idle state of UidRecord to true.) So I am
adding a bit of new code to keep track of what idle state we last
reported to observers, to make sure we tell it about newly created
uids that are idle but have never actually become active.

Test: runtest -c com.android.server.am.ActivityManagerServiceTest frameworks-services

Change-Id: I7bfd46bacadd4cab2a69f40e6e52afb4e67b456a
hortcutService.java
b2f9ab33478f4daf77bd57d4e90bcb819aa671ed 10-Jul-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow splits to declare a classloader type."
ab48e514d22e2bfa9546468d89f5a4b44055ec0b 07-Jul-2017 Shubham Ajmera <shubhamajmera@google.com> Merge "Compile secondary dex at boot after OTA"
ce54397368dc98182d7b4eb2ff3c142bbd87e39d 10-Jun-2017 Shubham Ajmera <shubhamajmera@google.com> Compile secondary dex at boot after OTA

Bug: 38413085
Test: build successful
Change-Id: If080281fb3147fea625bcafce91167e8c1439736
taDexoptService.java
ackageManagerService.java
ex/DexManager.java
c8b29ac6f0340bd0c3c9eb388c4be2d446de9a59 06-Jul-2017 Jeff Sharkey <jsharkey@android.com> Change storage migration to use quota APIs.

New quota APIs are much faster than trying to measure manually, and
removing this last user of calculateDirectorySize() means we can
remove it once and for all.

Bug: 36056324
Test: builds, boots
Change-Id: Ibdf1ee4e8885680e106df6a9269b6309ddc61af8
nstaller.java
f9419f0f8524da4980726e06130a80e0fb226763 15-Jun-2017 Narayan Kamath <narayan@google.com> Allow splits to declare a classloader type.

Add an attribute android:classLoader which can be set to the name
of the classloader the base or split wishes to use. For now, this can
only be set to "dalvik.system.PathClassLoader" or
"dalvik.system.DelegateLastClassLoader". The current implementation
only allows the classloader to exist in the boot classpath but that
restriction can be loosened in a future change if necessary.

Test: cts-tradefed run cts-dev -m CtsAppSecurityHostTestCases
Bug: 36044779

Change-Id: I5a51f7aa0c8c4c398d2f46129eb06785cc8e3c3f
ackageInstallerSession.java
ackageManagerShellCommand.java
6c96f7fa7dfdf998c3b553e5d150237d22a44e2a 29-Jun-2017 Fyodor Kupolov <fkupolov@google.com> Do not hold PM lock when calling AppOpsService.removeUser

Test: manual
Bug: 63117568
Change-Id: Ia23878df53c9b1b1e11bc78f2b36ff740e8f75a4
serManagerService.java
5c56129033bee668a97b363641991628f45dc792 27-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Use content type specified on the command line" into oc-dev
am: f89bf30312

Change-Id: I2eafecfbf73333541a8b28726dc2af0a456443c0
12062d493792ec59d0afa937d3c45fbbf6a0f913 27-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Use content type specified on the command line" into oc-dev am: f89bf30312 am: 1f56ccf5f0
am: 5b3c1af460

Change-Id: If593116112316c4126767d6769594cc9166e2663
5b3c1af4602832eb8ad9c181e3c0f6e2ed20e92b 27-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Use content type specified on the command line" into oc-dev am: f89bf30312
am: 1f56ccf5f0

Change-Id: Ib0fa2e896764407ad22d199523bb0213e864ee35
1f56ccf5f0b2920be8df87015c6015b74328f804 27-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Use content type specified on the command line" into oc-dev
am: f89bf30312

Change-Id: I33dc8db8cf347b43a404cb0d33b7f6a0a005da6a
279e1876d6c73772ea3c720084f1c44f9f2c0f18 27-Jun-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "reflect errors to child package"
5ab024333065c60620867e58eaa27f27dfa85752 27-Jun-2017 Jeff Sharkey <jsharkey@android.com> Only require that system UIDs tag their sockets.

Apps with a normal UID are typically isolated enough to not require
socket tagging; we're mostly interested in tracking down internal
UIDs that have lots of code sharing the same UID.

Also fix up everyone doing manual string checks of Build.TYPE, since
we now have first-class fields for those.

Bug: 38126076
Test: builds, boots
Change-Id: I3a40348196bd8459289f2b9355d9783a07f1e7dd
phemeralResolverConnection.java
ackageManagerService.java
6044d6ccaeb7dcc60d747113f77e0aa131211074 27-Jun-2017 Todd Kennedy <toddke@google.com> reflect errors to child package

Change-Id: I387b7dc4729b099a4064fbe10e9d949a8a7c340c
Fixes: 63055904
Test: install test and see that the system server does not restart
Test: adb install -r -g out/target/product/sailfish/data/app/FrameworkCoreTests_install_multi_package/FrameworkCoreTests_install_multi_package.apk
ackageManagerService.java
0e2a75d96d1deab417a7a32fc4007fd7d8057ebf 27-Jun-2017 Todd Kennedy <toddke@google.com> Use content type specified on the command line

Bug: 62914247
Test: Manual; query before change and no intents resolved. query after and intent resolved.
Test: sample query command: adb shell cmd package query-activities -a android.intent.action.OPEN_DOCUMENT -c android.intent.category.OPENABLE -t \\*/\\*
Change-Id: Ieadb15bcdebeff01e9b8075932417ba5585de16e
ackageManagerShellCommand.java
13d97c2e06696737df67ec36a62b43bae18d03b8 26-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Merge "Filter instant apps with different names" into oc-dev am: adcc94f160 am: ae524ac5fa" into oc-dr1-dev-plus-aosp
am: 193a4f12c5

Change-Id: I4f8fe31455f5946477d8a793843e70d0f88d17eb
191df632bdac63bab16ce95d047eaa23df422762 26-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Filter instant apps with different names" into oc-dev am: adcc94f160
am: ae524ac5fa

Change-Id: I4d858aec3c61899f150e1a48571d142075549654
a350db60bdcd0e05613466739dc6d41cd1caf639 26-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Filter instant apps with different names" into oc-dev
am: adcc94f160

Change-Id: Ia4d1b58648ceb986b0af014cb6b3a6f6c0b2ce2f
ae524ac5fa396c68f376445d172b45e43b9f339e 26-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Filter instant apps with different names" into oc-dev
am: adcc94f160

Change-Id: I855a58e6ea0655b4211f2aac0a4a1f9f94f639f2
adcc94f160398fce5d416d10a89c304f818a91fe 26-Jun-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Filter instant apps with different names" into oc-dev
1dfb21b673471aa8780e2b44b362a70f4675cb49 26-Jun-2017 Todd Kennedy <toddke@google.com> Filter instant apps with different names

ag/2447596 introduced a regression that caused instant apps to be
made visible to one another.

Change-Id: I5db9a43f05dd5bec991cc0934b1c9a9406dfade6
Fixes: 62998487
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
ackageManagerService.java
adcd1fe0f6a28aab9e25a8a2aa65440d7d0929f4 26-Jun-2017 Jeff Sharkey <jsharkey@google.com> Merge "Progress towards FBE and adoptable storage."
31e13ba55ccfd2b7c9f97ac994dac27e7f28f5ce 26-Jun-2017 Todd Kennedy <toddke@google.com> Merge "null check before dereference" into oc-dev am: df8569787c am: 6939301147
am: 8c18322a58

Change-Id: I9be94377b57340e5e4bbcdecacd009eae0324bdd
69393011471746552f8b5c409c4b65c77be0d595 26-Jun-2017 Todd Kennedy <toddke@google.com> Merge "null check before dereference" into oc-dev
am: df8569787c

Change-Id: I62067d87f75367bb527862d3ac3873b3c94c9b7c
b5af86e4443864ad60016ff4cf60c3737eb7ab4b 26-Jun-2017 Todd Kennedy <toddke@google.com> Merge "null check before dereference" into oc-dev
am: df8569787c

Change-Id: I41f9298e305f6f197120f2b3128187a4cbf6b28a
df8569787ce3278035b0b2e7204cd1b72924a801 26-Jun-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "null check before dereference" into oc-dev
7833e7c5cb628bbf634f8771e00a896a91d43403 26-Jun-2017 Todd Kennedy <toddke@google.com> null check before dereference

Change-Id: I6ae219b68920c160e104b307f60802fd75e705ce
Fixes: 62908319
Test: Manual
ackageManagerService.java
a65e6491e4aa90611045ecf696db4bf3328d09bc 21-Jun-2017 Jeff Sharkey <jsharkey@android.com> Progress towards FBE and adoptable storage.

Offer to adopt storage devices on FBE devices, but keep it guarded
behind a system property for now, since we still need to work out key
storage details.

Verify that all users are unlocked before moving apps or shared
storage. We only need them to be unlocked; we don't need them to
be actually running.

Have PackageManager dump the set of volumes that it's finished
scanning and loading, since otherwise CTS can get excited and race
too far ahead of it. Add a specific error code to communicate
that users are locked.

Test: cts-tradefed run commandAndExit cts-dev --abi armeabi-v7a -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AdoptableHostTest
Bug: 37436961, 29923055, 25861755, 30230655
Change-Id: I749dc3d8148e1a95d8bc4be56665253ef826d3fe
ackageManagerService.java
ae6c6d21ca3d6e1a19979221fee8a3a2a6ac791e 23-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Merge "Allow any app to dynamically install a split" into oc-dev am: 16503a8f7e am: 20fad610b9" into oc-dr1-dev-plus-aosp
am: bc5b5567d0

Change-Id: I9be704b2ad3f97df5ce7327675b459ffc84abafd
921fc1426f48dee8bf6dc9db256282b2a045bee7 23-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Allow any app to dynamically install a split" into oc-dev
am: 16503a8f7e

Change-Id: I13cf0e00de235d0bbdb79aa553e04386c519975d
20fad610b90f7746e98543663cbc522cb3fc1daf 23-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Allow any app to dynamically install a split" into oc-dev
am: 16503a8f7e

Change-Id: Ia20de35097f3b5b139afc5ccee59d71584f59a3a
16503a8f7e983178356f0c4bbbdaf71037e13a40 23-Jun-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow any app to dynamically install a split" into oc-dev
739af1876b6d1cb3b7c36742a8d2de495687c27e 22-Jun-2017 Todd Kennedy <toddke@google.com> Allow any app to dynamically install a split

Any application starting an activity resolved to a dyanmic split
should initiate split installation. Previously, only the application
defining the split could start installation of the split.

Bug: 62872325
Test: Manual; install instant app and start intent using 'adb shell am' and see that dynamic split installation occurs
Change-Id: I232dc5df82fb2c04653015a4a6b9f07c9e382205
ackageManagerService.java
1e7ffc1104a70b8949d4ff9205f05ab5457cda6e 22-Jun-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Always run the intent filter verifier in USER_SYSTEM"
f291e6380028a47317ae2c2f506f80584dd8e86e 22-Jun-2017 Christopher Tate <ctate@google.com> Always run the intent filter verifier in USER_SYSTEM

The temporary whitelisting of the intent filter verifier was not
taking effect when an app install was applied to all users, because
the USER_ALL userid argument was not applicable downstream in the
whitelist-package-within-user code flow. The verifier is located
explicitly in the system user anyway; we do not need to try to
launch or whitelist it in a per-target-user manner.

In addition, the whitelisting operation is now synchronous to avoid
any slight race between delivery of the verification broadcast and
application of the new whitelist state.

Bug 62814249
Test: manual

Change-Id: I051277dad6c541d0aa6bcdd824ad3cce4b20b269
ackageManagerService.java
b0297aeb968c8b83b46956af4d8c7814feb6428f 21-Jun-2017 Svetoslav Ganov <svetoslavganov@google.com> Merge "Support native shared libs" into oc-dr1-dev am: 77dea6284a
am: a6465a13cf

Change-Id: I95dbdad3eb12ea536b59134e86f4060fb35b3278
40610e3a1402a54697b3da2423431a327a1b3c71 21-Jun-2017 Svetoslav Ganov <svetoslavganov@google.com> Support native shared libs

resolve merge conflict for ac9b6706b

Add the shared libs that are APKs to the native library
path when creating application class loaders. Also don't
allow shared libraries hosting native libs to request
extraction of the native libs out of the APK. Lastly,
shared libraries hosting native libs must be declared
as multi-architecture.

Test: CTS tests in this topic

bug:62720360

Change-Id: Ie3f203db12a3f3826e114c219a8341d9acab604f
ackageManagerService.java
010b3b8bd015cfc3dd193d501cb38c7e410c63cd 21-Jun-2017 Chad Brubaker <cbrubaker@google.com> Merge "Allow Instant Apps to call getPermissionControllerPackageName" into oc-dev am: 88f98985d5 am: 53d87ebb55
am: 6aff0ffe8b

Change-Id: I4b0dc391b85229f1668c73fad94b463984bfe46c
667b655ee516ed54b619aaaa3f7b1212ab3d6b49 21-Jun-2017 Chad Brubaker <cbrubaker@google.com> Merge "Allow Instant Apps to call getPermissionControllerPackageName" into oc-dev
am: 88f98985d5

Change-Id: Ifc85ffb37f139cd499fd2ebef4cfc6f6d9fcd932
53d87ebb559f8dcfa3ac04c5cdf503006f48d8a8 21-Jun-2017 Chad Brubaker <cbrubaker@google.com> Merge "Allow Instant Apps to call getPermissionControllerPackageName" into oc-dev
am: 88f98985d5

Change-Id: Ifd33084351941d2fe58f6534014940a18d57528f
88f98985d5863cd4a3a1695648482be63c8c73bc 21-Jun-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow Instant Apps to call getPermissionControllerPackageName" into oc-dev
03f85fef7f80e2faa8ee8f452195d42158d3376e 21-Jun-2017 Chad Brubaker <cbrubaker@google.com> Allow Instant Apps to call getPermissionControllerPackageName

This is needed for requesting permissions to work.

Bug: 62791664
Test: Requesting a runtime permission doesn't crash the app
Change-Id: If18ac8e4c903f3804ec24df39d169fa9145f449e
ackageManagerService.java
d46d0386e24b5418408760a330232898dd65f4d6 21-Jun-2017 Svetoslav Ganov <svetoslavganov@google.com> Merge "[DO NOT MERGE] Support native shared libs" into oc-dev
am: 324c41ba89

Change-Id: Ia774a4f3bd1af7c334b2844f87fa8850de48f2f7
324c41ba890f1ee5bacfc01b869f084206b5187e 21-Jun-2017 Svetoslav Ganov <svetoslavganov@google.com> Merge "[DO NOT MERGE] Support native shared libs" into oc-dev
f8579581c1d6bf993f26d21aefca410ac9b6706b 17-Jun-2017 Svet Ganov <svetoslavganov@google.com> [DO NOT MERGE] Support native shared libs

Add the shared libs that are APKs to the native library
path when creating application class loaders. Also don't
allow shared libraries hosting native libs to request
extraction of the native libs out of the APK. Lastly,
shared libraries hosting native libs must be declared
as multi-architecture.

Test: CTS tests in this topic

bug:62720360

Change-Id: I0a398593ebe41b2976cb706ca8a388005f5aec83
ackageManagerService.java
5ce464e43e3df34cf4e26eed3707c2db987cc684 16-Jun-2017 Fyodor Kupolov <fkupolov@google.com> Avoid using global PM lock in isProtectedBroadcast

Otherwise it sometimes blocks ActivityManager for 100+ ms.

Test: manual
Bug: 62352844
Change-Id: I9b821551ba6ac884df68a164d888035e705b6f51
ackageManagerService.java
dbdfac35b92deede1ac5d4041e78aafde7a9d3ba 18-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Track both framework and app overlays per package" into oc-dev am: 65ffdba7f7 am: c36175d754
am: 6cfafd4c7b

Change-Id: Ia8e8b2b45c55879b212ca2a7dbf8b5b6dbfa0b5b
c36175d7544678d7331676678465e0bf7ba62c1e 18-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Track both framework and app overlays per package" into oc-dev
am: 65ffdba7f7

Change-Id: I4af23140f4d9ecc2c1e9faa09d03eddb22db9dae
895b695ab0ff3e6b4ac1301713d2b32a7856de91 18-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Track both framework and app overlays per package" into oc-dev
am: 65ffdba7f7

Change-Id: Ib58b5ed03daa375c0ba667829d4a38567c99ac78
65ffdba7f7d817bf015e649735ed227471d30788 18-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Track both framework and app overlays per package" into oc-dev
560830c9f06d07d97055426420709733571ca05b 16-Jun-2017 Todd Kennedy <toddke@google.com> Track both framework and app overlays per package

Always bundle framework and app overlays. The old implementation, where
framework and app overlays were tracked independently, lead to an error
in the following scenario:

1. Enable app overlay -> change reflected in app
2. Enable framework overlay -> error: no change reflected in app
3. Disable app overlay -> change reflected in app, including framework
overlay

This change also leads to better architecture since the package manager
no longer needs to know that an app's overlays consist of both framework
and app specific overlays. Instead, that knowledge is handled by the
overlay manager.

Also, correct indentation in "cmd package dump packages" output and
remove obsolete constant DUMP_ENABLED_OVERLAYS.

Test: Manual
Change-Id: I707fc00052a15b22fb8c17e6155732520e6b2e52
Bug: 62680061
ackageManagerService.java
ackageSettingBase.java
ettings.java
dab9a98ccd0af58c3b224dccf978e58e5e68c5db 16-Jun-2017 Todd Kennedy <toddke@google.com> Merge "enable/disable dexopt for instant apps remotely" into oc-dev am: 5d969b9862 am: 3586115ae5
am: 40c74514df

Change-Id: Id3432a8e7a01f0af69fd3ad0b70542718c6c33b7
40c74514df11e319ef658a97dc46968e58e7b3d2 16-Jun-2017 Todd Kennedy <toddke@google.com> Merge "enable/disable dexopt for instant apps remotely" into oc-dev am: 5d969b9862
am: 3586115ae5

Change-Id: I2a8093b966e246ad77ee4257b81bf819443e94c2
1466c1618f3ce0dcbec0535f14b2b64dde94bd89 16-Jun-2017 Todd Kennedy <toddke@google.com> Merge "enable/disable dexopt for instant apps remotely" into oc-dev
am: 5d969b9862

Change-Id: If9f063e5db82c079b7a9e682365a8840ee7da794
3586115ae562c18d5f1e2404dd31069f25a3c424 16-Jun-2017 Todd Kennedy <toddke@google.com> Merge "enable/disable dexopt for instant apps remotely" into oc-dev
am: 5d969b9862

Change-Id: Ica29f01779c2bb504d682a2b457f861264cc00b0
5d969b9862aefa3ddd8160f12829c22bc86de131 16-Jun-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "enable/disable dexopt for instant apps remotely" into oc-dev
0723ab2361af7c6d5f41e16c762ed892cda0cd17 16-Jun-2017 Jeff Hao <jeffhao@google.com> Merge "When updating a split app, copy compiled files from base.apk only." am: 8a945baf4a am: 47b1f54316 am: 2783f272b6
am: 27639484ef

Change-Id: I1c3d9dface747b5366f5472626935d43106893b3
76aa10ba243bf8d0cf3f9b925ecc35c5b56680e8 16-Jun-2017 Jeff Hao <jeffhao@google.com> Merge "When updating a split app, copy compiled files from base.apk only." into oc-dev
am: 08b3fd966c

Change-Id: Iabcb03567e71585898f60160a3e0a5c8e6870f3b
27639484efd8a8e8c2247dbe1bb17e29586e069c 16-Jun-2017 Jeff Hao <jeffhao@google.com> Merge "When updating a split app, copy compiled files from base.apk only." am: 8a945baf4a am: 47b1f54316
am: 2783f272b6

Change-Id: Id7236590276201928ba8abab549f3175d616a7bc
2783f272b6686d1a7d243f0ba425d30a295a9ce2 16-Jun-2017 Jeff Hao <jeffhao@google.com> Merge "When updating a split app, copy compiled files from base.apk only." am: 8a945baf4a
am: 47b1f54316

Change-Id: Ie04409229e2f118f1785db46e2c6f3fb0aa7603e
08b3fd966c926f9925bee09e61018d5172abe6ea 16-Jun-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "When updating a split app, copy compiled files from base.apk only." into oc-dev
117a9bb8e75fbb3b45c6ebebedae2fe31420dd4e 16-Jun-2017 Todd Kennedy <toddke@google.com> Merge "don't block uninstall of unknown packages" into oc-dev am: 627fbf8157 am: 7076de2d52
am: 7a9b182b33

Change-Id: I35e79bb8bf2c3f9b1ac79d1b4112577426a2681b
7a9b182b33b3fec91de73a952a42a0f302a2fd59 16-Jun-2017 Todd Kennedy <toddke@google.com> Merge "don't block uninstall of unknown packages" into oc-dev am: 627fbf8157
am: 7076de2d52

Change-Id: Id4f708616b1e9c7ad780a2a4532191872ffd44a0
e9bec628542ba1d87a3783faae9efbf7cce8611f 16-Jun-2017 Todd Kennedy <toddke@google.com> Merge "don't block uninstall of unknown packages" into oc-dev
am: 627fbf8157

Change-Id: I5cf548758617ae5c74f81a68b23893f584a46ee5
7076de2d5279f144cdb4ec8245df00122ea25e50 16-Jun-2017 Todd Kennedy <toddke@google.com> Merge "don't block uninstall of unknown packages" into oc-dev
am: 627fbf8157

Change-Id: I55a0b4906870f08de6b72ef601c151859fc0ccfb
627fbf8157469c29b90fe0160d64053e6776bd64 16-Jun-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "don't block uninstall of unknown packages" into oc-dev
be649a4ba1014a22ccb7d98319b26472b0e0076d 13-Jun-2017 Jeff Hao <jeffhao@google.com> When updating a split app, copy compiled files from base.apk only.

This fixes issues with some splits failing to be recompiled if they
haven't changed, but the dex files they depend on have.

The real fix will be for frameworks to generate the new expected
classpath and check in DexFile.getDexOptNeeded. Then we can undo
this change and copy over all the compiled split files again.

Bug: 62269291
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests

(cherry-picked from commit d1235f54d4943a0a3a920013a5875b5193bd0490)

Change-Id: I6e640a966ef3b43054d163326878adebe2329693
ackageInstallerSession.java
133c5da0d972ff8f1676890679f478aa30e08dfd 15-Jun-2017 Todd Kennedy <toddke@google.com> enable/disable dexopt for instant apps remotely

Change-Id: I997b8ae515f7bf2570edca4ed7ab4b46198148a5
Fixes: 62591398
Test: Manual; install instant app and see that it doesn't dexopt
Test: Manua; update gservices flag, install instant app and see that it does dexopt
ackageManagerService.java
a708300441729c9f55d53ee12bf81e3cf8245367 15-Jun-2017 Todd Kennedy <toddke@google.com> don't block uninstall of unknown packages

If a package can't be found because it's not installed or it's
been filtered due to lack of visibility, don't claim the uninstall
should be blocked.

Change-Id: I932b77cea5749e5964ca626558bef51cdfdfd17b
Fixes: 62450984
Test: Manual
ackageManagerService.java
d256065be715248412cb05c3da213d85af37b893 14-Jun-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "protect mIsolatedPackages access"
b0fea8a7d2e5ff7fc61378134d9282777a7aeaa9 14-Jun-2017 Todd Kennedy <toddke@google.com> protect mIsolatedPackages access

Change-Id: I125cd382315f88741c59e3c649830d43d72aa596
Fixes: 38341243
Test: manual
ackageManagerService.java
85b5ca67f1c0d65b98e566ebd8e582c27e682534 14-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Save overlay paths as user state" into oc-dev am: 508a5bade6 am: 80b761b6db
am: 7ad9b0bbd4

Change-Id: Iead9bfc153bfffd43d3d0f3cf68f066cedf4931c
7ad9b0bbd4a1e95ea91ea270882a4ff71325ae04 14-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Save overlay paths as user state" into oc-dev am: 508a5bade6
am: 80b761b6db

Change-Id: I0a2f3b0318b75bd08b8dfa1db1658930617333c1
9a1d5cf4a9ced50b5654d4529b5ca87e26962727 14-Jun-2017 Chad Brubaker <cbrubaker@google.com> Merge "Remove stopship workaround for instant app targetSdkVersion" into oc-dev am: 4a0ea3e88f am: 6d1b84bc3f
am: 8a691a3b2e

Change-Id: I03a5aa46d4ae74088d4ffe0eee32c239d044b628
80b761b6db5e70043aa4b09cba6761254d629a25 14-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Save overlay paths as user state" into oc-dev
am: 508a5bade6

Change-Id: Icba76fbeef9f4cd2a067fafd65c750f1f95a4ed0
b692f4a09585320fd0d65877ae888c03bfef0f23 14-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Save overlay paths as user state" into oc-dev
am: 508a5bade6

Change-Id: If46b58323883dcdeef72f0a394f79becca134c23
508a5bade66d5ecf7559cf6644c4ad7f29591f46 14-Jun-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Save overlay paths as user state" into oc-dev
bfd7cc4dbb4615b45321475e4bd14edc8e2b55b5 13-Jun-2017 Chad Brubaker <cbrubaker@google.com> Merge "Remove stopship workaround for instant app targetSdkVersion" into oc-dev
am: 4a0ea3e88f

Change-Id: Id7b7326f819c9e0389c3ad9db2863e72ec716f83
6d1b84bc3f44da21bb7a985257d6882db25b8e53 13-Jun-2017 Chad Brubaker <cbrubaker@google.com> Merge "Remove stopship workaround for instant app targetSdkVersion" into oc-dev
am: 4a0ea3e88f

Change-Id: I5dcc03662ab5babbfc5559257b1ecdf9568c9d49
4a0ea3e88f72835508245fa10297242b0e2614cd 13-Jun-2017 Chad Brubaker <cbrubaker@google.com> Merge "Remove stopship workaround for instant app targetSdkVersion" into oc-dev
b274947dfb03f04872546774af0f8770ade5bed7 13-Jun-2017 Todd Kennedy <toddke@google.com> Save overlay paths as user state

Instead of maintaining a separate structure just for overlay
paths, store them as user state in the package setting. Also
centralize updating the overlay paths to avoid issues with
inconsistent updates.

Fixes: 36561125
Test: Manual
Change-Id: Iac1c987e8650074dbc564e332d5da1950fad6ac5
ackageManagerService.java
ackageSettingBase.java
ettings.java
d1235f54d4943a0a3a920013a5875b5193bd0490 13-Jun-2017 Jeff Hao <jeffhao@google.com> When updating a split app, copy compiled files from base.apk only.

This fixes issues with some splits failing to be recompiled if they
haven't changed, but the dex files they depend on have.

The real fix will be for frameworks to generate the new expected
classpath and check in DexFile.getDexOptNeeded. Then we can undo
this change and copy over all the compiled split files again.

Bug: 62269291
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests

Change-Id: Id8e6dc59b16d4f10a6c2d9d81027012204e0f26b
ackageInstallerSession.java
31a44d0423307fb1e6ff5342eb9851b6d5e2a6e0 13-Jun-2017 Narayan Kamath <narayan@google.com> Merge "Eagerly serialize historical sessions" into oc-dev am: c7ea7effde am: 17652d85ec
am: 6ca3567674

Change-Id: I12390e4bb27b5480cad7623db8ea09fa1ccc48e9
7ba9c4dc620d17a7581abd206a96dedef30cd7a7 13-Jun-2017 Narayan Kamath <narayan@google.com> Merge "Eagerly serialize historical sessions" into oc-dev
am: c7ea7effde

Change-Id: Ice68d0de34795a23d9d7364244d564bc48a7d436
17652d85ecbbbababa7bec457130024346ff4b18 13-Jun-2017 Narayan Kamath <narayan@google.com> Merge "Eagerly serialize historical sessions" into oc-dev
am: c7ea7effde

Change-Id: Iff55674bc989986e14d0bcea3c71bad5751d4dcb
c7ea7effde64c682ba8ddaca0fd9ac4354029e41 13-Jun-2017 Narayan Kamath <narayan@google.com> Merge "Eagerly serialize historical sessions" into oc-dev
a22a766ea3eb14466221ac5a29ac7c298446ca5e 12-Jun-2017 Narayan Kamath <narayan@google.com> Eagerly serialize historical sessions

mHistoricalSessions maintained a strong reference to a PackageInstallerSession,
which in turn kept references to Bitmaps and other heavy-weight objects around.

Since this field is primarily used for debugging, this change replaces it with
a String dump of the session in question. Each dump takes about 600bytes, which
is comparable to the sizes of the un-serialized raw objects.

Bug: 62485552
Test: Manual

Change-Id: I4949a64b538ab4a97384f4f8bc9a6ef155a4b128
ackageInstallerService.java
0a7098f5a95d537d78a69ce566445b3ebfc2d7ed 13-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Merge "Don't log all instant app resolutions" into oc-dev am: 3ef0b8260f am: 5ca9d413f8" into oc-dr1-dev-plus-aosp
am: 6c240e311b

Change-Id: If93120172fb811743d876984e2622d09e9c0e1a2
f734de79cca292ae148f7e3e6e903d35370670f3 13-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Don't log all instant app resolutions" into oc-dev
am: 3ef0b8260f

Change-Id: I4ef141816c67957b0302be814315e2e739406c31
da080b2bd5f3d6349f13f9d23ab7af6739c37c9a 13-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Don't log all instant app resolutions" into oc-dev am: 3ef0b8260f
am: 5ca9d413f8

Change-Id: I10e7c59edb955ba537a12bd52f7117b382d46d7f
dc292b6003c80aa954bd82ca06d1b4eec271144e 13-Jun-2017 Jeff Sharkey <jsharkey@google.com> Merge "Active camera apps can defy reserved cache space." into oc-dr1-dev am: f7dc56ecc9
am: de624f3fbb

Change-Id: I0a125a6c00220ba280dca4e0d8ece88202a68afe
5ca9d413f89fb8634c2ed6a68afa1427f1470767 12-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Don't log all instant app resolutions" into oc-dev
am: 3ef0b8260f

Change-Id: Ibcc839c12fd0c23da254992a7147abb1e08d17cc
35e46d297255363a20ccde62af3c58c4ce3c13c5 09-Jun-2017 Jeff Sharkey <jsharkey@android.com> Active camera apps can defy reserved cache space.

We normally prevent apps from allocating into the "reserved" cache
space, but this change makes an exception for an active camera app,
since the user is probably trying to capture an important memory.

This change only lets the active camera app clear up to half of the
reserved space, since we don't want to completely destroy the
experience of all other apps.

Test: manual app before/during/after active camera session
Bug: 38267830
Change-Id: Ie9e63884fb2638ca881e10b894629eea84601648
ackageManagerService.java
0468ee9e4d6927b1f3971a309645cc50bc037ccd 26-May-2017 Fyodor Kupolov <fkupolov@google.com> In the stopping/shutdown state return unlock state of the user key

UserManager.isUserUnlocked should return true when user is stopping,
but encryption key is unlocked. Otherwise it causes issues in
non-cryptoaware apps that can can run while user is in STATE_STOPPING

Test: create/start/remove managed profiles in a loop and verify there
are no app or system crashes
Bug: 38212686

Change-Id: I47aa520269aafe3d3c967b6841ff46e765c446bd
serManagerService.java
f4c38558497cb1a52debd4a6bead5dc868ee7e8a 12-Jun-2017 Todd Kennedy <toddke@google.com> Don't log all instant app resolutions

we only want to log the successes

Change-Id: I31c79a1c964088ee67fd7527ca7fea16b0d29830
Fixes: 36563095
Test: Manual; run and see that only the success events are in the eventlog
nstantAppResolver.java
c017d299ce5058b217611200e1389df7ae97edcf 09-Jun-2017 Jeff Sharkey <jsharkey@google.com> Merge "Omit icons from bulk SessionInfo calls." into oc-dr1-dev
da1247a0769b184938d0afe9ca3b69ecab14654f 08-Jun-2017 Jeff Sharkey <jsharkey@android.com> Omit icons from bulk SessionInfo calls.

Calls that return List<SessionInfo> can end up returning hundreds of
sessions, each of which include a "Bitmap appIcon" object. Since we
quickly smash the entire list through a ParceledListSlice, we risk
exhausting FDs for all the ashmem regions.

To mitigate this, we omit these icons from the bulk calls, and then
fetch individual icons on-demand when explicitly requested.

Test: create 2k sessions and verify system doesn't croak
Bug: 38021844
Change-Id: I932073defe5b9b34a636818a69009d49060215fb
ackageInstallerService.java
ackageInstallerSession.java
66c2b228277a2e45bd276abc0c48fbeb4854f312 08-Jun-2017 Chad Brubaker <cbrubaker@google.com> Remove stopship workaround for instant app targetSdkVersion

Instant Apps will need to target O and the v2 security sandbox. Replace
the hack that silently upgrades them with an error.
Test: cts-tradefed run commandAndExit cts-dev -m
CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Fixes: 62444631

Change-Id: If28602924f38c78c06a23efb7e28c8f17528c4cf
ackageManagerService.java
23e5a1ee6527f7d2728b02583263266d855de5ae 08-Jun-2017 Todd Kennedy <toddke@google.com> Merge changes Iea24e5a1,If71385bc into oc-dev
am: 3834421c96

Change-Id: I691d03a8396d26193622f171f70f82d7aa91cea2
de066fd249d75fc693724c7e238017248924dccd 08-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Passing callingUid to internal methods" into oc-dev
am: dacdf2e978

Change-Id: Ie6e85346f63f4b06e693e6a6ac0c73b2ec3b9639
4d2a9a9f5077a5f4d336d69afcb557225fcb64e6 08-Jun-2017 Todd Kennedy <toddke@google.com> Merge changes Iea24e5a1,If71385bc into oc-dev
am: 3834421c96

Change-Id: I6ed4a41dbd9af3a97b774e7d2854fea1c66cc582
3834421c96ec503eff36e3eedceb7a06558a2a40 08-Jun-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes Iea24e5a1,If71385bc into oc-dev

* changes:
expand who can uninstall an instant app
Final changes to protect the API surface
ddb322a0005548baf998bd4be90ec492ca7dd894 08-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Passing callingUid to internal methods" into oc-dev
am: dacdf2e978

Change-Id: I11bcd48eb91c1f877a27f1cb06d6269aef76d3d2
dacdf2e978e4e293f381952b7d96969c86e571aa 08-Jun-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Passing callingUid to internal methods" into oc-dev
18211fd8f6ff4a70a4b8b16fab642783d536102b 06-Jun-2017 Todd Kennedy <toddke@google.com> Passing callingUid to internal methods

Sometimes callers want to clear the calling identity [to avoid permission
calls]. In this case, allow passing the original calling identity to
internal methods.

Test: Manual; create profile account and observe launcher still works cross profile
Test: bit FrameworksServicesTests:com.android.server.pm.ShortcutManagerTest{1..10}
Change-Id: I73f8ad4b2dc1895227c3fcb14f3f1f18f600562f
Fixes: 38349978
auncherAppsService.java
ackageManagerService.java
96a7326d90ff083c768f2ca7334f6ece9031561b 07-Jun-2017 Todd Kennedy <toddke@google.com> expand who can uninstall an instant app

More than just those with the ACCESS_INSTANT_APP
permission should be able to uninstall instant apps.
Any uid that can see instant apps [that includes
the shell and some others] should be able to
uninstall them.

Change-Id: Iea24e5a1cdb369bdf29e7cf5db7977db63faedfc
Fixes: 62406346
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
ackageManagerService.java
4e4769c12051daaef0092426c81e8b7c1e594b78 02-Jun-2017 Todd Kennedy <toddke@google.com> Final changes to protect the API surface

This is it. The last set of changes to protect instant apps
from full apps.

Bug: 35871369
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Test: Manual; install instant app and ensure it runs
Change-Id: If71385bcc9a5637590fbd99b0ffcd5ed8809509c
ackageManagerService.java
38e49013e0d9434f0671980e9327b34ac5dbe1fc 07-Jun-2017 Android Build Merger (Role) <android-build-merger@google.com> Merge "Merge "Handle renamed packages during default grants" into oc-dev am: bfc083c3a0 am: 7e05bb7793"
2317bfc643a76ac9209fc819893bfd917d075c45 07-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Handle renamed packages during default grants" into oc-dev am: bfc083c3a0
am: 7e05bb7793

Change-Id: Ib4e3b2799c2a104fd203b6e64e86d6181567b177
4cdd6209ee44a2d4c42e92d65339b7940a1d934e 07-Jun-2017 Christine Franks <christyfranks@google.com> Merge "Add TRON counter for demo user creation"
7e05bb7793d496ef7623b5c87c0b635fe3d19445 07-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Handle renamed packages during default grants" into oc-dev
am: bfc083c3a0

Change-Id: I068bb7548d1c972c3824185e5ab933a7b48c387b
bfc083c3a0235db80723d25efc825992747ce9e0 07-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Handle renamed packages during default grants" into oc-dev
7e79d354a1f2426ede5bd08384c0dbda665e0cac 06-Jun-2017 Todd Kennedy <toddke@google.com> Handle renamed packages during default grants

If a device has a privileged app on the system image which was
updated and a future OTA renames the app package (supported only for
privileged apps) we end up with a disabled system package setting
with no package information. Since we are not doing a null check
of the package we get from the disabled package settings during
default grants we crash leaving the system in a bad state.

Test: Manual
Change-Id: Id7255c92a4a52e368266739cd331977256eee2d3
Fixes: 62376260
efaultPermissionGrantPolicy.java
f5eef31de51daec220e736b87d123ae5b268bfba 06-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Don't verify instant apps" into oc-dev am: 9bac79a540
am: 27eb2e2b5b

Change-Id: I65b0a71e71620ec280aba8ee53f54c99d2a56352
27eb2e2b5b815d6a79b0f6d176af10f73c6e74ca 06-Jun-2017 Todd Kennedy <toddke@google.com> Merge "Don't verify instant apps" into oc-dev
am: 9bac79a540

Change-Id: I63537d6e6048152f93b5d314250334bcb1e75520
88220560a49b5f3504576f913ef66703b5855869 24-May-2017 Christine Franks <christyfranks@google.com> Add TRON counter for demo user creation

Differentiate count of demo users created versus regular users.

Bug: 38512629
Test: create demo user, and no crash.
Change-Id: I1e731206c2a4ee01ab084d0bf330a04d5ea4c605
serManagerService.java
a3112ceedc146005779dba2825af5484d55c8827 05-Jun-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add dumpsys option to print last restore status"
944e6965f73065bc40d38dc4b6309f6d5b10e33b 02-Jun-2017 Todd Kennedy <toddke@google.com> Don't verify instant apps

Change-Id: I07bc45bc82d1cbd2012c4605d5ca19f2ef36d615
Fixes: 62202471
Test: Manual; install instant app, see verification is disabled
Test: Manual; install full app, see verification is enabled
ackageManagerService.java
8e2cc10a893980ae1a64977392cec24372a780eb 01-Jun-2017 Todd Kennedy <toddke@google.com> Protect instant apps from full apps

Bug: 35871369
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Test: Manual; install instant app and ensure it runs
Change-Id: I1835fe58256377f901db38fcc3e4c98886d799ac
Merged-In: I1835fe58256377f901db38fcc3e4c98886d799ac
ackageManagerService.java
09c0ef3cf95118c31e3d07b9037da8ea0d2e066e 01-Jun-2017 Todd Kennedy <toddke@google.com> Protect instant apps from full apps

Bug: 35871369
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Test: Manual; install instant app and ensure it runs
Change-Id: I1835fe58256377f901db38fcc3e4c98886d799ac
(cherry picked from commit befd4bc33cb7af7b5e36100c3b5421f8d8515f81)
ackageManagerService.java
befd4bc33cb7af7b5e36100c3b5421f8d8515f81 01-Jun-2017 Todd Kennedy <toddke@google.com> Protect instant apps from full apps

Bug: 35871369
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Test: Manual; install instant app and ensure it runs
Change-Id: I1835fe58256377f901db38fcc3e4c98886d799ac
ackageManagerService.java
50a320e51ed280c148dc79f8745b48e79998d6c6 31-May-2017 Makoto Onuki <omakoto@google.com> Add dumpsys option to print last restore status

Now "dumpsys shortcut" will *not* dump UID states. "dumpsys shortcut -u" will
do so.

"dumpsys shortcut -f" now dumps dump taken after the last restore.

Bug: 62108985
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutManagerTestCases
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutHostTestCases
Change-Id: I5e8451b576081328242b485850f5311258fe7779
hortcutDumpFiles.java
hortcutPackage.java
hortcutService.java
hortcutUser.java
b562e539504c3eb72d1200a0e3dc67e9b2f0409b 31-May-2017 Jeff Sharkey <jsharkey@android.com> Merge commit '06951ac74d9e74b29037b0a5d8e3b9ad85983b5b' into mergeit
am: 3c3d9d8158

Change-Id: Ia4c7f1792c9b6e8e72b4ffe742249b02b82d0817
3c3d9d815856e8e22961c0092d34ff7b9c5b6e2c 31-May-2017 Jeff Sharkey <jsharkey@android.com> Merge commit '06951ac74d9e74b29037b0a5d8e3b9ad85983b5b' into mergeit

Change-Id: Ifa69c7bb53de94312e2b32607fa098c194a4c72c
06951ac74d9e74b29037b0a5d8e3b9ad85983b5b 31-May-2017 Jeff Sharkey <jsharkey@google.com> Merge "Consistent "low storage" behavior." into oc-dev
ddff807b762a8a455287abc97aea8f97b98fb104 26-May-2017 Jeff Sharkey <jsharkey@android.com> Consistent "low storage" behavior.

When answering the question "how much space is free", use the same
logic for Settings UI and StorageManager.getAllocatableBytes(). That
is, the reported free space is usable bytes plus any cached data the
system is willing to delete automatically.

This does *not* include any reserved cache space, since we don't want
abusive apps to penalize other well-behaved apps that are storing
their data in cache locations. Callers freeing cached data need to
now explicitly request defiance of the reserved cache space. (Most
callers are already doing this by using FLAG_ALLOCATE_AGGRESSIVE.)

Rewrite the core logic of DeviceStorageMonitorService to understand
this new "reserved" cache space, and to be easier to understand. It
also now handles cached data on adopted storage volumes, which had
been ignored until now. Also fix bug where we had skipped "low"
broadcasts when the device skipped directly from/to "full" state.

Bug: 38008706
Test: cts-tradefed run commandAndExit cts-dev -m CtsJobSchedulerTestCases -t android.jobscheduler.cts.StorageConstraintTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.StorageHostTest
Change-Id: Icbdcf3b52775f7ada1ceaeff2f96094c8d8052f9
nstaller.java
ackageManagerService.java
5d1ea59573251be8fb0312d12b54245b875f6ea7 31-May-2017 Svet Ganov <svetoslavganov@google.com> Prune unused static libs and instant apps if space needed am: f36d53cbfc
am: a8505b5448

Change-Id: I27762e5bf5141f7cc14a43163e67fcef13785419
a8505b54485cb8533192296eb57d40b64f031c14 31-May-2017 Svet Ganov <svetoslavganov@google.com> Prune unused static libs and instant apps if space needed
am: f36d53cbfc

Change-Id: I0fdca2a5069b6f3572a9cb5fe0d3ead0442b7b46
f36d53cbfc34dcadfe156f3037bf40b4908142a8 24-May-2017 Svet Ganov <svetoslavganov@google.com> Prune unused static libs and instant apps if space needed

We are caching unused static shared libs and instant apps
(installed and uninstalled) opportunistically. If space is
needed we delete these to free up space.

Test: manual

bug:62045000

Change-Id: Id992dee5c7c6e36b8e8b81050602dbc4eeafb0f9
nstantAppRegistry.java
ackageManagerService.java
f70625981373a1a3bb9f406c1a3d7fe81d988f38 31-May-2017 Svet Ganov <svetoslavganov@google.com> Merge "Compare against correct user id to determine static lib clients" into oc-dev am: 13eef357d6
am: 962b4ad29c

Change-Id: I101d2b0876445f09f881e90940401ca3847f2475
962b4ad29c09ee574d174d56291ee419e3d6ef0b 31-May-2017 Svet Ganov <svetoslavganov@google.com> Merge "Compare against correct user id to determine static lib clients" into oc-dev
am: 13eef357d6

Change-Id: I94d6ec64d861a687d4bda6ef900d092c3401bc03
832267afca9f3cf7ed1682e6a33fbd96f4879d12 31-May-2017 Todd Kennedy <toddke@google.com> resolve merge conflicts of fc5c78e0ef79 to oc-dev-plus-aosp

Test: I solemnly swear I tested this conflict resolution.
Change-Id: Ic9e83a568e992ea1444bb321ca9dda2f7002e4aa
5ded03bd46db1f223985f2624c68fae037f6adb1 24-May-2017 Svet Ganov <svetoslavganov@google.com> Compare against correct user id to determine static lib clients

Test: manual, static shared lib CTS tests pass

bug:36632264

Change-Id: I58b2787ff0b95c89f9e9bb9a005b39e3505aefcb
ackageManagerService.java
fc5c78e0ef79d28ee9f0c543be6187ba13f70901 31-May-2017 insight.lee <insight.lee@lge.com> Merge "Allow ManagedProvisioning to silently uninstall apps" am: cfc68b6661
am: 6683494c94

Change-Id: I9f0092630e3b89f708b3f157e1c36052297458db
cfc68b66618076e3eaf49f52d134846a8de22674 31-May-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "Allow ManagedProvisioning to silently uninstall apps"
879f879d6bb32d2b24a06e6e9b4cbd0d0482c0f4 08-May-2017 insight.lee <insight.lee@lge.com> Allow ManagedProvisioning to silently uninstall apps

1. During device owner provisioning, ManagedProvisioning uninstalls
non-required apps. Apps to remove are all system apps in the reference
device. On the other hand, OEM devices have several non system apps,
so ManagedProvisioning can not uninstall them and can not complete
device owner provisioning permarnently.

2. This commit allows ManagedProvisioning having
MANAGE_PROFILE_AND_DEVICE_OWNERS permission to uninstall non-required
apps silently.

Bug: 37681141
Test: manual
Signed-off-by : Sungmin Lee <insight.lee@lge.com>
Merged-In: I201b070f4bcf453a2ffb391600853c7e595aec5d
Change-Id: I201b070f4bcf453a2ffb391600853c7e595aec5d
ackageManagerService.java
a50630dd6855149883175e6bb2e62ea20d8ed6e4 27-May-2017 Sudheer Shanka <sudheersai@google.com> Merge "Allow ManagedProvisioning to silently uninstall apps"
4414db2da2ae6950a7506d9019b7eb9d17adf823 26-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "resolve merge conflicts of 255b69aca02f to oc-dev-plus-aosp" into oc-dev-plus-aosp
am: b118505ef0

Change-Id: I6e9963188b487de4e76dc0d17d56b53050fd3745
7e1a27370842bed8940765d9f3143b3be153ef14 26-May-2017 Nicolas Geoffray <ngeoffray@google.com> resolve merge conflicts of 255b69aca02f to oc-dev-plus-aosp

Test: I solemnly swear I tested this conflict resolution.
Change-Id: I9caf7542f11b0b322da063a5a08140384eba0ce0
255b69aca02f2344474d51b1cb3d2c63a25bdc86 26-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Pass bootComplete to dexopt." am: 18c3201986
am: 1e35b7b5bc

Change-Id: Id4633d3729c8532d901b33bb6720d8f34df1e6e9
2bde7ae481046d3387421a13cd0b797454930fb4 26-May-2017 Chad Brubaker <cbrubaker@google.com> Merge "Handle install time ephemeral permissions" into oc-dev am: dc89202d1a
am: 32b9061d2c

Change-Id: Ie6072d3704e9bdecbc4b55c93e3aca129c31e620
dc89202d1a7c6062c1a1e6a06f9878c534ab04cb 26-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Handle install time ephemeral permissions" into oc-dev
0d32dbe5b70039b12cdda666811338f87ec616a3 25-May-2017 Sudheer Shanka <sudheersai@google.com> Merge "[PackageManagerService]:Fix system app can't uninstall apps silently" into oc-dev am: 975ee1f25a
am: e406d52628

Change-Id: I090dfd872aa04c2c1af8e30c5faf834db05ba61e
975ee1f25a58e1f5f636248c0b51851767ccc14b 25-May-2017 Sudheer Shanka <sudheersai@google.com> Merge "[PackageManagerService]:Fix system app can't uninstall apps silently" into oc-dev
6c55758c0657492dc2f714ff0d8ac2a3ad461eec 25-May-2017 Tony Mak <tonymak@google.com> Merge "Fix permission is not granted to work profile system app by default" into oc-dev am: 0995b177ab
am: cb545cb5e2

Change-Id: I6264cd7ef5a570ef40c53b74ee6dbc97ad3215c1
0995b177ab0dc35eae1f54e2d73e45e2d0ce7813 25-May-2017 Tony Mak <tonymak@google.com> Merge "Fix permission is not granted to work profile system app by default" into oc-dev
3b4359a06c482095338080fa908a67441ad23a2b 25-May-2017 Nicolas Geoffray <ngeoffray@google.com> Pass bootComplete to dexopt.

bug: 37165062
Test: After OTA, check bootComplete=false on package updates
Change-Id: I6fc00216020bb16d8ed4f6e839b5e1df0e942700
ackgroundDexOptService.java
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerShellCommand.java
e3b676763f0889c3f3202ca7dab94f927a24ad1f 08-May-2017 insight.lee <insight.lee@lge.com> Allow ManagedProvisioning to silently uninstall apps

1. During device owner provisioning, ManagedProvisioning uninstalls
non-required apps. Apps to remove are all system apps in the reference
device. On the other hand, OEM devices have several non system apps,
so ManagedProvisioning can not uninstall them and can not complete
device owner provisioning permarnently.

2. This commit allows ManagedProvisioning having
MANAGE_PROFILE_AND_DEVICE_OWNERS permission to uninstall non-required
apps silently.

Bug: 37681141

Test: manual

Signed-off-by : Sungmin Lee <insight.lee@lge.com>

Change-Id: I201b070f4bcf453a2ffb391600853c7e595aec5d
ackageManagerService.java
ac2b5fb838ce7198def26085b5050e15d19495a4 24-May-2017 Chad Brubaker <cbrubaker@google.com> Handle install time ephemeral permissions

Normal install time permissions can still be denied to apps that are
running as Instant Apps, properly report such permissions as not
granted.

This fix isn't the perfect fix where PermissionState handles install
time permissions and Instant Apps but that fix is more invasive and
involves a lot of code change.

Bug: 37871983
Test: cts-tradefed run commandAndExit cts-dev -m
CtsAppSecurityHostTestCases -t
android.appsecurity.cts.EphemeralTest#testInstallPermissionNotGranted

Change-Id: Ie47fb92953bc5f2ff3a58a6420b1cb524cf1ed9e
ackageManagerService.java
c50c89a5d89b35c0a0c69c51ea73d2eea9dcb9af 24-May-2017 Todd Kennedy <toddke@google.com> Merge "System installed launcher can see instant apps" into oc-dev am: 1de10d6602
am: 4cdc26746e

Change-Id: I2a66bfa001ea03205535bc0337f720d869fa9132
1de10d6602df4ab2a7769b69a57e472920ba7fee 24-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "System installed launcher can see instant apps" into oc-dev
3329b126fc94ecdb42d7a3412b367386daaf37af 24-May-2017 Todd Kennedy <toddke@google.com> Merge "Filter instant <--> full app" into oc-dev am: 4d3d035255
am: 74877d44b6

Change-Id: I40bbc047442e15ea9417588d75ed4f94e9e38ac4
4d3d0352557e703cf0603131f1abd355e377e01e 24-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Filter instant <--> full app" into oc-dev
d8e7206d942ada63cd3c1bb5dff2def35033ad91 06-Apr-2017 luozhanwei <luozhanwei@xiaomi.com> [PackageManagerService]:Fix system app can't uninstall apps silently

System app in user space except Owner user can't uninstall apps silently

Bug: 62057943
Bug: 37324004
Test: manual

Change-Id: Ia168a5d757b4d8ae10fe9a82fc786626a3b5b2f7
Signed-off-by: luozhanwei <luozhanwei@xiaomi.com>
ackageManagerService.java
193311a07c14162726126d2b7e09c46f26804839 24-May-2017 Tony Mak <tonymak@google.com> Fix permission is not granted to work profile system app by default

After creating user, we will grant some runtime permissions to a set of
apps in that user.
However, DefaultPermissionGrantPolicy failed to look up some apps in
work profile cases as most apps are disabled by default.
Using MATCH_UNINSTALLED_PACKAGES flag to resolve the intent can fix
the issue.


Test: create work profile, enable calendar in work profile, observe
that permission is granted.

Change-Id: Icee02e7257a77cb7e2d15b848628f02e7bca0b9c
Fix: 62051433
efaultPermissionGrantPolicy.java
3051caac52729c8c059eb538805f4d274a9945a5 24-May-2017 Todd Kennedy <toddke@google.com> System installed launcher can see instant apps

Change-Id: I97f791b61f9b4f7ed33305345bf3d92394b40ae4
Fixes: 38202759
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Test: Manual. Create sample app that replaces the launcher to test ability to see ephemeral apps.
ackageManagerService.java
d7a2c1c23bdd6547aa864e325792cd89ffde0c5e 23-May-2017 Todd Kennedy <toddke@google.com> Filter instant <--> full app

Last in the series for protecting full apps from instant apps. Still
need to make another pass at the opposite direction.

Bug: 35871369
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Test: Manual; install instant app and ensure it runs
Change-Id: I3734cb154e7b952f3a9cf7c5415dffcd4de02aba
ackageManagerService.java
55f79db7eaacf4ac5e59d7379494f68ab2b71df4 24-May-2017 Calin Juravle <calin@google.com> Merge "Re-pin camera odex/vdex files only if they have changed" into oc-dev am: 9bb5e16657
am: 9406962b55

Change-Id: I17b7fbf9e980241f8bb28997cc7d43687dc99d2b
9bb5e1665748007df1393f5c9274b648163a6da9 24-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Re-pin camera odex/vdex files only if they have changed" into oc-dev
31ce3a8a56e78ecc17d9befbc64a1e529b6b78e9 23-May-2017 Calin Juravle <calin@google.com> Re-pin camera odex/vdex files only if they have changed

Test: Camera is re-pinned after
adb shell cmd package compile -f -m extract
com.google.android.GoogleCamera
adb shell cmd package bg-dexopt-job

Bug: 33168521
Change-Id: I5c5e76d1e40b6d433c9a0beba463c86f79ad437e
ackgroundDexOptService.java
ackageManagerService.java
80bf2641c4450eff7cc08aad1467efc401d62d43 23-May-2017 Todd Kennedy <toddke@google.com> Merge "Filter package manager calls" into oc-dev am: 07c832f405
am: e9f414237a

Change-Id: Idf607b6f405a5801fb3b9c87380708318b823cb9
07c832f40537e73fc468aae9b04f867d92c810e2 23-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Filter package manager calls" into oc-dev
570d041555f46a7a2af4712e8a9c9039d16f88cc 23-May-2017 Carmen Jackson <carmenjackson@google.com> Merge "Re-run pinner service on camera app update and dex optimization." into oc-dev am: a7e45e364c
am: 45956cfa46

Change-Id: I7d27e65dd6f5e0944bb8a0d4d06308ed821b66ae
a7e45e364ca42b4a759a4ef86fd8d7dc7230224a 23-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Re-run pinner service on camera app update and dex optimization." into oc-dev
556f3adf7ddedb9d1e3194162b33bc15230e0b3a 23-May-2017 Todd Kennedy <toddke@google.com> Merge "Blanket deny instant apps from some methods" into oc-dev am: dc28b0fdcb
am: d86e938cbf

Change-Id: I376bd49c0b4affb514a613f2382b12c204981997
dc28b0fdcbe4b52cfa16f0a27bcf2d7f81284469 23-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Blanket deny instant apps from some methods" into oc-dev
f107a23ff165bbb7f0ae145f9ac85ddca8b43ed7 16-May-2017 Carmen Jackson <carmenjackson@google.com> Re-run pinner service on camera app update and dex optimization.

When the camera app updates or the dex files are optimized, the files
that have been pinned by the pinner service fall out of date. The next
time they're used, they will be paged in like normal. This change
un-pins and re-pins the Camera app when the user's camera app updates,
as well as when background dex optimization finishes.

Bug: 33168521
Test: Manual. Here's a logcat of PinnerService activity while I ran the
following commands:

$ flashall -w
$ adb install -r -d --force-sdk [new camera app].apk
Success
$ adb root
restarting adbd as root
$ adb shell cmd package bg-dexopt-job

SystemServer: PinnerService
SystemServiceManager: Starting com.android.server.PinnerService
PinnerService: Starting PinnerService
SystemServerTiming: PinnerService took to complete: 2ms
PinnerService: Pinned file = /system/framework/arm64/boot-framework.oat
PinnerService: Pinned file = /system/framework/arm64/boot-framework.vdex
PinnerService: Pinned file = /system/framework/oat/arm64/services.odex
PinnerService: Pinned file = /system/framework/oat/arm64/services.vdex
PinnerService: Pinned file = /system/framework/arm64/boot.oat
PinnerService: Pinned file = /system/framework/arm64/boot.vdex
PinnerService: Pinned file =
/system/framework/arm64/boot-core-libart.oat
PinnerService: Pinned file =
/system/framework/arm64/boot-core-libart.vdex
PinnerService: Pinned /system/app/GoogleCamera/GoogleCamera.apk
PinnerService: Pinned
/data/dalvik-cache/arm64/system@app@GoogleCamera@GoogleCamera.apk@classes.dex
PinnerService: Updating pinned files.
PinnerService: Unpinned file /system/app/GoogleCamera/GoogleCamera.apk
PinnerService: Unpinned file
/data/dalvik-cache/arm64/system@app@GoogleCamera@GoogleCamera.apk@classes.dex
PinnerService: Pinned
/data/app/com.google.android.GoogleCamera-vVji3RQcPHS1Lzqh1WjY1g==/base.apk
PinnerService: Pinned
/data/app/com.google.android.GoogleCamera-vVji3RQcPHS1Lzqh1WjY1g==/oat/arm64/base.odex
PinnerService: Updating pinned files.
PinnerService: Unpinned file
/data/app/com.google.android.GoogleCamera-vVji3RQcPHS1Lzqh1WjY1g==/base.apk
PinnerService: Unpinned file
/data/app/com.google.android.GoogleCamera-vVji3RQcPHS1Lzqh1WjY1g==/oat/arm64/base.odex
PinnerService: Pinned
/data/app/com.google.android.GoogleCamera-vVji3RQcPHS1Lzqh1WjY1g==/base.apk
PinnerService: Pinned
/data/app/com.google.android.GoogleCamera-vVji3RQcPHS1Lzqh1WjY1g==/oat/arm64/base.odex

Change-Id: I10d72d6a3d1717773324913362a638f199d49bc9
ackgroundDexOptService.java
7210f130dbd37dc42f65ade897d6e7e5a3b445c3 22-May-2017 Todd Kennedy <toddke@google.com> Filter package manager calls

These are some of the nuanced package manager calls. These aren't
outright allowed or denied. Instead, their return value depends upon
who's calling it [eg an instant app or a full app] and the type of
application the method operates on.

Bug: 35871369
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Test: Manual; install instant app and ensure it runs
Change-Id: I88b37e2c7928d5b0a7428cef53112dc193053266
ackageManagerService.java
13c0104619acafbb3246362e4018256303ddd87a 22-May-2017 Todd Kennedy <toddke@google.com> fix import order

Test: manual
Change-Id: Idb5793bd322b27fdd5d60f5c8a552a38d3eedfa5
ackageManagerService.java
9403fa983207017339a814e7c32fc024e2cb4f41 19-May-2017 Todd Kennedy <toddke@google.com> Blanket deny instant apps from some methods

There are many methods instant apps are not allowed to call. Throw
a SecurityException if they try to call them.

Bug: 35871369
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Test: Manual; install instant app and ensure it runs
Change-Id: Iffdc6cd4e298fc4e1070e68abf7065369d0bed25
ackageManagerService.java
b2d50b4f9260bac241d59b993069604571291610 19-May-2017 Sudheer Shanka <sudheersai@google.com> Merge "Update PackageSettingBase.usesStaticLibraries correctly." into oc-dev am: f3bb49b02a
am: 9597cec9be

Change-Id: Ia0d0e00e65e311a755c1db4351c15864e4d50ba6
f3bb49b02ae80a612dd7179dd15ba2c3986db912 19-May-2017 Sudheer Shanka <sudheersai@google.com> Merge "Update PackageSettingBase.usesStaticLibraries correctly." into oc-dev
b7a8702e91361a5e1ad55119c1dd29d30186fb92 18-May-2017 Todd Kennedy <toddke@google.com> Merge "don't dex when installing an instant app" into oc-dev am: d5f3bd46a1
am: ec7cd6dbbe

Change-Id: I70a7876ea219ab9e8503be9dcb4ff7349a3941eb
6312b3c4f555f08a14c8aa1878dfec0ef50832e6 18-May-2017 Todd Kennedy <toddke@google.com> Merge "Filter package related info" into oc-dev am: 72b7b1f001
am: 36482247ea

Change-Id: I8b5a7d1c08e7d6f822347aaed2b15e4e270d0a49
d5f3bd46a1a9dd4b60a460ceffb40bc3bf8e0fb7 18-May-2017 Todd Kennedy <toddke@google.com> Merge "don't dex when installing an instant app" into oc-dev
72b7b1f00162e455fab471b451fe0b3fe33cb1db 18-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Filter package related info" into oc-dev
ed8c65aa4ebc41929e9561892bd7c7928c2ebc83 18-May-2017 Todd Kennedy <toddke@google.com> Merge "Add action to launch intent" into oc-dev am: ed57e46089
am: 61bfa28b97

Change-Id: I5ca06a8da6aa5ded02670736dacdb1e4c39a6169
ed57e46089ae8aeeabfefbf7390df1bd16fd50d1 18-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add action to launch intent" into oc-dev
9ba6afa31eaf84d43e3bdd6449ded56e7856e811 18-May-2017 Todd Kennedy <toddke@google.com> don't dex when installing an instant app

Bug: 38259387
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Test: install an instant app, see that it doesn't dex
Test: install a full app, see that it does dex
Change-Id: Id7dc749954d0be24bbd80da2ef0f43e39f77993e
ackageManagerService.java
dfc27c61f46af5e28b4c72c51029c78869134151 18-May-2017 Todd Kennedy <toddke@google.com> Add action to launch intent

Change-Id: Ief861ed349b99619d0458eb7ce1b9edd6679a860
Fixes: 38350785
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
nstantAppResolver.java
e459819383fc733cb1c83bd1f705fbc1b7c9b293 17-May-2017 Michael Wachenschwanz <mwachens@google.com> Merge "Merge "Purge Nonexistent User Jobs on Boot" into oc-dev am: a61f09f657" into oc-dev-plus-aosp
am: 414acfc033

Change-Id: I9eabccc26062dcbd6dccc56f031b02086da2bcf6
a61f09f6572e226de268807c32b228ec9ff0639e 17-May-2017 Michael Wachenschwanz <mwachens@google.com> Merge "Purge Nonexistent User Jobs on Boot" into oc-dev
610f097364f384f22006ef8504ca2adeada27352 17-May-2017 Andreas Gampe <agampe@google.com> Merge "PackageManager: Change post-install GC request" into oc-dev am: 89b5189516
am: 0ce0752eac

Change-Id: I5450d0f44c67201e9917f69ec430421d5643f765
89b5189516d1889b34e460c8fd21ad125fa4fa0b 17-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "PackageManager: Change post-install GC request" into oc-dev
3f2b6552ec00a69d5a818e3eadc985c45a416c6b 15-May-2017 Michael Wachenschwanz <mwachens@google.com> Purge Nonexistent User Jobs on Boot

In the case that a user has been removed but their jobs still exist on
disk, the JobSchedulerService will remove all jobs not associated with
current users on boot.
Exposed UserManagerService#getUserIds() via UserManagerInternal for
quick user id retrieval.

Fixes: 38261977
Test: manual

Change-Id: Id4b3c0a4142b4818fcd875eef18ea03f3c45ca40
Signed-off-by: Michael Wachenschwanz <mwachens@google.com>
serManagerService.java
e6393c95716e5ad9bfb52931eb6e4f23f7640f01 17-May-2017 Todd Kennedy <toddke@google.com> Filter package related info

This is one of many CLs to go through the PackageManager API surface
and filter access depending upon the requested information and the caller.
In this change, we filter ActivityInfo, ApplicationInfo and PackageInfo.

Bug: 35871369
Test: bit FrameworksCoreTests:android.content.pm.PackageManagerTests
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Change-Id: Iaefd73f912ab1c7e1844e72625388455f783a362
phemeralResolverConnection.java
ackageManagerService.java
b6f06813b1eccbd96a6a71de599a36a3a3e08955 16-May-2017 Sudheer Shanka <sudheersai@google.com> Update PackageSettingBase.usesStaticLibraries correctly.

Change-Id: Ie18f3a621a2a24ee385593454f45d4713ca8bd1f
Fixes: 36844859
Test: manual &&
android.os.cts.StaticSharedLibsHostTests - Same pass/failures before and after this change &&
runtest -c com.android.server.pm.PackageManagerSettingsTests#testInsertPackageSetting \
frameworks-services
ettings.java
98c1555da3f3f6904db01fb245500090811cdaef 17-May-2017 Makoto Onuki <omakoto@google.com> Merge "Restrict access to instant app data in usage stats" into oc-dev am: f38a1d3d2a
am: fd1dd05815

Change-Id: I9e06dfc17f934210bcfddb44fc7be7056c9b054c
f38a1d3d2a82e20f60d7b9bcf2457d6e1edb7616 16-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Restrict access to instant app data in usage stats" into oc-dev
43cf41b3eeb52b3b0f048fd7a4aaad54bdb04f75 16-May-2017 Todd Kennedy <toddke@google.com> Merge "Always add the instant app installer" into oc-dev am: e943a3cbe7
am: 9abb2cb590

Change-Id: I1be04d7ec849205df78d2a50e33652f59d61ee5a
e943a3cbe7dd9d7f1ab977e64178730190b37755 16-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Always add the instant app installer" into oc-dev
ad623015a119efe9b63f594af9c4703f40a0c27b 15-May-2017 Makoto Onuki <omakoto@google.com> Restrict access to instant app data in usage stats

- Events are obfuscated based on whether the app was instant or not at
the time each event was logged.

- UsageStats are obfuscated based on whether each app is instant or
not at the moment.

Bug 38202133
Test: Manual test using UsageStatsTest and instant apps

Change-Id: I3c74309196b88d010d317cb0dd6749bf4624e876
ackageManagerService.java
22d8bb2ca310a929803be4c4ab99c44bc43d1a93 15-May-2017 Todd Kennedy <toddke@google.com> Always add the instant app installer

Even if we filter out an instant app because the caller doesn't
have access to it, always make sure to add the installer when
we have the possibility of an instant app.

NOTE: This does not have CTS tests since it's impossible to test
without involving the resolver. CTS tests will be added in MR1+
when we can make changes to the APIs and add the necessary methods
to mock out the resolver service.

Change-Id: I92c88eb04520c0c5e0c58db6d668ed0a0e552a35
Fixes: 38268052
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
ackageManagerService.java
47698882f90b762b1bc960b5f6757a120d41bb78 16-May-2017 Andreas Gampe <agampe@google.com> PackageManager: Change post-install GC request

Only run a blocking GC when updating. Otherwise, only request a
concurrent GC to clean up.

Bug: 38259387
Test: m
Test: Device boots
Test: Install works
Change-Id: Id1a0e956f26e166d927f833075bc4807f32b94f7
ackageManagerService.java
647dc845609a45aa39634e8c4e9c90797994b2b5 16-May-2017 Svet Ganov <svetoslavganov@google.com> Merge "Support recursive static shared lib dependency" into oc-dev am: e04765998e
am: 8adfc2cac7

Change-Id: Ib07a986a02372d40ce93b9beb8e1ac74f0d3561b
e04765998e32dc3e098becfdfa3d19045926b541 16-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Support recursive static shared lib dependency" into oc-dev
58c99f02077d8279e88a89d8e6fe413af5692f87 15-May-2017 Svet Ganov <svetoslavganov@google.com> Support recursive static shared lib dependency

Test: Updated the static shared lib CTS tests to verify that
All static shared lib CTS tests pass

bug:35359862

Change-Id: Id4a0dabbc9d8e98962e92b6f537f6ffffa63b585
ackageManagerService.java
2ebfd1106c057cfed573e99afe9b26644105e6f1 15-May-2017 Hyunyoung Song <hyunyoungs@google.com> Merge "Fix Shortcut crash due to invalid Icon type (e.g., all adaptive bitmap shortcuts)" into oc-dev am: 10abacf3f3
am: d3790e9dfa

Change-Id: Ic11d92e3b653ab712c308a540908b257d5ffe45d
10abacf3f356ad99a0457957c58a79a4af04f08f 15-May-2017 Hyunyoung Song <hyunyoungs@google.com> Merge "Fix Shortcut crash due to invalid Icon type (e.g., all adaptive bitmap shortcuts)" into oc-dev
8947f59f964fba9f06a34297ba4a8f63ac2d3e4a 15-May-2017 Hyunyoung Song <hyunyoungs@google.com> Fix Shortcut crash due to invalid Icon type (e.g., all adaptive bitmap shortcuts)

b/38304824
Test: cts tests in ag/2262246 and also full build and tried the system image.

Change-Id: I8f021aa2bb1a0e99597bc00064ab1e9d85569bcb
hortcutService.java
6f974ad7f5c772ffec62e669c373cc8cc936a1dc 15-May-2017 Svet Ganov <svetoslavganov@google.com> Merge "Hadler USER_ALL when uninstalling static shared lib" into oc-dev am: 4c25935bfe
am: dcb1fc7d1c

Change-Id: I00d4a7f30763093bf5edb69bdbf5cebe57f5a2c6
4c25935bfea6b5df169c926b93185c042422f0ec 15-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Hadler USER_ALL when uninstalling static shared lib" into oc-dev
d37f079a7d181ddac8a1449ea2e758f98b65c81d 15-May-2017 Svet Ganov <svetoslavganov@google.com> Merge "Query for static shared libs as well when needed" into oc-dev am: 721a348839
am: ace471dbec

Change-Id: I30da9ff539b7c1918e7bdad2f1460d8c96d78369
721a348839263754b1d7d202d316ed1b690be13d 15-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Query for static shared libs as well when needed" into oc-dev
5ef1cefd6eaa2485fea5ed606b3b4d86374e7294 15-May-2017 Svet Ganov <svetoslavganov@google.com> Hadler USER_ALL when uninstalling static shared lib

Test: manual - cannot uninstall an lib with cross user dependency
All static shared lib CTS tests pass

bug:36632264

Change-Id: Idd11405b27ccd8cacc2a50814e1317356689b7d1
ackageManagerService.java
9da28810d956c5eab692ae7289c9e22b71a1872b 15-May-2017 Tony Mak <tonymak@google.com> Merge "Clear calling identity before binding instant app resolver" into oc-dev am: 247b9c4a0a
am: d7ad0b7a1c

Change-Id: I441505c7ae946b868f450a4766547981e4cfe765
a5c867c82c53a79532f73803afc338ef0e675036 15-May-2017 Svet Ganov <svetoslavganov@google.com> Query for static shared libs as well when needed

System components can see static shared libs but have to
explicitly request that. This change explicitly requests
static shared libs as well in the package manager shell
command, the package installer and the package manager
where needed.

Test: Static shared lib CTS tests pass

bug:36632271

Change-Id: I26804571be327888b830e2f6bccdcbaa820f763c
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerShellCommand.java
247b9c4a0a6720816c1119df7a05d18a8fe8f35d 15-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Clear calling identity before binding instant app resolver" into oc-dev
3ebf17dcb4fc8a5846822640d39d0cf8d954f1d7 13-May-2017 Bryce Lee <brycelee@google.com> Merge "Introduce result ranges for activity start return results." into oc-dev am: b3d265caaa
am: eb651bbfb6

Change-Id: I43ecf09dac5dd6142dba08f8bcdd1332f44d4aa2
b3d265caaabf6ee9e32b81855dfc944447a39817 13-May-2017 Bryce Lee <brycelee@google.com> Merge "Introduce result ranges for activity start return results." into oc-dev
00adcb06abdec8379c130e1387348b94e9554f33 13-May-2017 Todd Kennedy <toddke@google.com> Merge "Add command to retrieve the instant app resolver" into oc-dev am: 2a34734131
am: a17fe9cca6

Change-Id: I02a709b4716a65c27cb3c696adbf5da88627c517
d55a65c69c1fbdf00d039a902609865d0fa47709 13-May-2017 Hyunyoung Song <hyunyoungs@google.com> Merge "Update ShortcutManager/Service javadoc/impl around sizing" into oc-dev am: b9a098aeb6
am: ac9b9de6df

Change-Id: I54760855839f270aadab53c1a851f55b5e676dcd
2a3473413119ec44b45837110a06b97171036185 13-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add command to retrieve the instant app resolver" into oc-dev
7f9368637c8d2726b87cbe184b240512055da037 10-May-2017 Bryce Lee <brycelee@google.com> Introduce result ranges for activity start return results.

The return result from starting activity actually represents two
pieces of information. First, it conveys whether the activity
started. Secondly, it conveys whether there was a fatal error if
the activity did not start. Many parts of the code assume that a
value greater than or equal to the defined success means that the
activity successfully started. This is not the case as there are a
number of results greater than success where the activity does not
start.

This change addresses the issue by introducing three distinct
result ranges. The first represents results where the activity
could not start due to a fatal error. The second represents results
where the activity did not start due to a non-fatal error. The last
range represents successful activity starts. Two convenience methods
have been added to ActivityManager to return whether the result
represents a fatal error and whether the result was successful.

Change-Id: Ifaf844c353641a28b03b3c2d7b6be053fd9b8b44
Fixes: 38021882
Test: cts-tradefed run cts-dev --module DevicePolicyManager --test com.android.cts.devicepolicy.DeviceOwnerTest#testLockTask_deviceOwnerUser
auncherAppsService.java
b9a098aeb67a502fed450c1558c2b357860fcf3a 13-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Update ShortcutManager/Service javadoc/impl around sizing" into oc-dev
51829ae72f5785845cd7a24f448bdaab5091dd28 12-May-2017 Sunny Goyal <sunnygoyal@google.com> Merge "Setting Session commited broadcast when an existing apk is enabled for a different user" into oc-dev am: fc157e702f
am: 1e0a89055d

Change-Id: Ifefcd98f5df6a3175ad2d25aa058555ed02a4854
fc157e702f7bc79a1156bb8e54efa495984981a5 12-May-2017 Sunny Goyal <sunnygoyal@google.com> Merge "Setting Session commited broadcast when an existing apk is enabled for a different user" into oc-dev
406abd27f137553258531838bc4beba2f4b604ad 12-May-2017 Svet Ganov <svetoslavganov@google.com> Merge "Default grant mic, storage, camera to SMS app" into oc-dev am: 422a83de2c
am: f0cf3a95ed

Change-Id: I4f7a8379d6db6cdcc169029b5a13d8f0b2d2eacb
4703746f500933b920236a72f70f629304ea2578 09-May-2017 Hyunyoung Song <hyunyoungs@google.com> Update ShortcutManager/Service javadoc/impl around sizing

to account for AdaptiveIconDrawable type of shortcuts

Test: builds for now.. If Makoto is happy with this change, will add tests

b/37743074

Change-Id: Ieecd95d621db57f858fac449d3bcedd173c8607c
hortcutService.java
c6b707a356fdc1b073a0412e9ae36c15282e76d1 12-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Copy preopted profiles to ref for first boot"
1a99d36d56199a57c0688faa0bf10a9087f85537 10-Apr-2017 Svet Ganov <svetoslavganov@google.com> Default grant mic, storage, camera to SMS app

Test: CTS tests updated in same topic

bug:36713956

Change-Id: I496d8f8dac86594956dcdeb5afafa5b210e28de4
efaultPermissionGrantPolicy.java
a31a74b993578573eca33ca68762a98c6f6cb904 12-May-2017 Sunny Goyal <sunnygoyal@google.com> Setting Session commited broadcast when an existing apk is enabled for
a different user

Test: Manual tests and CTS
Bug: 38204385
Change-Id: Ic3bddbc2e6070c11b11f0685077db7737f2b8849
ackageInstallerSession.java
ackageManagerService.java
67bb77cdbdadb188d881c1134de813eb6e000d68 12-May-2017 Todd Kennedy <toddke@google.com> Merge "Remove lots of log spew" into oc-dev am: e96d66dbc1
am: fe270353c8

Change-Id: I1aa4f633fcbfe5e0bc5309cb68e3d712e1cab08a
f2645400c255aae29a217c5003fa661a0b4da6f1 12-May-2017 Tony Mak <tonymak@google.com> Clear calling identity before binding instant app resolver

EphemeralResolverConnection always bind the instant app resolver installed
in user 0. It can be a problem if PMS is calling
EphemeralResolverConnection in a binder call from other users.
In which case, we are binding service in user 0 from other users and
security exception is thrown.

This fix assume it is WAI we always bind instant app resolver in user 0.

Fix: 38257043

Test: reboot, launch a work profile app that start an ACTION_VIEW intent
with http link. No crash observed.

Change-Id: Ic4e451b67ef127f05c3e594254b310da690a2324
phemeralResolverConnection.java
8e9bcec1e470ddeeb375b26bb273f4122057bd17 11-May-2017 Todd Kennedy <toddke@google.com> Remove lots of log spew

Change-Id: Ia8dbc32c72585c14f9e1a2c5364ab2663bbf97ea
Fixes: 33351736
Test: Manual; start the system and enjoy how little PackageManager spams
ackageManagerService.java
16230706623c56166c74e6a038f1e62075bbd4ae 12-May-2017 Svet Ganov <svetoslavganov@google.com> Merge "System/root/shell need to explicitly ask for static libs to get them" into oc-dev am: c3db339987
am: e87dc7bb2c

Change-Id: I444ced398404698c88e1353ee47cd648c9ad9c9f
fd8ad94e1fddccc204accf8085b85feb920ed43b 12-May-2017 Andreas Gampe <agampe@google.com> Merge "OtaDexopt: Ensure float format for progress command" into oc-dev am: 4c8181cb48
am: b8ae293253

Change-Id: I8a130ded7048abaa1d9011180f01119b313a59ac
c3db339987acf8d4c0f81615c53ec6ac41f94f15 12-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "System/root/shell need to explicitly ask for static libs to get them" into oc-dev
235845dc72f24624e4702224015830ff54fa8f92 11-May-2017 Mathieu Chartier <mathieuc@google.com> Copy preopted profiles to ref for first boot

Since the app is partially compiled, compiled methods won't get new
samples. We need to copy the preopted profiles over so that the
methods are compiled for future speed-profile runs.

Test: Flash preopted speed-profile maps.
Test: Confirm ref profile exists.
Test: Close maps, recompile with speed-profile, test the profile was used.
Test: Launch maps, do some stuff until cur profile exists.
Test: Re-compile with speed-profile and confirm cur merged over ref correctly.

Bug: 38032017
Change-Id: I13f4c7eecca1feb2ab41299946828ffa4e59df7f
nstaller.java
ackageManagerService.java
9e77977ffa4cb3c8dfa82070c20417e556fe7c8a 11-May-2017 Svet Ganov <svetoslavganov@google.com> System/root/shell need to explicitly ask for static libs to get them

Test: manual - settings no longer shows static shared libs
all shared lib CTS tests pass

bug:36632271

Change-Id: If3363059b5f5300e309b61899af8c2559af317fe
ackageManagerService.java
dbce0ac3da5f3d56cb01bb710605d12614bf83cd 11-May-2017 Andreas Gampe <agampe@google.com> OtaDexopt: Ensure float format for progress command

The progress value will be forwarded to update_engine, which expects
a "."-based float representation. Use Locale.ROOT when printing.

Bug: 37760573
Test: m
Test: adb root && adb shell cmd otadexopt prepare && \
adb shell cmd otadexopt progress | grep 0.00
Test: Switch to German, reboot, \
adb root && adb shell cmd otadexopt prepare && \
adb shell cmd otadexopt progress | grep 0.00

Change-Id: I99ffdd3aefa77d77b73fb7b94accefc0f2eb3c0a
taDexoptShellCommand.java
a54a0df59606e89ef072b7759ba060f567cf07e8 11-May-2017 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #37360626: Apps can schedule alarms (and other things) with temp whitelist" into oc-dev am: c3b938ca5e
am: 8b4c4f09f6

Change-Id: Ia6dd41e08ea31ccc902c4d9ba714e6448898fac4
c3b938ca5ed1385ea07a500abfba31ee4943c096 11-May-2017 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #37360626: Apps can schedule alarms (and other things) with temp whitelist" into oc-dev
4e3f529c6d9b701d5f52ee04859eddfa3e1f7864 11-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Remove obsolete DEXOPT_SAFEMODE." am: 383b2af3ec
am: 10085b3737

Change-Id: Id05d1cd2d9cb6bd1b9d80b2128b45c4a411951a3
972b2c236ef005eb24cc01719ec4469dba517f74 05-May-2017 Nicolas Geoffray <ngeoffray@google.com> Remove obsolete DEXOPT_SAFEMODE.

PackageManager side of the change.

bug:37929796
Test: build
Change-Id: Iae830bb4060b448b4b4e54d3e0fe03ebee39d3fa
(cherry picked from commit 56123bacff220e6ac77a1179197578d3a62ecdd2)
nstaller.java
ackageDexOptimizer.java
a6a73ff55aefc13a51603ad18f3e22ef77425cc3 11-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Handle safe mode in PackageManager." into oc-dev
10f628cda2c20056b14de9569871527dffaf83ed 11-May-2017 Fyodor Kupolov <fkupolov@google.com> Merge "Added isUserNameSet" into oc-dev am: a9154ab391
am: 0e861d3e25

Change-Id: I335995890354ce7e4e591782af1188c093e89a6d
b6511a60e0766b1f11ad0c28c1f6711c4edb66b6 11-May-2017 Makoto Onuki <omakoto@google.com> Merge "Offload saving bitmaps from binder threads" into oc-dev am: 31ef139466
am: 3b178f77ce

Change-Id: I12603ba93310abaa8612c118ebf77ac25e6918c5
0e861d3e25e4926fb8cff94f7fed558b5116f903 11-May-2017 Fyodor Kupolov <fkupolov@google.com> Merge "Added isUserNameSet" into oc-dev
am: a9154ab391

Change-Id: I013381eab8809b98d17e7cf9063a62e4884b0e2a
a9154ab39112f30b9f90e62b79c6ed8f43dfc5bb 11-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Added isUserNameSet" into oc-dev
de507fb487b8aa75b951aeea7a5b2a228af5c6ea 11-May-2017 Pavel Grafov <pgrafov@google.com> Merge "If ENSURE_VERIFY_APPS is enforced, reject installation by default." into oc-dev am: 79cc05a6c1
am: dbb6c2abc6

Change-Id: Ic0c137a458c91a8ce148bfd4f91f113210889510
983055231b999e450def3e3df377fb4e23420711 06-May-2017 Dianne Hackborn <hackbod@google.com> Fix issue #37360626: Apps can schedule alarms (and other things) with temp whitelist

There is now an IBinder "token" that must be specified when setting
the whitelist duration for an Intent. To have the whitelist supplied,
the caller to send a PendingIntent must pass in the same token. The
PendingIntent and IntentSender classes now internally maintain this token
to pass in when their send() is called.

The big complexity for making this work is we now need to associate this
whitelist token correctly with the actual PendingIntent objects that
applications and other code is getting. To do this, we propagate the
token in the Notification object, and have a new API on Parcel that allows
us to make it available to PendingIntent when it is unmarshalled. And
this allows to deal with PendingIntents appearing in nested bundles, as
we can propagate that information from the original Parcel to the new
Parcel that Bundle keeps to delay unmarshalling.

Test: manual
Change-Id: Idda00490ccfe2be37e4ab21354b9ab7528a52750
ackageManagerShellCommand.java
3b178f77ce4cc611873089375821ba9ac640894d 11-May-2017 Makoto Onuki <omakoto@google.com> Merge "Offload saving bitmaps from binder threads" into oc-dev
am: 31ef139466

Change-Id: I2980b05a8a997e003792fe995973b54eaf29d5e1
605b12a6d0110c81d63e78e93f299a6b5753da46 11-May-2017 Fyodor Kupolov <fkupolov@google.com> Added isUserNameSet

It can be used to check that the value returned by getUserName() was set
by the user and is not a default value returned by the system.

Test: UserManagerServiceUserInfoTest pass
Bug: 38138381
Change-Id: I0ca37970fda548508190bffd1fa7be95d4a15076
serManagerService.java
31ef1394663ff7f36be36e63898544afc6a10c66 11-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Offload saving bitmaps from binder threads" into oc-dev
dbb6c2abc6f768cdf32a3fc365f140c823251a41 10-May-2017 Pavel Grafov <pgrafov@google.com> Merge "If ENSURE_VERIFY_APPS is enforced, reject installation by default." into oc-dev
am: 79cc05a6c1

Change-Id: Iaf27be8afb90c8364fa365d6d21bef61e8b7470b
bb1d49f89b8a53bde228cb50504c5fcf9de2d9ae 10-May-2017 Andreas Gampe <agampe@google.com> Merge "OtaDexoptService: Add missing return" into oc-dev am: ab516db3e6
am: 6a580bef1f

Change-Id: I3a75fb705d58211c2ecf6937b61722fa12294fd5
79cc05a6c1cac17d96fae01efd9cbed5c733618a 10-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "If ENSURE_VERIFY_APPS is enforced, reject installation by default." into oc-dev
6a580bef1f4551dc5cbc3b8ec5a11a84ff9d470b 10-May-2017 Andreas Gampe <agampe@google.com> Merge "OtaDexoptService: Add missing return" into oc-dev
am: ab516db3e6

Change-Id: I18d0be12e680424de3dfb48b0e1e6040e339204e
307a5af2adcba3738243cb90e57daae13c16699c 05-May-2017 Nicolas Geoffray <ngeoffray@google.com> Remove obsolete DEXOPT_SAFEMODE.

PackageManager side of the change.

bug:37929796
Test: build

(cherry picked from commit 56123bacff220e6ac77a1179197578d3a62ecdd2)

Change-Id: I3a789d49121ca383f7931f3803b6140be456340f
nstaller.java
ackageDexOptimizer.java
ab516db3e62058cfc7102048a3d5550b3287bc23 10-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "OtaDexoptService: Add missing return" into oc-dev
25a17269b5171452315e42300fee08a5fe03b1be 10-May-2017 Todd Kennedy <toddke@google.com> Merge "Don't require BROWSABLE" into oc-dev am: 59b9a851a7
am: 857bbed067

Change-Id: I81979ec46465c22aca3a6736dd4e1e6a4b5c8c2b
857bbed0673f253e513b9693e53fccf8c9557c3a 10-May-2017 Todd Kennedy <toddke@google.com> Merge "Don't require BROWSABLE" into oc-dev
am: 59b9a851a7

Change-Id: I4bcbcddd76b9fa4e85a0edf223a98b8c18dd791c
59b9a851a732ff9a291b9740fdff5eeee68127a6 10-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't require BROWSABLE" into oc-dev
e9c0b24ccedcf486c253a7bc474939ee28af7bae 09-May-2017 Pavel Grafov <pgrafov@google.com> If ENSURE_VERIFY_APPS is enforced, reject installation by default.

Bug: 37738016
Bug: 37737479
Test: manually, tried to install a package when the user is still locked on an FBE device and hence verifier doesn't run as it is not crypto-aware.
Change-Id: I6d9d5dd13c8ebd49cc8e5e3381d1a04eb54f1747
ackageManagerService.java
9b5a06037f80dff46218b1611862c1fd2b3df8b2 03-May-2017 Nicolas Geoffray <ngeoffray@google.com> Handle safe mode in PackageManager.

PackageManager side of the change.

bug:37929796
Test: manual OTA with a safemode app.
(cherry picked from commit d093b203f557685de33179bff0eb35ea205294a2)

Change-Id: Icee7f7174d28bed79fc2cde4c174ee002d182832
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
f4eb8eb25c48de2f526c0400f2ddd0646b7d2f77 10-May-2017 Andreas Gampe <agampe@google.com> OtaDexoptService: Add missing return

Add early-return for null handling.

Bug: 38186355
Test: m
Test: manual OTA
Change-Id: I9076427ab0ddb97f2c81ff208947a0d172d1b650
taDexoptService.java
475c36539da9687d75447adb9054c98ce03c754a 08-May-2017 Makoto Onuki <omakoto@google.com> Offload saving bitmaps from binder threads

Bug 34691191
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutManagerTestCases
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutHostTestCases
Test: Manual test with the phone app

Change-Id: Ibccf8ca162eae9179ee4cbdf0307ff34a6953aa1
hortcutBitmapSaver.java
hortcutPackage.java
hortcutService.java
7e4e87189764f52484375e22f26e71788d5581a1 09-May-2017 Todd Kennedy <toddke@google.com> Merge "Always throw a ConnectionException on error" into oc-dev am: 1c7445565d
am: dbb567838b

Change-Id: Ia0a54bdbc11fee2f39a851546fde191055b55c3f
303c786927bd646a4ad3b8ec55683e6d6309513b 09-May-2017 Todd Kennedy <toddke@google.com> Don't require BROWSABLE

Initially we wanted to limit instant apps to VIEW/BROWSABLE
intents, but, apparently apps don't always set the BROWSABLE
category. So, allow any VIEW intent w/ a URL to resovle to
an instant app.

Change-Id: I96e25cca8abcbe89b4a227b707112184c19565c6
Fixes: 38146110
Test: Manual
Test: open go/aia-test-links
Test: click any link
Test: notice it launches the instant app directly [instead of going through the installer]
ackageManagerService.java
dbb567838b691e378f8d7a87c424207aa759260e 09-May-2017 Todd Kennedy <toddke@google.com> Merge "Always throw a ConnectionException on error" into oc-dev
am: 1c7445565d

Change-Id: Ib80975794f05d97aec6c3bdc3639d113a7085f90
1c7445565d9af66b98cb65203c4d102ecec4118e 09-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Always throw a ConnectionException on error" into oc-dev
bdf2a80816a1bcb58f09ee989a995983638aa894 09-May-2017 Todd Kennedy <toddke@google.com> Always throw a ConnectionException on error

There was a single case where we would return a 'null' for the service
connect; if bindServiceAsUser() returned 'false'. Handle this condition
with an exception. Also make the exception descriptive enough so we
can add the correct resolution status to the resolution logs.

Change-Id: I6cee25adfa74745579577cb9726f8dd9c2950746
Fixes: 38131147
Test: Manual; restart the resolver and see the exceptions
phemeralResolverConnection.java
nstantAppResolver.java
0a3f081b228f527828f79c0beeca682de2743050 08-May-2017 Todd Kennedy <toddke@google.com> Add command to retrieve the instant app resolver

Bug: 33073536
Test: gts-tradefed run commandAndExit gts-dev -m GtsPackageManagerHostTestCases -t com.google.android.pm.gts.PackageManagerHostTest
Change-Id: I3050fb083da2f85c7226291ec5c7794ed95a13ef
ackageManagerService.java
ackageManagerShellCommand.java
e4390acd10f9dbcfb9075f6304ea471fe8a45817 08-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Remove obsolete DEXOPT_SAFEMODE."
ebe175c92f0b5e0ae4eb0231f6b75f56d7b21a0f 05-May-2017 Makoto Onuki <omakoto@google.com> Merge "Show warning log when ShortcutInfo is re-published" into oc-dev am: 9ccb15a351
am: f14f38ba4a

Change-Id: Idba763e56af1fa6e76ddbb3d8880f7eb78c944f3
f14f38ba4aa0b6b990210afa8d9a0304e50d229b 05-May-2017 Makoto Onuki <omakoto@google.com> Merge "Show warning log when ShortcutInfo is re-published" into oc-dev
am: 9ccb15a351

Change-Id: I7f246f362b6e8d124416db790e4856e52baa21b8
9ccb15a351c3732b4dd8f55eb100756b0f88a9e8 05-May-2017 Makoto Onuki <omakoto@google.com> Merge "Show warning log when ShortcutInfo is re-published" into oc-dev
e12063c15f10aa2d6341f1cf6fb61338d91bcc59 05-May-2017 Todd Kennedy <toddke@google.com> Merge "Create auxiliary info for local instant apps" into oc-dev am: 4804e41574
am: 143ad7ff09

Change-Id: I7bde4770ba29b8e57acd62cbe3a56c986a99bc80
143ad7ff09ccc72a9147c07bdec0d9fe4ad17a2c 05-May-2017 Todd Kennedy <toddke@google.com> Merge "Create auxiliary info for local instant apps" into oc-dev
am: 4804e41574

Change-Id: I181cb62756b16971b126c2174eea58788dd5bfea
c0dd03a666467d03e140f3a43704b3f3f3f4d4b7 05-May-2017 Todd Kennedy <toddke@google.com> Create auxiliary info for local instant apps

This reverts commit a1d8051fa2317d897a6b20442177e357172e93db.

Change-Id: Ic471a4efe64406dd75cc0bf1d6464276a94347d8
Fixes: 37947648
Test: Manual
Test: Install an instant app [https://www.nytimes.com/crosswords/game/mini]
Test: Try to run installed instant app from gMail
ackageManagerService.java
d36d46dd27cf6f7845a3338d9d9759e5b86fe11f 05-May-2017 Bryce Lee <brycelee@google.com> Merge "Revert "Create auxiliary info for local instant apps"" into oc-dev am: 8cfb1a95da
am: fb19563972

Change-Id: I80322c13e9fb5926432ea660f0b143f9aa78e315
fb19563972e775a3fafb3d781dab156d0b73580d 05-May-2017 Bryce Lee <brycelee@google.com> Merge "Revert "Create auxiliary info for local instant apps"" into oc-dev
am: 8cfb1a95da

Change-Id: I63d6a84c78f52d9ee20bdf719ac4edbca34fb44d
d86841e7cd3b62c2aa83ee6a8f1aebed808d1bc5 05-May-2017 Todd Kennedy <toddke@google.com> Merge "Don't set the failure extra on split install" into oc-dev am: d14e67656f
am: 9968f9aa27

Change-Id: I0d799cf7a9af9f3bad491aa58edc6f4aacae85bb
7a6eafb7a9052bc307aa6b3c57a61330467dc851 05-May-2017 Todd Kennedy <toddke@google.com> Merge "Create auxiliary info for local instant apps" into oc-dev am: d55670bcf5
am: b21b3efc55

Change-Id: I3d656bbbb9610e9f4ea6e68fbd8a287e88ad6894
8cfb1a95dac102bbe2dbb931df0dd60da083ee2c 05-May-2017 Bryce Lee <brycelee@google.com> Merge "Revert "Create auxiliary info for local instant apps"" into oc-dev
a1d8051fa2317d897a6b20442177e357172e93db 05-May-2017 Bryce Lee <brycelee@google.com> Revert "Create auxiliary info for local instant apps"

This reverts commit e15e7cb592a923eea029c12aa9fc144a3fbaddc0.

Change-Id: I116904fd8c2b28df7e03bc5ec2414ed67761b380
ackageManagerService.java
9968f9aa27b9c39ec18ea82accb3fc1e995ad886 05-May-2017 Todd Kennedy <toddke@google.com> Merge "Don't set the failure extra on split install" into oc-dev
am: d14e67656f

Change-Id: I8c317e316b699d742db50b2b642f2d1b0304de57
b21b3efc555b266c693e144ee3195f82b7295100 05-May-2017 Todd Kennedy <toddke@google.com> Merge "Create auxiliary info for local instant apps" into oc-dev
am: d55670bcf5

Change-Id: Ia0fe6ae25879711ae0c9cf92a71607a5d7c5f4dc
d14e67656f61d35ca4982cbee7aa9692f35fe9eb 05-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't set the failure extra on split install" into oc-dev
d55670bcf57febb38ec2b3bac86ad86a8200b443 05-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Create auxiliary info for local instant apps" into oc-dev
56123bacff220e6ac77a1179197578d3a62ecdd2 05-May-2017 Nicolas Geoffray <ngeoffray@google.com> Remove obsolete DEXOPT_SAFEMODE.

PackageManager side of the change.

bug:37929796
Test: build
Change-Id: Iae830bb4060b448b4b4e54d3e0fe03ebee39d3fa
nstaller.java
ackageDexOptimizer.java
304560b80615bae8d019dad7b74fb1414fd3edea 05-May-2017 Michael Wright <michaelwr@google.com> Merge "Remove line from bad resolution merge." into oc-dev-plus-aosp
am: 3732ed29e3

Change-Id: Id5ac6fdf07b28e59b0231359089fcf4a8415ad8f
731a7f38a9949bb9d15f9dd16514e7908c84ed9e 05-May-2017 Nicolas Geoffray <ngeoffray@google.com> Remove line from bad resolution merge.

Test: build
Change-Id: Ie7f9187ecf63150b9ea36858e80e226c6daaa184
ackageDexOptimizer.java
cdd64207c66e447a769bd4de9b0275b2710a4c6e 05-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "resolve merge conflicts of c2421a2a3c37 to oc-dev-plus-aosp" into oc-dev-plus-aosp
am: 39fea6b6dc

Change-Id: I492f304537eb73c630d92de77505840cdd4f9257
39fea6b6dcb3c1ba46364c153ca482a9f5f8e235 05-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "resolve merge conflicts of c2421a2a3c37 to oc-dev-plus-aosp" into oc-dev-plus-aosp
914d4bf10f8ad7f04769b9a18d19cd3de8d886f2 05-May-2017 Vladislav Kuzkokov <vkuzkokov@google.com> Merge "Store "block uninstall" flag separately from the rest of package state." into oc-dev
b0818e8871eb157ee6a6991ea27a6082dc084741 05-May-2017 Nicolas Geoffray <ngeoffray@google.com> resolve merge conflicts of c2421a2a3c37 to oc-dev-plus-aosp

Test: I solemnly swear I tested this conflict resolution.
Change-Id: I5825e002c7ac5655703cd31d84ccc1cb5379f0e0
c2421a2a3c37adc2140ff524fed42fb6e32a66f5 05-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Handle safe mode in PackageManager." am: a34610cebc
am: 2ea3874427

Change-Id: I18f16e094d96bd754c8ff0a8031450ce1a1ce023
a34610cebc0a4535ed495adecfe56d37ce66bbaf 05-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Handle safe mode in PackageManager."
989618a48e049405333a0a36bdbb26b77fdba1c2 05-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Adjust forced dexopt in case of stripped APKs." into oc-dev
bf563b63e5d3672ec102ee191a301e49e472139b 04-May-2017 Makoto Onuki <omakoto@google.com> Show warning log when ShortcutInfo is re-published

Bug 37986391
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Change-Id: Id9ca30068440915d2e86850fe2ed3684c0ce2af8
hortcutService.java
253984ed8c8f39fa0aa9c5f4addf2f44f334c749 24-Oct-2016 Vladislav Kuzkokov <vkuzkokov@google.com> Store "block uninstall" flag separately from the rest of package state.

This allows to set "block uninstall" prior to installation and avoid the
inevitable race that happens when Device Policy app tries to force install and
then immediately block uninstall.

BUG=31043188
Test: Block com.chrome.beta in TestDPC. install, fail to uninstall through adb, unblock, uninstall

Change-Id: I5ffa2abcb003982eccfb77585c43b59532dd501d
(cherry picked from commit 1fff9dcb9d0a4d7224ff8aa0f39e82df0b30152c)
ackageManagerService.java
ackageSettingBase.java
ettings.java
1307d25e25ab9aabf92d2f74cefb005f34751a55 04-May-2017 Vladislav Kuzkokov <vkuzkokov@google.com> Merge "Store "block uninstall" flag separately from the rest of package state."
2e0059ce813a70571076bd3e287bd6352ea21b36 04-May-2017 Todd Kennedy <toddke@google.com> Merge "ignore exception calling unlinkToDeath" into oc-dev am: 79777a5b43
am: cb63244206

Change-Id: I1ed85c606e688acc20b61ada0fe07978e3e296be
cb63244206d03bcacc3fac56232e20af5769ca55 04-May-2017 Todd Kennedy <toddke@google.com> Merge "ignore exception calling unlinkToDeath" into oc-dev
am: 79777a5b43

Change-Id: Iaffd850d9422244d92340ac8c5c2346cbb58f39f
79777a5b43c44b6bf2b138eb602caf5fcfda6383 04-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "ignore exception calling unlinkToDeath" into oc-dev
b73173d7e173d65f684dfe1301feb6a377c962a8 04-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Adjust forced dexopt in case of stripped APKs." am: 5669550a83 am: f59dd816b1 am: 8d76994c5b
am: 384683ef0a

Change-Id: I3f3a130059f0f878f2c84b368a2f12cc86076b67
384683ef0aedd1a1f204f755ee1eab95dd3bd410 04-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Adjust forced dexopt in case of stripped APKs." am: 5669550a83 am: f59dd816b1
am: 8d76994c5b

Change-Id: I87acb3200de0e731eab78107d30c3c8999674c6d
8d76994c5b4cb61fbccff400c07638ffe30b9434 04-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Adjust forced dexopt in case of stripped APKs." am: 5669550a83
am: f59dd816b1

Change-Id: If41af16abab0e193fcfef6a939f039a4f24a38ef
8a5845e69b4a5fa0a37149b8ea28251e84db31f7 03-May-2017 Nicolas Geoffray <ngeoffray@google.com> Adjust forced dexopt in case of stripped APKs.

We cannot compile from scratch for strip APK. So
if getDexOptNeeded returns NotNeeded, pretend there was
a compiler filter change, in order to pick up the vdex file.

bug: 37558732
Test: "adb shell cmd package compile" of a stripped /system apk

(cherry picked from commit 96d12a93aeffb8f6db80a7b415cb7d4eb2c4198c)

Change-Id: I3b699a18799ea035ff78c60578c08f8803a17e36
ackageDexOptimizer.java
96d12a93aeffb8f6db80a7b415cb7d4eb2c4198c 03-May-2017 Nicolas Geoffray <ngeoffray@google.com> Adjust forced dexopt in case of stripped APKs.

We cannot compile from scratch for strip APK. So
if getDexOptNeeded returns NotNeeded, pretend there was
a compiler filter change, in order to pick up the vdex file.

bug: 37558732
Test: "adb shell cmd package compile" of a stripped /system apk
Change-Id: I531010e01e44adfa300872c1739c49dab7292317
ackageDexOptimizer.java
2c6d5cd7eff1ec7c0efc47489aa4d610955037f7 04-May-2017 Calin Juravle <calin@google.com> Merge "Fix potential race in DexManager" into oc-dev am: c54fa39d8b
am: 43284ad8b7

Change-Id: I72dc2159438834c568a43ea8101109f34ea15c9a
c54fa39d8b503621fcb9b160d4de72a049d7e3b1 04-May-2017 Calin Juravle <calin@google.com> Merge "Fix potential race in DexManager" into oc-dev
34f5b421c5f5405a757702f6eae5a0edbbf86596 04-May-2017 Todd Kennedy <toddke@google.com> ignore exception calling unlinkToDeath

Change-Id: If3fdb2ca46f8118d9d2859fc932b4614bb62220e
Fixes: 37893511
Test: Manual
phemeralResolverConnection.java
7dd99e3d463eb2354e5ddb0cbeed1333ec590235 04-May-2017 Todd Kennedy <toddke@google.com> Don't set the failure extra on split install

Change-Id: I2f836b5ebc9f377ae8fe0a0d4a60541dd1666011
Fixes: 37852108
Test: Manual
Test: Install and run pico blast
Test: Note that the failure extra is set
Test: Click "New" to install a split
Test: Note that the failure extra isn't set
nstantAppResolver.java
ackageManagerService.java
a6cf18f431348087e88847cc6fdcd703ec833826 04-May-2017 Fyodor Kupolov <fkupolov@google.com> Merge "Use timeout for *dexopt* wake lock" into oc-dev am: bca6bd2b8c
am: aec91c2e73

Change-Id: I346aacd4412dddc98b0d68979355ee7087d6d366
bca6bd2b8c45020ec19e81b19b14370e72c03df4 04-May-2017 Fyodor Kupolov <fkupolov@google.com> Merge "Use timeout for *dexopt* wake lock" into oc-dev
e15e7cb592a923eea029c12aa9fc144a3fbaddc0 03-May-2017 Todd Kennedy <toddke@google.com> Create auxiliary info for local instant apps

Change-Id: I73fc6f36f666a0f4fd538e1d3c541ce10443902d
Fixes: 37947648
Test: Manual
Test: Install an instant app [https://www.nytimes.com/crosswords/game/mini]
Test: Try to run installed instant app from gMail
ackageManagerService.java
1fade2fc6d10fa90b58c4b3718206afaeee0723d 03-May-2017 Calin Juravle <calin@google.com> Fix potential race in DexManager

The internal cache of DexManager holding information about the code
locations may race if an install happens at the same time with a dex
load.

Test: runtest -x services/tests/servicestests/src/com/android/server/pm/dex/DexManagerTests.java
Bug: 37922353

Change-Id: Ia28fb54d6859ec185aaaf8e0ed68981004b173e5
ex/DexManager.java
1fff9dcb9d0a4d7224ff8aa0f39e82df0b30152c 24-Oct-2016 Vladislav Kuzkokov <vkuzkokov@google.com> Store "block uninstall" flag separately from the rest of package state.

This allows to set "block uninstall" prior to installation and avoid the
inevitable race that happens when Device Policy app tries to force install and
then immediately block uninstall.

BUG=31043188
Test: Block com.chrome.beta in TestDPC. install, fail to uninstall through adb, unblock, uninstall

Change-Id: I5ffa2abcb003982eccfb77585c43b59532dd501d
ackageManagerService.java
ackageSettingBase.java
ettings.java
d093b203f557685de33179bff0eb35ea205294a2 03-May-2017 Nicolas Geoffray <ngeoffray@google.com> Handle safe mode in PackageManager.

PackageManager side of the change.

bug:37929796
Test: manual OTA with a safemode app.
Change-Id: I98c8200d4330dc88fec7eb8ffeb27717a22a220b
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
e4f36952ab2f58ba92e0a269b3a051fe9bd25b59 03-May-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Update frameworks/base to new compiler filters." into oc-dev
2b331164773099ee37a71c77616d55dd97e47e2c 03-May-2017 Todd Kennedy <toddke@google.com> Merge "Optionally let the instant app into disambig" into oc-dev am: 1f1d60c5a1
am: 74e39de950

Change-Id: I4e48ba4c05d764322ad2e953430b8b02c7c09712
74e39de95095fa3f3356f4b47ead63b34c06e087 03-May-2017 Todd Kennedy <toddke@google.com> Merge "Optionally let the instant app into disambig" into oc-dev
am: 1f1d60c5a1

Change-Id: I78725fadab5bb7222f9d4528d21b22d881df45a1
72dc2fa6ad572ac58344f9435f3497a9bb87859a 26-Apr-2017 Todd Kennedy <toddke@google.com> Optionally let the instant app into disambig

When a user clicks "view on web", it's not assumed this is meant to be
forever. In this case, we will adjust the instant app's verification
status so that the instant isn't automatically run.

Change-Id: I246de901dafb23159a064d205fdb614d657a99dc
Fixes: 37686922
Test: Manual
Test: 1) Install instant app
Test: 2) Set to always-ask -- adb shell pm set-app-link package.name always-ask
Test: 3) Notice that we get a disambig w/ the instant app and chrome as options
Test: 4) Set to never -- adb shell pm set-app-link package.name never
Test: 5) Notice that we don't get the instant app
ackageManagerService.java
28f2855c3dbf0c7658d7f458fabb7c01d68e6f37 02-May-2017 Fyodor Kupolov <fkupolov@google.com> Use timeout for *dexopt* wake lock

There are reports of *dexopt* lock being held for 10+ minutes, which shouldn't
normally happen on threads that are monitored by the Watchdog. Added
logging to help detecting that.

The lock is now held with a timeout of WAKELOCK_TIMEOUT_MS. It is set to a
higher value than PM's watchdog timeout for easier reading from a timing
histogram.

Test: Manual, device boots without errors
Bug: 37756892
Change-Id: Iac569474d1c95447e08fe5e9870e4518b8d22c65
ackageDexOptimizer.java
ackageManagerService.java
d1326526104648e7b329c02af32e432b89adfc71 25-Apr-2017 Nicolas Geoffray <ngeoffray@google.com> Update frameworks/base to new compiler filters.

Also fix a merge issue with duplicated code.

bug:34715556
Test: build and boot aosp bullhead

(cherry picked from commit be7b0d18a7d68aa79dc8256ee904f0a94767d5d9)

Change-Id: I2c716427ac10090a694ce933421e4924748b0c71
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerShellCommand.java
74bfa119745bb02f3442355d6b0d1205140f96f2 02-May-2017 Jeff Sharkey <jsharkey@android.com> Merge "Rename to follow API council guidance." into oc-dev am: 0d6c3a691e
am: 6560d8845b

Change-Id: Ie9b4a033dfb08ea9326725e66ed4787a1ed69651
6560d8845be38806ccbfb9851bdb67bedd2e2660 02-May-2017 Jeff Sharkey <jsharkey@android.com> Merge "Rename to follow API council guidance." into oc-dev
am: 0d6c3a691e

Change-Id: I9116471537b51bd3aa785ff21f0bef48ec380889
0d6c3a691ec020d5d67f2040c032043b08f6e3d2 02-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Rename to follow API council guidance." into oc-dev
19ef3fceabd5a127469f777842d723585b83d9fd 02-May-2017 Svetoslav Ganov <svetoslavganov@google.com> Merge "Addess API council comments" into oc-dev am: a9bb97993f
am: 58d3836914

Change-Id: I095d5c9a488db01bd3dcf6b3609aa4e928311ca9
6958495360b267a65178d56f9dc1b265042ae123 02-May-2017 Calin Juravle <calin@google.com> Merge "SystemApi for dex module registration"
58d3836914e2791c64e5a694d17d17f4e818add2 02-May-2017 Svetoslav Ganov <svetoslavganov@google.com> Merge "Addess API council comments" into oc-dev
am: a9bb97993f

Change-Id: I1e521c08500bcdbbfc7fd708baa4762dbb91e39a
a9bb97993fd076be2e810e30ef3e27db1bb5db9f 02-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Addess API council comments" into oc-dev
f29d19610d7fe7c3b757dd6348a2bffc7e7b9435 01-May-2017 Jeff Sharkey <jsharkey@android.com> Rename to follow API council guidance.

Test: builds, boots
Bug: 37422404
Change-Id: Idcec897e775f2613805a86209615e389b63bd78d
ackageManagerService.java
e6b4614d88c04a3b3fb0497b5e8f6b4c359f6f2d 01-May-2017 Svetoslav Ganov <svetoslavganov@google.com> Addess API council comments

Test: manual

bug:37322491

Change-Id: I2017e667c5452c7ef7c56ec19c594e685700b33a
ackageManagerService.java
0e8606ed76f5446e69d247e6bd65112f5e20f0ea 01-May-2017 Makoto Onuki <omakoto@google.com> Merge "Move the last user save from onCleanupUser to onStopUser" into oc-dev am: f323e3a543
am: 7d10161005

Change-Id: I72d067bc5225641a3d1a6aa83f678bbad11f944c
7d1016100576581836e290d1bcbce2b91b0200a4 01-May-2017 Makoto Onuki <omakoto@google.com> Merge "Move the last user save from onCleanupUser to onStopUser" into oc-dev
am: f323e3a543

Change-Id: I77c183728a66b94a1fc3b92730596b5c4a77c5db
f323e3a5435ac21c6a5684e0aeba5f26ea699f9d 01-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Move the last user save from onCleanupUser to onStopUser" into oc-dev
01ce92b8ac98da3887515e4aa85353ac6cbcbd01 28-Apr-2017 Makoto Onuki <omakoto@google.com> Move the last user save from onCleanupUser to onStopUser

Bug: 37780857

Test: manual test with work profile

Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Change-Id: I8b053c6a55df374a89ab85d76b9d36abf639f649
hortcutService.java
de32220f646ded5b9d3a6ef7006c857c2d0044a6 29-Apr-2017 Chad Brubaker <cbrubaker@google.com> Merge "Create Instant App cookie dir if it doesn't exist" into oc-dev am: d2cc513e9f
am: 75a64a450e

Change-Id: Ie4d9d3f3f84920a75afd4cd1bd07737f3ad95aa8
75a64a450ea38101520ec8a3e08487c0c7b61322 29-Apr-2017 Chad Brubaker <cbrubaker@google.com> Merge "Create Instant App cookie dir if it doesn't exist" into oc-dev
am: d2cc513e9f

Change-Id: I28d2e598a9599ded68f9682a058133fcb12eec9e
d2cc513e9f79a525809408385b526765e7178d22 29-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Create Instant App cookie dir if it doesn't exist" into oc-dev
3572471398cd0866a6255f90e1b26bd06f5ffb37 28-Apr-2017 Chad Brubaker <cbrubaker@google.com> Merge "Allow system apps to define ephemeral permissions" into oc-dev am: 0ddca92018
am: 987da51b85

Change-Id: I281a7ca5437ce52034ced8aa9b03f497e27b9343
987da51b85e1853a04f9a67d8f5e0f9189cedde6 28-Apr-2017 Chad Brubaker <cbrubaker@google.com> Merge "Allow system apps to define ephemeral permissions" into oc-dev
am: 0ddca92018

Change-Id: Ie68abfae227db1b5a62029671ab607ac38620ce3
0ddca92018da69e7224b63cdedbf1944c63ddc34 28-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow system apps to define ephemeral permissions" into oc-dev
64c8b79afddd1f59976e46d06740ee031e66389e 28-Apr-2017 Chad Brubaker <cbrubaker@google.com> Create Instant App cookie dir if it doesn't exist

Bug: 37778533
Test: run instant app in b/37778533
Change-Id: I54ef62f6e5a290f3ccfa49ebde2a9d64a38de6a6
nstantAppRegistry.java
776158ba4ff3f2191daab5bf7dec0315a9bc018d 28-Apr-2017 Pavel Grafov <pgrafov@google.com> Merge "Introduce DISALLOW_BLUETOOTH_SHARING." into oc-dev
am: 90357d62e9

Change-Id: I925165817781c3b0f4e37afe8ebcce1ac264d775
90357d62e9908730bb3c781a402db455bf473596 28-Apr-2017 Pavel Grafov <pgrafov@google.com> Merge "Introduce DISALLOW_BLUETOOTH_SHARING." into oc-dev
84daedcdffad746dda6ecffd0592a025b53b1d36 28-Apr-2017 Jaekyun Seok <jaekyun@google.com> Merge "Apply static RRO when parsing Android manifest of a target package" into oc-dev am: dc326a883e
am: 1a4bcd04ee

Change-Id: I342faf8a6486f3b6dfdf42047e90ae11671b58e5
1a4bcd04ee976c9c5aa19e88d70e6af1db592c2e 28-Apr-2017 Jaekyun Seok <jaekyun@google.com> Merge "Apply static RRO when parsing Android manifest of a target package" into oc-dev
am: dc326a883e

Change-Id: I7803a75b0c0a863e5491b3faa3a03c03f46036e8
dc326a883efa75c4071284db2cdb48275e68b0f7 28-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Apply static RRO when parsing Android manifest of a target package" into oc-dev
30dc2a08667d56fdd3eecdcb70abec1b28d821f4 11-Apr-2017 Jaekyun Seok <jaekyun@google.com> Apply static RRO when parsing Android manifest of a target package

This CL creates idmaps for static RROs right before parsing a target
package. Those idmaps will be used to parse correctly the Android
manifest of the target package.

Later, OverlayManagerService will update each idmap with the correct
gid from the target package app id.
Note that the idmaps generated here will be used by OverlayManagerService
as well until they are outdated (http://ag/2127839).

Additionally a target package should be parsed again if its overlays are
updated to apply the changes.

Test: building succeeded and tested with sailfish-userdebug.
Bug: 37179531

Change-Id: Ie0d5e92ae6e06b2d377ebd4cfdb0a8519b49a944
ackageManagerService.java
b9511da2755c56603fcbdc85a7110dc03c967d32 28-Apr-2017 Todd Kennedy <toddke@google.com> Merge "add 'changes' cmd to dumpsys" into oc-dev am: 38b58abaac
am: fa25f9b05c

Change-Id: Ic781fbb52e66861abdd1cbe8e27abee7b5312dd9
fa25f9b05c97c9d556148069de18d65f04ace967 28-Apr-2017 Todd Kennedy <toddke@google.com> Merge "add 'changes' cmd to dumpsys" into oc-dev
am: 38b58abaac

Change-Id: Ie3746f8f06a74c6a5954113032ad6d0e9e4cd4e8
3d2af7f72a2e6be36f0f2cbf899ad4d0bde451b4 20-Apr-2017 Calin Juravle <calin@google.com> SystemApi for dex module registration

PackageManager#registerDexModule() allows apps which can call
system apis to register a dex module with the Package Manager.

The PM may optimize the modules on the spot if needed. This is
particular useful for shared dex modules (e.g. chimera modules)
which are loaded in multiple processes.

Test: adb shell am instrument -e class
'android.content.pm.PackageManagerTests' -w
'com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner'
Bug: 37290820
Change-Id: I9ea8f937a76d2549a29e90a6c84c53c2e44a1ee4
nstructionSets.java
ackageManagerService.java
ex/DexManager.java
38b58abaac77c4237cf3ac1e6ef047151bf243f2 28-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "add 'changes' cmd to dumpsys" into oc-dev
ffa07d2a8fc6ccf742a30de2041115a428f3ff8d 28-Apr-2017 Chad Brubaker <cbrubaker@google.com> Allow system apps to define ephemeral permissions

Test: manual
Change-Id: Ib21c48348d0d3e84fe9d913960443cdbec0bdc8b
ackageManagerService.java
a50f89ffeb9cc5d87cc71079d01279ea57bc044a 27-Apr-2017 Todd Kennedy <toddke@google.com> add 'changes' cmd to dumpsys

Bug: 37714054
Test: Manual; adb shell dumpsys package changes
Change-Id: Ibab209f80da7ac588bae54c3226305a95306cd7c
ackageManagerService.java
1bfe94164fe23d9118d9e02c474a127442cc359c 27-Apr-2017 Makoto Onuki <omakoto@google.com> Merge "Change IMPORTANCE_PERCEPTIBLE_DEPRECATED to IMPORTANCE_PERCEPTIBLE_PRE_26" into oc-dev am: 301663a61b
am: 27521581fb

Change-Id: I8b0443ccf4a876b4de0d6de6d1af7909a4dee00e
27521581fb574f172be500a94e60be5f410b5b2e 27-Apr-2017 Makoto Onuki <omakoto@google.com> Merge "Change IMPORTANCE_PERCEPTIBLE_DEPRECATED to IMPORTANCE_PERCEPTIBLE_PRE_26" into oc-dev
am: 301663a61b

Change-Id: I93d38d5255975a211723b41eacaec5ab882a7621
301663a61bda0e2eb863d6518de882cf805abcf7 27-Apr-2017 Makoto Onuki <omakoto@google.com> Merge "Change IMPORTANCE_PERCEPTIBLE_DEPRECATED to IMPORTANCE_PERCEPTIBLE_PRE_26" into oc-dev
d65e8e83261531faa54df04323c7305f505e07e0 27-Apr-2017 Chad Brubaker <cbrubaker@google.com> Merge "Allow apps to provide the Instant App installer extra information" into oc-dev am: a9d0e6b205
am: f4488dabd5

Change-Id: I6310b54fc3f5e11feb926fe904d33c4cf67db669
f4488dabd5ca2c5fe12d1b607e875dc43cacc880 27-Apr-2017 Chad Brubaker <cbrubaker@google.com> Merge "Allow apps to provide the Instant App installer extra information" into oc-dev
am: a9d0e6b205

Change-Id: I6edd3a615c1c276b6d7842af471dc928281f1f6f
a9d0e6b2053643a092d63dfa1671dd9e18a9529b 27-Apr-2017 Chad Brubaker <cbrubaker@google.com> Merge "Allow apps to provide the Instant App installer extra information" into oc-dev
4f4f6f83c20162814e95e9ca0654eee89a818bde 28-Mar-2017 Pavel Grafov <pgrafov@google.com> Introduce DISALLOW_BLUETOOTH_SHARING.

When this restriction is enforced Bluetooth sharing option should not be
present when the user tries to share something. Previously this was handled
by explicitly disabling bluetooth sharing activity during managed
provisioning, now this code is to be removed (see topic CLs) and the same
behavior should be achieved by setting this restriction for profile owners
by default.

In Bluetooth:
1) Don't check restrictions on boot, it is invoked anyway through the
listener during boot.
2) Ignore when the restriction is "changed" from true to true - i think
it was the initial intent in that condition.
3) Disable the component for a particular user and not always the
system user. This is something that has to be fixed in O I think since
currently in secondary user the bluetooth itself gets disabled but the
sharing thing still shows up.

In DPMS:
1) Now ActiveAdmin for PO also contains a set of restrictions applied by
default.
2) Now all ActiveAdmins for POs are loaded quite early. That shouldn't
have huge impact though.

Bug: 36249732
Test: run cts -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.ManagedProfileTest#testBluetoothSharingRestriction
Test: run cts -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.DeviceOwnerTest#testBluetoothRestriction
Test: runtest --path frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceMigrationTest.java
Change-Id: I78c4ffbd503c4a10138e8c0862a9f206f24c5631
Merged-in: I78c4ffbd503c4a10138e8c0862a9f206f24c5631
(cherry picked from commit 7f4ad75218bdd3f1bdf9022a146147eae032cc0c)
serRestrictionsUtils.java
8660a7583fa555a48d84fe8632da9e8cee92cc66 27-Apr-2017 Nicolas Geoffray <ngeoffray@google.com> resolve merge conflicts of 01f050f21fb2 to oc-dev-plus-aosp
am: be014da638

Change-Id: I5343d48d7bd21128c570feb1c4a534826dbdce10
be014da6387246edd786a4ec9ca049d3accdcd12 27-Apr-2017 Nicolas Geoffray <ngeoffray@google.com> resolve merge conflicts of 01f050f21fb2 to oc-dev-plus-aosp

Test: I solemnly swear I tested this conflict resolution.
Change-Id: If3796f456fa80c2f9c649855d39f4dab01e54f3c
01f050f21fb2d4223c0df32f92fb7e61aee54891 27-Apr-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Update frameworks/base to new compiler filters." am: 431bc34096
am: fee9c65f40

Change-Id: I19bfb0fff74e9660029f8a6eee4dd010d2f6c702
e92f79450a0e3a55586eb2992577d09fc997761a 26-Apr-2017 Makoto Onuki <omakoto@google.com> Change IMPORTANCE_PERCEPTIBLE_DEPRECATED to IMPORTANCE_PERCEPTIBLE_PRE_26

Also make sure to return the legacy value from
RunningAppProcessInfo.importance.

Bug: 37636026

Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsAppTestCases -t 'android.app.cts.ActivityManagerTest#testGetRunningAppProcesses'
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsAppTestCases -t 'android.app.cts.ActivityManagerTest#testGetMyMemoryState'
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsAppTestCases -t 'android.app.cts.AlertWindowsTests'
Change-Id: Ie04e4dfa40c28ea391ae5ce3c769c6f8ee70a43d
ackageManagerService.java
0606861de50995e997d7c117e3bab1eb5db06da8 06-Apr-2017 Chad Brubaker <cbrubaker@google.com> Allow apps to provide the Instant App installer extra information

Apps may want to provide additional context information to the instant
app installer in order to allow the installer to make smarter choices
about the context of the launch. This CL adds a bundle to
ActivityOptions that is sent to the Installer (if an Instant App is
launched) but not to any other application if something else on the
device handles the Intent instead.

Bug: 35180854
Test: manual
Change-Id: Ifc69a420a9c68041b39acd8a4b83db8a789822a6
nstantAppResolver.java
ackageManagerService.java
dc088a644d90b8a2fcae009d2a35c6df0bba3817 26-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Gather shared libs for split apks based on dependencies." into oc-dev
be7b0d18a7d68aa79dc8256ee904f0a94767d5d9 25-Apr-2017 Nicolas Geoffray <ngeoffray@google.com> Update frameworks/base to new compiler filters.

Also fix a merge issue with duplicated code.

bug:34715556
Test: build and boot aosp bullhead
Change-Id: I3b913878c83f708e752ec06f79bada1873213823
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerShellCommand.java
047c869e4875f9bc9459edd69d5a4d2ba3d4bf46 26-Apr-2017 Todd Kennedy <toddke@google.com> Merge "Merge "Add concept of implicitly exposed components" into oc-dev am: 0a4b7f5a86" into oc-dev-plus-aosp
am: eeb311e47d

Change-Id: I3857f3d588497024caab36d6a3a11f9374018c78
0a4b7f5a867612fffc14cbc480da306e89ec4892 26-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add concept of implicitly exposed components" into oc-dev
d520f3e2584e69bbf66bf88d3214a60a918c0143 25-Apr-2017 Christopher Tate <ctate@google.com> Merge "Clear default-browser state when it's uninstalled" into oc-dev am: 6338cd8155
am: 3b79ff4062

Change-Id: I2d174d7670287b235988eb82109f472cd67b5e9d
6338cd815564f8bfa2e0cd27ad898b04bb9d475d 25-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Clear default-browser state when it's uninstalled" into oc-dev
c05f5d12d9a1b98221833ec0919d081a869d2486 25-Apr-2017 Todd Kennedy <toddke@google.com> Add concept of implicitly exposed components

Implicitly exposed components are those that can still be accessed
via generic startActivity() calls. However, they cannot be started
by specifying a package or component. Additionally, package info
can't be obtained if the package only has implicitly shared
components.

Change-Id: I404a4dff87559cfeee6ad78f7dcc7f5d849d6869
Fixes: b_37343345
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
ackageManagerService.java
24a2f01faaec71b2c1c578f43fccf450e1428509 25-Apr-2017 Todd Kennedy <toddke@google.com> Merge "fix check for provider resolution" into oc-dev am: ade1496f96
am: 3627c9479a

Change-Id: I01241d8f5c5e13be273a5187502267c633e5fd9c
ade1496f967e4be96968e016d52887eadcaddd15 25-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "fix check for provider resolution" into oc-dev
53d52c8fbf814154aaa0d4209efefd4f6cb2f465 25-Apr-2017 Christopher Tate <ctate@google.com> Clear default-browser state when it's uninstalled

When the default browser is uninstalled, make sure to clean up that
bit of state in the package manager. Failing to do this was giving
the settings UI problems.

Also, don't bother twiddling intent-filter verification state around
default-browser change: that state is intentionally ignored for
browser apps anyway.

Bug 35193618
Test: manual

Change-Id: I0cedc4efdc5a7e2aa0d322e9976b68e000e6eca7
ackageManagerService.java
ettings.java
d27b6e320493c4ad2e0f16a6cffff0f0f02a7eac 24-Apr-2017 Todd Kennedy <toddke@google.com> Merge "Merge "fix service binding" into oc-dev am: 4eaeb91e42" into oc-dev-plus-aosp
am: af6b454b14

Change-Id: I55e0a3543202407577b6ebd433fdb8b406125137
d10acc1bf8f23270d110db3c69b5e8bd762e7bda 24-Apr-2017 Todd Kennedy <toddke@google.com> Merge "Merge "Send directed broadcast to the installer" into oc-dev am: 08896b34ac" into oc-dev-plus-aosp
am: 19f955ca22

Change-Id: I1238ef7c6cc59400b656069008f78d205e11d330
cc576cfbb4e3d63b5c01e1ad881f0b2c33d9bf28 24-Apr-2017 Todd Kennedy <toddke@google.com> fix check for provider resolution

Change-Id: I504e16463fbd58fb97a65ca74ffa38697e715652
Fixes: 37547666
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest#testEphemeralQuery
ackageManagerService.java
c2d407a7dc4ea0f402037cac548b47e95bf426a1 24-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Gather shared libs for split apks based on dependencies."
4eaeb91e42182cbb5c6ecfa235fd9ef6319bf25c 24-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "fix service binding" into oc-dev
08896b34ac79a64956769e1125800c7f19892f25 24-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Send directed broadcast to the installer" into oc-dev
9cea1d28dd96b05cf3cb910e03ade9dfc5146745 21-Apr-2017 Nicolas Geoffray <ngeoffray@google.com> Drop REASON_FORCED_DEXOPT.

This can already be configured with the default compiler filter.

Also remove unused performDexOptIfNeeded.

bug:35794392
Test: device boots, forced dexopt works.
Change-Id: I14fc86c4783b2d7ac9cf8972b6619ba303e79659
(cherry picked from commit e103256c1fee6b53ead10efe13ca35ad270626fa)
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
04fbbec585869fe9437651d51761509b066f6515 24-Apr-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Drop REASON_FORCED_DEXOPT."
46b4f2b7956e61cc2d4bc2f086c20ac859d44ba4 21-Apr-2017 Todd Kennedy <toddke@google.com> fix service binding

there were cases where we wouldn't bind when we should. also, add
some additional debug to better track potential connection issues.

Change-Id: I381da24f490e3102817a14428ef1a63982f33d19
Fixes: 37122153
Test: kill/upgrade GMS to ensure we re-bind in a timely manner
phemeralResolverConnection.java
nstantAppResolver.java
d85b1ddaeb342990a2f76226ecfdfd960e5c2305 21-Apr-2017 Jeff Sharkey <jsharkey@google.com> Merge "Fix code accounting bugs, track external app data." into oc-dev am: 4b32f7c676
am: 90d020d979

Change-Id: I7988898a2f2404e9af76b95190bd6ad839b85d77
5e756e61cfab898ce7c0d09ecd48e34856978afa 21-Apr-2017 Todd Kennedy <toddke@google.com> Send directed broadcast to the installer

The installer of record should be allowed background execution when
an application is removed/updated. The installer of record is the
installer that was responsible for installing the latest version of
the application.

Change-Id: I19ed0120975e6f75ac7e4982b21dd4785552a9e7
Fixes: 36788678
Test: Manual; install an app via 'adb' and set the installer, see that the installer gets the directed broadcast when the app is removed/replaced
ackageManagerService.java
4b32f7c676e014c3d59aac280be6a159cef3d4b8 21-Apr-2017 Jeff Sharkey <jsharkey@google.com> Merge "Fix code accounting bugs, track external app data." into oc-dev
e103256c1fee6b53ead10efe13ca35ad270626fa 21-Apr-2017 Nicolas Geoffray <ngeoffray@google.com> Drop REASON_FORCED_DEXOPT.

This can already be configured with the default compiler filter.

Also remove unused performDexOptIfNeeded.

bug:35794392
Test: device boots, forced dexopt works.
Change-Id: I14fc86c4783b2d7ac9cf8972b6619ba303e79659
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
5def5e5560a9f6fec1f323fdf85a8d5cb01ecec5 19-Apr-2017 Jeff Hao <jeffhao@google.com> Gather shared libs for split apks based on dependencies.

Traverses split dependency hierarchy to determine what the split paths
should be to add to the shared libs to pass down to dex2oat.

Bug: 34169257
Bug: 37480811
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests

Checked not only that CTS tests pass, but that shared libraries match
and collision checks are not being performed.

E.g. testInstallAllFeatureSplits has dependencies where:
APK_BASE <- APK_FEATURE_A <- APK_FEATURE_B and
APK_BASE <- APK_FEATURE_C.

Shared libraries passed to dex2oat:
for base.apk: /system/framework/android.test.runner.jar
for feature_a: /system/framework/android.test.runner.jar:base.apk
for feature_b: /system/framework/android.test.runner.jar:base.apk:split_feature_a.apk
for feature_c: /system/framework/android.test.runner.jar:base.apk

Change-Id: I77098452887e3a498c121be59ce1eda98b80f3e9
ackageDexOptimizer.java
08693df39d0c3248068c8d0374a8aeec65391b51 19-Apr-2017 Jeff Hao <jeffhao@google.com> Gather shared libs for split apks based on dependencies.

Traverses split dependency hierarchy to determine what the split paths
should be to add to the shared libs to pass down to dex2oat.

Bug: 34169257
Bug: 37480811
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests

Checked not only that CTS tests pass, but that shared libraries match
and collision checks are not being performed.

E.g. testInstallAllFeatureSplits has dependencies where:
APK_BASE <- APK_FEATURE_A <- APK_FEATURE_B and
APK_BASE <- APK_FEATURE_C.

Shared libraries passed to dex2oat:
for base.apk: /system/framework/android.test.runner.jar
for feature_a: /system/framework/android.test.runner.jar:base.apk
for feature_b: /system/framework/android.test.runner.jar:base.apk:split_feature_a.apk
for feature_c: /system/framework/android.test.runner.jar:base.apk

Change-Id: Ia2b0c5a7c9d6c1a2e9c5bde52ae7c53ddf964b96
ackageDexOptimizer.java
993f63270f880e2d1b880f88f2930b99dceb1068 20-Apr-2017 Svetoslav Ganov <svetoslavganov@google.com> Merge "Address API council comments" into oc-dev am: fb4fb03cc3
am: 375d615b30

Change-Id: Ibba72870f4d4da53ab411b5e279a967a86584e19
a3f70c18af934c3616952acc7bc997d8a4bdc725 20-Apr-2017 Christopher Tate <ctate@google.com> Merge "Revert "Introduce PACKAGE_FIRST_ADDED broadcast"" into oc-dev am: aa6b649a35
am: e56d699a89

Change-Id: I5d684f3dc14130655868394b001d2960a84d1579
9d7512e90221269d16d05dd47b9d80a9b3b1ef5d 20-Apr-2017 Christopher Tate <ctate@google.com> Merge "Treat the intent filter verifier app as foreground" into oc-dev am: 4b26576175
am: 1777b3f5a6

Change-Id: I8fc06443c25f0360cd140e5b3b01c27f66b32416
320dac0fae0e77209b59dde25c66bad0df3f384f 20-Apr-2017 Todd Kennedy <toddke@google.com> Merge "Adjust the bind timeout" into oc-dev am: 9d9d31d6b0
am: a01fbf8ebb

Change-Id: Ib1224838aa09c434e1113891e9b4e1fdaa19a0d7
4ba80183fafe9c0ae230991aa0e87ee6336646b3 20-Apr-2017 Todd Kennedy <toddke@google.com> Merge "Allow verifier to be optional" into oc-dev am: 8ffd8f7848
am: 72287ab766

Change-Id: I8fa8fa36781444904eb13bea539d283f79462186
696ab6b7ff3e8340b49de7dc86792225cd86f4da 20-Apr-2017 Chad Brubaker <cbrubaker@google.com> Merge "Change ANDROID_ID for Instant Apps" into oc-dev am: 904e6cad28
am: 97eecf8d09

Change-Id: Ibbea27ef27bfaa43649d0ff86e23f0ffd559d7f6
fb4fb03cc3aa273c763df97f99eae1ba11594997 20-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Address API council comments" into oc-dev
aa6b649a35072dc529c3b09bab097815fe3bff81 20-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Revert "Introduce PACKAGE_FIRST_ADDED broadcast"" into oc-dev
4b26576175ad33c204ae0cd7946f800006443712 20-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Treat the intent filter verifier app as foreground" into oc-dev
9d9d31d6b0928b891e175cc14ed11cb76dc0497e 20-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Adjust the bind timeout" into oc-dev
94b91dbbb899a4a1c9e5eec6cda5d7138f0a49b7 20-Apr-2017 Christopher Tate <ctate@google.com> Revert "Introduce PACKAGE_FIRST_ADDED broadcast"

This reverts commit ee3b42af3f23c37cbd2799c1527f89ac623844be.

Bug 37219124
Test: manual
ackageManagerService.java
8ffd8f78484410fbac45480c23e803bbb0a00ec7 19-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow verifier to be optional" into oc-dev
798cc9d0bca3485746ecafa79b6f764fed3a02da 19-Apr-2017 Todd Kennedy <toddke@google.com> Adjust the bind timeout

We were using a timeout of 5s when it should have always
been in the hundreds of ms. Setting the timeout to 300ms
for 'eng' build and 200ms for all other builds.

Change-Id: I31e17457e7bfdb3bf703be430074b718cae8c17a
Fixes: 37474581
Test: Manual; still resolve instant apps
phemeralResolverConnection.java
904e6cad286f2bf2ea4254124f4595af88104455 19-Apr-2017 Chad Brubaker <cbrubaker@google.com> Merge "Change ANDROID_ID for Instant Apps" into oc-dev
e61b60115f3b08535ebc94e57b62ddd8a3f7de0f 19-Apr-2017 Todd Kennedy <toddke@google.com> Allow verifier to be optional

Change-Id: Ibf01e5283b744f7745e92523787abb3d31a2c813
Fixes: 37412895
Test: Manual; disable verifier and notice that the device doesn't boot loop
ackageManagerService.java
fb9bd09db0e9155f5291f91029a9dedbced0da17 19-Apr-2017 Christopher Tate <ctate@google.com> Treat the intent filter verifier app as foreground

Similarly to other install-time validation, its work is a direct
extension of the OS's processing of a user-initiated install action,
so it's appropriately modeled as being "foreground" work.

Bug 37502027
Test: manual

Change-Id: Ib6426fa3c7cb05c4e758ddad3356011e4753629e
ackageManagerService.java
0d277a7b189c8807d142b69dd8d00b17978a49a5 13-Apr-2017 Chad Brubaker <cbrubaker@google.com> Change ANDROID_ID for Instant Apps

ANDROID_ID for Instant Apps now has the following properties:
1) per-app scoped
2) reset if the user clears the Instant App
3) remains the same if the Instant App gets upgraded to an installed
app.

Note that if the user goes instant -> installed_1 -> uninstall ->
installed_2 the ANDROID_ID at installed_1 will not be the same as
installed_2. This was deemed better than the id changing on the upgrade
step.

Test: manual
Change-Id: I532975c50049c94ff80902a897e001dd35a69f9f
nstantAppRegistry.java
ackageManagerService.java
c6687daa3b64c8fd4d3a6f330122bd7042df8631 06-Apr-2017 Jeff Hao <jeffhao@google.com> Handle shared libraries for split apks.

As we dexopt all the code paths of a package, we now append the code
paths to the list of shared libraries. These paths are passed as
relative paths since the apks are staged during installation, and are
not where they will be at runtime.

Part of a multi-project change.

Bug: 34169257
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests

(cherry-picked from commit 832641bb7205126829d425401a5262ab2e26fa80)

Change-Id: I28b1f8db6035ec62a5947679ed09013b1f9523a2
ackageDexOptimizer.java
98f62d8aa05479221ec0f35513cfac62a115922f 19-Apr-2017 Jeff Hao <jeffhao@google.com> Merge "Handle shared libraries for split apks." am: 9487dff8ab
am: dae160f51b

Change-Id: I3b8fd7be7bf987858df229cfd95ca8d4dc170b54
5d7027db6e0b82c0ffcb101c3a17997f6aefafc5 12-Apr-2017 Andrew Scull <ascull@google.com> Add implementation alternatives for OemLockManager.

The OEM lock can be implemented with the persistent data block or the
OemLock HAL.

Test: gts-tradefed run gts -m GtsOemLockServiceTestCases -t com.google.android.oemlock.gts.OemLockServiceTest
Bug: 34766843
Change-Id: I16b31785d9af58212a050a299ef024be3139f0c6
serRestrictionsUtils.java
35f1fe185421db533461218d3ed14a88994b33cd 19-Apr-2017 Svetoslav Ganov <svetoslavganov@google.com> Merge "Address API council comments" into oc-dev am: 57ed0ba69d
am: dca67a7f48

Change-Id: I991a268bf1dfc908249c3114802ea0cc2b567c63
0034788844fd053f87beee60092c1dd44c7046e2 18-Apr-2017 Jeff Sharkey <jsharkey@android.com> Fix code accounting bugs, track external app data.

When counting code size, don't include APKs baked into the system.

Settings already accounts external storage used by apps, so they
need a way to exclude that from the total space used by external
storage; give them new getAppSize() API.

Refine docs to explain that emulated storage might be included in
measured statistics.

Resolve symlinks as part of matching getUuidForPath().

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.StorageHostTest
Bug: 35812899, 35844919, 37193650
Change-Id: Iec3ce8b336b71dc98a7d25fdd30fa78e9ee826dc
nstaller.java
57ed0ba69d7f36493fc45cac66764bfeb10c6998 19-Apr-2017 Svetoslav Ganov <svetoslavganov@google.com> Merge "Address API council comments" into oc-dev
7da652fd43fcbeb3d62093259970f458c20ee076 06-Apr-2017 Jeff Hao <jeffhao@google.com> Handle shared libraries for split apks.

As we dexopt all the code paths of a package, we now append the code
paths to the list of shared libraries. These paths are passed as
relative paths since the apks are staged during installation, and are
not where they will be at runtime.

Part of a multi-project change.

Bug: 34169257
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests

Merged-In: I73823ca575560cbd445d78a6cfbfc72031943265
(cherry-picked from commit 16d4843433e024100b4ecd183f827ad5bd8772a6)

Change-Id: I943bf8234899e1b25d4eb5e98af15d9150a7a842
ackageDexOptimizer.java
345ffa5421f4158b9c30439b9f18aed7b61aaea9 19-Apr-2017 Svetoslav Ganov <svetoslavganov@google.com> Address API council comments

Test: cookie CTS tests pass

bug:37327624
bug:37325276
bug:37323696

Change-Id: I52b10470759e471629ec6772e115df94482eb341
nstantAppRegistry.java
0cb43ef67b5d284f6c0afbca5a50e189355c0ab3 18-Apr-2017 Svetoslav Ganov <svetoslavganov@google.com> Address API council comments

Test: all static shared lib CTS tests pass

bug:37327970

Change-Id: Ie8c4d853da5fa0a6125b9def38831860f79ce53d
ackageManagerService.java
832641bb7205126829d425401a5262ab2e26fa80 06-Apr-2017 Jeff Hao <jeffhao@google.com> Handle shared libraries for split apks.

As we dexopt all the code paths of a package, we now append the code
paths to the list of shared libraries. These paths are passed as
relative paths since the apks are staged during installation, and are
not where they will be at runtime.

Part of a multi-project change.

Bug: 34169257
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests

Change-Id: I73823ca575560cbd445d78a6cfbfc72031943265
ackageDexOptimizer.java
43b98a8f9dc42a51d0eb6721dc716fd2a15f86a8 18-Apr-2017 Erik Wolsheimer <ewol@google.com> DO NOT MERGE Mask case of base or tree permission being null am: cb8a640cef
am: 28fc6a28aa

Change-Id: Ia0dab8845a34753ed46199462a9e12c25f9a615f
28fc6a28aad92887a6bdd540d6d9544d46f403b0 18-Apr-2017 Erik Wolsheimer <ewol@google.com> DO NOT MERGE Mask case of base or tree permission being null
am: cb8a640cef

Change-Id: I43289a33b8e1e6df9307cd11891feff4d739da14
cb8a640cef14c3bc6d4fd2e96c43a87ea4702c27 18-Apr-2017 Erik Wolsheimer <ewol@google.com> DO NOT MERGE Mask case of base or tree permission being null

Bug: 34850544
Change-Id: I4bf9e85d7e615ccdb75752503e58d7e7f47b04c2
ackageManagerService.java
7fd27722fcb31411d30a369fe08a01271bc1877e 18-Apr-2017 Andreas Gampe <agampe@google.com> Merge "OtaDexopt: Add version support" into oc-dev am: 0c1b4769c7
am: cbefc3d308

Change-Id: Ib2a69149f3330b0fada90cd205ce287689fc566d
058641607fe22cb65232e3bfb58de08f66d22c38 18-Apr-2017 Christopher Tate <ctate@google.com> Merge "Turn down the preliminary foreground service API" into oc-dev am: 00ed0baca8
am: 663de998e7

Change-Id: I1c70471deaa3991945d2950d1c6e0f5bc90805b4
0c1b4769c778c3cd3627d0382efaf66d6b9ff402 18-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "OtaDexopt: Add version support" into oc-dev
00ed0baca874e171ecb39e51edfe0ee6eb6646f2 18-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Turn down the preliminary foreground service API" into oc-dev
37f190b346b899240656dece9ea57e45a34fe668 17-Apr-2017 Andreas Gampe <agampe@google.com> OtaDexopt: Add version support

Add version number to dexopt command. Current version is "2."

37256688
Test: m
Test: Manual OTA O (v2) -> O (v2)
Change-Id: I9fff673f3ba99833e88cf1c5c9625f42436ec150
taDexoptService.java
242ba3e997b45ec7ab5f8c40663c9044a13ad31f 15-Apr-2017 Christopher Tate <ctate@google.com> Turn down the preliminary foreground service API

The NotificationManager.startServiceInForeground() experiment is over,
and will not ship as API, so it's time to tidy up and get rid of it.

Bug 36130212
Test: manual

Change-Id: I834d1ce059aa464ff27f69f5e5d3625cc5e61d8a
ackageManagerService.java
e400c441c2669b7b3643d70ecc5a637ecf8d2b54 11-Apr-2017 Mike Tsao <miket@google.com> Add tests for ag/2086796

Fixes: 37192695
Change-Id: Id0b3cbf986490d64cdc5592541dee1b004853503
Test: added
(cherry picked from commit cfe4ffecceee005ff6bc79dcc1637f44f82bd43a)
ackageManagerService.java
e15f91276c7af4b8c064aa33518519603d494bb2 17-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix issue #35811414: Allow manifest receivers for ACTION_UID_REMOVED" into oc-dev
bcc7cebcdb0434241dfe85e7ef030b845540372c 17-Apr-2017 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #35811414: Allow manifest receivers for ACTION_UID_REMOVED"
56f715160e12c7262502e6cf3e217c991adf7494 17-Apr-2017 Todd Kennedy <toddke@google.com> Merge "expose the instant app installer component" into oc-dev am: 676590d060
am: 8d0dacb5b1

Change-Id: Id1df099740c6e108878c8f10aacceb59b42b0041
855aa45b880dfb2016ecc1ebc03bf4a67cb21864 15-Apr-2017 Dianne Hackborn <hackbod@google.com> Fix issue #35811414: Allow manifest receivers for ACTION_UID_REMOVED

Test: booted and ran.
Change-Id: Id972da711188177ca3ac38a22efa04c5901e7d47
ackageManagerService.java
a138567131896ff47f17af72b82deabf8f8d9080 15-Apr-2017 Dianne Hackborn <hackbod@google.com> Fix issue #35811414: Allow manifest receivers for ACTION_UID_REMOVED

Test: booted and ran.
Change-Id: Id972da711188177ca3ac38a22efa04c5901e7d47
Merged-In: Id972da711188177ca3ac38a22efa04c5901e7d47
ackageManagerService.java
801e65905b267014f390439cf8388b6ccc854e18 12-Apr-2017 Todd Kennedy <toddke@google.com> expose the instant app installer component

Bug: 35873804
Test: TreeHugger
Change-Id: I4d962927587bb10833bfe3c3db27fdceab668fc3
ackageManagerService.java
5fb012e45d36e27eca40ce359034fe7afe9d89e8 14-Apr-2017 Todd Kennedy <toddke@google.com> Merge "Filter instant app content providers" into oc-dev am: 3891674204
am: 0bb486bcb4

Change-Id: If96297cade9909d744eb57669aecd96841a27a31
d593e402c20cf819fa3d73db5ba9e3ff0508d656 14-Apr-2017 Chris Tate <ctate@android.com> Merge "Introduce PACKAGE_FIRST_ADDED broadcast" into oc-dev am: 117ac766a9
am: 636915a2ed

Change-Id: I28d8d31b30c9b500be1796566bb9885741b9aedc
9c1a13271eb74efca62e26d88887bb84388303c8 13-Apr-2017 Mike Tsao <miket@google.com> Merge "Add tests for ag/2086796"
38916742040f33f821ca5381c66160bb5b25214d 13-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Filter instant app content providers" into oc-dev
117ac766a931e1893fb4a61a95670d23c409f140 13-Apr-2017 Chris Tate <ctate@android.com> Merge "Introduce PACKAGE_FIRST_ADDED broadcast" into oc-dev
cfe4ffecceee005ff6bc79dcc1637f44f82bd43a 11-Apr-2017 Mike Tsao <miket@google.com> Add tests for ag/2086796

Fixes: 37192695
Change-Id: Id0b3cbf986490d64cdc5592541dee1b004853503
Test: added
ackageManagerService.java
0c48ce1309768c25e9ad3e656f22cd182760032c 13-Apr-2017 Fyodor Kupolov <fkupolov@google.com> Merge "Report app data fixup and prepare timings" into oc-dev am: 1423ea3a45
am: 9f3cf1a692

Change-Id: I81dfcf98097d356e53994ba7ffaf247618349304
1423ea3a45761eec3c98fe470373407bc3e6316f 13-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Report app data fixup and prepare timings" into oc-dev
ee3b42af3f23c37cbd2799c1527f89ac623844be 11-Apr-2017 Christopher Tate <ctate@google.com> Introduce PACKAGE_FIRST_ADDED broadcast

When an app first appears on a device, this new broadcast is issued
including to manifest receivers. The more general PACKAGE_ADDED
broadcast continues to be issued for both first install and updates,
but is not delivered to manifest receivers of apps that target O+.

Bug 37219124
Test: manual

Change-Id: I59b0a0b0dce96a909076b41280771f63e59584be
ackageManagerService.java
c06c0306717d0e1fc132541127f3657e937f02f4 10-Apr-2017 Todd Kennedy <toddke@google.com> Filter instant app content providers

Only expose the correct content providers depending upon which
component defines/exposes them.

Change-Id: I283c787165e33d9515068487f83de6d28616b427
Fixes: 35871462
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
ackageManagerService.java
7d0b84e1dffa6cd2a4a0006f85fd2c1ff4f466dd 12-Apr-2017 Todd Kennedy <toddke@google.com> Merge "Allow instant app resolution for any user" into oc-dev am: e7b806e9d2
am: 455b742bb6

Change-Id: I12b658529a580c1d29e7dc99f60b87ff048706a3
93b7acddf844d000c699899f0da2db2e69fafc51 12-Apr-2017 Jesse Evans <jsje@google.com> Merge "Rename WEB_ACTION_ENABLED to INSTANT_APPS_ENABLED" into oc-dev am: 684b5381e9
am: 3d1676cfc4

Change-Id: I0cc0d165ad5bceb1d93cbe48030e347b53e3caf4
e7b806e9d27ca20103cf5f4b7df32ce9bdc6aa49 12-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow instant app resolution for any user" into oc-dev
fc1bfc442cb52d4f904e6bf946f191bcf007277a 08-Apr-2017 Jesse Evans <jsje@google.com> Rename WEB_ACTION_ENABLED to INSTANT_APPS_ENABLED

Renames the instant apps setting to reflect what it is for.

Adds the SystemApi annotation to make this field visible
to the resolver and installer.

Test: existing tests

Change-Id: I1651bb101d69bdfdaa63c004435025c68a33cd8e
ackageManagerService.java
103f797a4c18a44982a7c1c52602e8945a0936ac 12-Apr-2017 Pavel Grafov <pgrafov@google.com> Merge "Introduce DISALLOW_BLUETOOTH_SHARING."
fac61e4928f0b638efc85270a2bafef2b4bbb415 12-Apr-2017 Andreas Gampe <agampe@google.com> Merge "OtaDexOptService: Log post-reboot moves" into oc-dev
a1ff00157c0ba3aa7ad93d5a4695fed97e18c430 12-Apr-2017 Fyodor Kupolov <fkupolov@google.com> Report app data fixup and prepare timings

They are now reported under SystemServerTimingAsync tag, which is
tracked by boottime dashboard.

Test: manual
Bug: 37186619
Change-Id: Ib3608d7cf27012b5dab1947446fcb8d8496bbf91
ackageManagerService.java
539e7af8a3c653f3c0230daaa225dbd7220ac98b 11-Apr-2017 Jaekyun Seok <jaekyun@google.com> Merge "Rebase enabled overlays for every PackageParser.generateActivityInfo() call" into oc-dev am: ad724f61ad
am: 65d4c83be7

Change-Id: I8ac06c1ea5deef261dc6e3da817f40ac42d85aff
65d4c83be73ca01b18267efedf3b91bef843968e 11-Apr-2017 Jaekyun Seok <jaekyun@google.com> Merge "Rebase enabled overlays for every PackageParser.generateActivityInfo() call" into oc-dev
am: ad724f61ad

Change-Id: I396870c82c6cdb1e4b709ff17cc1de4f62492a0a
ad724f61ade7b165bcbe6bbd93da62835dc8d636 11-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Rebase enabled overlays for every PackageParser.generateActivityInfo() call" into oc-dev
918d3fef695f0f7c45931148d3ad50686f514a75 11-Apr-2017 Todd Kennedy <toddke@google.com> Merge "add debug logs" into oc-dev am: 7fa473b1aa
am: 6f590d0913

Change-Id: I55f42ea0f15d271af80192a3e48cc6e20c4a9f75
6f590d09136bd0dd83ae6d11288808ed4abde0b7 11-Apr-2017 Todd Kennedy <toddke@google.com> Merge "add debug logs" into oc-dev
am: 7fa473b1aa

Change-Id: I1ea353968caff9d4e1ce2ef56267a40e3801be14
7fa473b1aa6acdbf65cc4079dd55710992a0c184 11-Apr-2017 Todd Kennedy <toddke@google.com> Merge "add debug logs" into oc-dev
bf297bcf295735d186a627acbefa68f183562070 11-Apr-2017 Todd Kennedy <toddke@google.com> Allow instant app resolution for any user

Change-Id: Iaf26cfda3a8226d97eb147b0a9e62f051b33e81b
Fixes: 37215608
Test: Swtich to secondary user and see that instant apps resolve and launch
ackageManagerService.java
e5be43c1cda6d72d4cea213793cbb00f66311229 11-Apr-2017 Andreas Gampe <agampe@google.com> Merge "OtaDexOptService: Log post-reboot moves" am: ac293515b3 am: 4e04b5882f am: 5e81820123
am: c3118992fb

Change-Id: I62728490a76253ec90584750ccf4dcea85ca6a11
c3118992fb6b258e20eea459ace085a5d687f71b 11-Apr-2017 Andreas Gampe <agampe@google.com> Merge "OtaDexOptService: Log post-reboot moves" am: ac293515b3 am: 4e04b5882f
am: 5e81820123

Change-Id: Ibad423bf2f49ec4af474ade4dd74fb772f50c50a
5e81820123ced1a8d33fb847530533ce2066438f 11-Apr-2017 Andreas Gampe <agampe@google.com> Merge "OtaDexOptService: Log post-reboot moves" am: ac293515b3
am: 4e04b5882f

Change-Id: I6a94ee15c203a5386c5e92f49b65544d75d55e18
3e1b6ad1e3eda378738d03e5861b344992e80f86 11-Apr-2017 Andreas Gampe <agampe@google.com> OtaDexOptService: Log post-reboot moves

Disable artifact checks for non-upgrade booting. Log the number of
successfully move artifacts.

(cherry picked from commit 95349c0e9664ec6392a959893f96390310e3b8a4)

Bug: 37158297
Test: m
Test: manual
Change-Id: Ic81531950582ce937e2e3b7815fb9132888d9a42
taDexoptService.java
7f4ad75218bdd3f1bdf9022a146147eae032cc0c 28-Mar-2017 Pavel Grafov <pgrafov@google.com> Introduce DISALLOW_BLUETOOTH_SHARING.

When this restriction is enforced Bluetooth sharing option should not be
present when the user tries to share something. Previously this was handled
by explicitly disabling bluetooth sharing activity during managed
provisioning, now this code is to be removed (see topic CLs) and the same
behavior should be achieved by setting this restriction for profile owners
by default.

In Bluetooth:
1) Don't check restrictions on boot, it is invoked anyway through the
listener during boot.
2) Ignore when the restriction is "changed" from true to true - i think
it was the initial intent in that condition.
3) Disable the component for a particular user and not always the
system user. This is something that has to be fixed in O I think since
currently in secondary user the bluetooth itself gets disabled but the
sharing thing still shows up.

In DPMS:
1) Now ActiveAdmin for PO also contains a set of restrictions applied by
default.
2) Now all ActiveAdmins for POs are loaded quite early. That shouldn't
have huge impact though.

Bug: 36249732
Test: run cts -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.ManagedProfileTest#testBluetoothSharingRestriction
Test: run cts -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.DeviceOwnerTest#testBluetoothRestriction
Test: runtest --path frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceMigrationTest.java
Change-Id: I78c4ffbd503c4a10138e8c0862a9f206f24c5631
serRestrictionsUtils.java
809506694b0e225366790035d27f7dd629dd21b0 11-Apr-2017 Fyodor Kupolov <fkupolov@google.com> Merge "Cache mEphemeralAppsDisabled state" into oc-dev am: aedca2e55d
am: 101a03b58c

Change-Id: I7d07e9038f270d5d69f7a81b3c8c6173a1fde079
467ef375b73522f5b352b4be9bff786d1dc8eca0 09-Apr-2017 Jaekyun Seok <jaekyun@google.com> Rebase enabled overlays for every PackageParser.generateActivityInfo() call

PackageParser.generateActivityInfo() generates ApplicationInfo as well.
So enabled overlays should be rebased for the ApplicationInfo to keep
the overlay path info correctly.

Test: building succeeded and tested on sailfish device.
Bug: 37179769
Change-Id: I12727fd27c1d4cf37ad63b333792108a82efccd6
ackageManagerService.java
aedca2e55d5d5b9ebe957431b9515e3b23406565 11-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Cache mEphemeralAppsDisabled state" into oc-dev
95349c0e9664ec6392a959893f96390310e3b8a4 11-Apr-2017 Andreas Gampe <agampe@google.com> OtaDexOptService: Log post-reboot moves

Disable artifact checks for non-upgrade booting. Log the number of
successfully move artifacts.

Bug: 37158297
Test: m
Test: manual
Change-Id: Ic81531950582ce937e2e3b7815fb9132888d9a42
taDexoptService.java
7cf918ed2d5e7274793c94503d356ca4e052d57b 11-Apr-2017 Todd Kennedy <toddke@google.com> add debug logs

Test: TreeHugger
Change-Id: I4b12acb43aa4af7a5587842fe5e2528fee8f4fed
phemeralResolverConnection.java
368423cf3c2ba3e99f0d0825fca13a55085f7882 10-Apr-2017 Todd Kennedy <toddke@google.com> Merge "send broadcast to the right users" into oc-dev am: 4a30689414
am: 41d82e619f

Change-Id: I25cf7f76c50ddb9770a060a1be5dac878fb3b16d
433d68713f76a4fe0c4616d775ae90c4133105b1 07-Apr-2017 Fyodor Kupolov <fkupolov@google.com> Cache mEphemeralAppsDisabled state

Init mEphemeralAppsDisabled in systemReady when settings provider
is available.

Registered content observers for ENABLE_EPHEMERAL_FEATURE and
WEB_ACTION_ENABLED.

Test: manual triggering enable_ephemeral_feature=1/0
Fixes: 36869938
Fixes: 36895304
Change-Id: I0051c45bb209d86041b967a409f8a95967df21dc
ackageManagerService.java
4efa14c78449d5ef6c222256fa63edc09d91c1ff 10-Apr-2017 Todd Kennedy <toddke@google.com> send broadcast to the right users

Change-Id: Ibda2d922cd58d6ca1c1a4ecdccaa25e5c71c6320
Fixes: 37192695
Test: manual; create restricted profile and see that users haven't been removed
ackageManagerService.java
ac1f2d07f7be237ca457940ee90e68d9668aeb10 07-Apr-2017 Calin Juravle <calin@google.com> Merge "Check for a null packageInfo before notifying about app install" into oc-dev am: 1fd46de245
am: 63b897585a

Change-Id: I9ebef84e044424da11cecb5acd91e016a3485410
1fd46de245e24d7e73a9d283c1af544915e0d3bc 07-Apr-2017 Calin Juravle <calin@google.com> Merge "Check for a null packageInfo before notifying about app install" into oc-dev
a030c55048c856149e8c7df8fa4f702eca27c107 07-Apr-2017 Calin Juravle <calin@google.com> Merge "Reconcile secondary dex paths when compiling with adb shell cmd..." into oc-dev am: d34076385d
am: e5fffd4b83

Change-Id: I24607ab97be3acbb06cac8f2c78416ae092865eb
7502ddd83dc70c2711ba1cb5dc8756db81fe7a27 07-Apr-2017 Calin Juravle <calin@google.com> Merge "Pass SElinux info to installd dexopt" into oc-dev am: 31762dd9a0
am: e5b210fc55

Change-Id: I7e9ff742f23b5b22fcc70f6e06209c05ad2fcfed
d34076385d34ee4b4d4712e33d10133d08339d49 07-Apr-2017 Calin Juravle <calin@google.com> Merge "Reconcile secondary dex paths when compiling with adb shell cmd..." into oc-dev
31762dd9a0d02c291d7b4282a8c398177a89ae6d 07-Apr-2017 Calin Juravle <calin@google.com> Merge "Pass SElinux info to installd dexopt" into oc-dev
9b87b969f47bbb57fcc9d6e250550c91b7065b95 07-Apr-2017 Todd Kennedy <toddke@google.com> Merge "change how instant app installer is updated" into oc-dev am: 5b36b4db64
am: 573d7a08a8

Change-Id: I4e62b52abeabac8a905497476255749bae0f5680
5b36b4db648c98f7853fc240b4abb02d052b2b4c 06-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "change how instant app installer is updated" into oc-dev
0f8e46aef0e753649c287ca569c1cf63b77735e3 06-Apr-2017 Svetoslav Ganov <svetoslavganov@google.com> Make sure pending cookie persistence canceled am: 8aa379e0eb
am: a1dfc0f975

Change-Id: Ibfd0b6b418ec74e0b330255ac43ec57a9f4be592
7671735fa5d307e559ea9873fe94d720ff01b553 06-Apr-2017 Chad Brubaker <cbrubaker@google.com> Merge "Allow permissions to be runtime-only." into oc-dev am: 941e9e2b38
am: 57a9464831

Change-Id: Ibf8b8f13ff5a8819671142e77ee238ba08805d40
c33cbb21e8cc3d3501fc53c45e9263274c524d85 05-Apr-2017 Todd Kennedy <toddke@google.com> change how instant app installer is updated

. only pay attention to package changes if there's no
installer or the changed package is the installer
. always update the installer component, even if the
resolved component is identical [the install paths
might have updated]

Change-Id: I16eba07ccdb55f5cb61ba6172e71ce1698445fa5
Fixes: 36740490
Test: Manually install/remove/update the installer and see that the component is updated
ackageManagerService.java
8aa379e0eb2aa87129e8d95751eb5cdd5a435d38 05-Apr-2017 Svetoslav Ganov <svetoslavganov@google.com> Make sure pending cookie persistence canceled

When a full app is uninstalled we delete its instant app
cookie but were not canceling a pending write which ended
up having the written cookie file after the app is uninstalled.

Test: InstantCookieHostTest#testCookieResetOnNonInstantReinstall

bug:36455310

Change-Id: Iec6d1f95f8ff731885241913808daf12ce3a5587
nstantAppRegistry.java
72bb1c61c57705df3b3ea7626ef408126d0817f1 06-Apr-2017 Calin Juravle <calin@google.com> Check for a null packageInfo before notifying about app install

Test: device boots (wasn't able to repro the race)
Bug: 36642664
Change-Id: Ibab3109a8605c2ff8555d3308cb96389e480cc84
ackageManagerService.java
91d6a8a0e95f2a88ba7bea1d2d5067997f080459 06-Apr-2017 Todd Kennedy <toddke@google.com> Merge "Bind with the correct action" into oc-dev am: e7ec7ec634
am: f97938f9d0

Change-Id: I22c9be81cd3dc580fc3b5edc82f0d0f28cc38952
941e9e2b38ae46e167d03f5d5d7afb9701dde88f 06-Apr-2017 Chad Brubaker <cbrubaker@google.com> Merge "Allow permissions to be runtime-only." into oc-dev
13dcd27fb54546d33fa949ec9e7b81fc973ecb88 06-Apr-2017 Calin Juravle <calin@google.com> Reconcile secondary dex paths when compiling with adb shell cmd...

Test: running `adb shell cmd package compile -r bg-dexopt -f --secondary-dex com.google.android.gms` prints no error for missing dex files.

Bug: 36895499
Change-Id: Ibde3d47121dcb2c252fe29772d8db81ea599b2d0
ackageManagerService.java
e7ec7ec6343b2de2e072749c5cdb710da1437880 06-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Bind with the correct action" into oc-dev
45ecfa677088156d73408169ad1c572e79adef20 06-Apr-2017 Calin Juravle <calin@google.com> Merge "Keep track of protected data dirs in DexManager" into oc-dev am: 539128f6d6
am: 50d47492f1

Change-Id: Ie68b20aa4e30ba24c2ec7a3e2c7e0b315d59d931
539128f6d652d0a38cede9cb4dbb9888f89ffbcf 06-Apr-2017 Calin Juravle <calin@google.com> Merge "Keep track of protected data dirs in DexManager" into oc-dev
811a75a0c0dbe211ccabdfbfba60c8f76d5738eb 06-Apr-2017 Calin Juravle <calin@google.com> Pass SElinux info to installd dexopt

For secondary dex files, the oat directory is created on the fly. We
need to make sure we restore the SElinux context after the oat files are
generated. To do that we need to pass the app SElinux info to installd
dexopt.

Bug: 36896515
Test: adb shell cmd package compile -r bg-dexopt --secondary-dex com.google.android.gms
adb shell ls
/data/user_de/0/com.google.android.gms/app_chimera/m/0000000c/oat/arm64/
-Z
youtube loads gms modules without extracting from apk

Change-Id: I5be34b42a509701f6222ca52bec4761c161ec6eb
nstaller.java
taDexoptService.java
ackageDexOptimizer.java
205eb2f4c6ca958251588e3f9e7816547490c73f 06-Apr-2017 Todd Kennedy <toddke@google.com> Merge "don't honour domain verification for browsers" into oc-dev am: 154836844d
am: e97e0abd9d

Change-Id: I918d04c5fbd998bcf6b678f3cc634c55f8ad39b8
154836844d280ebfeb8ae81eb650083dce6e4a7c 06-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "don't honour domain verification for browsers" into oc-dev
d7a44e499086bccb6a3901e645c28f1f316b259e 06-Apr-2017 Calin Juravle <calin@google.com> Merge "Fix dex flags for secondary dex files" into oc-dev am: b0baef0715
am: c7929b73e4

Change-Id: I0cbbc5ac102c34c1bee94f5b6ff48f661b8174e7
a97bda90c7950acb36191acd7ac62ceece2d585d 06-Apr-2017 Todd Kennedy <toddke@google.com> Merge "don't log non-instant app resolutions" into oc-dev am: f2e4e8ba90
am: 28bd2a06ac

Change-Id: Iddf35acbedde0e77d496b4e6996ac12d2c7a9143
b0baef0715d848d282769ae54ca3b43760199bad 06-Apr-2017 Calin Juravle <calin@google.com> Merge "Fix dex flags for secondary dex files" into oc-dev
d40276760bb20b05dbd94a7456dc90f74d4004a7 06-Apr-2017 Christopher Tate <ctate@google.com> Merge "Allow background default container service in a less crashy way" into oc-dev am: 0283544c49
am: 9e8672a482

Change-Id: Iebeda2dbcf94c3546b124b30741c15d2ef1ef5a3
f2e4e8ba90559cf83bdb5b1ab3eef07e1609fb5e 05-Apr-2017 Todd Kennedy <toddke@google.com> Merge "don't log non-instant app resolutions" into oc-dev
02a6b73e979e07bfd20cbaca01cb16a165c7b791 05-Apr-2017 Todd Kennedy <toddke@google.com> Bind with the correct action

While services themselves don't need an action when an explicit
component is specified, services in GMS may be different. In
the case of instant apps, the resolver service is hidden behind
a proxy that uses the action to route to the actual, implementing
service.

Bug: 36594944
Test: see that ephemeral resolution occurs
Change-Id: Id8c352614f780dc63f36c65be2ddb2d480b6846b
phemeralResolverConnection.java
ackageManagerService.java
f6746ce14819b3b153e2d20ae3d85069ae5578a9 05-Apr-2017 Todd Kennedy <toddke@google.com> don't honour domain verification for browsers

When a default browser is set, we change its domain verification status
to "INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS". This change is
global and permanent; it affects all URLs and won't be cleared by
resetting the browser's domain handling in settings.

To properly handle this, we don't pay attention to the domain verification
status for "browser" applications when we determine whether or not to
offer an instant app.

Change-Id: I1e2766e9856b0c9d3276e33a8db10195c72ae6ea
Fixes: 36978307
Test: Install firefox, start a browser intent [from command line], select chrome and choose "use always", start another browser intent that resolves to an instant app, see that ephemeral apps still resolve
ackageManagerService.java
0283544c498bbc8293207ffb47662e285bf42384 05-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow background default container service in a less crashy way" into oc-dev
1823cd2a8fb6237415622524ac87d8d5364332a0 05-Apr-2017 Todd Kennedy <toddke@google.com> Merge "look for old intent values" into oc-dev am: 1aade4e4a1
am: 057e80d21c

Change-Id: I5d4cfc4ccc8567f39bb0691868e3310a718c8d04
adbadd5577d2b1291d10146b6ffb5577cf236528 29-Mar-2017 Calin Juravle <calin@google.com> Keep track of protected data dirs in DexManager

Apps may store data in any of their protected dirs
(deviceProtectedDataDir or credentialProtectedDataDir).

DexManager used to keep track of only the default data directory, which
could be any of them. The CL adds support for all protected dirs.

Test: runtest -x services/tests/servicestests/src/com/android/server/pm/dex/DexManagerTests.java
check that all of gmscore modules get recorded and compiled with
adb shell cmd package compile --secondary com.android.google.gms

Bug: 32871170
Change-Id: Id98904ce9e9fc8bb060b01c6fbb9ccce8f7f5328
ackageDexOptimizer.java
ex/DexManager.java
2952cbeb8e42558d78e5897a7f860b8b32e81e5f 05-Apr-2017 Todd Kennedy <toddke@google.com> look for old intent values

the instant app installer/resolver/setting components haven't updated
to the new values yet. Need to continue looking for the previous intent
values.

Test: boot and see ephemeral enabled
Change-Id: Id88191a4878a138fa90bbd9816805ff76665ada9
ackageManagerService.java
efb1c943598f4969855b4a8e181921b9b11718b8 05-Apr-2017 Calin Juravle <calin@google.com> Fix dex flags for secondary dex files

getDexFlags should always be called after getRealCompilerFilter.
Otherwise public dex files might be considered private and their oat
file will not be readable by others.

Bug: 36896515
Test: adb shell cmd package compile -r bg-dexopt --secondary-dex com.google.android.gms
check that the oat directory and files have the right permissions

Change-Id: Ic91957f155c2008ed59a7e2ba14732e5af88d12a
ackageDexOptimizer.java
0dce786e5b9d1ebe060079292ce8c922e56b7512 05-Apr-2017 Todd Kennedy <toddke@google.com> Merge "Don't broadcast PACKAGE_REMOVED for InstantApps" into oc-dev am: b28e1e68d2
am: 33f6353479

Change-Id: I9d8ee046726d0be1d9ca5344aa80966f2af914ed
b28e1e68d2e3623d2a526654817e0d695e0a8440 05-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't broadcast PACKAGE_REMOVED for InstantApps" into oc-dev
424b03f75e98c8af4061236ef1dd2785f5608299 04-Apr-2017 Christopher Tate <ctate@google.com> Allow background default container service in a less crashy way

Turns out we run this code during early boot, before the device idle
service has even been constructed yet. Find another way to achieve
the needed service execution.

Bug 36865930
Test: manual

Change-Id: I8e3304f37c3a5ee125b73aef2b7d7c7b387aa200
ackageManagerService.java
158a760a54d3962b32b1f6d22b3592739ee228ae 05-Apr-2017 Todd Kennedy <toddke@google.com> Merge "Change name of the intent fields" into oc-dev am: 5379b05256
am: 368628cd8e

Change-Id: I0861afea841e3e5b4b2bf94d522e6ddc2eca2cc4
5379b05256166b7ec01da3f8776a23340fabf9f5 05-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Change name of the intent fields" into oc-dev
3daefb4b102a92fc9bf3ea9c382e8e673bb070d9 04-Apr-2017 Todd Kennedy <toddke@google.com> Don't broadcast PACKAGE_REMOVED for InstantApps

Change-Id: I7f054bbf844ad6c1b9a8aa20c5ba91cbf9a5db04
Fixes: 36444594
Test: Manual; uninstall AIA and see that the broadcast isn't sent
ackageManagerService.java
f4628d92e0fed4bf63d630a3bf92eae09c64afe3 04-Apr-2017 Jeff Sharkey <jsharkey@android.com> Merge "Offer to "fixup" GIDs used for app data." into oc-dev am: 359ce10912
am: 200d520261

Change-Id: Id2e36dad9e750904c8c2b6e2de61a173631a73e0
359ce10912dcf2f9ccdbb5e3dfd5afad055a25c1 04-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Offer to "fixup" GIDs used for app data." into oc-dev
e9018108626b1b58ee027b6e2bda3880422929b1 04-Apr-2017 Fyodor Kupolov <fkupolov@google.com> Merge "Dump PackageInstaller state outside of mPackages lock" into oc-dev am: 2b285566a4
am: 79151ce8b5

Change-Id: Idaac5880933d4277dad21ccd9c9f8964a8ec1ece
2b285566a4fd99640be5f029ffa78320d265b22f 04-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Dump PackageInstaller state outside of mPackages lock" into oc-dev
fdb8916ece6b2234a80a11f81fefb38d7520a55e 04-Apr-2017 Todd Kennedy <toddke@google.com> Merge "rebind if the connection drops" into oc-dev am: dff13a0bb1
am: a2c07cec34

Change-Id: I497b7415146efa6f5c5f6320651bffaa4cfd77c1
d46a1604b7e95f7c04966d2961f59858651495c2 04-Apr-2017 Todd Kennedy <toddke@google.com> Change name of the intent fields

Change-Id: I67d3f5c7fb3189fdb35908011e92cc82c24b9154
Fixes: 36594944
Test: cts-tradefed run commandAndExit cts-dev -m CtsSignatureTestCases -t android.signature.cts.IntentTest#shouldNotFindUnexpectedIntents
phemeralResolverConnection.java
ackageManagerService.java
dff13a0bb1e36783662d432cd4ba97309a489f22 04-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "rebind if the connection drops" into oc-dev
a5d70a17ebd1b3ffe026879c5d9d96f04d10d4f2 23-Mar-2017 Chad Brubaker <cbrubaker@google.com> Allow permissions to be runtime-only.

This adds the new runtime protection level flag that if set means
the permission can only be granted to apps that target runtime
permissions (>= M).

ANSWER_PHONE_CALLS has also been made runtime-only.

Bug: 30932767
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermission2TestCases
Change-Id: I42b30414c808730f2d5961ca31b6e3db740b8cf7
asePermission.java
ackageManagerService.java
7c5797be841cb247f3b387e53d25fa35c8c23f31 04-Apr-2017 Todd Kennedy <toddke@google.com> don't log non-instant app resolutions

for normal web url resolution, we don't want to drop a log entry.
this is likely going to be too verbose [i.e. will drop a log for
every link clicked on in the browser].

Change-Id: I622b7f27ccebc440b837daa420e34c16ec0e2a4d
Fixes: 36563095
Test: Manual; resolve ephemeral links and see logs
Test: Manual; resolve non-ephemeral links and see no logs
nstantAppResolver.java
765a1b78576c94c316bb270ee11f153f1b2fedaa 04-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix PackageManagerService passing usesLibraryFiles to dexOpt." into oc-dev
16c3a3e7e811f44b257d1ee557e5e2ac7bb67e52 03-Apr-2017 Todd Kennedy <toddke@google.com> rebind if the connection drops

Change-Id: I9d91e9080b99690ff1e50dc28b01df0dcda4e97a
Fixes: 36566927
Test: Manual; stop gms:persistent process using "kill -9"
Test: Manual; stop process using "adb shell am force-stop com.google.android.gms"
Test: Manual; stop process using "adb install -r PrebuiltGmsCore.apk"
phemeralResolverConnection.java
b0be09922cc7647b005c4ef657b96470fecc5ddb 29-Mar-2017 Jeff Hao <jeffhao@google.com> Fix PackageManagerService passing usesLibraryFiles to dexOpt.

The shared libraries for the package need to be updated before calling
performDexOpt so that they can be populated and passed down to dexOpt.
This isn't missing in the AOSP version, so the fix is only for master.

Bug: 36698836
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t
android.appsecurity.cts.UsesLibraryHostTest

Change-Id: Id58bd50a13e5115af03c9167d4eb7f4b1d1dc9da
(cherry picked from commit 1d643dabe543f3f1b7d96485d6317eece7836a4e)
ackageManagerService.java
aadbb7fab0cc543a3a5c998587539650169339dd 03-Apr-2017 Jesse Evans <jsje@google.com> Load IA resolver settings from resolver package

Changes the logic of getEphemeralResolverSettingsLPr() to resolve
a settings component in any of the packages whitelisted to provide
the instant apps installer.

Test: Boots

Bug: 36840581
Change-Id: Iac5e3dfa2cb97a630092212322f9c983c2d29926
(cherry picked from commit d4310934905aea48079dd5e3a590cd4e2427dcac)
ackageManagerService.java
1163568d7c5f0cdbfd9e0a9b93ed5209bc2614bd 04-Apr-2017 Narayan Kamath <narayan@google.com> Merge "Properly guard access to CloseGuard in finalizers."
a999b02c70e1e7975adae6758c25f9e383086b60 04-Apr-2017 Jeff Sharkey <jsharkey@android.com> Merge "Emit fingerprints during OTA upgrades." into oc-dev am: 19627d678b
am: 5ea809f29c

Change-Id: I4825d7480861ca6518f15bbfea0274c1527b2c3a
19627d678bae7aa707990c1e0122579e47ff63c2 04-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Emit fingerprints during OTA upgrades." into oc-dev
09546ff639d8838b896da2d6a27ee7d930401e1c 04-Apr-2017 Fyodor Kupolov <fkupolov@google.com> Dump PackageInstaller state outside of mPackages lock

Otherwise it may cause a deadlock.

Also removed new line before instant attribute.

Test: manual
Change-Id: I2812a6fe76c638f12728ca6850918eb3a98e3158
Fixes: 36813032
ackageManagerService.java
ettings.java
6483c2d5fa47a4f13fee70c6a9a744437357c0f7 04-Apr-2017 Makoto Onuki <omakoto@google.com> Merge "Don't wtf() for reverse profile access; make it a warning." into oc-dev am: 5fd39fad26
am: d6da0d25cb

Change-Id: Iac4bdaf66a661218eca4a562646e4867998b5cab
5fd39fad261fbe7c3fce8403e2de557990f80aaa 04-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't wtf() for reverse profile access; make it a warning." into oc-dev
0751546c16d1aae0632220dbaca6a29722708617 04-Apr-2017 Jeff Sharkey <jsharkey@android.com> Emit fingerprints during OTA upgrades.

Can be used to help confirm diagnosis of bugs like 34525014.

Test: builds, boots
Bug: 36795529
Change-Id: Ie2517061ef031716c493b2544b0fb95628f20737
ackageManagerService.java
38edfd49a1c4375df554acbe1c33691909375ae1 04-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Load IA resolver settings from resolver package"
1566233bfdb994cd41d21ffb2615af8d0e29166f 04-Apr-2017 Jeff Sharkey <jsharkey@android.com> Offer to "fixup" GIDs used for app data.

We recently started tracking cached app data using a per-app GID for
the "cache" and "code_cache" directories and their contents. For
upgraded devices, we ideally want to "fixup" the GIDs of any existing
data while the device is still showing the boot animation, instead of
blocking the user when they unlock the device.

This fixup operation has the nice side-effect of priming the dentry
cache with all the directories that we'll be validating when unlocking
a user, so by always running fixup we speed up onBeforeUnlockUser()
from about ~540ms to ~220ms.

Test: /data/nativetest/installd_service_test/installd_service_test
Bug: 34201111, 35084485
Change-Id: If40244d0356beb11df25d3052097c3c5a90d010f
nstaller.java
ackageManagerService.java
0303797e1badd613397b62ea27d4d33700c65390 04-Apr-2017 Makoto Onuki <omakoto@google.com> Merge "Remove/fix broken test due to change to DUMP permission check." into oc-dev am: 6a7a967b71
am: eeb6197d39

Change-Id: Ief58d7cf855babdda0ae0a0933051ee8a1ee2b53
6a7a967b712145a84771de2920082d3647de2d24 04-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Remove/fix broken test due to change to DUMP permission check." into oc-dev
d4310934905aea48079dd5e3a590cd4e2427dcac 03-Apr-2017 Jesse Evans <jsje@google.com> Load IA resolver settings from resolver package

Changes the logic of getEphemeralResolverSettingsLPr() to resolve
a settings component in any of the packages whitelisted to provide
the instant apps installer.

Test: Boots

Bug: 36840581
Change-Id: Iac5e3dfa2cb97a630092212322f9c983c2d29926
ackageManagerService.java
3cc7cd1c18f5d5b2df0f8aebb22fdb3feb23ecd0 03-Apr-2017 Makoto Onuki <omakoto@google.com> Don't wtf() for reverse profile access; make it a warning.

Bug:36003688
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Change-Id: I6d6a73e1d9281dc0b92186dd0666865b0f6b3f1c
auncherAppsService.java
b3f05c90a1de34a3f2fd8e0d86a98054d927e6ef 03-Apr-2017 Makoto Onuki <omakoto@google.com> Merge "Revert "Push chooser targets to the shortcut manager."" into oc-dev am: ef7dff2563
am: be3ee7ee30

Change-Id: I13a0dd37dfb4475866535abb514aa4a8dcd2f6a6
c4361e34ad6fbc1bab34271ece668ebf79232a64 03-Apr-2017 Makoto Onuki <omakoto@google.com> Remove/fix broken test due to change to DUMP permission check.

Bug 36854321
Test: adb shell am instrument -e class 'com.android.server.pm.ShortcutManagerTest2' -w com.android.frameworks.servicestests

Change-Id: I80f2a326b70f8d0598246732510e3725a0c58871
hortcutService.java
ef7dff2563ccbe74564ab3b417d810a04df556e7 03-Apr-2017 Makoto Onuki <omakoto@google.com> Merge "Revert "Push chooser targets to the shortcut manager."" into oc-dev
d6ce1adabf5e8e8430403494aa9bc2904c30b1e1 03-Apr-2017 Chad Brubaker <cbrubaker@google.com> Merge "Rename READ_PHONE_NUMBER to READ_PHONE_NUMBERS" into oc-dev am: e35d50622c
am: a8c068f723

Change-Id: Id57b91b68ce6a4e1f31e8670798b59b82593ea96
efe5d222723940d1d95f037b8bdf4225ca599c95 03-Apr-2017 Todd Kennedy <toddke@google.com> Merge "Implement service filtering" into oc-dev am: 35110948b7
am: 48a2f0036c

Change-Id: I479a1db354a7f61e669f67241a0648d843301e95
bb36746ad15e8ac6767a355c9bc1586cfca45487 03-Apr-2017 Jorim Jaggi <jjaggi@google.com> Revert "Temporarily bg-whitelist the default container package-cleaning service" am: 91232840aa
am: c4bfd5e751

Change-Id: I83a8d235fca0991f394cd9da899089a96bc0a7f3
c0a60682e27a98ae01069348551813c5822207e2 03-Apr-2017 Jeff Sharkey <jsharkey@android.com> Merge "We really want f_frsize and f_bavail." into oc-dev am: fd463121c6
am: f9f7d71cc5

Change-Id: Ifa28cb4515d6e9e74380fe70d73aec292d126ac9
e35d50622c8387919e42b81c7b052c64decb0615 03-Apr-2017 Chad Brubaker <cbrubaker@google.com> Merge "Rename READ_PHONE_NUMBER to READ_PHONE_NUMBERS" into oc-dev
492e9e851cadca62df84eaff1a3c1ba788492fba 22-Mar-2017 Narayan Kamath <narayan@google.com> Properly guard access to CloseGuard in finalizers.

CloseGuard instances are allocated in constructors and usually
assigned to final fields. This implies they're non-null in finalizers
except in the case where the constructor throws. We add a null check
to make sure we can continue cleaning up other state in the finalizer
(if applicable).

Also, this change decouples closeguard warnings in constructors
from other state based logic. This because the logic there is usually
duplicated with the call to close().

NOTE: This change is not a "complete" fix. Many of these finalizers
are broken in the case where <init> throws. The only objective of
this change is to make such errors more obvious.

Note that some of these classes don't have CTS tests.

Test: make, CtsMediaTestCases.
Bug: 35609098

Change-Id: I24d9e0215f80e44914dba8ab99b6312fd6ed1fc0
ackageManagerService.java
35110948b7ada496bb4bd8af2a5c9b721275f971 03-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Implement service filtering" into oc-dev
91232840aa1cebd4586ab2437243345a05f34fa4 03-Apr-2017 Jorim Jaggi <jjaggi@google.com> Revert "Temporarily bg-whitelist the default container package-cleaning service"

Causes bootloop.

This reverts commit f16e7423c79c4ccccf43265a5b1966eb8e7f7be7.
ackageManagerService.java
fd463121c64643557af5324a8f480677facab15b 03-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "We really want f_frsize and f_bavail." into oc-dev
60bca4e4bf3a869a75590c20b2236a66797747fd 03-Apr-2017 Jeff Sharkey <jsharkey@android.com> Enforce PACKAGE_USAGE_STATS for usage data. am: 6df866a851
am: 979f227fb9

Change-Id: Ia3aaf773b4defb4b1399544ff7475cd4142f16aa
558b0dd41866dd0391457197b96b4ace42f2344c 03-Apr-2017 Jeff Sharkey <jsharkey@android.com> Consistent dump() permission checking. am: fe9a53bc45
am: 020de02854

Change-Id: Iffbf78a7b48cea41ed4b0763f2452738e084225c
dafb17e7eb9a15862ed1314dff2b82d29ad23632 03-Apr-2017 Jeff Sharkey <jsharkey@android.com> We really want f_frsize and f_bavail.

It's confusing, but f_bsize is not the value you're looking for; the
real block size is f_frsize. Fix all those bugs.

Also, the vast majority of clients are interested in the usable
disk space, not including reserved space.

Test: builds, boots
Bug: 36840579
Change-Id: Ib1470389afd49c14cab62282ec1e978ebb2c4791
ackageManagerService.java
6df866a8510af2776c48425a361f708ae7f5d7d6 31-Mar-2017 Jeff Sharkey <jsharkey@android.com> Enforce PACKAGE_USAGE_STATS for usage data.

Some system services are offering package usage data through both
public/system APIs and through dump() calls. In principle, usage
data hould always be protected with PACKAGE_USAGE_STATS, so start
enforcing that. (Otherwise if a user blocked PACKAGE_USAGE_STATS
access to an app, that app could still obtain the data via dump()
if they held the DUMP permission.)

Bottom line, let's respect the user's wishes.

Protecting the entire output like this is pretty blunt, but future
CLs can add more nuance to the output if desired.

Test: cts-tradefed run commandAndExit cts-dev -m CtsSecurityTestCases -t android.security.cts.ServicePermissionsTest
Bug: 32806790
Change-Id: I46173562713bea7d89e12a4313c78eb52ea8d77d
ackageManagerService.java
hortcutService.java
fe9a53bc45fd0124a876dc0a49680aaf86641d3e 31-Mar-2017 Jeff Sharkey <jsharkey@android.com> Consistent dump() permission checking.

This change introduces new methods on DumpUtils that can check if the
caller has DUMP and/or PACKAGE_USAGE_STATS access. It then moves all
existing dump() methods to use these checks so that we emit
consistent error messages.

Test: cts-tradefed run commandAndExit cts-dev -m CtsSecurityTestCases -t android.security.cts.ServicePermissionsTest
Bug: 32806790
Change-Id: Iaff6b9506818ee082b1e169c89ebe1001b3bfeca
ackageManagerService.java
hortcutService.java
serManagerService.java
224f95a32d8ec9da8ca287beb0005e95ce8b97cf 01-Apr-2017 Makoto Onuki <omakoto@google.com> Merge "Handle disabled packages as removed." into oc-dev am: 2f8f5ffc4b
am: 202c0418b1

Change-Id: I9c0ba823fa4007ab75d7ff2d5b860e716b2f36a0
82fb2eb057032bb7f38f547fb3667c7bf2547517 01-Apr-2017 Makoto Onuki <omakoto@google.com> Handle disabled packages as removed.

Bug 36600272
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Change-Id: I272334cef00337d5ba01ce4b878c799d9476432f
hortcutPackage.java
hortcutService.java
99302b55c6a960c9078ad2c84ae9be3296bd32f3 29-Mar-2017 Makoto Onuki <omakoto@google.com> Revert "Push chooser targets to the shortcut manager."

This reverts commit 58fc95dc578244b7beb687a48184045dcce788b8.

Bug 36186790
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutHostTestCases
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutManagerTestCases

Also all unit tests, except for the known failrues.
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Change-Id: I733ee7e12a419ee7ea17ca67c56afe7b039d189a
auncherAppsService.java
hortcutPackage.java
hortcutService.java
51b3aaccfe7f8d7a97fb1218c40a37428f26a6a1 31-Mar-2017 Todd Kennedy <toddke@google.com> Implement service filtering

Instant apps can no longer see services that haven't been
exposed to them via the visibleToInstantApps attribute.

Change-Id: I6fd78067d1253825668d67b9e17dd3a0703f5d57
Fixes: 35871716
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
ackageManagerService.java
ettings.java
0c1651f2899ae3d13db005315ed3709f56ab3db3 31-Mar-2017 Chad Brubaker <cbrubaker@google.com> Rename READ_PHONE_NUMBER to READ_PHONE_NUMBERS

Bug: 35853790
Test: make -j128 checkbuild
Test: cts-tradefed run commandAndExit cts-dev -m CtsPermission2TestCases
Change-Id: I11d374cbbb6c2deaf74ac784ff995bd182fe9157
ackageManagerService.java
49ce49034f20275509c6f7cefbae81c9603f8b31 31-Mar-2017 Chris Wren <cwren@android.com> Merge "standardize system notification IDs" into oc-dev am: 441162562b
am: 72eb5da93b

Change-Id: Icf0abd881615f16e85547b275edbf081d6ee1819
441162562b75f8510586e1acdf2009820f25493d 31-Mar-2017 Chris Wren <cwren@android.com> Merge "standardize system notification IDs" into oc-dev
282cfefea0fbbd299839e353e6d30affdcd4a55c 27-Mar-2017 Chris Wren <cwren@android.com> standardize system notification IDs

All the trivial cases, plus some fixes to try to
mitigate collisions with the complex ones.

Complex services to follow in another CL,

Bug: 32584866
Test: make framework services
Change-Id: Ie9663600171d8ede11676e9d66f009dbb06def03
ackageInstallerService.java
7664b804547e958084a3bf7072333270f75df3a3 31-Mar-2017 Wale Ogunwale <ogunwale@google.com> Merge "Fix issue with force resizing activity when app level doesn't want to" into oc-dev am: 1284be68e8
am: e7d68c767e

Change-Id: Iee5e3350ce90d5438f7bd4b425819e712a7240e4
1284be68e806917a1ca75c54cd61960c0b1bb64a 31-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix issue with force resizing activity when app level doesn't want to" into oc-dev
0f93410ec160ca8e8d96a0f7c787abd80ea04a8e 31-Mar-2017 Christopher Tate <ctate@google.com> Merge "Temporarily bg-whitelist the default container package-cleaning service" into oc-dev am: d47e192d7c
am: 00393b987d

Change-Id: Ifed62170573d6b74dfffd9f1bec307dfc01c6498
e633eb00a0ab352b4e1a390bb622c7a6ffa2fb68 30-Mar-2017 Wale Ogunwale <ogunwale@google.com> Fix issue with force resizing activity when app level doesn't want to

Don't force resize activity whose manifest attribute has
resizeableActivity set to false at the application tag level.

Fixes: 36704475
Test: Launch an app that disables resizeableActivity at the app level
in multi-window mode.

Change-Id: I73137175290355266a4d3ecc469e7a39d73dbc62
ettings.java
f16e7423c79c4ccccf43265a5b1966eb8e7f7be7 29-Mar-2017 Christopher Tate <ctate@google.com> Temporarily bg-whitelist the default container package-cleaning service

Bug 35968513
Test: manual

Change-Id: Iac3e831631d279f68dec3a49d50393a4abf03088
ackageManagerService.java
474662da390937a95ed2e3b3acdae00c92be47d8 30-Mar-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Drop REASON_SHARED_APK." into oc-dev
08992ac57e973d6bf32693725ebb341a481e5944 21-Mar-2017 Christopher Tate <ctate@google.com> API refactor: context.startForegroundService()

Rather than require an a-priori Notification be supplied in order to
start a service directly into the foreground state, we adopt a two-stage
compound operation for undertaking ongoing service work even from a
background execution state. Context#startForegroundService() is not
subject to background restrictions, with the requirement that the
service formally enter the foreground state via startForeground() within
5 seconds. If the service does not do so, it is stopped by the OS and
the app is blamed with a service ANR.

We also introduce a new flavor of PendingIntent that starts a service
into this two-stage "promises to call startForeground()" sequence, so
that deferred and second-party launches can take advantage of it.

Bug 36130212
Test: CTS

Change-Id: I96d6b23fcfc27d8fa606827b7d48a093611b2345
(cherry picked from commit 79047c62b58fb0a0ddf28e2b90fe4d17e05bc528)
ackageManagerService.java
a94c58642ff7bbef35001bb9b322ec8a2ad4e9d7 30-Mar-2017 Chris Tate <ctate@android.com> Merge "API refactor: context.startForegroundService()"
67a64e626d4425196b0f54170afceeedcb8913a4 30-Mar-2017 Chad Brubaker <cbrubaker@google.com> Merge "Track isolated process owners" into oc-dev am: cd181e63ff
am: 5cde044596

Change-Id: Icfa2e715ce8341b511364ccadf66955bebdb9e81
0a1dbb1589974199482650e9da82d4ccf6e72d54 30-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix PackageManagerService passing usesLibraryFiles to dexOpt."
cd181e63ff1a03aff38041e6f30e23cfa27f5c72 30-Mar-2017 Chad Brubaker <cbrubaker@google.com> Merge "Track isolated process owners" into oc-dev
2ab076f611cecb771fe546580634583a27c61aa5 26-Mar-2017 Nicolas Geoffray <ngeoffray@google.com> Drop REASON_SHARED_APK.

This reason was only used by "system shared libraries", not shared
APKs like GMS.

Code that uses this reason is now obsolete, as we do compile these shared
libraries when we see an apk that uses it.

bug:33799337
Test: m -j32 && boot
Change-Id: I2eef22797551401a5c39ed339bc2486cf0d091a8
(cherry picked from commit 86d1e9e23e79687ae94854fc6aa22c3d4ad98423)
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
8d686949515ca665406b24f0073adf117f77546c 30-Mar-2017 Nicolas Geoffray <ngeoffray@google.com> Merge "Drop REASON_NON_SYSTEM_LIBRARY." into oc-dev
679cb71054111c44ad5b1064f85edb24f51cb738 30-Mar-2017 Makoto Onuki <omakoto@google.com> Merge "Show user running state in dumpsys user." into oc-dev am: 2692dafa9b
am: 60e6e538f9

Change-Id: Id37b0c99f10a2b6f9506778f600e3f98a234099c
2692dafa9b78ef22bc685da3ae46198abdd9b0e8 30-Mar-2017 Makoto Onuki <omakoto@google.com> Merge "Show user running state in dumpsys user." into oc-dev
de0272b85c4ff1eba1c58a3cdfd53bd5eb9925ef 26-Mar-2017 Nicolas Geoffray <ngeoffray@google.com> Drop REASON_NON_SYSTEM_LIBRARY.

Dexopt them with the same "mode" as the apk we are
going to dexopt. Because we treat them as shared, this
means they are only going to be fully compiled once an app
that has it in its <uses-library> gets compiled.

bug:33799337
Test: m -j32 && boot
Change-Id: Ic93fbcf45be6b9cf31ad3a3eb498f9fbbefeb288
(cherry picked from commit 90978b4159dd1394c0643ae8171d24668fbc27a4)
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
30f18587e3bf6079f910699c89f1b702664982b5 24-Mar-2017 Nicolas Geoffray <ngeoffray@google.com> Drop REASON_CORE_APP.

After ensuring apps used by system server are speed compiled
on /system, we don't need a special reason anymore.

bug:36532541
bug:33799337

Test: m -j32 && boot
Change-Id: I1fb894f0f5b796cb9d59ed01a4afb2709c0f5496
(cherry picked from commit b70e4bfe0776a3446ccfddd5a10b1ff155f60e34)
taDexoptService.java
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
86d1e9e23e79687ae94854fc6aa22c3d4ad98423 26-Mar-2017 Nicolas Geoffray <ngeoffray@google.com> Drop REASON_SHARED_APK.

This reason was only used by "system shared libraries", not shared
APKs like GMS.

Code that uses this reason is now obsolete, as we do compile these shared
libraries when we see an apk that uses it.

bug:33799337
Test: m -j32 && boot
Change-Id: I2eef22797551401a5c39ed339bc2486cf0d091a8
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
92d64b16ebad35738463c6b2144fee418832aec9 30-Mar-2017 Nicolas Geoffray <ngeoffray@google.com> Merge changes Ic93fbcf4,I1fb894f0

* changes:
Drop REASON_NON_SYSTEM_LIBRARY.
Drop REASON_CORE_APP.
1d643dabe543f3f1b7d96485d6317eece7836a4e 29-Mar-2017 Jeff Hao <jeffhao@google.com> Fix PackageManagerService passing usesLibraryFiles to dexOpt.

The shared libraries for the package need to be updated before calling
performDexOpt so that they can be populated and passed down to dexOpt.
This isn't missing in the AOSP version, so the fix is only for master.

Bug: 36698836
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t
android.appsecurity.cts.UsesLibraryHostTest

Change-Id: Id58bd50a13e5115af03c9167d4eb7f4b1d1dc9da
ackageManagerService.java
88aef7560531601bdb7647bc6bd1fa0e0a320092 30-Mar-2017 Makoto Onuki <omakoto@google.com> Show user running state in dumpsys user.

Test: Manual test with: watch adb shell dumpsys user
Change-Id: I38f36331b95e2602b09d60bee75a65f62cf85a86
serManagerService.java
0f28a80d8e80a3546fe0776999b2deaa3dc2157c 29-Mar-2017 Chad Brubaker <cbrubaker@google.com> Track isolated process owners

This fixes two issues:
1) Isolated processes spawned by Instant Apps do not get full access to
package lists as those spawned by normal apps do
2) Package manager considers the isolated process the same app as the
Instant App that created it when determining what packages are exposed.

Bug: 34087569
Test: Webview works
Test: Isolated apps cannot access package info of other apps via start
an isolated service.

Change-Id: Ib26280b87fb46dc66f1f25ee6209427a095342b0
ackageManagerService.java
79047c62b58fb0a0ddf28e2b90fe4d17e05bc528 21-Mar-2017 Christopher Tate <ctate@google.com> API refactor: context.startForegroundService()

Rather than require an a-priori Notification be supplied in order to
start a service directly into the foreground state, we adopt a two-stage
compound operation for undertaking ongoing service work even from a
background execution state. Context#startForegroundService() is not
subject to background restrictions, with the requirement that the
service formally enter the foreground state via startForeground() within
5 seconds. If the service does not do so, it is stopped by the OS and
the app is blamed with a service ANR.

We also introduce a new flavor of PendingIntent that starts a service
into this two-stage "promises to call startForeground()" sequence, so
that deferred and second-party launches can take advantage of it.

Bug 36130212
Test: CTS

Change-Id: I96d6b23fcfc27d8fa606827b7d48a093611b2345
ackageManagerService.java
5949d0dcdc240149cac7b1efef63aca80bab4a02 29-Mar-2017 Calin Juravle <calin@google.com> Merge changes from topic 'dex' am: f665781c74
am: 8a4afd3dad

Change-Id: Ieb7d998721404040c0d2be010896a5dd15a3458c
8a4afd3dad21ff046e2dffb3cd8723ea8417057b 29-Mar-2017 Calin Juravle <calin@google.com> Merge changes from topic 'dex'
am: f665781c74

Change-Id: I31c202a56d8f92634cc1d5d84106e27cb8c23bfd
c480bdafdb984f024bb13a8f0de9b6e1efd34bcd 10-Mar-2017 Calin Juravle <calin@google.com> Compile secondary dex files according to REASON_BACKGROUND_DEXOPT

Test: adb shell cmd package bg-dexopt-job works for sercondary dex files

Bug: 32871170
Bug: 26719109

(cherry picked from commit a70b1b120365976f5eeb7cb3f577f5f6ff7ad18e)

Merged-In: Iaee8071449c83e774b2fe331aaccfc5433856f4f
Change-Id: I2334e4d73a5acdd1106e913c59ddf642782f1eee
ackgroundDexOptService.java
ackageManagerService.java
ex/DexManager.java
61ae34afe3473909f5e6f0d90a889757d99ea12f 28-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Intercept direct launch of instant app installer" into oc-dev
b21be12d9db5d0d85afa26e401813eaa360bd2e0 24-Mar-2017 Todd Kennedy <toddke@google.com> Intercept direct launch of instant app installer

The instant app installer is not designed to be launched directly
by 3p apps. Instead, intercept the launch and make it look like
a "normal" instant app launch.
cherry-picked from I89c9b8c56865e260a2b92f8c2312a305a74f9cf5

Bug: 33073524
Test: Built and notice poorly behaving apps [*cough* keep *cough*] now launch instant apps
Change-Id: I5401aa8423042f54f1478409065b0d6b25cebe89
ackageManagerService.java
37fb57084b78d32e3930d3aa07840d8762a0fff0 16-Mar-2017 Calin Juravle <calin@google.com> Set pm.BackgroundDexOptService as the source of true

The real dexopt maintainance job is
com.android.server.pm.BackgroundDexOptService, and not
com.android.server.BackgroundDexOptJobService

Partial revert of commit 096d304ae3d85c1bfcda1a1d9cd4eb13d0815500.

Test: manual inspection
Bug: 36140426

(partial cherry picked from commit
91d40f1baa2eeed2aa68d2492e20650d5e71dab5)

Merged-In: I983ac91117f107282095fa7eefdbce08e0dcfce3
Change-Id: I983ac91117f107282095fa7eefdbce08e0dcfce3

# Conflicts:
# core/res/AndroidManifest.xml
#
services/core/java/com/android/server/pm/PackageManagerService.java
# services/java/com/android/server/SystemServer.java
ackgroundDexOptService.java
b3e74b2f90e18d3246bbe15ae7b4496e77266b84 11-Mar-2017 Calin Juravle <calin@google.com> Add missing return in DexManager

Harmless issue but which can spam the logs.

Test: mostly manual since the check is buried deep inside and cannot be
verified accurately. I added another test to DexManager to stress that
code path and then checked the logs.

Bug: 36117123

(cherry picked from commit 2dfc1b3e125860221bc67835c2d5c99198a12f8a)

Merged-In: I1a878a200f3f726dfaa85f1bed1398acc8dce979
Change-Id: Ib2c034add2e8229b90eb4aaa0067d42d26798670
ex/DexManager.java
24ff75fb08190bdfa59678091cb9d02a2945f373 23-Feb-2017 Calin Juravle <calin@google.com> Update package use info when the app data is updated

- clear usesByOtherApps flag when the package is updated
- delete secondary dex usage data when the app data is destroyed

Test: runtest -x .../PackageDexUsageTests.java
runtest -x .../DexManagerTests.java
Bug: 32871170
Bug: 35381405

(cherry picked from commit 99dd37b3c5262910150ef955d16a33d32da264dd)

Merged-In: I3a249b9e8680e745fa678c7ce61b4ae764078fb9
Change-Id: Ia8416e7232cda3e42a8dccd51cb152a237e0f317
ackageManagerService.java
ex/DexManager.java
ex/PackageDexUsage.java
336ae5b6161454304ef09be715505007c7a7da56 24-Mar-2017 Chad Brubaker <cbrubaker@google.com> Add ACTION_EPHEMERAL_RESOLVER_SETTINGS

This Intent will be used in Settings to show the settings UI for the
Ephemeral resolver. Settings can get the correct component to send the
Intent to by calling
PackageManager.getInstantAppResolverSettingsComponent

Bug: 35918998
Test: Boots
Change-Id: I0edcf85704f2c19e0ee27f91b6ef057d52e32778
(cherry picked from commit aa49cb86e6d5f23d82c97db32c848bc4ea2b81bc)
ackageManagerService.java
22a5cf6d9b1d3d500bd5e198948f7c5092ab8780 28-Mar-2017 Chad Brubaker <cbrubaker@google.com> Merge "Add ACTION_EPHEMERAL_RESOLVER_SETTINGS"
aa49cb86e6d5f23d82c97db32c848bc4ea2b81bc 24-Mar-2017 Chad Brubaker <cbrubaker@google.com> Add ACTION_EPHEMERAL_RESOLVER_SETTINGS

This Intent will be used in Settings to show the settings UI for the
Ephemeral resolver. Settings can get the correct component to send the
Intent to by calling
PackageManager.getInstantAppResolverSettingsComponent

Bug: 35918998
Test: Boots
Change-Id: I0edcf85704f2c19e0ee27f91b6ef057d52e32778
ackageManagerService.java
90978b4159dd1394c0643ae8171d24668fbc27a4 26-Mar-2017 Nicolas Geoffray <ngeoffray@google.com> Drop REASON_NON_SYSTEM_LIBRARY.

Dexopt them with the same "mode" as the apk we are
going to dexopt. Because we treat them as shared, this
means they are only going to be fully compiled once an app
that has it in its <uses-library> gets compiled.

bug:33799337
Test: m -j32 && boot
Change-Id: Ic93fbcf45be6b9cf31ad3a3eb498f9fbbefeb288
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
7d6a729c763d7bb812d4f94219491b7dea016974 24-Mar-2017 Todd Kennedy <toddke@google.com> Intercept direct launch of instant app installer

The instant app installer is not designed to be launched directly
by 3p apps. Instead, intercept the launch and make it look like
a "normal" instant app launch.

Bug: 33073524
Test: Built and notice poorly behaving apps [*cough* keep *cough*] now launch instant apps
Change-Id: I89c9b8c56865e260a2b92f8c2312a305a74f9cf5
ackageManagerService.java
b70e4bfe0776a3446ccfddd5a10b1ff155f60e34 24-Mar-2017 Nicolas Geoffray <ngeoffray@google.com> Drop REASON_CORE_APP.

After ensuring apps used by system server are speed compiled
on /system, we don't need a special reason anymore.

bug:36532541
bug:33799337

Test: m -j32 && boot
Change-Id: I1fb894f0f5b796cb9d59ed01a4afb2709c0f5496
taDexoptService.java
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
4b0aa4db3a0d8101293832dd554b53cb8a0114b9 24-Mar-2017 Fyodor Kupolov <fkupolov@google.com> Use resolved ActivityInfo to set instant app installer

Previously we were only using the component name, which is not always
enough.

Now the resolved ActivityInfo is used and only 'flags'/'exported' and
'enabled' attributes are modified.

Test: Manual
Bug: 34751853
Change-Id: I32a2a2bd98cc5d73ab02ccfc100868b826bb8105
ackageManagerService.java
e219aaae85bc8749b787d27fa9fd741035f7f17f 23-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Delete preloadsFileCache when the cache has expired"
935618a2c5d8e776a1372473e6355c65f0570414 23-Mar-2017 Fyodor Kupolov <fkupolov@google.com> Delete preloadsFileCache when the cache has expired

Added deletePreloadsFileCache that can be called from settings app.

Modified freeStorageAndNotify to call deletePreloadsFileCache if the
cache has expired, or aggressive flag is set.

Bug: 34690396
Test: Manual
Change-Id: Ia097cd2f62ad501644be1c2cc573c249d8cfbf55
ackageManagerService.java
749b26abe58f63bd8a9234215bf852fa8391db5a 23-Mar-2017 Todd Kennedy <toddke@google.com> Allow the Instant App installer to be dynamic

Change-Id: I58e81f5f473ac1cffb8947cd713bb1249ce00305
Fixes: 33072933
Test: add/remove/update the instant app installer and see that it changes dynamically
ackageManagerService.java
fbd54b42637641dfaafb9ffff6f6ffc8701e4e24 23-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Revert "Allow the Instant App installer to be dynamic""
829ea130bf9c3bdea6143f2c46f8145a1549d294 23-Mar-2017 Esteban Talavera <etalavera@google.com> Revert "Allow the Instant App installer to be dynamic"

Breaks work profile creation among other multi user issues

Bug: 36530935

This reverts commit 85942c2bc69385eb326cfe0e15ad9223bf1cffb5.

Change-Id: I0b5901a02ca590b7e8121aa8babe5b1c5819eca7
ackageManagerService.java
d45040ffc77e6920110d40ba4d7a8b078d31380e 23-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Added a UserManager.DISALLOW_AUTOFILL restriction."
24d5893b25ce62b7bc9ed9f35fa72b9d47f23cdd 21-Mar-2017 Felipe Leme <felipeal@google.com> Added a UserManager.DISALLOW_AUTOFILL restriction.

bug: 35710740

Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases -t android.autofillservice.cts.LoginActivityTest#testUserRestriction
Test: cts-tradefed run commandAndExit cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.MixedDeviceOwnerTest#testDisallowAutofill_allowed
Test: cts-tradefed run commandAndExit cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.MixedProfileOwnerTest#testDisallowAutofill_allowed
Test: cts-tradefed run commandAndExit cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testDisallowAutofill_allowed

Change-Id: I41b2bf9fe3bc8df627c6650960bd11346c430a7e
serRestrictionsUtils.java
fb92c738dfde66468cec1ea460566bf7bd9f0935 23-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix launching installer on missing split"
40199e3d4c5c8cd0cfee9590eea89b1359e8b88e 22-Mar-2017 Todd Kennedy <toddke@google.com> Fix launching installer on missing split

Bonehead mistake; we were applying the post-resolution filters twice.
Don't do that!

Test: build and see that the installer runs when trying to launch a split that's not on the device
Change-Id: Ice65cdd7cc85d0394422009ba42f388f0ec2595c
ackageManagerService.java
ab2bc07e5fcf2797c165890109016af0ee314e46 22-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Prevent downgrade of targetSandboxVersion"
9a4b2ab18cc54d954f6d6a3981af10ec13acbb0b 22-Mar-2017 Todd Kennedy <toddke@google.com> Merge "Allow the Instant App installer to be dynamic"
11f5cf937a0c27eaa5d5e7d0329c587fc0232620 21-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Send launch token to activity manager"
85942c2bc69385eb326cfe0e15ad9223bf1cffb5 21-Mar-2017 Todd Kennedy <toddke@google.com> Allow the Instant App installer to be dynamic

Change-Id: I4f8e341dd3cb993099cdcf170141aef37a62604b
Fixes: 33072933
Test: add/remove/update the instant app installer and see that it changes dynamically
ackageManagerService.java
7105dd8bfa13bf12e6021d9c082fee4d468e73bd 21-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Shame developers that are calling hidden APIs."
6f4b2a3039ac353e1b0bcebfdebba5060ad38cf3 21-Mar-2017 Jeff Sharkey <jsharkey@android.com> Shame developers that are calling hidden APIs.

Test: builds, boots
Change-Id: Id3edf1a7890f7dbc4cff2a2699bbeabc247c6e90
ackageManagerService.java
6304ec34529865fb76845e215ade3c711bcf7e25 21-Mar-2017 Calin Juravle <calin@google.com> Clean up logs in DexManager

The log notifying that the dex path does not exists for the user was not
accurate. Also, the symlink debug check was misplaced.

Test: runtest -x .../DexManagerTests.java
Bug: 32871170
Change-Id: I1e90034da47d71a11efb307df2307951572011ee
ex/DexManager.java
b3b43130db1c02493ca881ad95adf27ec0cbe8ad 21-Mar-2017 Todd Kennedy <toddke@google.com> Send launch token to activity manager

When an instant app is installed, control passes from the platform
to the instant app installer. However, when the instant app is
launched, the original launch token needs to be associated with that
launch. Do this by sending the launch token along with the original
launch intent

Change-Id: I5741be343862d4e5c8bfb6b4a81d0bac8e53ea9c
Fixes: 35445667
Test: Build and manully inspect the event logs to ensure the launch token is sent on instant app launch
nstantAppResolver.java
d3c5106940838f2867afbbbfe251aaad38ab24b5 18-Mar-2017 Todd Kennedy <toddke@google.com> Add token to the resolver APIs

Change-Id: Ia6d4f6d88ec265480a4dca94fe77ef42592a328c
Fixes: 35442315
Test: Build and make sure instant apps still resolve
phemeralResolverConnection.java
nstantAppResolver.java
683bcd30ef0a90bc2a6a3dffb91be5a803560fa9 19-Mar-2017 Jeff Sharkey <jsharkey@android.com> Use allocatable space when measuring for install.

The system is often willing to clear cached data to make room for
incoming installs, so use StorageManager.getAllocatableBytes() when
making "does it fit?" style decisions.

Add new INSTALL_ALLOCATE_AGGRESSIVE flag, which will flow through
to use StorageManager.FLAG_ALLOCATE_AGGRESSIVE when making allocation
related requests. (This can be used by installers to indicate
packages that are critical to system health or security.

Test: runtest -x frameworks/base/core/tests/coretests/src/android/content/pm/PackageHelperTests.java
Bug: 36131437
Change-Id: If8118762fd1ca1f497d2cdd1787bdb3c9759dcc0
ackageInstallerService.java
ackageInstallerSession.java
cf2c279a2320de6d81f7fffa4ddfd9780abe1e20 18-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add TRON logs"
072082d617832d476a59a47d26478b6cdc8ba361 18-Mar-2017 Calin Juravle <calin@google.com> Merge "Compile secondary dex files according to REASON_BACKGROUND_DEXOPT"
10eb1455b9047084261442392f00235ec023eec2 18-Mar-2017 Adam Lesinski <adamlesinski@google.com> Merge changes from topic 'configForSplit'

* changes:
libandroidfw: Search all packages for an identifier
AAPT2: Finish support for feature splits
Add support for configForSplit
789a3e82cb204820c83b47d730744d91889af99b 18-Mar-2017 Andreas Gampe <agampe@google.com> Merge "Ota: Add command logging" am: 9a8d78dc86 am: 8dd991a7ef
am: c47f92b374

Change-Id: I6038dc9afd05c375bd1c6933b2aa5882f7835174
c47f92b374ee9c1e9b8e467ed8474ef78cb736af 17-Mar-2017 Andreas Gampe <agampe@google.com> Merge "Ota: Add command logging" am: 9a8d78dc86
am: 8dd991a7ef

Change-Id: I7a5061a98c33abbae787a42079c41263dbcdc7cb
8dd991a7ef26aec6e4aa17ea4539a624a4e4b3eb 17-Mar-2017 Andreas Gampe <agampe@google.com> Merge "Ota: Add command logging"
am: 9a8d78dc86

Change-Id: I48b887a26c8f8123c112559da0f74112bb703b1c
332dd12baa08a7663131042800ecb139520bb281 17-Mar-2017 Andreas Gampe <agampe@google.com> Ota: Add command logging

Log the next command.

Bug: 25612095
Test: m
Change-Id: I284a2fb3e329afcb0b03f7162585b0eefe13eb0e
taDexoptService.java
50d946c13a5a47c6617530425479b0ad4f381700 17-Mar-2017 Todd Kennedy <toddke@google.com> Add TRON logs

Add logs for instant app resolution [both phase 1 & 2]
as well as new logs for all activity starts.

Change-Id: I0d25daa383854eacd3bc406ce1360d819a8ec4ba
Fixes: 35442251
Fixes: 35441725
Test: Manual; install/run instant app and inspect the event logs for appropriate tags
phemeralResolverConnection.java
nstantAppResolver.java
ackageManagerService.java
ef8297e2759e027692ba2b6de57cb8a14b0899f5 17-Mar-2017 TreeHugger Robot <android-build-prod@system.gserviceaccount.com> Merge "Send broadcast when user restrictions change."
1c10a61a97afb889553f7a7a209ac59a580964fb 17-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow Instant Apps access PackageInfo of exposed apps"
06ca1e08739fb2df62327293a6222f541639642d 17-Mar-2017 Chad Brubaker <cbrubaker@google.com> Allow Instant Apps access PackageInfo of exposed apps

Instant Apps can only see apps that explicitly expose a component via
android:visibleToInstantApp.

Bug: 34087569
Test: cts-tradefed run commandAndExit cts-dev -m
CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Change-Id: Ibcba43597f545966abc883e90008369fb20d61ae
ackageManagerService.java
a70b1b120365976f5eeb7cb3f577f5f6ff7ad18e 10-Mar-2017 Calin Juravle <calin@google.com> Compile secondary dex files according to REASON_BACKGROUND_DEXOPT

Test: adb shell cmd package bg-dexopt-job works for sercondary dex files

Bug: 32871170
Bug: 26719109
Change-Id: Iaee8071449c83e774b2fe331aaccfc5433856f4f
ackgroundDexOptService.java
ackageManagerService.java
ex/DexManager.java
576de9fb774272741601196733843c842a536598 17-Mar-2017 Tadashi G. Takaoka <takaoka@google.com> Merge "Add has-feature shell command to PackageManagerService"
e72f81b64d356149c81104ecbdeca1abea31da85 16-Mar-2017 Makoto Onuki <omakoto@google.com> Send broadcast when user restrictions change.

- Send UserManager.ACTION_USER_RESTRICTIONS_CHANGED, which is a runtime receiver
only broadcast.

Bug 36355208

Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsDevicePolicyManagerTestCases -t 'com.android.cts.devicepolicy.UserRestrictionsTest#testUserRestrictions_deviceOwnerOnly'
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsDevicePolicyManagerTestCases -t 'com.android.cts.devicepolicy.UserRestrictionsTest#testUserRestrictions_primaryProfileOwnerOnly'
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsDevicePolicyManagerTestCases -t 'com.android.cts.devicepolicy.UserRestrictionsTest#testUserRestrictions_secondaryProfileOwnerOnly'
Change-Id: Ifd82e39ce2c08ed5accdf017f4a1ea3af6face63
serManagerService.java
1665d0f028e3a225cb117d3e227bef5c5dace2d4 10-Mar-2017 Adam Lesinski <adamlesinski@google.com> Add support for configForSplit

Applications with the android:isolatedSplits="true" attribute in
their AndroidManifest.xml would have their Split APKs loaded in
isolation of each other, based on a set of dependencies.

Configuration Splits generated for a Feature split would not be properly
loaded before, so this change, along with a tools change, fixes this
issue and completes support for isolatedSplits.

Bug: 30999713
Test: CTS test coming (depends on some tool changes)
Change-Id: Ia4e7b0e69168a9d6637867558e306f7031720fb3
ackageInstallerSession.java
ackageManagerShellCommand.java
d249e0892a21a38205ab2a9c376d4dab520fc501 16-Mar-2017 Fyodor Kupolov <fkupolov@google.com> Merge "Clear mGuestRestrictions before loading from disk"
4fd6eb6192d4eba6809fee8f35dd0afe6a24ddbc 16-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Avoid trying to grant non-ephemeral permissions to instant apps"
be5782f4f84ad8421935bf2e2ada24d336c1e221 14-Feb-2017 Tadashi G. Takaoka <takaoka@google.com> Add has-feature shell command to PackageManagerService

This PackageManagerService's has-feature shell command may be useful
to write host-side CTS test.

Bug: 35336548
Test: Run "adb shell cmd package has-feature android.hardware.nfc 0" and
verify that it prints true on Nexus 5X.
Test: Run "adb shell cmd package has-feature android.hardware.gamepad" and
verify that it prints false on Nexus 5X.

Change-Id: Icacfd0ad2b83a3c276e711a1f22d4d66112ba932
ackageManagerShellCommand.java
91d40f1baa2eeed2aa68d2492e20650d5e71dab5 16-Mar-2017 Calin Juravle <calin@google.com> Set pm.BackgroundDexOptService as the source of true

The real dexopt maintainance job is
com.android.server.pm.BackgroundDexOptService, and not
com.android.server.BackgroundDexOptJobService

Partial revert of commit 096d304ae3d85c1bfcda1a1d9cd4eb13d0815500.

Test: manual inspection
Bug: 36140426
Change-Id: I983ac91117f107282095fa7eefdbce08e0dcfce3
ackgroundDexOptService.java
ackageManagerService.java
eafee02fdc463e765ce34b8541f4ba55989b4bee 16-Mar-2017 Fyodor Kupolov <fkupolov@google.com> Clear mGuestRestrictions before loading from disk

Only guest user restrictions that are set to true are saved in
writeUserListLP. When loading <guestRestrictions>, they are applied
on top of mGuestRestrictions filled with default values.
Restrictions set to false are reset and this was causing the issue.

Bug: 33250860
Test: Manual
Change-Id: I6e5c792a3adcf2116bb26fd5feba551d7edcb28e
serManagerService.java
serRestrictionsUtils.java
64814139ada90b09ce85c3c71ffd6df99133e5e5 16-Mar-2017 Chad Brubaker <cbrubaker@google.com> Avoid trying to grant non-ephemeral permissions to instant apps

Fixes: 36272655
Test: `adb install -g --ephemeral` does not crash if an app requests a
non-ephemeral permission

Change-Id: I18a6fa7697528a2a35b42e36f7010b687be23f73
ackageManagerService.java
1176f7b2b097a25db3b0150e92e60b446a9952c9 15-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "More whitelisting"
ade616eb7f9083e51388edab31e9eb8bfdb5dae7 15-Mar-2017 Andreas Gampe <agampe@google.com> Merge "PackageManagerService: Fix ABI adjustment logging" am: 844be62eef am: 0c662c0ac0
am: 77ede7ab80

Change-Id: Ie2133c4e8e5abfd6979ba5c03c8d347985a5dcb4
77ede7ab806cb76caeefb62598a8ae11896f3c56 15-Mar-2017 Andreas Gampe <agampe@google.com> Merge "PackageManagerService: Fix ABI adjustment logging" am: 844be62eef
am: 0c662c0ac0

Change-Id: Idaa8ce7b31fb7921877462d0cf98d6d9fd4e1ae8
0c662c0ac00551e0cfa3ac3aa01be1be6b2f5ed7 15-Mar-2017 Andreas Gampe <agampe@google.com> Merge "PackageManagerService: Fix ABI adjustment logging"
am: 844be62eef

Change-Id: I35f0affaef73033c37798eba41dfc1b992187176
f68b2661d367ed68de1fdf470491b11d18f6958e 15-Mar-2017 Makoto Onuki <omakoto@google.com> More whitelisting

Bug 34973771

Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Change-Id: I77c7001b31a963dfabe8036647a2e51ede6a759f
auncherAppsService.java
108c7737dae7c9137a0966004285c99bb24e7f9b 15-Mar-2017 Andreas Gampe <agampe@google.com> PackageManagerService: Fix ABI adjustment logging

Fix logging of "Adjusting ABI" to be tolerant to null
packages.

Bug: 36172429
Test: m
Test: manual
Change-Id: Ic6b9a8e09e58dce6be97e464fe3986c709f820de
ackageManagerService.java
be4cf58436437da3bf78c48eeb401a5416459f95 15-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add API to mark apps that have an update available"
ab53289c593aad60eddbe1ffc73402ac1f92c112 08-Mar-2017 Todd Kennedy <toddke@google.com> Add API to mark apps that have an update available

Ostensibly for instant apps, we allow play to mark an app as having
an update available. This will trigger instant app resolution even
if the instant app is already installed on device.

Bug: 35143464
Test: Manual; launch URI of installed instant app, see it runs w/o resolution. set bit. launch URI of installed instant app, see it runs resolution
Change-Id: I511df2b2a3eab39377167c770255ccbe02d5dad2
ackageManagerService.java
ackageSettingBase.java
ettings.java
d3b1def2ebe1821212b9f110dff2fb0b15491e1b 15-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Enable cache clearing v2 logic, fix bugs."
e730ae877a24d44f5b3db096f08b0a2d7399aa2d 15-Mar-2017 Jeff Sharkey <jsharkey@android.com> Enable cache clearing v2 logic, fix bugs.

Now that we have CTS tests to verify the cache clearing v2 logic,
we're ready to enable it!

Switch storage APIs over to "usable space" to match implementation
down in installd. Add a missing clearCallingIdentity(), and offer
better logging for missing appop permission.

Load quotas from disk right away at device boot instead of waiting.

Bug: 35685848, 35684969
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.StorageHostTest
Change-Id: I8167e0322b4662ca6c975da5c50715e2d71332a7
ackageManagerService.java
341455319799a9d3d2688a7d040bdece826a634d 15-Mar-2017 Makoto Onuki <omakoto@google.com> Workaround for b/36228253

Dynamic shortcuts must have target activities, but somehow the invariant
was broken.

Bug: 36228253

Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Change-Id: I9163d57121f102d88baa3e34791877412719da50
hortcutPackage.java
hortcutService.java
dc61d1b2c05c73f3c78de8146caa17432fa5a32c 14-Mar-2017 Calin Juravle <calin@google.com> Merge "Add missing return in DexManager"
4c4936f42572dc39519c5f31c778ae05ee1a2354 14-Mar-2017 Alex Deymo <deymo@google.com> Merge "iot: Grant all runtime permissions for installed apks."
2dfc1b3e125860221bc67835c2d5c99198a12f8a 11-Mar-2017 Calin Juravle <calin@google.com> Add missing return in DexManager

Harmless issue but which can spam the logs.

Test: mostly manual since the check is buried deep inside and cannot be
verified accurately. I added another test to DexManager to stress that
code path and then checked the logs.

Bug: 36117123
Change-Id: I1a878a200f3f726dfaa85f1bed1398acc8dce979
ex/DexManager.java
0de9e5ca3ddb69b4d3d9f3756f03d29f09b81469 14-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Lower-overhead version of LockGuard."
5f3e93451e87d72c513e75c5d5459a4bd2cc41b2 13-Mar-2017 Jeff Sharkey <jsharkey@android.com> Lower-overhead version of LockGuard.

Instead of building up a giant set of all locks inside the system
server, there are only a handful that we're interested in watching:
specifically those below the ActivityManagerService lock.

This change adds a index-based variant of lock registering and
checking, which has much lower overhead that doesn't bring a device
to its knees. It's disabled by default, but can be enabled on local
development builds.

Currently uses the boostPriorityForLockedSection() hook in AMS to
check for lock inversions when enabled.

Test: builds, boots, no AMS lock inversions detected
Bug: 35410906
Change-Id: I473d634d23c08538029412a1254bf4f92b96fb84
ackageManagerService.java
serManagerService.java
02d4e3441bc1bf767d0ed57b81bdfa59d2894cb6 11-Mar-2017 Jeff Sharkey <jsharkey@android.com> Move PackageInstaller over to AppFuse.

When PackageInstaller was originally written, we needed a way to
ensure that untrusted apps were fully hands-off of any opened
FileDescriptors before we could proceed with certificate checks.

The best way to satisfy this security constraint was to build
a utility called FileBridge which was a (terribly slow) RPC
mechanism that could be cut off when needed.

However, a new feature called "AppFuse" offers to create a "proxy"
FileDescriptor which relays file operations back into userspace, and
it's much more performant than FileBridge. (Local benchmark tests
that deliver a 64MB APK show that AppFuse is about 45% faster than
FileBridge.) Because userspace is still involved in every operation,
we can still "revoke" access at any time to deliver on our security
requirements.

This change adds support for AppFuse, while keeping around FileBridge
as the default for now. An upcoming flag-flip CL can be used to
easily switch between the two modes.

Test: builds, boots, benchmarking, stress tests
Bug: 35728404, 31332379, 25510838
Change-Id: I2a70c0ca922a5ba468ffdef7b2fd8ab79f7cfefd
ackageInstallerSession.java
659af44ef9e2cff1c5ced780ad9e6d85de9c71a0 12-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Switch RescueParty to PMS.logCriticalInfo()."
51673a50e3198c48dbfc56c7c567c0660f92dafa 12-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix two storage measurement bugs."
bc9caa1a2a38e23f7a6b61bcda81b5759e45ec66 12-Mar-2017 Jeff Sharkey <jsharkey@android.com> Switch RescueParty to PMS.logCriticalInfo().

When RescueParty is triggered, we could end up in recovery before a
bugreport can be taken. To help understand why RescueParty was
triggered after the fact, this change switches a handful of critical
log messages to use PMS.logCriticalInfo().

These logs then go into our persistent log on disk, which is also
included in all future bugreports.

Bug: 35805331, 36033178
Test: builds, boots, forced crashing recorded in persistent log
Change-Id: Ic71206b25c4b0b703e464ff1d07c5e0b31549257
ackageManagerService.java
82add8a7145c864ce8a604e145ed6abcaa4640b4 12-Mar-2017 Jeff Sharkey <jsharkey@android.com> Fix two storage measurement bugs.

First, every time installd starts up we need to invalidateMounts()
to ensure we have valid mappings for quotactl() to work. (Without
this forced invalidation, we were falling back to manual calculation
after an installd restart.)

Second, when calculating the disk space for an app, we need to use
the real appId deconstructed from the uid; oops! (Without this we
were always trying to calculate the disk usage for UID 0, which
forced us back into the slow-path.)

Bug: 36032444, 35706513
Test: runtest -x frameworks/base/services/tests/servicestests/src/com/android/server/pm/InstallerTest.java
Change-Id: I1ca55e2b7670678ed55798e2e06857d727ce2487
nstaller.java
2cfdf62ed20016c6f64bba3ce6d7ec1c446c272f 12-Mar-2017 Jeff Vander Stoep <jeffv@google.com> Merge "Move mac_permissions to etc/selinux" am: b063fe384f am: 1376b937ed
am: 7f9630868c

Change-Id: Ie90342ef543ed0803fc279adbfb3e919f6bf63d5
7f9630868c2d2a4e43ddf82a09317e33c6db0393 12-Mar-2017 Jeff Vander Stoep <jeffv@google.com> Merge "Move mac_permissions to etc/selinux" am: b063fe384f
am: 1376b937ed

Change-Id: Iac3ff86d133cbd8cdbee69456be0677a5c2f7c51
1376b937ed5cc65c64a73487eb9935c9e3f3f46d 12-Mar-2017 Jeff Vander Stoep <jeffv@google.com> Merge "Move mac_permissions to etc/selinux"
am: b063fe384f

Change-Id: Ia6da81ff48e749c8d3f4f150e81fc0c138e7763e
c37cc6030146f7179d658cc1969a5353dad5fd97 11-Mar-2017 Sudheer Shanka <sudheersai@google.com> Merge "Update IUidObserver.onUidStateChanged to include procStateSeq."
d2820e4e8913741ce5b34344ed37c7ced3cc2d96 11-Mar-2017 Jeff Vander Stoep <jeffv@google.com> Move mac_permissions to etc/selinux

Test: Build and boot Marlin
Test: See the following in the logs:
01-01 02:10:28.756 1345 1345 D SELinuxMMAC: Using policy file /system/etc/selinux/plat_mac_permissions.xml
01-01 02:10:28.787 1345 1345 D SELinuxMMAC: Using policy file /vendor/etc/selinux/nonplat_mac_permissions.xml
Bug: 36003167

Change-Id: I97479260eabe14c1b1dcc238d7322016f6b5c4dd
ELinuxMMAC.java
8025580449081ddd21f449f8719bc87d1cc9fc7b 04-Mar-2017 Sudheer Shanka <sudheersai@google.com> Update IUidObserver.onUidStateChanged to include procStateSeq.

This procStateSeq is associated with the process state change of
an uid and will help in identifying if network policy rules have been
updated for a process state change.

Bug: 27803922
Test: runtest -c com.android.server.am.ActivityManagerServiceTest
frameworks-services
Change-Id: Iaab8d004f476b96f28d08c886c7b0a6b585b9fef
hortcutService.java
40d3de36ba0936e1113804a2e8084641ceff5902 10-Mar-2017 Svetoslav Ganov <svetoslavganov@google.com> [DO NOT MERGE] Don't allow permission change to runtime am: fe430be9f1 am: 903102fa54 am: 33f5a3ccb3 am: 4682420d59
am: 52fc40c21c

Change-Id: I015615df364706be928680209135cc3f23aed8f7
52fc40c21cb120eb1e1d3e7ef909b4255b5e2867 09-Mar-2017 Svetoslav Ganov <svetoslavganov@google.com> [DO NOT MERGE] Don't allow permission change to runtime am: fe430be9f1 am: 903102fa54 am: 33f5a3ccb3
am: 4682420d59

Change-Id: I2855b5a4f566006fe08eac46b9eb78a8662c915e
4682420d59b8caae8b324f906126410d6706f0b9 09-Mar-2017 Svetoslav Ganov <svetoslavganov@google.com> [DO NOT MERGE] Don't allow permission change to runtime am: fe430be9f1 am: 903102fa54
am: 33f5a3ccb3

Change-Id: Ie8690c9aa675fc06faec8b8da878030e1dccb4d7
33f5a3ccb382e66d1e1c95469782e388a44f51d3 09-Mar-2017 Svetoslav Ganov <svetoslavganov@google.com> [DO NOT MERGE] Don't allow permission change to runtime am: fe430be9f1
am: 903102fa54

Change-Id: I5035132d971ab163c20ad036851830d8abdc8137
903102fa54aaa20d3969f90426512d09adb69f09 09-Mar-2017 Svetoslav Ganov <svetoslavganov@google.com> [DO NOT MERGE] Don't allow permission change to runtime
am: fe430be9f1

Change-Id: I7c41e88f49738d927a5c0233b9702b36d2ca7282
fe430be9f102893c95258cc81589df132b7d02b3 29-Dec-2016 Svetoslav Ganov <svetoslavganov@google.com> [DO NOT MERGE] Don't allow permission change to runtime

Prevent apps to change permission protection level to dangerous
from any other type as this would allow a privilege escalation
where an app adds a normal permission in other app's group and
then redefines it as dangerous leading to the group auto-grant.

Test: Added a CTS test which passes.

Bug: 33860747

Change-Id: I1ccf546f78ee79ff027cb98124be81c8e5265a82
ackageManagerService.java
34573b289f03d29aa4da114a33c5584856da412d 08-Mar-2017 Chad Brubaker <cbrubaker@google.com> Prevent downgrade of targetSandboxVersion

Bug: 34761192
Test: manual
Change-Id: I0a17006156213ebbc748a37bc5b4ceaa8cc8dd94
ackageManagerService.java
e6306c485f0d43ce094a708c76bb9f5ea9703fd3 08-Mar-2017 Jeff Sharkey <jsharkey@android.com> Throw at getPackageSizeInfoAsUser() callers.

But only when targeting O; if they're old apps then log and pass
a soft failure message to their callback.

Test: builds, boots
Bug: 35749102
Change-Id: I6c6b5a37c23669e7b1ed3c30207bca610821eb1f
ackageManagerService.java
4f459b85d414ef163dd1233af4b1700a5afd4fe7 08-Mar-2017 Jeff Sharkey <jsharkey@google.com> Merge "Revert "Throw at getPackageSizeInfoAsUser() callers.""
e8914d2ba4bcd793e675cac6c1c226b98520bc32 08-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Do not disable Open Network Notifications setting on profile change."
dd3adc339808ebb5eb2d1e73a8b0a0bd09f9455a 08-Mar-2017 Tony Mantler <nicoya@google.com> Revert "Throw at getPackageSizeInfoAsUser() callers."

This reverts commit 597c93454699eaed99d6b417080417d75777e72d.

Change-Id: I7d966ef973050ef791403062774fd7f576a65388
ackageManagerService.java
4ad75b0541d824bea1a7314092b27b94b5a85a9c 08-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Throw at getPackageSizeInfoAsUser() callers."
597c93454699eaed99d6b417080417d75777e72d 08-Mar-2017 Jeff Sharkey <jsharkey@android.com> Throw at getPackageSizeInfoAsUser() callers.

But only when targeting O; if they're old apps then log and pass
a soft failure message to their callback.

Test: builds, boots
Bug: 35749102
Change-Id: Ifecf7108397444e88763f404a4b5f3fdc48443bb
ackageManagerService.java
b1818b8a36868675b06d080abe7c5b46f4271a85 07-Mar-2017 Calin Juravle <calin@google.com> Merge "PackageManager: Clean up code related to foreign dex use"
am: eef66fd0c7

Change-Id: I443f001c15daddd63a17685c2e82fc9a619c45ee
bf80a14d5b60a051af3872bdbed215cc4de05e7f 06-Mar-2017 Stephen Chen <stewchen@google.com> Do not disable Open Network Notifications setting on profile change.

The DISALLOW_CONFIG_WIFI user restriction will be enforced in the
feature implementation instead.

Bug: 35996959
Test: runtest --path
frameworks/base/services/tests/servicestests/src/com/android/server/pm/UserRestrictionsUtilsTest.java

Change-Id: Iabde4f974d26ab264e9544018d6547b4147f81aa
serRestrictionsUtils.java
aa66d9f7e4239374bcfebf7a77ac5df23b847b0e 06-Mar-2017 Todd Kennedy <toddke@google.com> Don't call InstantAppRegistry with a null package

Change-Id: I40e3a6529cf6b77857ea67c9a83029cc57696227
Fixes: 35970992
Test: Manual
ackageManagerService.java
4c06f55f14538d8b065d97d7f3fd2b79976fb94b 04-Mar-2017 Calin Juravle <calin@google.com> PackageManager: Clean up code related to foreign dex use

We simplified the way we track whether or not a dex file is used by
other apps. DexManager in the framework keeps track of the data and we
no longer need file markers on disk.

Test: device boots, foreign dex markers are not created anymore

Bug: 32871170

(cherry picked from commit 74f0a3450cd598f52b2c68c43531b1a27fb4e1ce)

Change-Id: I2a9daca15e5120518852584fa17aa94012af8f1a
Merged-In: I3660e2f3913a73904181449c2d910af0a0477950
ackageManagerService.java
9108ae1a16d1c9b0ad75292903b9cab26ab47633 07-Mar-2017 Calin Juravle <calin@google.com> Merge "PackageManager: Clean up code related to foreign dex use"
74f0a3450cd598f52b2c68c43531b1a27fb4e1ce 04-Mar-2017 Calin Juravle <calin@google.com> PackageManager: Clean up code related to foreign dex use

We simplified the way we track whether or not a dex file is used by
other apps. DexManager in the framework keeps track of the data and we
no longer need file markers on disk.

Test: device boots, foreign dex markers are not created anymore

Bug: 32871170
Change-Id: I3660e2f3913a73904181449c2d910af0a0477950
ackageManagerService.java
a9e8d358e873c53484ff071685e98361a21c48ef 07-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes I546a3133,I5d892b2d

* changes:
Don't skip verification of Instant Apps
Expose ACCESS_INSTANT_APPS to the verifier
a485f71fd77302f31daa0d6ae29f6802a61eddcf 06-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Refactor EphemeralResolverService"
b94103d25dc15adde4329383a2bf0281868c45c9 06-Mar-2017 Chad Brubaker <cbrubaker@google.com> Don't skip verification of Instant Apps

Test: builds
Change-Id: I546a31334b8f15f360ca5599d96ac8783496fc92
ackageManagerService.java
0fdb3a84cfd722c994ab693cfef3edc2a51f3115 04-Mar-2017 Christopher Tate <ctate@google.com> Fix bug #35673706 - null verifier component...

...causing an NPE when we attempted to call getPackageName() on it.

This patch avoids the NPE, but does not address the underlying
question of why the component we're attempting to target is coming
back null. This new approach guarantees the security of the broadcast,
though, so we needn't worry further about that.

Test: install app & note verifier action

Change-Id: I0d316e0815210ba1fbb14da6b76d5c23a85c96a4
ackageManagerService.java
8d3a80405424b11a9f6741751fe40bb1cadce14c 01-Oct-2016 Ralph Nathan <ralphnathan@google.com> iot: Grant all runtime permissions for installed apks.

Iot devices don't have user-installable apps. In addition, not all iot
devices have a screen. As such, it doesn't make sense to have runtime
permissions nor can users grant them in all cases.

Cherry-picked and adapted to depend on the FEATURE_EMBEDDED flag.

Bug: 31220981
Bug: 35804180
Test: manual test w/app

(cherry-picked from 1e577da550c523edea9bd23ef5a0baf221c936f8)

Change-Id: Ib3ca73660bc511ab68982b82327463801b583d0b
efaultPermissionGrantPolicy.java
1fb3404b2ba69a823e961bec2d9ed61622107052 01-Mar-2017 Todd Kennedy <toddke@google.com> Refactor EphemeralResolverService

* Change name to InstantAppResolverService
* Left old service in place to handle existing client
[to be removed prior to O launch]
* When resolving phase II, return a list instead of a single item

Bug: 34763730
Test: Build and verify resolution occurs w/ legacy & new resolver service
Change-Id: Ieccaf91538bd91c04f4be4e35d8264619d7cd6d7
phemeralResolver.java
phemeralResolverConnection.java
nstantAppResolver.java
ackageManagerService.java
e096df0063f9b22af1bf9159e4b6056c1c5c70f0 03-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Adding support for passing arbitrary extras when requesting to pin a widget. Also defining an extra constant for widget preview which can be used by developers to provide a snapshot of the widget with the pin request"
638903002ef2a6da352c52aaeb9342ec25339ad1 03-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "OMS: Introduce default overlays"
9635fbd7c51db046df5144fc80035b5a5fbf626e 03-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "handle case where user == USER_ALL"
e6f3ed6aefcc3622e040343754b70757577bb9c9 03-Mar-2017 Calin Juravle <calin@google.com> Merge changes from topic 'secondary-dex1'
am: d56d98b860

Change-Id: Ia9c1329584597a6f30aeaa2bd8e8c979705d8eea
d56d98b8607e7316e93fd3daf33b7b7438921ce8 03-Mar-2017 Calin Juravle <calin@google.com> Merge changes from topic 'secondary-dex1'

* changes:
Use DexManager logic to decide if a package is used by other apps
Skip class path checking for secondary dex files
c6494490939768ab86d88abd2e562e0e591d7a8e 02-Mar-2017 Calin Juravle <calin@google.com> Use DexManager logic to decide if a package is used by other apps

Stop relying on the file marker recorded by the runtime. We have the
same data available from the DexManager.

The clean up CL to remove the handling of the file markers will follow.

Test: verify that "shared packages" (e.g. gmscore) are not compiled with speed-profile.

Bug: 32871170

(cherry picked from commit 07b6eabe79261267ecd7114790e96e1f6828672a)

Change-Id: I2969b75fa77d38dde0073ef67aa89b1dc91237b5

Merged-In: I6cc5834ac88489e69896cd5fba9ed9968aa7f5a2
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceUtils.java
ex/DexManager.java
f8afcdc7b7b39ddc7161b1be01eebf763e68c793 15-Feb-2017 Calin Juravle <calin@google.com> Skip class path checking for secondary dex files

Pass '&' marker to dex2oat classpath when compiling secondary dex files.
This will skip class path checking when loading the oat files.

Test: adb shell cmd package compile -m speed -f --secondary-dex com.google.android.gms
oatdump --header-only --oat-
file=/data/user/0/com.google.android.gms/app_chimera/m/00000006/oat/arm64/DynamiteModulesC_GmsCore_prodmnc_alldpi_release
check that the class path contains the special '&' marker

Bug: 32871170

(cherry picked from commit aae35767b6bca6f872c906a0fd38d7adb61217bd)

Change-Id: I7f3c6743e749316ee02e8586a525ad28ae1ef765

Merged-In: If0628aeb4e3f5717604bfc4a87a4b1d438e5fa65
ackageDexOptimizer.java
ackageManagerService.java
6f00e6e977eff9d4a18a1cd607faa904b78adb9c 03-Mar-2017 Elliott Hughes <enh@google.com> Merge "Remove the name length limit for system properties."
am: c657b769ab

Change-Id: I700b379c0482d7d9609183a39a5c9664746ea5aa
c657b769ab9d37daa8a6086ec0e468bcb3530a50 03-Mar-2017 Elliott Hughes <enh@google.com> Merge "Remove the name length limit for system properties."
a400ccdaa0c77f4cce3113d0a4f71f5c4b02fa52 03-Mar-2017 Calin Juravle <calin@google.com> Merge changes from topic 'secondary-dex'
am: 9e88c53337

Change-Id: I77e80eaf9274a64348c80b251e865ecdb6e53dbc
ade90057c6d80d13114134c54c5e594892856b48 03-Mar-2017 Calin Juravle <calin@google.com> Save package dex usage info after secondary dex reconciliation
am: 61fd6eab46

Change-Id: I90a95645e9d2acf1b2377e165a64b34b1a678295
112a61bf32d7c9ba6337d2fd4c760bc2904e4688 03-Mar-2017 Calin Juravle <calin@google.com> Compile secondary dex files during background dexopt job
am: 574994afde

Change-Id: I204983f6221c07467b450ea9e0bf71b6d15926e1
90ac28d618a8428a5943e4183d4139f08a5a25ad 03-Mar-2017 Calin Juravle <calin@google.com> Add a shell command to force the background dexopt job
am: f7edab63d9

Change-Id: Ie77bc356a9ff4786c23a06d1267dc7ca5e45a90a
a0358c9e32b4e0c1797b799457af602710e228d9 03-Mar-2017 Calin Juravle <calin@google.com> A bit more refactoring in BackgroundDexOptService
am: a57ef16375

Change-Id: Ic258b5484eedcc68650b474acb4fa3eae8589c82
110e897eaa78aab17685ada1402185f69358699a 03-Mar-2017 Calin Juravle <calin@google.com> [PM] Clean up logic for secondary dex oat files
am: e69fba3f7f

Change-Id: I223b27221acf25e628003dde0f63cffe66779753
468be64cf2a7dac72f9803f6b1fb0fbed0a17fa6 03-Mar-2017 Calin Juravle <calin@google.com> Compile secondary dex files in DexManager
am: 7218363a92

Change-Id: I53e7864b097cf9cff702e9185bb1c9091d97fe63
27ea5920987d4639a457130d1e55a0b92bb73dc2 03-Mar-2017 Calin Juravle <calin@google.com> Notify DexManager about new package installs
am: fcd672fca3

Change-Id: I63514deebef293d52f7811023b0915cf655514f6
a5ca62408381058c12bd5a1fe3b30f2512a73e03 02-Mar-2017 Adam Lesinski <adamlesinski@google.com> OMS: Introduce default overlays

Default overlays are applied at first boot. They are specified by
package name in system property ro.boot.vendor.overlay.theme as a
semicolon separated list.

Eg:

ro.boot.vendor.overlay=com.android.vendor.overlay;com.android.vendor.overlay_two

Test: manual (remove /data/system/overlays.xml and reboot)
Change-Id: I8a7443a9059ccabfe1a63b075b95f1b2b6db7dbd
ackageManagerService.java
33cc60ccc98b555bb7d9e7c75d7435917cca1458 02-Mar-2017 Elliott Hughes <enh@google.com> Remove the name length limit for system properties.

Bug: http://b/33926793
Test: builds
Change-Id: Ib89b66b7abebc9a28961a0c9032b99947e3db0d6
Merged-In: Ib89b66b7abebc9a28961a0c9032b99947e3db0d6
ackageManagerServiceCompilerMapping.java
cb0629eaa1a63684b1e6dbb366d42e80a26a5da9 02-Mar-2017 Elliott Hughes <enh@google.com> Merge "Remove the name length limit for system properties."
3c954e9e01b4a79535f3de27a20398e6af620df0 02-Mar-2017 Calin Juravle <calin@google.com> Merge "Update package use info when the app data is updated"
ad014af09a737c2c336236b63f19b7f35f536b19 07-Feb-2017 Calin Juravle <calin@google.com> Fix typo in dexopt.secondary system property

Test: adb shell cmd package bg-dexopt-job
Bug: 32871170

(cherry picked from commit 4466c5ad84e4429284b7d5e13ad8a87c924ea7fc)

Change-Id: Ibfe3111198877ed0d758b68be89afb23c4756053

Merged-In: Ic8a14a3fc5c9aa63f6cb376f337b5bf459997325
ackgroundDexOptService.java
61fd6eab463d5b86ef177537c149ee45a0a40dcc 27-Jan-2017 Calin Juravle <calin@google.com> Save package dex usage info after secondary dex reconciliation

Bug: 1833991
Test: add a bogus entry to /syste/data/package-dex-usage.list
adb shell cmd package reconcile-secondary-dex-files
com.android.google.gms
wait a bit and check the bogus entry is gone

(cherry picked from commit b1097411028103b6c88ce325af23d2ff1ec746c8)

Change-Id: I23248b11ea07bceb6527f55bf62618d1b2c3d83d

Merged-In: Ic07126bfb8730933081a5e010e3c357d338786e8
ex/DexManager.java
ex/PackageDexUsage.java
574994afde208fcb60f5aea9921b9b381e13e888 26-Jan-2017 Calin Juravle <calin@google.com> Compile secondary dex files during background dexopt job

Extend the backgound dexopt job to compile secondary dex files when
"dalvik.vm.deopt.secondary" system property is set to true.

Test: adb shell cmd package bg-dexopt-job
Bug: 32871170

(cherry picked from commit 51f521c3bf46e6040f36757bc53ea57ddc7be85e)

Change-Id: I220ff4ea26c4eee030ab1a9f4c957a09aa9f2f4c

Merged-In: If3a4b77f785e92c7f2f7869e25ff9b99904f165a
ackgroundDexOptService.java
ackageManagerService.java
ex/DexManager.java
ex/PackageDexUsage.java
f7edab63d9358b9a4e0dbec3243f6db9f50a2bbe 26-Jan-2017 Calin Juravle <calin@google.com> Add a shell command to force the background dexopt job

Add 'bg-dexopt-job' command to 'adb shell cmd package' which will force
the background dexopt job to run the optimizations immediately.

Note that the command only runs the background optimizer logic. It may
overlap with the actual job but the job scheduler will not be able to
cancel it. It will also run even if the device is not in the idle
maintenance mode.

Test: adb shell cmd package bg-dexopt-job
Bug: 32871170

(cherry picked from commit cb5f41ea11b1a6fcd0977a64ee146dde8f537076)

Change-Id: I82c781d46fe16e7b7566a5b5ee91be723a2125cb

Merged-In: I8b0112074220b2e09baf13d842401ee1cf306a89
ackgroundDexOptService.java
ackageManagerService.java
ackageManagerShellCommand.java
a57ef163750ca72180092de7e85835d2b8f464bc 26-Jan-2017 Calin Juravle <calin@google.com> A bit more refactoring in BackgroundDexOptService

Extract convenient methods to help with:
- adding a shell command to run the background dexopt job
- extending idleOptimizations to cover secondary dex files

Test: device boots, background job run.
Bug: 32871170

(cherry picked from commit c660475aafe91269be306c802823cf543005ce36)

Change-Id: I146e4faeea90f2d58144a5dba26ae7f90a36b402

Merged-In: I18fde62a1cb05c030a620722d5f217589beaefb1
ackgroundDexOptService.java
e69fba3f7fbc8e4fc6c02b80c8fac097804b97f7 25-Jan-2017 Calin Juravle <calin@google.com> [PM] Clean up logic for secondary dex oat files

Add logic in DexManager to reconcile secondary dex records with the
actual files on disk. If secondary dex files are moved or removed then
DexManager will remove the generated oat files during the call to
reconcileSecondaryOdex() and update its internal state.

Add 'adb shell cmd package reconcile-secondary-dex packageName' which
will force DexManager to sync its data with the actual secondary dex
files.

Test: devices bots
runtest -x .../PackageDexUsageTests.java
runtest -x .../DexManagerTests.java
adb shell cmd package reconcile-secondary-dex
com.android.google.gms (after artificially/temporarily renaming some
dex files)

Bug: 32871170

(cherry picked from commit c22c30ed1c05c5c24185dc4d380d1c5026923d46)

Change-Id: Ied9fcbfe367ed3a8250a9ba8d202518b264c64e8

Merged-In: Id2d72dc89995f89cf1ddf79ae4e992afd3f3c127
nstaller.java
ackageManagerService.java
ackageManagerShellCommand.java
ex/DexManager.java
ex/PackageDexUsage.java
7218363a92d15cc1854cf298ef77e1ed2aeafa3b 17-Jan-2017 Calin Juravle <calin@google.com> Compile secondary dex files in DexManager

Add logic for secondary dex compilation in DexManager. Also, extend the
`cmd package compile` command with '--secondary-dex' option which will
compile all used secondary dex files for the given package.

Test: flash & boot,
cmd package compile --secondary-dex -f -m speed
com.google.android.gms
Bug: 32871170

(cherry picked from commit c22c30ed1c05c5c24185dc4d380d1c5026923d46)

Change-Id: I3cf26edbfb5e9f3683e608bb2a596e1ab5682bd4

Merged-In: Ia2b95cb70d26c4ead5cb650047641b0881ca84ae
nstaller.java
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
ackageManagerShellCommand.java
ex/DexManager.java
fcd672fca3e48cc5ce1e82aacec26ac391cedd01 24-Jan-2017 Calin Juravle <calin@google.com> Notify DexManager about new package installs

This will update the internal cache so that the secondary dex files of
the new package can be found when loaded.

Test: runtest -x .../DexManagerTests.java

Bug: 32871170

(cherry picked from commit 0d4b8f8b0c963d9a1f5cb6aff11a11195a3df225)

Change-Id: I34008f6d262f19e88a346a36b83e4093b4129105

Merged-In: I0cb7158af249feeb01cf578a7544dda978eede9d
ackageManagerService.java
ex/DexManager.java
e9f0fe9274cce675e09a117e3593601b9424ea51 02-Mar-2017 Calin Juravle <calin@google.com> Merge "Use DexManager logic to decide if a package is used by other apps"
67a14e1124f799b535d8bc28aa0dbe402eb77a04 02-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Force ephemeral apps to have correct targetSdk/targetSandbox temporarily"
99dd37b3c5262910150ef955d16a33d32da264dd 23-Feb-2017 Calin Juravle <calin@google.com> Update package use info when the app data is updated

- clear usesByOtherApps flag when the package is updated
- delete secondary dex usage data when the app data is destroyed

Test: runtest -x .../PackageDexUsageTests.java
runtest -x .../DexManagerTests.java
Bug: 32871170
Bug: 35381405

Change-Id: I3a249b9e8680e745fa678c7ce61b4ae764078fb9
ackageManagerService.java
ex/DexManager.java
ex/PackageDexUsage.java
594ea5f8b031c09de090eab446209b84aa78fd37 02-Mar-2017 Dianne Hackborn <hackbod@google.com> Merge "Implement issue #34842682: Add ability to limit permissions based on features"
c77001de5158b531b18858a84488a08d9460a429 02-Mar-2017 Elliott Hughes <enh@google.com> Remove the name length limit for system properties.

Bug: http://b/33926793
Test: builds
Change-Id: Ib89b66b7abebc9a28961a0c9032b99947e3db0d6
ackageManagerServiceCompilerMapping.java
07b6eabe79261267ecd7114790e96e1f6828672a 02-Mar-2017 Calin Juravle <calin@google.com> Use DexManager logic to decide if a package is used by other apps

Stop relying on the file marker recorded by the runtime. We have the
same data available from the DexManager.

The clean up CL to remove the handling of the file markers will follow.

Test: verify that "shared packages" (e.g. gmscore) are not compiled with speed-profile.

Bug: 32871170
Change-Id: I6cc5834ac88489e69896cd5fba9ed9968aa7f5a2
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceUtils.java
ex/DexManager.java
4ad6b57700bef4c484021f49e018117046562e6b 28-Feb-2017 Sunny Goyal <sunnygoyal@google.com> Adding support for passing arbitrary extras when requesting to pin a widget.
Also defining an extra constant for widget preview which can be used by
developers to provide a snapshot of the widget with the pin request

Bug: 35811129
Test: All exisiting tests passing
for f in 1 2 3 4 5 6 7 8 9 10; do \
adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest$f \
-w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner; \
done;

adb shell am instrument -e class com.android.server.appwidget.AppWidgetServiceImplTest \
-w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: Id854bd28468a5bf0416ff1a1b19c44d850016f32
hortcutRequestPinProcessor.java
hortcutService.java
e4179e2c4e674b32390a9133bb9fbb3ef5df651b 01-Mar-2017 Hyunyoung Song <hyunyoungs@google.com> Change MaskableBitmap to AdaptiveBitmap
Test: $ make dist -j30
b/35399620

Change-Id: I96d6eaceaf7ce9dec7de21634a5fa2bd40b0deba
hortcutPackage.java
hortcutService.java
cd154e95353e7af11314d2339500d6c7f85e181a 01-Mar-2017 Dianne Hackborn <hackbod@google.com> Implement issue #34842682: Add ability to limit permissions based on features

Two new attributes for <uses-permission>: android:requiredFeature and
android:requiredNotFeature.

Also update aapt to include this information in badging:

uses-permission: name='android.content.cts.REQUIRED_NOT_FEATURE_UNDEFINED' requiredNotFeature='android.software.cts.undefined'
uses-permission: name='android.content.cts.REQUIRED_MULTI_DENY' requiredFeature='android.software.cts.undefined' requiredNotFeature='android.software.cts'

Test: new PermissionFeatureTest suite.

Change-Id: Icc1f815a4675ae9dd2cb7f61730ab28b5c11228a
ackageManagerService.java
arallelPackageParser.java
2cda00e29a9a081087a7f16333fd492b88da988a 01-Mar-2017 Geoffrey Pitsch <gpitsch@google.com> Merge "Channels for Frameworks notifications"
7381e6eb214689c1230b357451b23bd5bf42ef90 01-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Expose isInstantApp() to more callers"
af759c52ce01fe6b5144957e38da956af01a217b 15-Feb-2017 Geoffrey Pitsch <gpitsch@google.com> Channels for Frameworks notifications

Adapts all notifications used by system services to use channels.
Channels are initialized by SystemServer after the NotificationService
has started.

Test: runtest systemui-notification
Change-Id: I25c45293b786adb57787aeab4c2613c9d7c89dab
ackageInstallerService.java
eaff891f0157f92e81601cb7eb2a9c2d902de152 01-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "set bounds"
1b4cdf909f7c9f3ad9b12d666ca5a4c1dde43308 01-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add boolean when instant apps are available"
247a3c01326fbcd4e12270b5a2d4fb42fa78e7c6 01-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Introduce ANSWER_PHONE_CALLS permission"
41a0efb3ca31ee9c2c6a763e26765f7ecbdff126 01-Mar-2017 Todd Kennedy <toddke@google.com> Expose isInstantApp() to more callers

Instead of just allowing the instant app itself, also allow anyone
with ACCESS_INSTANT_APP permission or apps that the instant app
has granted access.

Change-Id: I5a79ef9520db908ba9ab56af0157b1646d2d8cc1
Fixes: 34123112
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
ackageManagerService.java
e19e5677a57de03453ed61d7c36c806427a98d20 01-Mar-2017 Sunny Goyal <sunnygoyal@google.com> Merge "Sending explicit broadcast to the launcher when a package is installed"
533c9ff58d7649c6056f12c85b4122970f77236b 27-Feb-2017 Todd Kennedy <toddke@google.com> Add boolean when instant apps are available

Bug: 34168547
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Change-Id: Ic1072d02aa4d43947e689e4381c2c5ee43704dd0
ackageManagerService.java
03f336b1fa8ac79f94d27e9bc8f9b3a312eab18c 01-Mar-2017 Todd Kennedy <toddke@google.com> set bounds

temporary workaround to prevent ephemeral app uninstallation from
crashing the system server.

Bug: 35673160
Test: manually uninstall ephemeral app and see the framework doesn't crash
Change-Id: I6542206b51a00ca4321de4310a59620569b1516a
nstantAppRegistry.java
6d7cb232362d8036875d1d3c3f0e8f5d47a2ad25 30-Jan-2017 Sunny Goyal <sunnygoyal@google.com> Sending explicit broadcast to the launcher when a package is installed

Test: Manually tested on device and add CTS tests
Bug: 32920609
Change-Id: Ic23c077a469fb41d6c4e123d4bc022899f634198
ackageInstallerSession.java
ackageManagerService.java
e0177dbb8bd28526e6cd56188896b1a9528c7f38 28-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Prevent packages besides android defining ephemeral permissions"
2f2053b939fdd1aee80d7bba531707d56f498c07 28-Feb-2017 Chad Brubaker <cbrubaker@google.com> Prevent packages besides android defining ephemeral permissions

Bug:34980926
Test: manual
Change-Id: I608bc746b4b212c02ba62433fbb3f8141b5e67e9
ackageManagerService.java
6de3d56a9fe8ae8fdc6bfe9e0231a531327b9d04 28-Feb-2017 Todd Kennedy <toddke@google.com> handle case where user == USER_ALL

Change-Id: I0f2737dbe994595e2c624b674a1a8ce863ae1854
Fixes: 35271941
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.PkgInstallSignatureVerificationTest#testInstallEphemeralRequiresV2Signature
ackageManagerService.java
bdaded344f39124abb47512927338e7daa6de21d 27-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't log privapp-permissions violations for updated apps"
1058a3dd95c6afe89e2a9eb97fa2e554f383ee86 27-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Push chooser targets to the shortcut manager."
ff8351a311045cd91962f0cb5d03f15425d2401e 27-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "don't call settings provider with pkg mgr lock"
9687767d759936a51ca2f7d90b3810f8b9bea0d4 27-Feb-2017 Makoto Onuki <omakoto@google.com> Merge "Allow querying providers with a specific metadata."
58fc95dc578244b7beb687a48184045dcce788b8 14-Dec-2016 Hakan Seyalioglu <hseya@google.com> Push chooser targets to the shortcut manager.

More info at go/direct-share-push

Test: Some basic testing currently in, more to be added.

Change-Id: I069f9779988c3eca2c4d8b83ec62501983854355
auncherAppsService.java
hortcutPackage.java
hortcutService.java
2fc7c3f7e0c2f96caa9478e333e7741c82680029 27-Feb-2017 Todd Kennedy <toddke@google.com> don't call settings provider with pkg mgr lock

Bug: 34739922
Test: manual
Change-Id: I8bd5ad76d1db5125d75c086b7f0aa24b7ac3919a
ackageManagerService.java
d627294d830d6010f79168a9dcc3828e5221c6c9 26-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Catch all exceptions thrown by the interfaces."
cae3d3e59e5f9f2161921654f80e3ec6283f7662 31-Jan-2017 Eugene Susla <eugenesusla@google.com> Introduce ANSWER_PHONE_CALLS permission

This exposes an API to answer a ringing call, as well as a corresponding
runtime permission and appop

Test: Grant the permission and ensure the call gets answered.
Deny the permission, and ensure that the API call throws an exception.
Bug: 30932767
Change-Id: I4c33fcea6b95a30469fa6c0c37090be32b0ad52e
ackageManagerService.java
e9cedbd28199cac0eb1e392d0703880d3e56725d 25-Feb-2017 Makoto Onuki <omakoto@google.com> Merge "Don't include Bitmaps in activity intents"
8abba3a641086cbc66c7ed037a8f6f8a9f600802 24-Feb-2017 Makoto Onuki <omakoto@google.com> Don't include Bitmaps in activity intents

Bug: 35515740
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutManagerTestCases
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutHostTestCases

Change-Id: Ibb94728eb03997bb850b08c61c756f283bd90a08
hortcutRequestPinProcessor.java
ff506659a73d47ce96a61a0b93013786ba60e8c0 24-Feb-2017 Netta Peterbursky <nettap@google.com> Merge "Protobufferize PackageManager dumpsys"
0ba0d814b300e9dea70933885c1837695eda69da 24-Feb-2017 Fyodor Kupolov <fkupolov@google.com> Don't log privapp-permissions violations for updated apps

Only warn about violations in non-updated apps. If an updated privileged
app started requesting a new privileged permission, it cannot be
whitelisted on system image, so we should revoke it as before, but not log.

Test: manual
Bug: 35633526
Change-Id: I6aacaed4be7bf6eaef08ea81ea49cd250c81e71e
ackageManagerService.java
aaee062899d41513840fd11fe2df73604ceb80ea 24-Feb-2017 Jeff Sharkey <jsharkey@android.com> Catch all exceptions thrown by the interfaces.

Test: builds, boots
Bug: 35749102
Change-Id: Ib5db19dd8f3ae591ed84972c1b234f27932fc66c
ackageManagerService.java
1a082becfd4106d87dc69ef0634e080629483991 24-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Better error message when no UID allocated."
2140cd6431266bdb17024c66bb93cf88ff7cc407 24-Feb-2017 Jeff Sharkey <jsharkey@google.com> Merge "Block new installs into ASEC containers."
f60d8ab3d8dc4721098d59682a3659ef5a790cdf 24-Feb-2017 Jeff Sharkey <jsharkey@android.com> Better error message when no UID allocated.

Test: builds, boots
Bug: 34355942
Change-Id: I6062dc542d9088f34b5cb8ddac197cc34a970278
ettings.java
8c61e39e042c31dd21567897c834c7c45fe7181b 24-Feb-2017 Jeff Sharkey <jsharkey@android.com> Block new installs into ASEC containers.

ASEC containers have been deprecated since MNC, which is when we
introduced the "adoptable storage" feature. Adoptable storage is a
much better user experience, since we move both the APK and private
app data together as a single unit, making it much easier to explain
to users.

Test: builds, boots
Bug: 32913676
Change-Id: I97385d081a50a79fc005d4e23e09999f9ae6cfc1
ackageInstallerService.java
ackageManagerService.java
9584868f8824e41f010590b4c64654a6de1f5357 24-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add new internal resolve method"
d143808365c06be7e64837d005d07e91ebfad745 06-Feb-2017 Chad Brubaker <cbrubaker@google.com> Force ephemeral apps to have correct targetSdk/targetSandbox temporarily

There is a bit of a chicken and egg problem with Instant Apps and the
requirement to have targerSdk >= O and targetSandboxVersion >= 2 with
the sdk not being locked down yet. To work around this for now the
targetSdk and targetSandboxVersion will be made correct instead of
causing the install to fail. This work around must be removed before O
ships.

Test: adb install --ephemeral updates the targetSdk and targetSandbox
accordingly.

Change-Id: I283e71e459f0f69ef4053591b6647991746f54da
ackageManagerService.java
bd9e74cae0f3de1039c9ddcee3caa0849b604c7c 24-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "OMS: integrate OverlayManagerService into framework"
4d1de7da79010be3e1f0eb85aa50b6002a8241fd 23-Feb-2017 Todd Kennedy <toddke@google.com> Add new internal resolve method

Instant apps are unique in that any application can start them
with a VIEW/BROWSABLE while only very few apps can see an
instant app using queryIntentActivites, etc... In order to
support this dichotomy, we need an internal hook to resolution
for activity start.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Bug: 25119046
Change-Id: If6974c09c733ff0417ef72cabb9d9e9aca86c37c
ackageManagerService.java
ettings.java
2e0d0f311100d8e0bb40d7d60b8498237f011f0c 02-Jun-2016 Mårten Kongstad <marten.kongstad@sonymobile.com> OMS: integrate OverlayManagerService into framework

Hand over ownership of overlays to OverlayManagerService.

Changes to a package's overlays are propagated using the activity life
cycle. Affected activities will be recreated as needed. This provides a
well-defined point to modify an application's assets while the
application is paused.

Consolidate how overlays targeting the system and overlays targeting
regular applications are handled. Previously, system overlays were
handled as a special case. Now, everything is handled identically. As a
side effect, the call to idmap --scan during Zygote boot has become
obsolete and is removed.

Information on what overlays to use is recorded in
ApplicationInfo.resourceDirs. The PackageManagerService is responsible
for the creation of ApplicationInfo objects. The OverlayManagerService
is responsible for informing the PackageManagerService in advance about
what resourceDirs to use.

When launching an application, the ApplicationInfo is already populated
with up-to-date information about overlays.

When enabling or disabling an overlay for a running application, the
OverlayManagerService first notifies the PackageManagerService about the
updated resourceDirs. It then tells the ActivityManagerService to push
the new ApplicationInfo object to the application's ActivityThread.
Finally the application requests its ResourcesManager to create new
ResourcesImpl objects based on the updated paths.

Change-Id: Ib8afa05ccab4e2db558f89ce4423983c086bb61a
Co-authored-by: Martin Wallgren <martin.wallgren@sonymobile.com>
Signed-off-by: Zoran Jovanovic <zoran.jovanovic@sonymobile.com>
Bug: 31052947
Test: run tests from 'OMS: tests for OverlayManagerService'
ackageManagerService.java
5feacbed43c73958b68e69acd894c75ce1f6cb4d 23-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Load splits on-demand"
112a5b62d85d288bd89819b2ffc49fa17020a05f 23-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Temporarily whitelist apps known to hit the wtf case"
e991022423c2e5b4386553af7ef3b54da7c54be1 22-Feb-2017 Todd Kennedy <toddke@google.com> Load splits on-demand

A split may be declared in an application's base manifest, but,
defined in a feature split. When resolving such a component,
invoke the installer to download and install the necessary split(s)

At the moment, this only works for instant apps. However, the
implementation is generic and could be applied to any application.

Bug: 25119046
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Change-Id: I6598abb34becfd049fc03199813226736e5057b1
phemeralResolver.java
phemeralResolverConnection.java
ackageManagerService.java
32757292030117e3abda2bb2a3eb349f646c9fa8 22-Feb-2017 Makoto Onuki <omakoto@google.com> Allow querying providers with a specific metadata.

CP2 will need it to scan GAL providers faster.

Test: Manual test with CP2 under development
Bug: 35388445
Change-Id: I1202420078b1bbe48f6eb4bb9e3f705c71df9c0c
ackageManagerService.java
426cbefdf3c78bd0aa80b180ffc1fb8b5a226bc3 10-Feb-2017 Netta P <nettap@google.com> Protobufferize PackageManager dumpsys

Bug: 34230809
Test: cts-tradefed run cts-dev -m CtsIncidentHostTestCase -t com.android.server.cts.PackageIncidentTest
Change-Id: I6dc455db47a8a636267cf7abe993e135e9044b33
ackageManagerService.java
ackageSetting.java
ackageSettingBase.java
ettings.java
df0824ad4cd31a3e96653fe82ce969b08cd00be2 23-Feb-2017 Guang Zhu <guangzhu@google.com> Merge "Revert "OMS: integrate OverlayManagerService into framework""
95459806920dec34abb3214ab6e1a9b9213a2a61 23-Feb-2017 Guang Zhu <guangzhu@google.com> Revert "OMS: integrate OverlayManagerService into framework"

Bug: 31052947
Bug: 35697944

This reverts commit 21a3d1ad686dee97b9cf0ed80389ee2ab0d48013.

Change-Id: I2d86931020301524c26cf8c8e80d557c97fdd6c3
ackageManagerService.java
0f09817859b19054aee3feded1dbf9757a5ec131 23-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "OMS: integrate OverlayManagerService into framework"
26a449e62a337eb3c94be42e216734d76a2d517e 23-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Reconcile apps in 2 phases"
4f6188e775f864a1b321289307bb8071d59dd658 23-Feb-2017 Jeff Sharkey <jsharkey@google.com> Merge "Slowly deprecate hidden getPackageSizeInfo() API."
cd824ef3895bd581c9d87d9b010385fd15b41d7e 07-Feb-2017 Fyodor Kupolov <fkupolov@google.com> Reconcile apps in 2 phases

During boot app data folders are reconciled in 2 phases:
- in the constructor only core apps are reconciled. prepareAppData
for remaining apps is deferred and run on a separate thread (phase 2)
- Phase 2 must finish before third-party apps can start

Also moved GC to final stages of system server init. GC alone takes ~200 ms.

Overall boot time improvement: ~1 second

Before:
02-17 18:33:33 D/BaseBootTest: successive-boot :
28835.0,29638.0,30205.0,29793.0,29752.0,28228.0,30125.0,28983.0,28487.0,28865.0,
02-17 18:33:33 D/BaseBootTest: successive-boot_avg : 29291.1
02-17 18:33:33 D/BaseBootTest:
SystemServerTiming_StartPackageManagerService :
3150.0,3615.0,3515.0,3495.0,3814.0,3158.0,3746.0,3274.0,3222.0,3607.0,
02-17 18:33:33 D/BaseBootTest:
SystemServerTiming_StartPackageManagerService_avg : 3459.6
02-17 18:33:33 D/BaseBootTest: SystemServerTiming_StartServices :
8244.0,8863.0,9035.0,9832.0,8998.0,8096.0,8719.0,8209.0,8279.0,8754.0,
02-17 18:33:33 D/BaseBootTest: SystemServerTiming_StartServices_avg :
8702.9

After:
02-17 17:59:51 D/BaseBootTest: successive-boot :
27711.0,27607.0,28408.0,28968.0,28397.0,28063.0,27885.0,28483.0,27917.0,29317.0,
02-17 17:59:51 D/BaseBootTest: successive-boot_avg : 28275.6
02-17 17:59:51 D/BaseBootTest:
SystemServerTiming_StartPackageManagerService :
2467.0,2489.0,2369.0,2548.0,2647.0,2523.0,2497.0,2553.0,2482.0,2657.0,
02-17 17:59:51 D/BaseBootTest:
SystemServerTiming_StartPackageManagerService_avg : 2523.2
02-17 17:59:51 D/BaseBootTest: SystemServerTiming_StartServices :
7686.0,7538.0,7598.0,7869.0,7884.0,7950.0,7971.0,8370.0,7696.0,7885.0,
02-17 17:59:51 D/BaseBootTest: SystemServerTiming_StartServices_avg :
7844.7

Test: manual
Bug: 28750609
Change-Id: I3543ef577af1365394775318e40907584ddbe950
ackageManagerService.java
bfaaa44f274050d708b149bc94a4250e4cc5ca32 23-Feb-2017 Jeff Sharkey <jsharkey@android.com> Slowly deprecate hidden getPackageSizeInfo() API.

It was never a public API, and we now have a support and CTS tested
public API over at StorageStatsManager that apps should be using.

Test: builds, boots
Bug: 34643504
Change-Id: Iad3f2c000dd9d7c1b1e70d0bf2d281826737322e
ackageManagerService.java
18280782bc1a6faa2b3e3b1f609c17e9e197b44e 22-Feb-2017 Makoto Onuki <omakoto@google.com> Temporarily whitelist apps known to hit the wtf case

Bug: 34973771
Test: Manual tests with hangouts

Change-Id: If456649cb90164562cd71503119625454590d60d
auncherAppsService.java
3aa3a007f841b7f1aea7d376cfe1c0ca76919854 22-Feb-2017 Jeff Sharkey <jsharkey@google.com> Merge "Split cache clearing into two phases."
458428ea6633e6000b453ef272c13823f5d02fe5 22-Feb-2017 Jeff Sharkey <jsharkey@android.com> Split cache clearing into two phases.

Use newly defined "V2_DEFY_QUOTA" flag to split cache clearing into
two phases: clearing data for apps above their quotas, and then
pushing deeper by clearing data for apps below their quotas.

Add placeholder comments for other data types that we're planning to
add shortly. Route all clearing behavior through this new method,
which remains guarded behind a flag for now.

Test: builds, boots
Bug: 34692014
Change-Id: I678d7b4e2bf6c837dd8a9adbc36a53015907f75f
nstaller.java
ackageManagerService.java
8a510236056fec68969816a327c0aab61c58c80a 22-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow default permission exceptions to be read from vendor partition"
21a3d1ad686dee97b9cf0ed80389ee2ab0d48013 02-Jun-2016 Mårten Kongstad <marten.kongstad@sonymobile.com> OMS: integrate OverlayManagerService into framework

Hand over ownership of overlays to OverlayManagerService.

Changes to a package's overlays are propagated using the activity life
cycle. Affected activities will be recreated as needed. This provides a
well-defined point to modify an application's assets while the
application is paused.

Consolidate how overlays targeting the system and overlays targeting
regular applications are handled. Previously, system overlays were
handled as a special case. Now, everything is handled identically. As a
side effect, the call to idmap --scan during Zygote boot has become
obsolete and is removed.

Information on what overlays to use is recorded in
ApplicationInfo.resourceDirs. The PackageManagerService is responsible
for the creation of ApplicationInfo objects. The OverlayManagerService
is responsible for informing the PackageManagerService in advance about
what resourceDirs to use.

When launching an application, the ApplicationInfo is already populated
with up-to-date information about overlays.

When enabling or disabling an overlay for a running application, the
OverlayManagerService first notifies the PackageManagerService about the
updated resourceDirs. It then tells the ActivityManagerService to push
the new ApplicationInfo object to the application's ActivityThread.
Finally the application requests its ResourcesManager to create new
ResourcesImpl objects based on the updated paths.

Co-authored-by: Martin Wallgren <martin.wallgren@sonymobile.com>
Signed-off-by: Zoran Jovanovic <zoran.jovanovic@sonymobile.com>
Bug: 31052947
Test: run tests from 'OMS: tests for OverlayManagerService'
Change-Id: Idc96dae6fc075d5373aa055bbf50e919136d7353
ackageManagerService.java
d5d5e926eb8ff2541a845d6a5657cee5e5c6e7b6 21-Feb-2017 Jeff Sharkey <jsharkey@android.com> Clear cache space when allocating bytes.

Fleshes out remainder of allocation implementation, where we offer
to clear cached data to satisfy the allocation request. To prevent
abuse, we never let apps allocate into either the minimum cache space
or low storage space.

Clean up quota APIs to require the caller to pass in the path they're
interested in, and we resolve the underlying filesystem for them.

Defines settings that can be used to tweak the minimum cache space.

Test: builds, boots
Bug: 34690590
Change-Id: I85bc07399f91ee4aa568a8a54c615646bf748ad4
nstaller.java
ackageInstallerSession.java
ackageManagerService.java
b8789dd9cd77175980acae13137704eab02d8a32 20-Feb-2017 Jaekyun Seok <jaekyun@google.com> Allow default permission exceptions to be read from vendor partition

Soc vendors should be allowed to add their own default permission
exceptions because they can install their own apps in /vendor/app.

Test: building succeeded and tested on sailfish.
Bug: 35369237
Change-Id: I7fd0044f4edee6524232c6f8d77481c26535e1d6
efaultPermissionGrantPolicy.java
5653fd68f9af064e38dcbdff4b58f58e8949b027 19-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix a race in persisting instant cookie"
312c6cc6a6d53719cc7cfbf5e113bf077fb24313 18-Feb-2017 Svet Ganov <svetoslavganov@google.com> Fix a race in persisting instant cookie

Test: CTS passes and manual too

Change-Id: I8beb7edb84e5f7e2a181a9c237d6f0f761805d70
nstantAppRegistry.java
8ab1a6abc2af233da63edc7bbe48ff5a9913a6cb 18-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix a race when persisting cookie data"
ee2028c31fc564b01b4acf652fadb39514d968cc 18-Feb-2017 Svet Ganov <svetoslavganov@google.com> Fix a race when persisting cookie data

bug:34983226

Test: CTS passes

Change-Id: I457154fecdc15c057e276358e443d3c941128ab2
nstantAppRegistry.java
18c527b96d94c31d789ec137cb12f6e13cd20916 18-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix instant app resolution"
d133b00efb49adeb21b9b62b334769c03f40bf43 17-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Put package verifier on the power whitelist when invoked"
bbdd8e4a3b4bd9bcf4574005b42bed83b4d4ed31 17-Feb-2017 Todd Kennedy <toddke@google.com> Fix instant app resolution

Resolving intents with a specified component goes down a different
path than regular resolution. For Instant Apps, that meant that
sometimes the Instant App was not able to resolve it's own
activities. Added some new CTS tests to verify that this works.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Change-Id: Ic8a8eaef7eb9e230fdc701c79c85227d0939d974
ackageManagerService.java
19657b359a333dd477c589aa9c124059a05251b0 17-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Revert "Revert "remove app-ephemeral"""
8c9a6b0089ff712df4e06454ade1443b77a4a9f4 17-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Revert "Revert "Per user setting for instant app"""
08a2dd12bbb48c2145c75721bca2ccc1c8c058aa 17-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Defer readSessionsLocked until system ready"
be0b8896d1bc385d4c8fb54c21929745935dcbea 15-Feb-2017 Todd Kennedy <toddke@google.com> Revert "Revert "Per user setting for instant app""

This reverts commit be9ffa15af9e1906e9ffb505768328d62d4a3793.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Change-Id: Ib21321cf157a79890de487060a093840f7182047
phemeralResolver.java
nstantAppRegistry.java
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
ackageManagerShellCommand.java
ackageSettingBase.java
ELinuxMMAC.java
ettings.java
da0acdf938f1d6e7a978e143d5d80d8dd5af52ad 15-Feb-2017 Svet Ganov <svetoslavganov@google.com> Auto-grant background execution and data access

Companion apps can declare they want background access and
background execution exceptions via dedicated permissions
in their manifest. If such a permission is requested we
auto-grant the corresponding exception after the user has
chosen a device from the companion UI. These permissions
are appop ones allowing us to use the app ops for gauging
whether the user has made a change after we auto-granted
the permission since we would like to revoke these special
privileges when the app disassociates itself from the
companion device if the user did not make an excplicit
choice otherwise.

While at this auto-grant fixed location permission to the
companion device discovery service.

Test: manual

Change-Id: I46ee4291e5e5a8f7613f0dd75eb61d6b9341f306
efaultPermissionGrantPolicy.java
4c64c0d99ee4340983d17f971f3dfca0c1cbf234 16-Feb-2017 Hyunyoung Song <hyunyoungs@google.com> Merge "ShortcutManager should support MaskableBitmap Icon type"
f281e7afae14f61e1d031f55cc80c59d0b39b528 13-Feb-2017 Hyunyoung Song <hyunyoungs@google.com> ShortcutManager should support MaskableBitmap Icon type

Note: https://ag/1872683/ is where initial code review happened.

Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsShortcutHostTestCases -t 'android.content.pm.cts.shortcuthost.ShortcutManagerMultiuserTest'
Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsDevicePolicyManagerTestCases -t 'com.android.cts.devicepolicy.LauncherAppsProfileTest'


b/34196580

Change-Id: I3b983c29387e474c7a8c687a524105ceaceac81e
hortcutPackage.java
hortcutService.java
860d8b9a7c1742817ea360a7433139786196accb 16-Feb-2017 Christopher Tate <ctate@google.com> Put package verifier on the power whitelist when invoked

Give the package verifier the right to run services while we're asking
it to do its thing.

Bug 31025833

Change-Id: If6a593d95fe37d4c2c7ab6d59aa2661c1e5df6b3
ackageManagerService.java
4b7a7bede86cc92abc03818bedfaedbf5fa1c0ba 16-Feb-2017 Calin Juravle <calin@google.com> Merge "Skip class path checking for secondary dex files"
8094e09089204b4bfbdc873d70d0c331ae8c046f 15-Feb-2017 Todd Kennedy <toddke@google.com> Revert "Revert "remove app-ephemeral""

This reverts commit c2f0d886f46ee5eb28011e1119fa9d23b073a64c.

Test: Manual
ackageInstallerService.java
ackageManagerService.java
d80ba8abc812778a0c7e2042a1f2ffa87f25cb60 15-Feb-2017 Guang Zhu <guangzhu@google.com> Merge "Revert "remove app-ephemeral""
626ffb455650e334fff3fe407a31aa0fa437fdf2 15-Feb-2017 Guang Zhu <guangzhu@google.com> Merge "Revert "Per user setting for instant app""
be9ffa15af9e1906e9ffb505768328d62d4a3793 15-Feb-2017 Guang Zhu <guangzhu@google.com> Revert "Per user setting for instant app"

Bug: 35390781

This reverts commit 2f5811dcfd840e149851a9333e27ef3cdddf7a46.

Change-Id: Ibb1c8dacbdc6908fc7fa2bc5dca664f2455162bf
phemeralResolver.java
nstantAppRegistry.java
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
ackageManagerShellCommand.java
ackageSettingBase.java
ELinuxMMAC.java
ettings.java
c2f0d886f46ee5eb28011e1119fa9d23b073a64c 15-Feb-2017 Guang Zhu <guangzhu@google.com> Revert "remove app-ephemeral"

Bug: 35390781

This reverts commit 4eb7cea562cd117e598a327ab4d93142589c1ae6.

Change-Id: I94567d333b40f99f7a2573125259f4ab575a0519
ackageInstallerService.java
ackageManagerService.java
93a8e2c7d1e6becf48e59d32c56692d87bf56a4a 15-Feb-2017 Todd Kennedy <toddke@google.com> Merge "remove app-ephemeral"
606f8e79a210260a28b2629726740bf7e94c9f13 15-Feb-2017 Tony Mak <tonymak@google.com> Defer readSessionsLocked until system ready

readSessionsLocked depend on DPMS, so defer it until all system
service is started

Fix: 34663223

Test: Manual
1. Try to install an app and reboot before it is installed
(so the session is persisted in a file)
2. Observe that PackageInstallerService
read the persisted session in onSystemReady and
able to get the DPM instance.
3. Observe play can read the persisted session

Change-Id: Ia14ed09db08fcf59189fa29293f0ac5066650942
ackageInstallerService.java
bf92b812dbe1c762ff2381ca4ba14290a5ece8b8 15-Feb-2017 Todd Kennedy <toddke@google.com> Merge "Per user setting for instant app"
4eb7cea562cd117e598a327ab4d93142589c1ae6 15-Feb-2017 Todd Kennedy <toddke@google.com> remove app-ephemeral

instant apps are no longer stored in a separate folder. they
are now stored along side other full apps in the apps directory.

Bug: 25119046
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Change-Id: I6669be797987169a0b9cca78f80539c908812f9e
ackageInstallerService.java
ackageManagerService.java
aae35767b6bca6f872c906a0fd38d7adb61217bd 15-Feb-2017 Calin Juravle <calin@google.com> Skip class path checking for secondary dex files

Pass '&' marker to dex2oat classpath when compiling secondary dex files.
This will skip class path checking when loading the oat files.

Test: adb shell cmd package compile -m speed -f --secondary-dex com.google.android.gms
oatdump --header-only --oat-
file=/data/user/0/com.google.android.gms/app_chimera/m/00000006/oat/arm64/DynamiteModulesC_GmsCore_prodmnc_alldpi_release
check that the class path contains the special '&' marker

Bug: 32871170
Change-Id: If0628aeb4e3f5717604bfc4a87a4b1d438e5fa65
ackageDexOptimizer.java
ackageManagerService.java
1a13a01ae82ff38025af09a4e4be9b5d3145c886 15-Feb-2017 Jeff Vander Stoep <jeffv@google.com> Fix bad automerge

Test: Marlin builds again!
Change-Id: Ic0034a5006d22f758daef92994338fdfb00210fc
ELinuxMMAC.java
5e2714ea7ae7bd162ee8c8ae60233e47bbdf7075 15-Feb-2017 Amith Yamasani <yamasani@google.com> Merge "Kernel mapping for package scope by user"
0d954a080f0d16abee997fcbdd22d639b186d879 15-Feb-2017 Michael Peck <mpeck@mitre.org> Merge "Pass targetSdkVersion specifier for SELinux labeling" am: 4516240b47 am: f8cefed995 am: 5493749d64
am: fa030e505d

Change-Id: Ie6b6bba24490f0ca2db738aa46d2bbc2c6f9387c
fa030e505df144c0ef6af681c5e5a8243f8b5e9c 15-Feb-2017 Michael Peck <mpeck@mitre.org> Merge "Pass targetSdkVersion specifier for SELinux labeling" am: 4516240b47 am: f8cefed995
am: 5493749d64

Change-Id: I731220c719cf29d94e11698906dfb7f049a90a55
5493749d64a8bc99c975c180c423251fcd6b7d5f 15-Feb-2017 Michael Peck <mpeck@mitre.org> Merge "Pass targetSdkVersion specifier for SELinux labeling" am: 4516240b47
am: f8cefed995

Change-Id: Ie71368e7b4571d209d8c3a824bbf1a8c738f56a8
f8cefed995a160cf1c74e15c186e05db07000259 15-Feb-2017 Michael Peck <mpeck@mitre.org> Merge "Pass targetSdkVersion specifier for SELinux labeling"
am: 4516240b47

Change-Id: Ic61c4dc30f075d01a85d8b60cfe4ae1de773aa09
23ab7f54d96386db2b45dc0b352b3451f665e331 23-Jan-2017 Amith Yamasani <yamasani@google.com> Kernel mapping for package scope by user

Inform the kernel via configfs, of userids that
should be excluded when an app is not installed
for them.

Also push userid to remove_userid when a user is
removed so that the exclude list of that user can
be cleaned up in one command for all packages.

Test: runtest -x ....KernelPackageMappingTests.java
Change-Id: Ib94b1a0b737f45b2d03deb9650f0f0eb68e363d9
ackageManagerService.java
ackageSettingBase.java
ettings.java
2f5811dcfd840e149851a9333e27ef3cdddf7a46 30-Jan-2017 Todd Kennedy <toddke@google.com> Per user setting for instant app

The same application can run as either an instant app or an installed
app. Store this setting per-user instead of based upon the install
location.

Bug: 25119046
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Change-Id: Iff565bb1ac10d631499f0bd0f69b401cb073c10e
phemeralResolver.java
nstantAppRegistry.java
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
ackageManagerShellCommand.java
ackageSettingBase.java
ELinuxMMAC.java
ettings.java
9106c64bf3ca60d0b867fa1f2d78d3b19c9e4178 08-Feb-2017 Todd Kennedy <toddke@google.com> Add API to track package changes

After any package install, removal or update, save the changed
package and update a global sequence number. At any point, apps
can query for the packages changed since a particular sequence
number.

If a package is changed multiple times, it is only included once
in the change list.

Bug: 33865505
Test: Create sample app to query for changes and see which packages are changed after performing certain operations
Change-Id: Ia4646035362b16a97110e05f3f909ce385b48428
ackageManagerService.java
7c4787b4df31600cc700c751222003fd6bab0af2 14-Feb-2017 Michael Peck <mpeck@mitre.org> Pass targetSdkVersion specifier for SELinux labeling

Motivation:
Provide the ability to phase in new security policies by
applying them to apps with a minimum targetSdkVersion

Test: Marlin builds and boots. Apps targeting targetSdkVersion<=25
run in untrusted_app_25 domain. Apps targeting the current development
build >=26 run in the untrusted_app domain with fewer permissions. No
new denials observed during testing.
Bug: 34115651
Change-Id: Ib9f6ded9bd2f426861a6d843861b4074084253b0
ELinuxMMAC.java
3571b79c7f315ee0d2279ac54aff50f5ffc1f001 14-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Pass targetSdkVersion specifier for SELinux labeling"
976071a631cd12ad87c0dc34a64b80cde0290947 13-Feb-2017 Makoto Onuki <omakoto@google.com> Follow-up to I61640146 Remove duplicate check.

Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Change-Id: I0af448186c90e548542160d1902bc462545bb03e
auncherAppsService.java
0a2b187309aea30c7f4f69dc91feb58604b0995c 13-Feb-2017 Makoto Onuki <omakoto@google.com> Merge "Do not allow work profile to see main other profiles"
5b51730b8a6c06fdf7912016919209769136e8e2 08-Jan-2016 Michael Peck <mpeck@mitre.org> Pass targetSdkVersion specifier for SELinux labeling

Motivation:
Provide the ability to phase in new security policies by
applying them to apps with a minimum targetSdkVersion

Test: Marlin builds and boots. Apps targeting targetSdkVersion<=25
run in untrusted_app_25 domain. Apps targeting the current development
build >=26 run in the untrusted_app domain with fewer permissions. No
new denials observed during testing.
Bug: 34115651
Change-Id: Ib9f6ded9bd2f426861a6d843861b4074084253b0
ELinuxMMAC.java
b1e7776e2ca348ad734fdddc68d9bda6eb17c5e0 13-Feb-2017 Dianne Hackborn <hackbod@google.com> Fix issue #35309312: Background start not allowed: service...

...Intent { flg=0x100 cmp=com.android.systemui/.SystemUIService }
to com.android.systemui/.SystemUIService from pid=28245 uid=1000 pkg=android

Rework the persistent app check to just directly look at the package
manager (but as efficiently as possible). My idea for trying to keep
this in the UidRecord was stupid. :p

Test: manually tested it boots
Change-Id: I5a88717a27fa3529048d37a853518a3ec04055db
ackageManagerService.java
33a119c94fbef9a185b82204fc58292e08c3d33d 13-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix typo on DISALLOW_UNMUTE_DEVICE"
de3c16c8057b61bb3cc2e0c3d5603730f5841c51 26-Jan-2017 Makoto Onuki <omakoto@google.com> Do not allow work profile to see main other profiles

It won't throw SecurityException, but it'll pretend there's
no apps on the other profile.

- Also log an error about it, in the client side process.

- Also still send WTF() about the reverse access.

Bug: 34650921
Bug: 34340531

Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsShortcutHostTestCases -t 'android.content.pm.cts.shortcuthost.ShortcutManagerMultiuserTest'
Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsDevicePolicyManagerTestCases -t 'com.android.cts.devicepolicy.LauncherAppsProfileTest'
Change-Id: I6164014685009db3f34a176a3f12c517766b2b49
auncherAppsService.java
492b4724fb42adf29f3978f01ebc5238f893d194 13-Feb-2017 Esteban Talavera <etalavera@google.com> Fix typo on DISALLOW_UNMUTE_DEVICE

Test: Builds sucessfully. Cannot find other usages in code search
Change-Id: I83f85b4715b11630b0ce0b471be536aef46a2936
serRestrictionsUtils.java
c6ea7fc45ef147fa9e9c4f424faa1628bf954534 06-Feb-2017 Fyodor Kupolov <fkupolov@google.com> Log.wtf all privapp-permissions in a single message

Test: manual
Bug: 34872687
Change-Id: Ib67604db73dada235f16e91a41e52a8c8ea625bf
ackageManagerService.java
0c0daaa5c2579ff6491d05d0a73d34246e602f0b 08-Feb-2017 Calin Juravle <calin@google.com> Merge "Fix typo in dexopt.secondary system property"
11015dd44641781fb494e1b49fe349fa2ab6adcb 08-Feb-2017 Suprabh Shukla <suprabh@google.com> Merge "Deprecating secure setting install_non_market_apps"
4466c5ad84e4429284b7d5e13ad8a87c924ea7fc 07-Feb-2017 Calin Juravle <calin@google.com> Fix typo in dexopt.secondary system property

Test: adb shell cmd package bg-dexopt-job
Bug: 32871170
Change-Id: Ic8a14a3fc5c9aa63f6cb376f337b5bf459997325
ackgroundDexOptService.java
e3745eed8b9599de6f413d48a81098209fd41791 03-Feb-2017 Suprabh Shukla <suprabh@google.com> Deprecating secure setting install_non_market_apps

Apps targetting Android O or higher should use the new api
canRequestPackageInstalls in package manager. The secure setting
INSTALL_NON_MARKET_APPS which was used is set to 1 to make the
change transparent to apps who are already querying for this setting's
value.

Test: adb shell am instrument -e class\
'com.android.providers.settings.InstallNonMarketAppsDeprecationTest' -w\
'com.android.providers.setting.test/android.support.test.runner.AndroidJUnitRunner'

Bug: 33947615

Change-Id: Ie38d130bfccd022483a566270fce071acbdb00b7
serRestrictionsUtils.java
50979d14f913b97852c9e39b3b85c555988760f5 28-Jan-2017 Fyodor Kupolov <fkupolov@google.com> Tests for UserDataPreparer

Moved reconcileUsers, enforceSerialNumber to UserDataPreparer and added
unit tests

Test: manual + UserDataPreparerTest
Bug: 34736064
Change-Id: Icde93974ac68849e38357d8cfea0cc1b7a2aab49
ackageManagerService.java
serDataPreparer.java
serManagerService.java
68f68701e69ceed0edb0e8831ce2ed507ba154a5 06-Feb-2017 Narayan Kamath <narayan@google.com> PackageManagerService: Log time spent on cpppreopt.

Makes it more convenient to debug post OTA boot-time issues.

Bug: 34953276
Test: manual

Change-Id: Iefb0f93f0c7d536ee46b756d83f316f038166da3
ackageManagerService.java
a27780e0aa7eab16ea42ad4f93957cf523c82002 03-Feb-2017 Fyodor Kupolov <fkupolov@google.com> Use self-locking for mAvailableFeatures

mAvailableFeatures is read-only and set in the constructor. Calls to
hasSystemFeature are often blocked if PM is busy with other operations.

Test: manual - device boots without errors
Bug: 33199244
Change-Id: I5ce0fa7af37e95ac64afb11a1022a27e37c67703
ackageManagerService.java
e3482c2601fd025002377d47389be97bbc0c892d 01-Feb-2017 Brad Ebinger <breadley@google.com> Merge "Adds @hide permission granting API for ImsServices" am: 390ec27f9d am: 6734275c2f am: fa1dca0ad6
am: 3aaf673c60

Change-Id: I6a6a2d136f0f31bbac984e4ba18f9f6b90808705
3aaf673c60377fdff72fe1ab17099083f5fe9622 01-Feb-2017 Brad Ebinger <breadley@google.com> Merge "Adds @hide permission granting API for ImsServices" am: 390ec27f9d am: 6734275c2f
am: fa1dca0ad6

Change-Id: Id2875b5b60401405e31e76eb07968798144df700
fa1dca0ad61af079c7653ba80d847a5b51df343c 01-Feb-2017 Brad Ebinger <breadley@google.com> Merge "Adds @hide permission granting API for ImsServices" am: 390ec27f9d
am: 6734275c2f

Change-Id: I6d502db3362aafcfed426b6598be0bd39dd38890
6734275c2f7bdffca50062c08c07a58609eba78b 01-Feb-2017 Brad Ebinger <breadley@google.com> Merge "Adds @hide permission granting API for ImsServices"
am: 390ec27f9d

Change-Id: I0f3d38811925884681d11cf18e12f1b0574d64c6
2591ce4d9fb834568b0a5fe3e7d1d8f9368eb56b 31-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "fix array index out of bounds"
7a12f9fa20fe21b586f13d24a5ffc32e7557da21 31-Jan-2017 Todd Kennedy <toddke@google.com> fix array index out of bounds

we can't be removing items from the list while we're iterating
through them!

Test: Manual
Change-Id: I18c70aced01269e196adbf4aa538c42345d74a95
nstantAppRegistry.java
de0fb617a198babe1a67c0dc921d0e7703f73384 31-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "don't require 'O' for instant apps"
910a19a535760df574371534bec030f9335bc351 31-Jan-2017 Todd Kennedy <toddke@google.com> don't require 'O' for instant apps

It's unclear if we need this check; esp if we want to support
running legacy instant apps [i.e. instant apps that run pre-O
under the supervisor].

Test: Build and install instant app
Change-Id: I241f97e7960635af933e8fe1ddd86675789ec26c
ackageManagerService.java
096d304ae3d85c1bfcda1a1d9cd4eb13d0815500 31-Jan-2017 Svetoslav Ganov <svetoslavganov@google.com> Add instant cookie APIs

This change adds APIs for instant apps to store cookie data
that is presisted across instant installs and across the
upgrade from an instant to a standard app. Standard apps
can use the cookie APIs but when they are uninstalled the
cookie is also deleted. The cookies are kept longer than
the instant apps as they are much smaller - 16KB by default.
We can change the cookie size via a system setting i.e.
after we ship we can increase size if needed.

We also add internal APIs to surface information about
installed and uninstalled instant apps which should be
used for showing them in the UI. For this puporse we store
the icon, permissions, and label of uninstalled apps. If
the app is re-installed we drop this meta-data but keep
the cookie around. If we have cookie data stored and the
signing cert of the app changes when it gets re-intalled
we wipe the cookie.

Test: CTS tests pass; hiddent APIs tested manually

Change-Id: If145c0440cc61a5303e2cbb70228d235d36037a5
asePermission.java
phemeralApplicationRegistry.java
phemeralResolver.java
nstantAppRegistry.java
ackageInstallerService.java
ackageManagerService.java
ELinuxMMAC.java
hortcutService.java
efdc6635695df115a1d5759b022cb7f9f7bdc45e 31-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Define targetSandboxVersion"
11e45075221680dcc25e3da1d3c32710e5a98603 25-Jan-2017 Todd Kennedy <toddke@google.com> Define targetSandboxVersion

The new attribute allows both ephemeral and non-ephemeral apps to
opt into a new, tighter security model.

Test: Manual; built app w/ targetSandboxVersion and verified the security domain
Change-Id: I8fcaf84e25f0519b438ba51302f79790e680e025
ELinuxMMAC.java
f477979bf9b8ecbaa366f0b600b0f2f2030c21ab 24-Jan-2017 Brad Ebinger <breadley@google.com> Adds @hide permission granting API for ImsServices

Adds the @hide API to grant ImsServices default permissions
using the PackageManager and DefaultPermissionGrantPolicy APIs.

Test: Manual
Bug: 32460405
Change-Id: Ia143ede42623b4c2203261fc6e83624d73c478f1
efaultPermissionGrantPolicy.java
ackageManagerService.java
1ba6b5a076659a6aea48a2cf3df0f106fdff5887 30-Jan-2017 Calin Juravle <calin@google.com> Merge changes Ic07126bf,If3a4b77f,I8b011207,I18fde62a

* changes:
Save package dex usage info after secondary dex reconciliation
Compile secondary dex files during background dexopt job
Add a shell command to force the background dexopt job
A bit more refactoring in BackgroundDexOptService
2b4f8731ca5d20bb686aacdd09bb2351eeebd337 30-Jan-2017 Calin Juravle <calin@google.com> Merge "[PM] Clean up logic for secondary dex oat files"
a0f2f77cdc24fb51f2c6906b6fc481c2c6d673c5 30-Jan-2017 Calin Juravle <calin@google.com> Merge "Compile secondary dex files in DexManager"
071db34e78d166a6057cd8bec2b4c5508e3ec5f2 29-Jan-2017 Thecrazyskull <anaskarbila@gmail.com> Merge "KeySetManagerService: prevent NPE" am: c66327149a am: 51ad0f67d2 am: 7adb348796
am: 8734438320

Change-Id: I8618393edf8c2c41663dfb457588ac4f9511239c
873443832051bfce7d5f5a04e883d1b65d547472 29-Jan-2017 Thecrazyskull <anaskarbila@gmail.com> Merge "KeySetManagerService: prevent NPE" am: c66327149a am: 51ad0f67d2
am: 7adb348796

Change-Id: Icc4d2d025c03cc71557e359bf8f4f230d38ef595
7adb3487967a0dbee54fe74f450a364fbbc6a17f 29-Jan-2017 Thecrazyskull <anaskarbila@gmail.com> Merge "KeySetManagerService: prevent NPE" am: c66327149a
am: 51ad0f67d2

Change-Id: I72d62e1d1f3d2b6db616762e724c1608a1e487c8
51ad0f67d27be05d44304efe58a58590c3d11671 29-Jan-2017 Thecrazyskull <anaskarbila@gmail.com> Merge "KeySetManagerService: prevent NPE"
am: c66327149a

Change-Id: I09d6fb3e2644ab9330b10bd67c44e61a204e589b
b1097411028103b6c88ce325af23d2ff1ec746c8 27-Jan-2017 Calin Juravle <calin@google.com> Save package dex usage info after secondary dex reconciliation

Bug: 1833991
Test: add a bogus entry to /syste/data/package-dex-usage.list
adb shell cmd package reconcile-secondary-dex-files
com.android.google.gms
wait a bit and check the bogus entry is gone

Change-Id: Ic07126bfb8730933081a5e010e3c357d338786e8
ex/DexManager.java
ex/PackageDexUsage.java
51f521c3bf46e6040f36757bc53ea57ddc7be85e 26-Jan-2017 Calin Juravle <calin@google.com> Compile secondary dex files during background dexopt job

Extend the backgound dexopt job to compile secondary dex files when
"dalvik.vm.deopt.secondary" system property is set to true.

Test: adb shell cmd package bg-dexopt-job
Bug: 32871170
Change-Id: If3a4b77f785e92c7f2f7869e25ff9b99904f165a
ackgroundDexOptService.java
ackageManagerService.java
ex/DexManager.java
ex/PackageDexUsage.java
cb5f41ea11b1a6fcd0977a64ee146dde8f537076 26-Jan-2017 Calin Juravle <calin@google.com> Add a shell command to force the background dexopt job

Add 'bg-dexopt-job' command to 'adb shell cmd package' which will force
the background dexopt job to run the optimizations immediately.

Note that the command only runs the background optimizer logic. It may
overlap with the actual job but the job scheduler will not be able to
cancel it. It will also run even if the device is not in the idle
maintenance mode.

Test: adb shell cmd package bg-dexopt-job
Bug: 32871170
Change-Id: I8b0112074220b2e09baf13d842401ee1cf306a89
ackgroundDexOptService.java
ackageManagerService.java
ackageManagerShellCommand.java
c660475aafe91269be306c802823cf543005ce36 26-Jan-2017 Calin Juravle <calin@google.com> A bit more refactoring in BackgroundDexOptService

Extract convenient methods to help with:
- adding a shell command to run the background dexopt job
- extending idleOptimizations to cover secondary dex files

Test: device boots, background job run.
Bug: 32871170
Change-Id: I18fde62a1cb05c030a620722d5f217589beaefb1
ackgroundDexOptService.java
1aa5f88e35734383e66ecd65e82e83d788e18ccb 25-Jan-2017 Calin Juravle <calin@google.com> [PM] Clean up logic for secondary dex oat files

Add logic in DexManager to reconcile secondary dex records with the
actual files on disk. If secondary dex files are moved or removed then
DexManager will remove the generated oat files during the call to
reconcileSecondaryOdex() and update its internal state.

Add 'adb shell cmd package reconcile-secondary-dex packageName' which
will force DexManager to sync its data with the actual secondary dex
files.

Test: devices bots
runtest -x .../PackageDexUsageTests.java
runtest -x .../DexManagerTests.java
adb shell cmd package reconcile-secondary-dex
com.android.google.gms (after artificially/temporarily renaming some
dex files)

Bug: 32871170

Change-Id: Id2d72dc89995f89cf1ddf79ae4e992afd3f3c127
nstaller.java
ackageManagerService.java
ackageManagerShellCommand.java
ex/DexManager.java
ex/PackageDexUsage.java
c22c30ed1c05c5c24185dc4d380d1c5026923d46 17-Jan-2017 Calin Juravle <calin@google.com> Compile secondary dex files in DexManager

Add logic for secondary dex compilation in DexManager. Also, extend the
`cmd package compile` command with '--secondary-dex' option which will
compile all used secondary dex files for the given package.

Test: flash & boot,
cmd package compile --secondary-dex -f -m speed
com.google.android.gms
Bug: 32871170

Change-Id: Ia2b95cb70d26c4ead5cb650047641b0881ca84ae
nstaller.java
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
ackageManagerShellCommand.java
ex/DexManager.java
6fd52cd04bb2b76fdd522bca5b51acb3d86ced48 27-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Introduced UserDataPreparer class"
5c0ecfdb37b082bd6bd490270193b676ecb481c2 27-Jan-2017 Fyodor Kupolov <fkupolov@google.com> Introduced UserDataPreparer class

Extracted the logic for preparing and destroying user data into a new
class. Unit tests will be added in a follow up cl.

Test: manual + UserManagerTest
Bug: 34736064
Change-Id: I4df7189c4ad8703cb34f54da21873b9ec83589c5
ackageManagerService.java
serDataPreparer.java
serManagerService.java
eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5 15-Dec-2015 Mårten Kongstad <marten.kongstad@sonymobile.com> OMS: introduce the OverlayManagerService

Add a new system service to manage Runtime Resource Overlays. This will
offload the PackageManagerService and allow administration of overlay
packages while affected packages continue to execute.

Overlays can be enabled or disabled during runtime. Running applications
will re-create their ResourcesImpl objects and restart their activities
via the usual activity life cycle.

The order in which a set of overlays is loaded may also be changed
during runtime. The underlying mechanics are the same as for when an
overlay is enabled or disabled.

When an overlay changes state, e.g. becomes enabled, the
OverlayManagerService will broadcast one of the new intents
android.intent.action.OVERLAY_ADDED, *_CHANGED, *_REMOVED or
*.OVERLAYS_REORDERED.

Clients that wish to read information about overlays for users other
than themselves are required to hold the
android.permission.INTERACT_ACROSS_USERS_FULL permission. This mirrors
the protection level of PackageManager.getPackageInfo.

Clients that wish to change the information are required to
hold the permission android.permission.CHANGE_OVERLAY_PACKAGES.

Each pair of overlay package and corresponding target package is
respresented by a new OverlayInfo class. This class mirrors the
existing PackageInfo class.

Overlay packages are handled per Android user. The data is persisted in
/data/system/overlays.xml.

Co-authored-by: Martin Wallgren <martin.wallgren@sonymobile.com>
Signed-off-by: Zoran Jovanovic <zoran.jovanovic@sonymobile.com>
Bug: 31052947
Test: run tests from 'OMS: tests for OverlayManagerService'
Change-Id: I15325e173193df3240b8dc0a58c852fd7a3d5916
ackageManagerService.java
33d9bc529e4969444aca821190f16b565a7726a9 26-Jan-2017 Sunny Goyal <sunnygoyal@google.com> Merge "Adding AppWidgetManager.isRequestPinAppWidgetSupported"
a28071306ec86da664603ff08e74ec7acadbd427 26-Jan-2017 Amith Yamasani <yamasani@google.com> Clear up /data/misc_ce/user folder on delete and reboot

Clean up the folder to avoid leaving residue behind when
a user is removed. This was causing issues with reusing
the userid. Also check on reboot for incomplete cleanup
and remove the folders.

Change-Id: Icd21d2669249d5f87032ef0fe95bad49537fa477
Fixes: 34736064
Test: Manual
ackageManagerService.java
75a6d9c8759fd92d441ab4a791c637f38db3804b 26-Jan-2017 Calin Juravle <calin@google.com> Merge "Notify DexManager about new package installs"
7664bceec3422f55db46d7d1bf908ae6110a6548 26-Jan-2017 Thecrazyskull <anaskarbila@gmail.com> KeySetManagerService: prevent NPE

* If pubKeys is null, we cannot check the size of pubKeys

Test: none

Change-Id: I3b4074d8727b084fea98a0e0a5a0afbd96bea41d
eySetManagerService.java
bcf3b70371a98878bcad088914a886df4217f555 26-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Adding an api for apps to check whether they can install apps"
d1b6dcbea63c688650d13d77156526581db27630 26-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't return self if not a profile"
aef2513c7157a28236d097a81fe74d7ba6b710c9 24-Jan-2017 Suprabh Shukla <suprabh@google.com> Adding an api for apps to check whether they can install apps

Some apps may want to check whether they are trusted to install apps on
the device, so they can prompt the user to go to settings and mark them
as trusted before they do an intensive operation like downloading an
apk.

Test: cts-tradefed run cts -m CtsExternalSourcesTestCases

Bug: 31002700
Change-Id: Icd9d04daa157e6733decba245ec251ce4acd4122
ackageManagerService.java
801e342faaa45708e15f488af4c8fc2f9de91712 25-Jan-2017 Amith Yamasani <yamasani@google.com> Don't return self if not a profile

This fixes the inconsistency between no profile and a
removed profile.

Change-Id: I85d37ce42113bde8567be382372c5f4997601e85
Fixes: 34699518
Test: runtest -x
frameworks/base/services/tests/servicetests/src/com/android/server/pm/UserManagerTest.java
serManagerService.java
9aa513bf95498b6c7a94ba10b2f0444a6d09bd6b 25-Jan-2017 Adam Lesinski <adamlesinski@google.com> Merge "Add support for Split APK dependcies"
38c239507884be18edc5c0ea80f8f90e8d296ec7 25-Jan-2017 Nicolas Prévot <nprevot@google.com> Merge "Allow DO to provision even if it has set disallow remove mp."
b2540e8d8d46a8eaa3f82ea36fb2bd60d53f77dc 25-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes from topic 'remove-idmap-adamlesinski'

* changes:
Fix memory leak during idmap creation
installd: add command 'removeIdmap'
16382634fcc1c850b7c3b8f9646ac122bea818a1 02-Jun-2016 Mårten Kongstad <marten.kongstad@sonymobile.com> installd: add command 'removeIdmap'

Add an installd command to remove an idmap file. This is the inverse of
the 'idmap' command and is intended for clean-up once an idmap file is
no longer needed because an APK was removed, etc.

This commit depends on a corresponding commit in frameworks/native (with
the same Change-Id).

Bug: 31052947
Test: run tests from 'OMS: tests for OverlayManagerService'
Change-Id: Iae19a519803f0c172b02a32faa283ef36f43863c
nstaller.java
6bb61a7d2471a8844c59c786598f08d00154170e 25-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add support for carrier demo mode"
4e8628157ad0c8c52e74b720eb0328086272ffda 22-Nov-2016 Adam Lesinski <adamlesinski@google.com> Add support for Split APK dependcies

Apps can now declare in their base APK AndroidManifest.xml
that they want to have their split APKs loaded in isolated
Contexts. This means code and resources from the split
get loaded into their own ClassLoader and AssetManager.

<manifest xmlns:android="..."
...
android:isolatedSplits="true"
...

In order to make this more useful, splits can declare dependencies
on other splits, which will all get pulled in to the Context
and run as expected at runtime.

A split declares its dependency on another split by using the
tag <uses-split> in its AndroidManifest.xml:

<manifest xmlns:android="...">
...
<uses-split android:name="feature_split_1" />
...

A split can have a single parent on which it depends on. This is
due to the limitation of having a single ClassLoader parent.
All splits depend on the base APK implicitly.

PackageManager verifies that no cycles exist and that each dependency
is present before allowing an installation to succeed.

The runtime will then load splits based on the dependencies.

Given the following APKs:

base <-- split A <-- split C
^----- split B

If an Activity defined in split C is launched, then the base,
split A, and split C will be loaded into the ClassLoader defined
for the Activity's Context. The AssetManager will similarly be loaded
with the resources of the splits.

A split can be manually loaded by creating a Context for that split, defined
by its name:

Context.createContextForSplit("my_feature_split_1");

All installed Activities, Services, Receivers, and Providers are accessible
to other apps via Intent resolution. When they are instantiated, they are
given the appropriate Context that satisfies any dependencies the split they
were defined in stipulated.

Test: WIP (CTS tests to come)
Change-Id: I8989712b241b7bc84381f2919d88455fcad62161
ackageInstallerSession.java
ackageManagerService.java
ackageManagerShellCommand.java
7f7372ae2abeecb564d426ec3efbfa039c797885 24-Jan-2017 Sunny Goyal <sunnygoyal@google.com> Adding AppWidgetManager.isRequestPinAppWidgetSupported

Launchers can choose to implement support pin shortcut or pin appwidget
or both by specifying different actions in the intent filter

Test: Automated tests and CTS
Bug: 34174006
Change-Id: I4456dbb943cfba11d465556f0732f0ed629ab3ba
hortcutRequestPinProcessor.java
hortcutService.java
454a9777b84431ad0f3492477d197390eb491508 25-Jan-2017 Makoto Onuki <omakoto@google.com> Merge "Add client package name to WTF message"
f05cf3ee40dda739f051efb62818039f6c3410f9 12-Jan-2017 Justin Klaassen <justinklaassen@google.com> Add support for carrier demo mode

Fixes: 33746309
Test: manually verified carrier demo mode and normal demo mode are setup
correctly

Change-Id: Ia38790599f672a9d1999274276156b5328c9f75a
(cherry picked from commit b632c5546968bc20e60e5b86ded4c41612a47c52)
serManagerService.java
52faea7acbad5bf9c2006db79353390ea915b18d 24-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't emit versioncode by default"
5a5afca93618a3ea669693d231e050be595e7a94 24-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add versionCode"
0d4b8f8b0c963d9a1f5cb6aff11a11195a3df225 24-Jan-2017 Calin Juravle <calin@google.com> Notify DexManager about new package installs

This will update the internal cache so that the secondary dex files of
the new package can be found when loaded.

Test: runtest -x .../DexManagerTests.java

Bug: 32871170
Change-Id: I0cb7158af249feeb01cf578a7544dda978eede9d
ackageManagerService.java
ex/DexManager.java
3a2541e6daec72824f0f9f8c9cd81bacac263b5c 24-Jan-2017 Makoto Onuki <omakoto@google.com> Add client package name to WTF message

Bug 34650921
Test: manual tests with GEL launcher with work profile
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsShortcutHostTestCases -t 'android.content.pm.cts.shortcuthost.ShortcutManagerMultiuserTest#testManagedUser'
Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsDevicePolicyManagerTestCases -t 'com.android.cts.devicepolicy.LauncherAppsProfileTest'
Change-Id: I68f72f0798b752690e4e8d32360fd1d15bedef31
auncherAppsService.java
25ee47ff2408494f85ff6b9acbb509aef84cf80e 24-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Temporarily disable LauncherApps reverse access check"
badc69af3d741a737900eddd90279ab94e15a88a 24-Jan-2017 Todd Kennedy <toddke@google.com> Don't emit versioncode by default

use --show-versioncode argument if you want to see them

Change-Id: I4ec6236c2c7643e61529765bce24f03555944c3e
Fixes: 34670329
Test: Manually run 'adb shell cmd package list packages' w/ and w/o --show-versioncode
ackageManagerShellCommand.java
316c2f207914da455a8d610aee6e4bc60e5c8f3a 24-Jan-2017 Todd Kennedy <toddke@google.com> Add versionCode

We need to specify the version code to use when installing
splits since the version on the device might be different
from the latest on the server.

Bug: 25119046
Test: manual
Change-Id: I4ad21f9e5924fcf76a39780e6d98e8d7a1fef5d4
phemeralResolver.java
86389b3edc86994b8f59a4562ce2a499294d96bf 24-Jan-2017 Makoto Onuki <omakoto@google.com> Temporarily disable LauncherApps reverse access check

Bug 34650921
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

With the reverted CTS,
Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsShortcutHostTestCases -t 'android.content.pm.cts.shortcuthost.ShortcutManagerMultiuserTest#testManagedUser'
Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsDevicePolicyManagerTestCases -t 'com.android.cts.devicepolicy.LauncherAppsProfileTest'

Change-Id: Id9d13c11816fca10b2dacac92537b2baded3ac9c
auncherAppsService.java
d37c4a99b2602dd4483ca2985e63b5316e8f4f63 23-Jan-2017 Nicolas Prevot <nprevot@google.com> Allow DO to provision even if it has set disallow remove mp.

If the device owner has set DISALLOW_REMOVE_MANAGED_PROFILE,
and there is already a managed profile:
it should be allowed to provision a new managed profile by
deleting the old one.
Test: adb shell am instrument -e class
com.android.server.devicepolicy.DevicePolicyManagerTest
-w
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
BUG:34116228

Change-Id: I9e6f39924107aee40b57d22e638487a1ea3132de
serManagerService.java
1a2928842069da80fe03f0fb88e7d8861815b42d 24-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add an accidentally removed call to update libs"
4fa94da34b0c2b15b68821a694c3eed1e43c058c 24-Jan-2017 Svetoslav Ganov <svetoslavganov@google.com> Add an accidentally removed call to update libs

Disabled system package may define a lib which its
update does not. When the update is uninstalled we
need to upate the libs so ppl can use the lib in
the now restored sys package.

Change-Id: I22e6aafde86838fa76aa74eda8dfe2c528f998aa
ackageManagerService.java
4bd54c70fa37909fdd7c764d9995c132e7cc137d 23-Jan-2017 Svetoslav Ganov <svetoslavganov@google.com> Merge "Allow shared lib and package name to match"
5733d9de2ce946789c4d777179eb251cc3526d27 23-Jan-2017 Svetoslav Ganov <svetoslavganov@google.com> Allow shared lib and package name to match

The old package manager implementation was guarding for
shared libs to not match any package name but due to a
bug this was not enfroced and as a result we have apps
where the package and lib match, e.g. GCore. The new
static shared lib support properly enforced the rule
breaking apps. So, this CL relexes the constraint.

Test: CTS test in the topic passes

bug:34598313

Change-Id: I15d22fd1c3a44a27c4b9b8379de3992ae553dd05
ackageManagerService.java
66e4a2b801fe0ff2ee1db5e0578a3e7cb6e1f6d6 23-Jan-2017 Makoto Onuki <omakoto@google.com> Do not allow ephemeral apps to access ShortcutManager

Bug: 34178279
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Change-Id: I5672f15705a1bf6568a8df58b66e48c802c11852
hortcutService.java
540dcb222e14522e037fd0c6b69b21f14ac92b24 23-Jan-2017 Todd Kennedy <toddke@google.com> null check

Fixes: 34598376
Test: Manual
Change-Id: Ia2508434f6fada2219c1eea9b05f9101fc4490e3
ackageManagerService.java
6788212d17f54475ca9c3dd689a863e031db868f 12-Dec-2016 Svet Ganov <svetoslavganov@google.com> Platform support for static shared libraries

This change adds support for static shared libraries that
emulate static linking allowing apps that statically link
against the same library version to share a common
implementation. A library is hosed by a package in a standard
APK.

Static shared libraries have a name and a version declared
by a dedicated manifest tag. A client uses also a new tag
to refer to the static library it uses by specifying the
lib name, version, and the hash of the signing certificate.
This allows two apps to rely on two different library versions
and prevents impersonation of the shared library by a side-loaded
app with the same package name.

Internally apps providing static libs use synthetic package
name generated from the manifest package name and the library
version. This allows having different "versions" of the same
package installed at the same time.

An application cannot be installed if a static shared lib it
depends on is missing. A used shared library cannot be uninstalled.
Shared libraries can rotate certificates like normal apps. The
versions of these libs should be ordered similarly to the version
codes of the hosting package. Such libs cannot use shared user
id, cannot be ephemeral, cannot declare other libraries, cannot
rename their package, cannot declare child-packages. They must
target O SDK. Also they cannot be suspended or hidden or their
uninstall blocked. Generally, speaking policy regarding code in
static shared libs should be applied to the packages using the
library as it could have just statically linked the code.

We now have APIs to query information about the shared libraries
on the device in general. To clients static shared libraries are
presented as multiple versions of the same package which is how
they are declared and published. Therefore, one can have two
versions of the same package which means we need way to query
for and uninstall a specific version of a package. Also static
shared libs can depend on other static shared libs which are
versioned packages. To ease representation we add the concept
of a versioned package which should be used in the case of
static shared libs.

A client can see only the static shared libs it depends on and
more specifically only the versions it depends would be retrieved
by using the standard package manager APIs. There is a new
dedicated API to get info about all shared libraries which
would provide data about all static shared lib versions. Also
these libraries must use v2 signing scheme.

Test: CTS tests pass

bug:30974070

Change-Id: I4f3d537ee7a81f880950377b996e1d9d4813da5c
ackageInstallerService.java
ackageManagerService.java
ackageManagerShellCommand.java
ackageSetting.java
ackageSettingBase.java
ettings.java
29d20fc0f9d185ce356a984468142ae5c63e911b 21-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Remove call to propagate permissions"
75ca7b8eddd790d0117ff9573c44ce35be93e94c 21-Jan-2017 Makoto Onuki <omakoto@google.com> Merge "Do not allow work profile apps to access main profile app."
1a30d0cb4d65f38ddacf3b5bd7d47d29653be1ec 20-Jan-2017 Todd Kennedy <toddke@google.com> Remove call to propagate permissions

There's a bug and will be fixed in the near future

Test: Manual
Change-Id: I9ef8c4a278acf1131f133431e571d438776ab1e1
phemeralApplicationRegistry.java
aecbd037514af1bff0f5ca50932241776d6c5fc3 19-Jan-2017 Makoto Onuki <omakoto@google.com> Do not allow work profile apps to access main profile app.

Bug: 34340531

Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsShortcutHostTestCases -t 'android.content.pm.cts.shortcuthost.ShortcutManagerMultiuserTest#testManagedUser'
Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsDevicePolicyManagerTestCases -t 'com.android.cts.devicepolicy.LauncherAppsProfileTest'

Change-Id: I34e9f351d2a8addf65a5a928c3dd4363f08611dc
auncherAppsService.java
aaad776c2ce45b8caf629febea004c08eeebfd94 20-Jan-2017 Bartosz Fabianowski <bartfab@google.com> Merge "Allow system to retrieve persistent preferred activities"
444d64749df82407382184f580c4bd6518af4fd6 20-Jan-2017 Makoto Onuki <omakoto@google.com> Merge "requestPinShortcut for pinned shortcut still notifies launcher"
4c0659f5313bcc70be704a3808af9e670f467ee6 20-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Enable background restrictions"
a2b1774d758b58fc5977f631eff76fa21d303906 20-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Grant access to ephemeral metadata"
54df14956eb890bcd92ffa1590705f8b417ccf5b 20-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Disable moving 3rd party apps to internal if not allowed."
42a386b7717300bf6d75cbd3b4f7ad00f294be0d 07-Nov-2016 Christopher Tate <ctate@google.com> Enable background restrictions

Apps that target O+ are always subject to background restrictions.
Legacy apps' background restriction is subject to the OP_RUN_IN_BACKGROUND
app op.

Apps with these properties are exempted from background restrictions:
- persistent process
- currently on the idle battery whitelist
- global whitelist for things like bluetooth services

Bug 30953212

Change-Id: Icc19b2fbc05f40dcf8c3fc4abf718c373dc8d4f6
ackageManagerService.java
0c280710320368e82c52c9b135e2ab3015d0c924 20-Jan-2017 Makoto Onuki <omakoto@google.com> requestPinShortcut for pinned shortcut still notifies launcher

Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Bug: 34391829
Change-Id: Iac652790f2aa02dab6afbe52f2e40be99543f325
hortcutRequestPinProcessor.java
022b8eaa1def76dca0ac9b409065588f55c71597 16-Dec-2016 Yao Chen <yaochen@google.com> Disable moving 3rd party apps to internal if not allowed.

ag/1633903 added config_allow3rdPartyAppOnInternal flag to specify
whether 3rd party apps are allowed on internal storage. We need to
respect the flag when moving apps between storages.

Bug: 30980219

Test: Added ApplicationPackageManagertest

Change-Id: I0f8e76467b5071d70f40da28c2087e689c049c06
ackageManagerService.java
0e989d00ed1e95be0ccb77c29846ee0b6ac33356 13-Jan-2017 Todd Kennedy <toddke@google.com> Grant access to ephemeral metadata

When an ephemeral application explicitly accesses an
installed application, it grants access to its package
metadata. The ephemeral application effectively stays
hidden if it doesn't explicitly connect to any activity,
service or provider [i.e. implicit connections using
an ACTION_VIEW/CATEGORY_BROWSABLE intent will not expose
its metadata].

Bug: 34123112
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Change-Id: I7e1680902599b3ada0d4fba5998af30566017051
phemeralApplicationRegistry.java
ackageManagerService.java
823fe8481eeae2d5b72ee83a8aa70ea8619a3428 19-Jan-2017 yuanhao <yuanhao@xiaomi.com> Merge "Fixed NPE in canAddMoreManagedProfiles" am: a83222e4fb am: 8d3a8b1327 am: 1a34a41268
am: 70abb5122a

Change-Id: I806e4ce4f01e28c3b7e413b6447154a3cf77aca5
70abb5122aefb7301937d78a556bcf5fff0b8f91 19-Jan-2017 yuanhao <yuanhao@xiaomi.com> Merge "Fixed NPE in canAddMoreManagedProfiles" am: a83222e4fb am: 8d3a8b1327
am: 1a34a41268

Change-Id: Ic3673491705af125a88f66460996911244184fc8
1a34a412688dbb5489a20c942a6bfa5996bf1e77 19-Jan-2017 yuanhao <yuanhao@xiaomi.com> Merge "Fixed NPE in canAddMoreManagedProfiles" am: a83222e4fb
am: 8d3a8b1327

Change-Id: I8a5f9b7fcf46d2a801446fabece327ddceec3add
8d3a8b13272fff1757ad793a748816119b21dcea 19-Jan-2017 yuanhao <yuanhao@xiaomi.com> Merge "Fixed NPE in canAddMoreManagedProfiles"
am: a83222e4fb

Change-Id: Icd63296061485d29a95fa6c6735a8c1a91099afc
a83222e4fbdc5eef936eb3834cbf02be05bfc19c 19-Jan-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "Fixed NPE in canAddMoreManagedProfiles"
e1a774e3590ddaa6533c6855f712f919afbc408b 19-Jan-2017 Jeff Sharkey <jsharkey@android.com> Merge "Follow installd API changes." am: 915f279556 am: 6b662722f0 am: 5e17fe3e8c
am: f52972ad8b

Change-Id: Ib22fb4e87944824a64faf93667181a8bc56098ef
f52972ad8b08310aee9e725f0838d6abdbcd5a2b 19-Jan-2017 Jeff Sharkey <jsharkey@android.com> Merge "Follow installd API changes." am: 915f279556 am: 6b662722f0
am: 5e17fe3e8c

Change-Id: I4b812be109896a3574b1034033c163d8f2872e59
5e17fe3e8c0cd9560c0832a9412b75c107b3c3d6 19-Jan-2017 Jeff Sharkey <jsharkey@android.com> Merge "Follow installd API changes." am: 915f279556
am: 6b662722f0

Change-Id: Ia9406884d17226b10cae21fd2d98eecb9e5e7253
6b662722f01beac91c74862b521c9d5d5bfc5092 19-Jan-2017 Jeff Sharkey <jsharkey@android.com> Merge "Follow installd API changes."
am: 915f279556

Change-Id: Ib362db25a0393e859909e06a00dbb0c655fd4b47
d9fa667e2db634ceedbbb793ab3210cb7b229920 18-Jan-2017 Bartosz Fabianowski <bartfab@google.com> Allow system to retrieve persistent preferred activities

This CL allows system code to retrieve persistent preferred activities
(default intent handlers set by a Device Owner or Profile Owner app).
Settings will use this information to indicate which default apps were
set by the admin.

There is no public PackageManager API. Settings will call via the
IPackageManager interface directly.

Bug: 32692748
Test: Will be CTS-verifier-tested together with Settings

Change-Id: Ibd0a39f13852a9117836ca75cc0882e4cbe0ec1d
ackageManagerService.java
47f9f7cbcb4213a8baa4fd9e52162abde46721de 18-Jan-2017 yuanhao <yuanhao@xiaomi.com> Fixed NPE in canAddMoreManagedProfiles

We can use the command 'adb shell pm create-user --profileOf -10000
--managed TestProfile_12345678' to reproduce the problem.

Signed-off-by: yuanhao <yuanhao@xiaomi.com>
serManagerService.java
9e83cbbc10014b3ed560b3181f594868cd89f9ae 19-Jan-2017 Chris Tate <ctate@android.com> Revert "Enable background restrictions"

This reverts commit 21f778060badb1e78bffde05e8de7662d275003d.

Change-Id: I65586f9739da84fb32b51b0ea166b8288c41d1b3
ackageManagerService.java
6804d4de65cd5a30c4746c3e097b0713119c4e27 19-Jan-2017 Sunny Goyal <sunnygoyal@google.com> Merge "Adding support for apps to return PinItemRequest to launchers as a result of Intent.ACTION_CREATE_SHORTCUT"
155873057fa576c0516677acb86e6bf5f586baf8 18-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Enable background restrictions"
fcca000d4732a85b3154fc512bf02c31d1c8d937 18-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Ensure correct install reason"
21f778060badb1e78bffde05e8de7662d275003d 07-Nov-2016 Christopher Tate <ctate@google.com> Enable background restrictions

Apps that target O+ are always subject to background restrictions.
Legacy apps' background restriction is subject to the OP_RUN_IN_BACKGROUND
app op.

Apps with these properties are exempted from background restrictions:
- persistent process
- currently on the idle battery whitelist
- global whitelist for things like bluetooth services

Bug 30953212

Change-Id: Ib444829a2d222125f64ff19e8218823fa78373f9
ackageManagerService.java
36ba022316e61f28581c946fcbb9b7123a14da75 18-Jan-2017 Jeff Sharkey <jsharkey@android.com> Follow installd API changes.

Test: builds, boots, clearing strategy looks sane
Bug: 33965858
Change-Id: Ie5bbb71fb7a464999215c22e5a1fef0c07a620a4
nstaller.java
ackageManagerService.java
4a601f972a9930e26aa2ead8995cc8b97c1844b3 17-Jan-2017 Svet Ganov <svetoslavganov@google.com> DO NOT MERGE ANYWHERE Skip review permissions if package is installed with -g.

Bug: 34193954

Change-Id: Id744fd190ef78e498e635c2ab9936f12d0bbc917
(cherry picked from commit 6130fb741c86d7d4f0f86e3a875c3eca1fe8aa51)
ackageManagerService.java
2646571a0ef94401938f067de909d9811594df3a 13-Jan-2017 Bartosz Fabianowski <bartfab@google.com> Ensure correct install reason

When installing a package, we trust the installer to set the install
reason correctly. However, there are cases where we know what the
install reason should be (e.g. install by Device Owner or Profile Owner
should always be recorded as caused by enterprise policy) or we do not
trust the installer (e.g. an ordinary app not acting on behalf of an
enterprise should not be allowed to set the install reason to enterprise
policy).

This CL introduces a fix-up method that enforces these rules.

Bug: 32692748
Test: Manually tested all scenarios; DO case also covered by CTS

Change-Id: I18eb891401c9e38546f823a14f67391c94b22e28
ackageInstallerService.java
ackageManagerService.java
a6be88a10d6f6391b09f626ead051d0c698fb2d1 13-Jan-2017 Sunny Goyal <sunnygoyal@google.com> Adding support for apps to return PinItemRequest to launchers
as a result of Intent.ACTION_CREATE_SHORTCUT

> Adding API to allow launchers to query shortcut config activities in
managed profiles.
> Adding API to allow the default Launcher to start the shortcut config
activity in managed profiles.
> Updating the ACTION_CREATE_SHORTCUT documentation to represend changes
in the expected result.

Test: Manual tests and all the unit tests
adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
... to test10

Change-Id: I785c4f2fba782b864cc401ac7905330ea4498289
auncherAppsService.java
hortcutRequestPinProcessor.java
hortcutService.java
eaed75d923c132f7bb7679d3246a89eff78e6811 18-Jan-2017 Pavel Grafov <pgrafov@google.com> Merge "Make ENSURE_VERIFY_APPS global even when set by PO."
36fb17666f441e51ad76f532905b19181f4061d8 18-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Skip review permissions if package is installed with -g."
c4adc2ce0adb8df274d3e79baba141a6f0e88c40 18-Jan-2017 Calin Juravle <calin@google.com> Merge "Refactor PackageDexOptimizer" am: b3edbd7432 am: 8259b91984
am: db19cad1db

Change-Id: I3825f93d837f9dcc0de4ef45b059a458d9970690
db19cad1dbc1c9772246b5869188cf12f11b8726 18-Jan-2017 Calin Juravle <calin@google.com> Merge "Refactor PackageDexOptimizer" am: b3edbd7432
am: 8259b91984

Change-Id: Ia7420cf2511c840b3f98979f79701e3f50b70924
8259b9198405e2a9789ba62ce3614c8095b6f460 18-Jan-2017 Calin Juravle <calin@google.com> Merge "Refactor PackageDexOptimizer"
am: b3edbd7432

Change-Id: I6ecee9500002c977de497f598abfd8be081dd584
bef6872c45a9d417c1a6463226ed33991e299c87 18-Jan-2017 Jorge Lucangeli Obes <jorgelo@google.com> Merge "PackageDexOptimizer: fix typo in log message." am: 228123dd53 am: 9323d8e163
am: 562e57185b

Change-Id: I3b01da80b187736e590e8c5d23b5ec1e07ed9730
562e57185bdcdd9d7b055aea6f9467d6e4726b35 18-Jan-2017 Jorge Lucangeli Obes <jorgelo@google.com> Merge "PackageDexOptimizer: fix typo in log message." am: 228123dd53
am: 9323d8e163

Change-Id: I67faa22374f52b3c763593fca1b895bde6a57ed7
9323d8e163cdbf01ace9c3f093a80047248e63cc 18-Jan-2017 Jorge Lucangeli Obes <jorgelo@google.com> Merge "PackageDexOptimizer: fix typo in log message."
am: 228123dd53

Change-Id: I9bc4e9f9ac04a0666001b50dab4617986cf5da14
bb10525a661a1b034790cd3043daff88a7288483 04-Jan-2017 Calin Juravle <calin@google.com> Refactor PackageDexOptimizer

Split performDexoptLI in multiple smaller helpers. This will help in
adding the logic to process secondary dex files.

The goal is to move towards simple logic which can be reused between
compiling the package's code and its secondary dex files.

Test: device boots, packages get compiled in the background job,
adb shell cmd package compile -m speed|speed-profile packageName

Bug: 32871170

(cherry picked from commit 2d4b6ad7f38a3308d4f7be95219f0f9a6dde2d4d)

Change-Id: I802c16ec5c142d89b23c788011ef8f3daf5a9a61
Merged-In: I2d55edf42baa768f990939a82b3d52edf5f68a2c
ackageDexOptimizer.java
ae9ad65e9964dd9c2c4043eb6426416d0aa7dc88 09-Dec-2016 Jorge Lucangeli Obes <jorgelo@google.com> PackageDexOptimizer: fix typo in log message.

'oatDir' is the only token that has a space around the '='. None of the
other tokens in the log message do. Make the log message consistent so
that grepping is easier -- and the log message looks better.

Before:
PackageManager.DexOptimizer: Running dexopt (dex2oat) on:
/system/priv-app/Telecom/Telecom.apk pkg=com.android.server.telecom
isa=arm64 vmSafeMode=false debuggable=false
target-filter=interpret-only oatDir = null sharedLibraries=null

After:
PackageManager.DexOptimizer: Running dexopt (dex2oat) on:
/system/priv-app/Telecom/Telecom.apk pkg=com.android.server.telecom
isa=arm64 vmSafeMode=false debuggable=false
target-filter=interpret-only oatDir=null sharedLibraries=null

Bug: None
Test: Build, flash, grep for log message.

(cherry picked from commit 0f6250823612b2a43784bef12f833ac850bf2e2f)

Change-Id: Ic14ed7f634f1b36a76ed7b1e658c85078b87b4ad
Merged-In: I84162ec3535e3f83a60a62d40cbaf8e74d2051c6
ackageDexOptimizer.java
6130fb741c86d7d4f0f86e3a875c3eca1fe8aa51 17-Jan-2017 Svet Ganov <svetoslavganov@google.com> Skip review permissions if package is installed with -g.

Bug: 34193954

Change-Id: Id744fd190ef78e498e635c2ab9936f12d0bbc917
ackageManagerService.java
f1eb6ea403150d9bd25b8d0d7fbd78e2d5fa328a 18-Jan-2017 Jeff Sharkey <jsharkey@google.com> Merge "Invalidate installd when mounts change."
e77f180149231ff898f7cfe3f8c66285677dbbed 17-Jan-2017 Svet Ganov <svetoslavganov@google.com> DO NOT MERGE: Propagate revoked permissions in permission review mode am: 4518d0be16
am: 1e3fd31932

Change-Id: I0bb05ec8471c8f4de55ac295650424caaa86748e
1e3fd31932c3726a577289a095cc79f97e25144b 17-Jan-2017 Svet Ganov <svetoslavganov@google.com> DO NOT MERGE: Propagate revoked permissions in permission review mode
am: 4518d0be16

Change-Id: If068f8560868264079b2d867ff3b08234dac9b96
20cf769d96f1a2dae9e99d50f0d3dedc1e92b83f 17-Jan-2017 Svet Ganov <svetoslavganov@google.com> DO NOT MERGE: Propagate revoked permissions in permission review mode
am: 4518d0be16

Change-Id: Id0525c380c7b9aaf8c160b1e4fad24b9b2756a0d
4518d0be1623c8d1925db9d480618f6c46ff1461 17-Jan-2017 Svet Ganov <svetoslavganov@google.com> DO NOT MERGE: Propagate revoked permissions in permission review mode

In permission review mode we represent install permissions for legacy
apps as constantly granted runtime ones since we need to keep per
user flags associated with a permission. We were not propagating
a revoked permission for a legacy app when the later is upgraded to
a modern app when permission review is enabled.

Test: CTS test passes and manual testing worked fine

Bug: 34240393
Change-Id: I32b8ffee89cc034661f8eb5a172dbe2349ea4a18
(cherry picked from commit fe0253b34ec4fdb6afceb11193f29029b524866a)
ackageManagerService.java
1bb70191766c25a6463295c88bd2e2b5886dc2f8 17-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow removing non-enabled profiles"
fff1e744e3f72094e81b01134752d8f48c86d8e5 17-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Propagate revoked permissions in permission review mode"
7d25fafea7b313cf3eee5bbf4eb959f4986ffce4 17-Jan-2017 Jeff Sharkey <jsharkey@android.com> Invalidate installd when mounts change.

Test: builds, boots, common operations work
Bug: 34249218
Change-Id: Ia893b43dd7ff6078d91df50a9e8d644583617982
nstaller.java
fe0253b34ec4fdb6afceb11193f29029b524866a 17-Jan-2017 Svet Ganov <svetoslavganov@google.com> Propagate revoked permissions in permission review mode

In permission review mode we represent install permissions for legacy
apps as constantly granted runtime ones since we need to keep per
user flags associated with a permission. We were not propagating
a revoked permission for a legacy app when the later is upgraded to
a modern app when permission review is enabled.

Test: CTS test passes and manual testing worked fine

Change-Id: I32b8ffee89cc034661f8eb5a172dbe2349ea4a18
ackageManagerService.java
eda5d5183e5bc0fc63027b77b7dfd7d407bf22d6 17-Jan-2017 Jeff Sharkey <jsharkey@android.com> Only persist category hint when actually mutated.

Otherwise we're churning disk.

Test: builds, boots
Bug: 34328134
Change-Id: Iabc485b9ce3644e914240b5de5bcea98d939b2cb
ackageManagerService.java
6a40f09083fc52acc3309d0b04401fca02df6372 25-Oct-2016 Pavel Grafov <pgrafov@google.com> Make ENSURE_VERIFY_APPS global even when set by PO.

Currently only device owner can set global user restrictions.
With this CL ENSURE_VERIFY_APPS will be global no matter who
enforces it, DO or PO.

To make it possible for system apps to check who enforces a
particular restriction in this case a new API method is added
to UserManager: getUserRestrictionSources which returns a list
of users who enforce the restriction.

Bug:31000521
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.UserRestrictionsTest (ag/1732744)
Test: runtest --path frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
Test: runtest --path frameworks/base/services/tests/servicestests/src/com/android/server/pm/UserRestrictionsUtilsTest.java
Test: runtest --path frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerServiceMigrationTest.java
Test: installed M on a Nexus5x device, created a managed profile with some user restrictions, and checked that after upgrading M->O all restrictions are preserved and split correctly into base, global and local.
Change-Id: I543d3ec9ef0cf2b730da6f7406021c0bba43b785
serManagerService.java
serRestrictionsUtils.java
c8776157eefc3764ad4a5a1964cd3a1f8c50e418 06-Jan-2017 Benjamin Franz <bfranz@google.com> Allow removing non-enabled profiles

Bug: 31668514
Test: runtest -c
com.android.server.pm.UserManagerServiceCreateProfileTest
frameworks-services
Change-Id: If8db670d6f253a44b2aa91df97349dd0ffd85f02
serManagerService.java
f5bda2874f353106bf86aaba77876590218f89bf 16-Jan-2017 Narayan Kamath <narayan@google.com> Merge "PackageParser: Disable package cache on "eng" builds."
9e0642287e1f6d907356f1724272332f0db7f7af 14-Jan-2017 Bartosz Fabianowski <bartfab@google.com> Merge "Add install reason"
906a21ba084aed7b213653782d1d4b8269b56dd2 14-Jan-2017 bohu <bohu@google.com> Emulator: Fix CTS failure caused by removed MANAGE_USERS permission in Shell
am: d91dd06591

Change-Id: Ie178b790e11eb081857cd67c7f9af7fa95914868
bdd0a2b14ab1da5c739c2658aa94f87daa9b3c04 14-Jan-2017 Sudheer Shanka <sudheersai@google.com> Merge "Emulator: Fix CTS failure caused by removed MANAGE_USERS permission in Shell" into nyc-mr2-dev
b4be8c8df11a0ae54e4e659bacbbe6344de8d5e1 13-Jan-2017 Justin Klaassen <justinklaassen@google.com> Add support for carrier demo mode
am: b632c55469

Change-Id: Ib8061ae05e5144a79921123ba6dfdaec81baaece
b632c5546968bc20e60e5b86ded4c41612a47c52 12-Jan-2017 Justin Klaassen <justinklaassen@google.com> Add support for carrier demo mode

Fixes: 33746309
Test: manually verified carrier demo mode and normal demo mode are setup
correctly

Change-Id: Ia38790599f672a9d1999274276156b5328c9f75a
serManagerService.java
21a2838e3474c7b7918ca638be70aa1c27649117 13-Jan-2017 Narayan Kamath <narayan@google.com> PackageParser: Disable package cache on "eng" builds.

- Catch a wider variety of exceptions from the package parse
stage. Ignore and delete the cache entry if we catch *any*
exceptions from deserializing the parse result.

- Rename the system property pm.boot and not ro.boot, since the
former needs less effort to change back and forth.

- Finally, add a heuristic to wipe caches on non-numbered
userdebug builds when changes to the system partition are detected.

Also re-enable the cache by reverting commit
20274d15d8f40112dd13d01980c210b49f78cda9.

Test: Manual
Change-Id: I7b5b71ac60d8c438398c354be50b207e80550148
ackageManagerService.java
a34f53f61be31b7171d6cbcb12490ee143acffff 11-Jan-2017 Bartosz Fabianowski <bartfab@google.com> Add install reason

This CL allows a reason to be specified when installing a package. The
install reason is a sticky piece of metadata: When a package is e.g.
installed via enterprise policy and an update is then manually
installed or sideloaded, the install reason will remain "policy."
The install reason is tracked separately for each user.

With this CL, two install reasons exist: "policy" and "unknown." Other
install reasons will likely be supported in the future.

Bug: 32692748
Bug: 33415829
Test: Tested manually with "adb install" / "adb uninstall"

Change-Id: I0c9b9e1b8eb666bb6962564f6efd97e41703cd86
ackageManagerService.java
ackageSettingBase.java
ettings.java
244a63a2d359c1df8fd85291ab336dbf89b91a72 13-Jan-2017 Todd Kennedy <toddke@google.com> Merge "Allow starting ephemeral apps from 'am'"
54b8e5deae9c461ad2c98f7b78154da01c953155 12-Jan-2017 Todd Kennedy <toddke@google.com> Merge "Turn off caching temporarily until we can address some of the issues."
20274d15d8f40112dd13d01980c210b49f78cda9 12-Jan-2017 Todd Kennedy <toddke@google.com> Turn off caching temporarily until we can address some of the issues.

Revert "PackageManagerService: Enable package parse cache."

This reverts commit 6453db68ca47cd9c686142b8eab3c98f51fd19b4.

Change-Id: I88b6e08a64827550abda91df2dc06611cedeab62
ackageManagerService.java
4286f7ae46210a5cdcb71bde5b1a4f3f01dc21c1 12-Jan-2017 Calin Juravle <calin@google.com> Merge "Refactor PackageDexOptimizer"
2d4b6ad7f38a3308d4f7be95219f0f9a6dde2d4d 04-Jan-2017 Calin Juravle <calin@google.com> Refactor PackageDexOptimizer

Split performDexoptLI in multiple smaller helpers. This will help in
adding the logic to process secondary dex files.

The goal is to move towards simple logic which can be reused between
compiling the package's code and its secondary dex files.

Test: device boots, packages get compiled in the background job,
adb shell cmd package compile -m speed|speed-profile packageName

Bug: 32871170
Change-Id: I2d55edf42baa768f990939a82b3d52edf5f68a2c
ackageDexOptimizer.java
0078e1b777fbd1b8d9e734632185851fee720cc9 12-Jan-2017 Jeff Sharkey <jsharkey@android.com> Add support for fallback categories.

When an app doesn't define a category, look for a fallback category
in a hard-coded list. This change only defines a fallback for a
single package, but device-specific overlays can be used to provide
more detailed fallback lists.

The precidence order is: app manifest > installer hint > fallback

Test: builds, boots, fallback categories work
Bug: 33815939
Change-Id: I1f5ca76fb7e5743a4500c0a1230a754266f34d9e
ackageManagerService.java
9bc89af3f1bce8003ee4f93b89a1770d8f5b9cc9 11-Jan-2017 Jeff Sharkey <jsharkey@android.com> Add API for apps to declare their "category".

Upcoming platform features need to cluster apps together into broad
categories to help summarize information to users. (For example,
when presenting battery, network, and disk usage.)

We are tightly limiting the set of categories to keep them easily
presentable to users when summarizing information. This feature is
not designed to be a general-purpose taxonomy, nor should it be
allowed to become one.

Older apps may not have defined a category in their manifests, so
allow the installing app to define a category on their behalf.

Test: builds, boots
Bug: 33815939
Change-Id: I785b882ee7c18072ef47d56e0fc19ad72888e1b7
ackageManagerService.java
ackageSettingBase.java
ettings.java
d91dd06591a761aa9e3eab519a23b40bf2b0dbcc 27-Sep-2016 bohu <bohu@google.com> Emulator: Fix CTS failure caused by removed MANAGE_USERS permission in Shell

BUG: 34132936
BUG: 31648062
Change-Id: I9679c18c0e3611ebc9779408826f182ea8f1e88b
(cherry picked from commit 57f47e8490b68678fd123cdc111d5073ec994382)
(cherry picked from commit 12d23a13bb45cd4f83395f0f45f3382d7571effe)
serManagerService.java
44f1b306663f2b9b04934c05dc35640821419c59 10-Jan-2017 Todd Kennedy <toddke@google.com> Allow starting ephemeral apps from 'am'

We previously filtered any ephemeral app if either startActivity or
queryIntentActivities was called from a non-ephemeral app. However,
the system should have access to all activities [ephemeral or not]

Bug: 33458220
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Change-Id: I381862e3848b2e6f7f7b2612e9cc8977a1e132ab
ackageManagerService.java
832af67c1d543858ca4817139e4c1a62fd715b9e 11-Jan-2017 Richard Uhler <ruhler@google.com> Merge "Cleanup code given PATCHOAT_FOR_RELOCATION has been removed." am: 8582826f8d am: 5c5637e1bd am: 4911e517ab
am: c662c1541b

Change-Id: I2ac812bdbd3a8fb8619d5c8d1694fb67a8a69632
c662c1541b8f8039ce9c191fbc63e10cf74c909b 11-Jan-2017 Richard Uhler <ruhler@google.com> Merge "Cleanup code given PATCHOAT_FOR_RELOCATION has been removed." am: 8582826f8d am: 5c5637e1bd
am: 4911e517ab

Change-Id: I5fd04eb1e91d4ff590a195598566a85bbc00999f
4911e517ab4c7434cb2a93eafe6ce4ed4477046e 11-Jan-2017 Richard Uhler <ruhler@google.com> Merge "Cleanup code given PATCHOAT_FOR_RELOCATION has been removed." am: 8582826f8d
am: 5c5637e1bd

Change-Id: I27f00cca9b511d6950e12b59f179faae21f07147
5c5637e1bd3a37066e72c56b8abe5be3a2a08154 11-Jan-2017 Richard Uhler <ruhler@google.com> Merge "Cleanup code given PATCHOAT_FOR_RELOCATION has been removed."
am: 8582826f8d

Change-Id: If5d55f55d86c4e4711e36a7f517336fbdda96e3d
d670d5866754beca43a217ef5013b5acd1976e78 08-Dec-2016 Richard Uhler <ruhler@google.com> Cleanup code given PATCHOAT_FOR_RELOCATION has been removed.

Test: make, device boots, installed an app
Test: adb shell cmd package compile -m speed|speed-profile <app>
Bug: 33192586
Change-Id: I8ef7d4926773586251fedf8a7737a8005f119859
ackageDexOptimizer.java
5c451a64fd3edc6f651d335bd72dc5eced1f08e3 11-Jan-2017 Calin Juravle <calin@google.com> Add an extra debug flag to BackgroundDexOptimizer am: 3a2b7f7d59 am: 236477e86e
am: f5d005b8c2

Change-Id: Icb9d089b68ec192b73b31b965c66f2f747ce220b
a9d1bfadf083df3d84fa1eafd517d940c70dcbce 11-Jan-2017 Calin Juravle <calin@google.com> Some refactoring in BackgroundDexOptService. am: 95176bb18e am: 377cc26e3a
am: e1a0a76381

Change-Id: Id97538a51933ccbb9c62511e5949664780b7e861
6d90cdb03bdead1b717c714e699ca14f50c9bb97 11-Jan-2017 Calin Juravle <calin@google.com> Do not try to resolve realpath in DexManager. am: b96dba9bad am: b8f31d8a85
am: d86ca1cd25

Change-Id: I6b01cc2af9447ca2d5a871c6e1dd9ccf8d84e640
4b92117bf6c4563561548295a244c9261c460c17 11-Jan-2017 Calin Juravle <calin@google.com> Log DexManager realpath errors only in debug mode. am: 271bacbf5c am: 42c7fc7f27
am: 46b323869f

Change-Id: I55e04d69bba9d14f0527c648d29f8ec8b7bbddfb
a9911290edcda9a0e2b6f430e3bc28f91697014f 11-Jan-2017 Calin Juravle <calin@google.com> Record data about dex files use on disk am: 5a9094c1b6 am: dc10a3bdb0
am: ea1c34d45e

Change-Id: Ie9f489ff2ec89e9014eb683e269139ba633762bb
edc6306402826f04e42a833dca54aba0281623b0 11-Jan-2017 Calin Juravle <calin@google.com> Add logic for recording dex files use on disk am: 6ea5ace7b3 am: 34bdf1680a
am: bc7f234daa

Change-Id: Iaf2ffd60d374eef179705e35743338ff3d8105c3
f5d005b8c2c507fcfdc42e0bc8e938cfa195a4b9 11-Jan-2017 Calin Juravle <calin@google.com> Add an extra debug flag to BackgroundDexOptimizer am: 3a2b7f7d59
am: 236477e86e

Change-Id: I30686bda79e0400d6aaca8ee71ca0c449452ed31
e1a0a76381f19f88371df349dca66b8c33e746f9 11-Jan-2017 Calin Juravle <calin@google.com> Some refactoring in BackgroundDexOptService. am: 95176bb18e
am: 377cc26e3a

Change-Id: If18489475e12e1d5c641f512a6b21f0ba70c6b6a
d86ca1cd2503a7554e6a98ce1bff48fdd72eda6c 11-Jan-2017 Calin Juravle <calin@google.com> Do not try to resolve realpath in DexManager. am: b96dba9bad
am: b8f31d8a85

Change-Id: I4b9e9c0781a4db89a49d588bcebb953c6144f5a3
46b323869fcd3c0698df7dbb660a4acb4b0d06c7 11-Jan-2017 Calin Juravle <calin@google.com> Log DexManager realpath errors only in debug mode. am: 271bacbf5c
am: 42c7fc7f27

Change-Id: I68f14e9a0b7507a93a9569e670b3693958fd7c09
ea1c34d45eacd9d20860b5dee1559be7fbfbfb9d 11-Jan-2017 Calin Juravle <calin@google.com> Record data about dex files use on disk am: 5a9094c1b6
am: dc10a3bdb0

Change-Id: Ife1e626d722ba129cdcb6cd4a8f454cf28ca267c
bc7f234daa95e9ca2d42e24ab71e445ab7ac25d8 11-Jan-2017 Calin Juravle <calin@google.com> Add logic for recording dex files use on disk am: 6ea5ace7b3
am: 34bdf1680a

Change-Id: I075e6c5224b374f2d03d711e4d5492d60e4da572
236477e86e431a8c1eede04bea8bc88cf2196de3 11-Jan-2017 Calin Juravle <calin@google.com> Add an extra debug flag to BackgroundDexOptimizer
am: 3a2b7f7d59

Change-Id: I309923c247bef67ffbdba56955582f6decde3800
377cc26e3ac8417755493444693a0cabcd846413 11-Jan-2017 Calin Juravle <calin@google.com> Some refactoring in BackgroundDexOptService.
am: 95176bb18e

Change-Id: I191aeed8a7264bb13c4cef8b1ba135fd03a75d58
b8f31d8a854362b2e8c1306a5debbfb31d79453b 11-Jan-2017 Calin Juravle <calin@google.com> Do not try to resolve realpath in DexManager.
am: b96dba9bad

Change-Id: I67aba48784bca9a51f63e47b54c211ba535dd0e4
42c7fc7f27c397927efcfc4013f43ef658de95e4 11-Jan-2017 Calin Juravle <calin@google.com> Log DexManager realpath errors only in debug mode.
am: 271bacbf5c

Change-Id: I94aca4959284912e6d5008f56617254be2fc3ea7
dc10a3bdb0e07aaa6a093a4f97e536278eb48e19 11-Jan-2017 Calin Juravle <calin@google.com> Record data about dex files use on disk
am: 5a9094c1b6

Change-Id: I50378b1351a5ae83ac55f1b26e2e0c5f3230c6d2
34bdf1680a7b9f621fc9026ad75045ccc4273a31 11-Jan-2017 Calin Juravle <calin@google.com> Add logic for recording dex files use on disk
am: 6ea5ace7b3

Change-Id: I82246efd8e78c1c4ac18a67f0274b10545605207
619d6282c3c263672113efee8e1e386de480e119 11-Jan-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge changes I5b94a8f0,Ie6cdd846,Ie6b5f5e6,Ib962edf6,I9d779b2d, ...

* changes:
Add an extra debug flag to BackgroundDexOptimizer
Some refactoring in BackgroundDexOptService.
Do not try to resolve realpath in DexManager.
Log DexManager realpath errors only in debug mode.
Record data about dex files use on disk
Add logic for recording dex files use on disk
3a2b7f7d59da9f54d9de4afbbfeebcfb4a3866f2 22-Dec-2016 Calin Juravle <calin@google.com> Add an extra debug flag to BackgroundDexOptimizer

This makes testing/debugging the job a bit easier.

Test: device boots, packages get compiled
Bug: 32871170

(cherry picked from commit a50d58e22630cd651a815381639e70476991bdbf)

Change-Id: I5b94a8f0b3bbf9075dcaecf028aaf79a21aaab7b
ackgroundDexOptService.java
95176bb18e5efeb78978f4950a18fadaf9e6d57e 22-Dec-2016 Calin Juravle <calin@google.com> Some refactoring in BackgroundDexOptService.

Extract postOta/idle optimizations in their own method.
In preparation for adding the logic to handle secondary dex files.

Test: device boots, pacakges get compiled
Bug: 32871170

(cherry picked from commit be6a71a0b3f369843a26c91dd5123d0499f00e7e)

Change-Id: Ie6cdd8461e7214f5de68bc9172f4171ebf72aa39
ackgroundDexOptService.java
b96dba9badc18f1c831c0c83ff7934f6aaf4f51c 22-Dec-2016 Calin Juravle <calin@google.com> Do not try to resolve realpath in DexManager.

PM should already provide the real path of the application directory.

Test: runtest -x .../DexManagerTests.java

Bug: 33807524
Bug: 32871170

(cherry picked from commit c066205cea051c6d9f386188b9cb426c03dbee2d)

Change-Id: Ie6b5f5e61d08710e7ef7d3149b7b13cc7d03a242
ackageManagerService.java
ex/DexManager.java
271bacbf5c524bbe33a7f0551b33f7a21cb64f17 22-Dec-2016 Calin Juravle <calin@google.com> Log DexManager realpath errors only in debug mode.

Test: runtest -x .../DexManagerTests.java
Bug: 33807524

(cherry picked from commit bb9ed1f3c93f0267fa97d6cbeb58ecd1de41d795)

Change-Id: Ib962edf67ce7f5b9b93c9bc6855675e00e025810
ex/DexManager.java
5a9094c1b6e5797327674d4f12fa1ac4ade7275c 16-Dec-2016 Calin Juravle <calin@google.com> Record data about dex files use on disk

Add DexManager to keep track of how dex files are used.

Every time a dex file is loaded, PackageManager will notify DexManager
which will process the load. The DexManager will look up what package
owns the dex file and record its use in package-dex-usage.list (through
PackageDexUsage).

Test: device boots, package-dex-usage.list is created and contains valid data, after device reboot the list is succesfully read from disk.
runtest -x .../PackageDexUsageTests.java
runtest -x .../DexManagerTests.java

Bug: 32871170

(cherry picked from commit b8976d8f22fecaa9ed39276d9d8ded17d35b51a6)

Change-Id: I9d779b2d39814d7c54fc7a888df93d403a001df5
ackageManagerService.java
ex/DexManager.java
6ea5ace7b3a8ddf19a7389592eb9df3b33c673f3 01-Dec-2016 Calin Juravle <calin@google.com> Add logic for recording dex files use on disk

Add PackageDexUsage to handle the I/O operations of dex usage data. It
is responsible to encode, save and load dex

Test: runtest -x .../PackageDexUsageTests.java

Bug: 32871170

(cherry picked from commit 0318162abcbd07a0472989df43e00e353fac731b)

Change-Id: I6d483d480d62aa14cb1663560fd88092469a2835
bstractStatsBase.java
ackageManagerServiceUtils.java
ex/PackageDexUsage.java
460e9104d09cd15543ba28eb95b3869018b81733 11-Jan-2017 Makoto Onuki <omakoto@google.com> Merge "Allow adding target activity via requestPinShortcut()."
255461f676f09db9be3876c156d571f4e08981ee 10-Jan-2017 Makoto Onuki <omakoto@google.com> Allow adding target activity via requestPinShortcut().

Also now ShortcutManager tries to fill in the main activity as the target
activity if the caller has one.

Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: Running: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsShortcutManagerTestCases
Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsShortcutHostTestCases

Bug 34047091

Change-Id: I2bf2b20e94a2384cfa6e6b7d40d56cfe96a94fd9
hortcutPackage.java
hortcutRequestPinProcessor.java
hortcutService.java
e961992ed313ea1c733500d9b66f1af5349b59b2 10-Jan-2017 Calin Juravle <calin@google.com> Merge "Add an extra debug flag to BackgroundDexOptimizer"
54402aab14deb9f21b0a9b451f80113ab9821b04 10-Jan-2017 Andrew Scull <ascull@google.com> Merge "Evict CE key on request and when work mode is turned off."
bd439dcef072fd9a853a6bc9055cfa347ad7c969 10-Jan-2017 Jeff Sharkey <jsharkey@android.com> Merge "Methods to calculate user and external disk usage." am: 6a9ad14172 am: 7beb2b75a9 am: 669affdb8e
am: 91b91b7f86

Change-Id: I7859db9f53560ad602bb26f37854bdfc02f15d09
91b91b7f86d890ef4c0210b1dfb78e2aa3a7dc10 10-Jan-2017 Jeff Sharkey <jsharkey@android.com> Merge "Methods to calculate user and external disk usage." am: 6a9ad14172 am: 7beb2b75a9
am: 669affdb8e

Change-Id: I698dd15a397f16dd2358729362860443f7e81a33
669affdb8e70043e3ecb8274251f609cb529bbf0 10-Jan-2017 Jeff Sharkey <jsharkey@android.com> Merge "Methods to calculate user and external disk usage." am: 6a9ad14172
am: 7beb2b75a9

Change-Id: I236eb3357b597cac26f5234a72551a471919a411
7beb2b75a92c22a6bfcc9caeece737e4ea0fd562 10-Jan-2017 Jeff Sharkey <jsharkey@android.com> Merge "Methods to calculate user and external disk usage."
am: 6a9ad14172

Change-Id: Ie4ab045a5425b35ce1bdd245f7c6ab248c796df2
82ca90171fdd5b76f58225bacbf9939a76350712 09-Jan-2017 Jeff Sharkey <jsharkey@android.com> Methods to calculate user and external disk usage.

Add method to calculate user disk usage, which will be faster than
making a Binder call for every single appId under a user. Add method
to calculate external disk usage, which uses file extensions to track
usage with "audio", "video", and "images" categories.

Start measuring internal and external storage space separately; new
GIDs are coming in a future CL. Pass down all package names, inodes,
and code paths, since shared UIDs host more than one.

Test: builds, boots, stats are consistent
Bug: 27948817, 32206268
Change-Id: Icbb82a30fe711ef05e9a16bb1dc740dc943a9ddc
nstaller.java
ackageManagerService.java
a50d58e22630cd651a815381639e70476991bdbf 22-Dec-2016 Calin Juravle <calin@google.com> Add an extra debug flag to BackgroundDexOptimizer

This makes testing/debugging the job a bit easier.

Test: device boots, packages get compiled
Bug: 32871170
Change-Id: Ic5b1bfe16c364d53f322048ee087e1178439cbd2
ackgroundDexOptService.java
458c4115ecd65a9e2b2071a68cb783c66367f952 09-Jan-2017 Calin Juravle <calin@google.com> Merge "Some refactoring in BackgroundDexOptService."
9f7b7ce0c8119bd16ddc4571600b5ca25879da48 09-Jan-2017 Calin Juravle <calin@google.com> Merge "Do not try to resolve realpath in DexManager."
09e3c9b78cf6670e26fcc23d3f9ea59ca5e741d0 07-Jan-2017 Alex Naidis <alex.naidis@linux.com> Merge "DefaultPermissionGrantPolicy: Pass correct arguments" am: 0b325c6634 am: fd55f834c8 am: 80888cdcbe
am: 2603aab95c

Change-Id: Iaca178d58a657ed59e3b9cbc08c3d2909cbf0811
2603aab95c9787153796955b712f2afccba4788d 07-Jan-2017 Alex Naidis <alex.naidis@linux.com> Merge "DefaultPermissionGrantPolicy: Pass correct arguments" am: 0b325c6634 am: fd55f834c8
am: 80888cdcbe

Change-Id: I9852107278f6206582393a57be60074763a6cb81
80888cdcbed7d9445fefb3f47a813516a10a6b17 07-Jan-2017 Alex Naidis <alex.naidis@linux.com> Merge "DefaultPermissionGrantPolicy: Pass correct arguments" am: 0b325c6634
am: fd55f834c8

Change-Id: Ia53faad0ba004233d0ee031e1ca83d705f5bd379
fd55f834c804f239bd0f8b0683e9bfee18550442 07-Jan-2017 Alex Naidis <alex.naidis@linux.com> Merge "DefaultPermissionGrantPolicy: Pass correct arguments"
am: 0b325c6634

Change-Id: I5d217037bececb7a096ccfa018fafaa4280e4537
f030a28a6be0ae25285495ee9c6da5ce4b41285d 03-Jan-2017 Alex Naidis <alex.naidis@linux.com> DefaultPermissionGrantPolicy: Pass correct arguments

After parsing the xml files in the "default-permissions"
system, we are passing the arguments in the wrong order.

The method we are targeting is:
private void grantRuntimePermissionsLPw(PackageParser.Package pkg, Set<String> permissions,
boolean systemFixed, boolean isDefaultPhoneOrSms, int userId) {

However we are passing our argument for "systemFixed"
to "isDefaultPhoneOrSms" and the other way around too.

This patch fixes it by using the version of the method
which takes 4 arguments and sets "isDefaultPhoneOrSms"
as false.

Change-Id: I3604a5d6045aadcd91b6dd3f6f1b47b561403b23
Signed-off-by: Alex Naidis <alex.naidis@linux.com>
efaultPermissionGrantPolicy.java
9fd9019cf1f2c69c9bd1b9ea635a2605b3d9208f 06-Jan-2017 Makoto Onuki <omakoto@google.com> Revert "ShortcutManager: Floating shortcuts shouldn't have target activities."

This reverts commit 106ff7a0a1bef974ff04e9e79a25eb5e84555893.

Test: All the unit tests (ShortcutManagerTest1*) CtsShortcutHostTestCases and CtsShortcutManagerTestCases

Change-Id: Iadce2b3785cbf728daa60c4e2ff103e516d85896
hortcutPackage.java
hortcutService.java
6453db68ca47cd9c686142b8eab3c98f51fd19b4 05-Jan-2017 Narayan Kamath <narayan@google.com> PackageManagerService: Enable package parse cache.

Bug: 30792387
Test: FrameworksServicesTests

Change-Id: I817adea928832993afa6182d0510be8abf38e4bb
ackageManagerService.java
3aea7330591e90a44e2bceb76decfe879bcdf8e5 06-Jan-2017 Narayan Kamath <narayan@google.com> Merge "PackageManagerService: Implement packageParser cache in ParallelPackageParser."
54217e5c2521dc9d8ffb1a4dc8f4be2c6abbc97f 05-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Added SystemServerInitThreadPool"
e29a5a11529dc7df82911b48b9f95461383cbcc2 17-Dec-2016 Fyodor Kupolov <fkupolov@google.com> Added SystemServerInitThreadPool

System services can use it during the boot to submit tasks that can be run in
parallel with the main thread.

Switched PersistentDataBlockService and FingerprintService from FgThread to
the new thread pool.

UiModeManagerService: update initial configurations on init thread. They run
while holding the mLock so no extra synchronization barriers are needed at a
later stage.

Test: manual - device boots without errors
Test: ParallelPackageParserTest passes
Change-Id: I548f34b0a18f61924e09a39afb12e085cde35442
arallelPackageParser.java
be6a71a0b3f369843a26c91dd5123d0499f00e7e 22-Dec-2016 Calin Juravle <calin@google.com> Some refactoring in BackgroundDexOptService.

Extract postOta/idle optimizations in their own method.
In preparation for adding the logic to handle secondary dex files.

Test: device boots, pacakges get compiled
Bug: 32871170
Change-Id: Iee12ab90215b60ea00ed54ca2d8c4f526036058c
ackgroundDexOptService.java
c066205cea051c6d9f386188b9cb426c03dbee2d 22-Dec-2016 Calin Juravle <calin@google.com> Do not try to resolve realpath in DexManager.

PM should already provide the real path of the application directory.

Test: runtest -x .../DexManagerTests.java

Bug: 33807524
Bug: 32871170
Change-Id: I700419157bf5532af6437812b7e0a76f80057022
ackageManagerService.java
ex/DexManager.java
5c50e8630164d7d9a1a097f70d2f8bcbf1bd854f 24-Nov-2016 Narayan Kamath <narayan@google.com> PackageManagerService: Implement packageParser cache in ParallelPackageParser.

We save about 2800ms of cold startup time over baseline on a marlin,
and ~1200 ms over the parallel parsing case.

warm cold
---------------
Baseline : 1700ms 4300ms
Parallel : 1400ms 2700ms
Cache : 1000ms 1600ms
Cache & parallel : 900ms 1500ms

Note that further changes will improve the speed of cache processing.

This change also includes support for :
- a flag that been flipped in code (currently set to false).
- disabling the cache via a system property.
- wiping the cache on system upgrades.
- cache versioning.

Bug: 30792387

Test: FrameworksServicesTests
Test: manual timing

Change-Id: I281710c110af5307901dd62ce93b515287c91918
ackageManagerService.java
arallelPackageParser.java
b4413f694fbb8b03737d3e7a3831896bd371bed5 05-Jan-2017 Nicolas Prévot <nprevot@google.com> Merge "Make disallow add/remove managed profile restriction not global."
2ea46fe658c5a977a11372d7180e8ed9abf261e8 05-Jan-2017 Nicolas Prevot <nprevot@google.com> Make disallow add/remove managed profile restriction not global.

Otherwise: if the DO sets remove managed profile user restriction:
the profile owner of a managed profile cannot remove this managed
profile.

BUG:33854430
Test: adb shell am instrument -e class com.android.server.devicepolicy.DevicePolicyManagerTest -w
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I90b2028ea627a2073298bf9ef3c07b4fdf8d13a1
serRestrictionsUtils.java
a532c3ff8c2101de42281cb71cc411ab1dff64f0 04-Jan-2017 Sunny Goyal <sunnygoyal@google.com> Merge "AppWidgetManager: direct add widget support."
7dfe29f0108564a0d027993a0e1e327ea2d71d72 04-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Propagate ephemeral flag from adb install to PackageParser"
58bfae414ec280fab0eac11d98d9ffd62abbceae 04-Jan-2017 Alex Klyubin <klyubin@google.com> Propagate ephemeral flag from adb install to PackageParser

This fixes the bug where adb install --ephemeral switch was not
propagated to PackageParser.collectCertificates.

Bug: 34060793
Test: Modified PackageParser.collectCertificates to print received flags, invoked adb install with and without --ephemeral
Change-Id: I562008e4275f7a40fd923022d80e2b42f6dc6e6f
ackageInstallerSession.java
87a563e0707bb7e2be034c195e9827dfe3451cfd 02-Jan-2017 Sunny Goyal <sunnygoyal@google.com> AppWidgetManager: direct add widget support.

Test: Manual test and all the unit tests:
adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
... to test9
adb shell am instrument -e class com.android.server.appwidget.AppWidgetServiceImplTest -w com.android.frameworks.servicestests

Bug 32404406
Change-Id: Icd6d4cbd25d9cdf4508da725d95d6401cc3a46a7
hortcutRequestPinProcessor.java
hortcutService.java
dbc2ef417b5689dc502c52312e99f5dc2fd730a3 03-Jan-2017 Jeff Sharkey <jsharkey@android.com> Merge "Offer to measure disk stats using quotas." am: f8720b95be am: 4b80a4a372 am: 1e1cdbead1
am: 7664e61885

Change-Id: I91c0810aad2ec530650855bcd2f1d25c309717a1
7664e6188574a6a10b5dcb70791b15fe3a8c4707 03-Jan-2017 Jeff Sharkey <jsharkey@android.com> Merge "Offer to measure disk stats using quotas." am: f8720b95be am: 4b80a4a372
am: 1e1cdbead1

Change-Id: Ic00acfb0efb6188a15357322528075d41467310b
1e1cdbead134b55301786c85e8fe5ec8776df061 03-Jan-2017 Jeff Sharkey <jsharkey@android.com> Merge "Offer to measure disk stats using quotas." am: f8720b95be
am: 4b80a4a372

Change-Id: I2ab9a2bd2ff60cafea332998789ad947dda0140b
4b80a4a3727f7f9fc45997fb6c1ac8e708a2bc65 03-Jan-2017 Jeff Sharkey <jsharkey@android.com> Merge "Offer to measure disk stats using quotas."
am: f8720b95be

Change-Id: I56bab3ec4895c232ce8287623827c20f2dbfaaf6
5eb3eb58acf18dd624c477d5b11b45a23aea6261 13-Dec-2016 Jeff Sharkey <jsharkey@android.com> Offer to measure disk stats using quotas.

Now we're getting somewhere! This CL starts measuring disk usage
using quotactl(), which is almost instant and has much lower impact
on flash memory lifetime.

We now grant the per-app cache GID to every launched app, and the
ContextImpl logic that creates cache directories matches the logic
down in installd.

Test: builds, boots, quota stats match manual stats
Bug: 27948817
Change-Id: Ie269a2958ce0e1c17cb74dbfecc791a5c12922cf
nstaller.java
ackageManagerService.java
ff8d66bbc2fa20b5711becf5e9266a69fbefc2ec 29-Dec-2016 Svetoslav Ganov <svetoslavganov@google.com> Don't allow permission change to runtime

Prevent apps to change permission protection level to dangerous
from any other type as this would allow a privilege escalation
where an app adds a normal permission in other app's group and
then redefines it as dangerous leading to the group auto-grant.

Test: Added a CTS test which passes.

bug:33860747

Change-Id: Icd2d596d42ae2c6cf569c016d20d9bb9106a29ef
ackageManagerService.java
5b95d07725b629272f202993f3620a7b0f1dd6fb 29-Dec-2016 Svetoslav Ganov <svetoslavganov@google.com> Revert "Don't allow permission change to runtime"

This reverts commit 0f929c53201264da0ae908e349c904f2fa930e29.

Change-Id: I1b86461e352a6a2cf3d32748e06c7d5806937667
ackageManagerService.java
0f929c53201264da0ae908e349c904f2fa930e29 28-Dec-2016 Svetoslav Ganov <svetoslavganov@google.com> Don't allow permission change to runtime

Prevent apps to change permission protection level to dangerous
from any other type as this would allow a privilege escalation
where an app adds a normal permission in other app's group and
then redefines it as dangerous leading to the group auto-grant.

Test: Added a CTS test which passes.

bug:33860747

Change-Id: I1ccf546f78ee79ff027cb98124be81c8e5265a82
ackageManagerService.java
ae89c4c1532255680c40131b4b16656d14619f58 22-Dec-2016 Calin Juravle <calin@google.com> Merge "Log DexManager realpath errors only in debug mode."
bb9ed1f3c93f0267fa97d6cbeb58ecd1de41d795 22-Dec-2016 Calin Juravle <calin@google.com> Log DexManager realpath errors only in debug mode.

Test: runtest -x .../DexManagerTests.java
Bug: 33807524

Change-Id: I69b7aca347bcd23323a5d72c78edc94a39335d09
ex/DexManager.java
37d37f0fa9f033d74b3c8d01bd0a0538359e2071 22-Dec-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Settings recovery support"
e080da9ee027fcd030aa92ea26fd0ed9f031674f 22-Dec-2016 Svetoslav Ganov <svetoslavganov@google.com> Settings recovery support

This change allows the system to perform iterative reset
of changes to settings in order to recover from bad a
state such as a reboot loop.

To enable this we add the notion of a default value. The
default can be set by any package but if the package that
set it is a part of the system, i.e. trusted, then other
packages that are not a part of the system, i.e. untrusted,
cannot change the default. The settings setter APIs that
do not take a default effectively clear the default. Putting
a setting from a system component always makes it the
default and if the package in not trusted then value is
not made the default. The rationale is that the system is
tested and its values are safe but third-party components
are not trusted and their values are not safe.

The reset modes from the least intrusive are: untrusted
defaults - reset only settings set by untrusted components
to their defaults or clear them otherwise; untrusted clear
- clear settings set by untrusted components (or snap to
default if provided by the system); trusted defaults - reset
all settings to defaults set by the system or clear them
otherwise.

Also a package can reset to defaults changes it made to
the global and secure settings. It is also possible to
associate a setting with an optional token which can then
be used to reset settings set by this package and
associated with the token allowing parallel experiments
over disjoint settings subsets.

The default values are also useful for experiment (or
more precisely iterative tuning of devices' behavior in
production) as the stable configuration can be set to
the "graduated" safe defaults and set the values to the
experimental ones to measure impact.

Test: tests pass

Change-Id: I838955ea3bb28337f416ee244dff2fb1199b6943
ackageManagerService.java
32eed0e59fc64d3b0886d184c79f0961f8fa0acf 21-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Reconnect to installd when it restarts." am: 48d5d6cda8 am: fe35f0f4f6 am: e286d1b2f8
am: 57c829c291

Change-Id: I6bf169d83de6b9a300f9bb4717660183b1b9e24b
57c829c2910c68fc60fc69aca62298f262cc7136 21-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Reconnect to installd when it restarts." am: 48d5d6cda8 am: fe35f0f4f6
am: e286d1b2f8

Change-Id: Ib7ff45fee2865a28e7cb138d9fd418d7a3e50c94
e286d1b2f8eaee8a6ee4c2df8817ae749ce68a33 21-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Reconnect to installd when it restarts." am: 48d5d6cda8
am: fe35f0f4f6

Change-Id: I63a78822f4a4c3c4d6e71af721c7a31a5bdba03a
fe35f0f4f6870e4891be1b171e7d691d7f49f23a 21-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Reconnect to installd when it restarts."
am: 48d5d6cda8

Change-Id: Ib4c4ced58f5963465f1e2d3eb401a8c71624ac12
1bf4a521443543779afbf540709244eb1c736bea 21-Dec-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Revert "Settings recovery support""
457608986ca2e44cbe1677523d1892f1d8c8f985 21-Dec-2016 Fyodor Kupolov <fkupolov@google.com> Revert "Settings recovery support"

This reverts commit aa31697424064f823019c068d66fac704e5a2fc1.

Fixes: 33799277
Change-Id: I438e97c6a81512c673f20f6a01d3b9715c2dbf8a
ackageManagerService.java
9f2f2183fc835dd00d414114e496e6d95dde37cc 21-Dec-2016 Jeff Sharkey <jsharkey@android.com> Reconnect to installd when it restarts.

Test: builds, boots, reconnects when installd dies
Bug: 33695164
Change-Id: I29769a111783095f742ad81af779a7403ca52ff3
nstaller.java
e83feea26acbeb61de0daa8b0d1076eb662e7b09 21-Dec-2016 Calin Juravle <calin@google.com> Merge "Record data about dex files use on disk"
0f3fa9e3cc4a7cdd22d12e96d8d4bd003ba2e0a6 21-Dec-2016 Calin Juravle <calin@google.com> Merge "Add logic for recording dex files use on disk"
5be781d874198ed476da31e800a1354c826ca689 21-Dec-2016 Calin Juravle <calin@google.com> Merge "Report non-primary dex files loads to PM" am: f23ea2ca62 am: 78b3889804
am: 9947e79b26

Change-Id: I8ddb7756c0690584343cb026a298bc5f0b8d4e27
9947e79b263dbefcd760e0014d088db65f16eecd 21-Dec-2016 Calin Juravle <calin@google.com> Merge "Report non-primary dex files loads to PM" am: f23ea2ca62
am: 78b3889804

Change-Id: Iaf17def2729170403fa61ce0e09ced4675a47191
78b388980445b6b35f41b5b1d45ad1dba2ada632 21-Dec-2016 Calin Juravle <calin@google.com> Merge "Report non-primary dex files loads to PM"
am: f23ea2ca62

Change-Id: I5eb9f8c8bc7e66c074adb95ad5dfec412cec539c
f23ea2ca62e2e652004f538e55282c140c3813a4 21-Dec-2016 Calin Juravle <calin@google.com> Merge "Report non-primary dex files loads to PM"
aa31697424064f823019c068d66fac704e5a2fc1 07-Nov-2016 Svet Ganov <svetoslavganov@google.com> Settings recovery support

This change allows the system to perform iterative reset
of changes to settings in order to recover from bad a
state such as a reboot loop.

To enable this we add the notion of a default value. The
default can be set by any package but if the package that
set it is a part of the system, i.e. trusted, then other
packages that are not a part of the system, i.e. untrusted,
cannot change the default. The settings setter APIs that
do not take a default effectively clear the default. Putting
a setting from a system component always makes it the
default and if the package in not trusted then value is
not made the default. The rationale is that the system is
tested and its values are safe but third-party components
are not trusted and their values are not safe.

The reset modes from the least intrusive are: untrusted
defaults - reset only settings set by untrusted components
to their defaults or clear them otherwise; untrusted clear
- clear settings set by untrusted components (or snap to
default if provided by the system); trusted defaults - reset
all settings to defaults set by the system or clear them
otherwise.

Also a package can reset to defaults changes it made to
the global and secure settings. It is also possible to
associate a setting with an optional token which can then
be used to reset settings set by this package and
associated with the token allowing parallel experiments
over disjoint settings subsets.

The default values are also useful for experiment (or
more precisely iterative tuning of devices' behavior in
production) as the stable configuration can be set to
the "graduated" safe defaults and set the values to the
experimental ones to measure impact.

Test: tests pass

Change-Id: I8c23b145d4f8ee0de2f29dedaa4641ac59343d6a
ackageManagerService.java
d5115103fcc6e1dc352ff002f6eb6b5c982f17d9 20-Dec-2016 Chad Brubaker <cbrubaker@google.com> Merge "Require targetSdk >= O for ephemeral installs"
85a63bc1a06870b5a86926b0bce94a2bf559e3f0 24-Oct-2016 Andrew Scull <ascull@google.com> Evict CE key on request and when work mode is turned off.

DPMS.lockNow takes a flag which can request the managed profile CE key to
be evicted.

Test: com.android.cts.devicepolicy.ManagedProfileTest#testLockNowWithKeyEviction*
Bug: 31000719
Change-Id: I68f4d6eed4b041c39fd13375f7f284f5d6ac33da
serManagerService.java
83dcc26065ce6f5b846c10edf08473c79ecb8a7b 20-Dec-2016 Tony Mak <tonymak@google.com> DO NOT MERGE: Cross profile candidate should be considered
am: ff11122ddc

Change-Id: I9de28d980021579d70d85193b1994ddca042d4fa
ff11122ddc170ef6583f39c2402d802941e1fab4 02-Nov-2016 Tony Mak <tonymak@google.com> DO NOT MERGE: Cross profile candidate should be considered

Bug: 32547783

Fixed the regression introduced in 8e2d9d1d9050e93b15c54e992698325c7d4aa57c

Test: Manual test - Open a map link in work calendar, personal map is shown as an option.

Change-Id: If5651b5e09cf1916813e8f91dbdcdf53f9119ef2
(cherry picked from commit 9f2c93663c2de84f958eebef96a98458ebaf51a9)
ackageManagerService.java
e9ff480804b82ca8768ebca6d07c52c95a622e67 20-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Remove ~1/3 of the installd calls at boot." am: 5bc305b97c am: d948865e27 am: e36f449c90
am: bdf62c82c8

Change-Id: Iae00facaf7131c24e0480e909d7386b8ad64e6d1
bdf62c82c8b2c3f8970301bd225979d3d8a389ba 20-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Remove ~1/3 of the installd calls at boot." am: 5bc305b97c am: d948865e27
am: e36f449c90

Change-Id: I818578f22a8988a141636694ae3811ad2d45f52e
e36f449c905c7cb46eda6e6f9177f2cd5d8bd6f3 20-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Remove ~1/3 of the installd calls at boot." am: 5bc305b97c
am: d948865e27

Change-Id: Iaf9d7f9a3f7d2fd34a11ec2ee80d849fc7dd0078
d948865e276cde672649ff95b7736a71366c4949 20-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Remove ~1/3 of the installd calls at boot."
am: 5bc305b97c

Change-Id: Ia6af8d920971118f108320d08b15cbe3da59b28a
1c6f72397320c8e4aeb34d55429ee62e2acd432a 20-Dec-2016 Jeff Sharkey <jsharkey@android.com> Remove ~1/3 of the installd calls at boot.

When preparing CE storage for an app, we always perform a second call
to extract any newly created CE directory inode. Let's simplify this
and just return the inode number from the createAppData() call.

Test: builds, boots, reads CE inodes after wipe
Bug: 33463450
Change-Id: I9b73da576800b56d7d0961dd4deb0b6a546acbe7
nstaller.java
ackageManagerService.java
b8976d8f22fecaa9ed39276d9d8ded17d35b51a6 16-Dec-2016 Calin Juravle <calin@google.com> Record data about dex files use on disk

Add DexManager to keep track of how dex files are used.

Every time a dex file is loaded, PackageManager will notify DexManager
which will process the load. The DexManager will look up what package
owns the dex file and record its use in package-dex-usage.list (through
PackageDexUsage).

Test: device boots, package-dex-usage.list is created and contains valid data, after device reboot the list is succesfully read from disk.
runtest -x .../PackageDexUsageTests.java
runtest -x .../DexManagerTests.java

Bug: 32871170
Change-Id: If5496c3b95820b537260c326d4eaa04eb50b1d8c
ackageManagerService.java
ex/DexManager.java
0318162abcbd07a0472989df43e00e353fac731b 01-Dec-2016 Calin Juravle <calin@google.com> Add logic for recording dex files use on disk

Add PackageDexUsage to handle the I/O operations of dex usage data. It
is responsible to encode, save and load dex

Test: runtest -x .../PackageDexUsageTests.java

Bug: 32871170
Change-Id: I2acc5430080a7e937c798513d8959ab631decfd9
bstractStatsBase.java
ackageManagerServiceUtils.java
ex/PackageDexUsage.java
9abb501075b1309ff6d238e42fc8cc87ce5c3bdf 23-Nov-2016 Calin Juravle <calin@google.com> Report non-primary dex files loads to PM

Scaffold for the reporting of non-primary dex files loads to the package
manager.

This will enable:
1) monitoring and compilation of secondary dex file
2) better way to track foreign dex file usage (used to determined the
compilation filter of apks).

Test: device boots
Bug: 32871170

(cherry picked from commit 8d2a51f1b8fc35a1d4fda6b6cdfdf2754f1e1211)

Change-Id: I61e65aee471798fbc7a18938647051274c3a058a
ackageManagerService.java
12e15a9c22cbd46e8d18b947b1b3434d5a27df8f 19-Dec-2016 Calin Juravle <calin@google.com> Merge "Report non-primary dex files loads to PM"
c309058efdda3ad5119b1f4a71f4ef51d46eb89d 16-Dec-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "fix leaky apps"
de315b99dcaf7202898d6334570753ffee43c1f1 16-Dec-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManagre: foreground check, more tests."
a01f4f03e920277a48369b06983c728a73b8dcd4 16-Dec-2016 Makoto Onuki <omakoto@google.com> ShortcutManagre: foreground check, more tests.

Test: Manual test and all the unit tests:
adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
... to test8

Bug 32908854

Change-Id: I30ba421e9730741776c1936e40ccf7b7431289da
hortcutRequestPinProcessor.java
hortcutService.java
d5f7e30505c351f3db58f791382240d6dece4dec 16-Dec-2016 Todd Kennedy <toddke@google.com> fix leaky apps

We leak installed app information if either the package or component
are specified in the query intents.

Bug: 25119046
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Change-Id: Ide2bc83889cc90bb56b5e13a8c3ddc1ba1901be7
ackageManagerService.java
d9a76c34bbe3d6ad6673b08b93d1b9ca59b792d4 15-Dec-2016 dcashman <dcashman@google.com> Split mac_permissions.xml into plat and non-plat components. am: b1cc4f8ca4 am: 2a7ce100b7 am: 46d6966f43
am: aa9ada00e6

Change-Id: I1af0ca0508e0b9fb9b30644e9f097ad7da7f5f34
aa9ada00e63fa6735bf433dc1ddcc8202788f933 15-Dec-2016 dcashman <dcashman@google.com> Split mac_permissions.xml into plat and non-plat components. am: b1cc4f8ca4 am: 2a7ce100b7
am: 46d6966f43

Change-Id: I99def3496b5319c2dd717b02fe28d9c691b47880
46d6966f43c90dd130c352339543aed8cce3961d 15-Dec-2016 dcashman <dcashman@google.com> Split mac_permissions.xml into plat and non-plat components. am: b1cc4f8ca4
am: 2a7ce100b7

Change-Id: I9d0e0f824fdc26c64d41f97b370f7483b63b97c5
2a7ce100b72d4d0ce227d7fb05ecf6c9489ab829 15-Dec-2016 dcashman <dcashman@google.com> Split mac_permissions.xml into plat and non-plat components.
am: b1cc4f8ca4

Change-Id: I4c3d3a9c088c4cfc75f5503966390030e1375305
b1cc4f8ca4202556d41e48cd7b0bb0559ea4b182 14-Dec-2016 dcashman <dcashman@google.com> Split mac_permissions.xml into plat and non-plat components.

Bug: 31363362
Test: Bullhead and Sailfish both build and boot without new denials.
Change-Id: Ic9523ce4b0755d6c585548f4f2b1f00e7000195b
ELinuxMMAC.java
ab99c11c55c82e39a601a0b6f59005011f9fa109 15-Dec-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: direct pin shortcut support."
2ef9979c720d80184aa5d35f1e16320c2ec7cc6b 15-Dec-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Remove duplicated code."
d2a7a674fb52753a791766428de32e0760e0f832 14-Dec-2016 Jorge Lucangeli Obes <jorgelo@google.com> Remove duplicated code.

Maybe the result of a bad merge? The removed section is identical to
the section above.

Bug: None
Test: Marlin builds, boots.
Change-Id: I588f60e60eb89adc606bd433e835caea029c8a72
ackageManagerService.java
06fd71abdf4c76d5f4ec357146f61280fb5580fa 14-Dec-2016 Esteban Talavera <etalavera@google.com> Merge "Create DISALLOW_{ADD,REMOVE}_MANAGED_PROFILE user restrictions"
8d2a51f1b8fc35a1d4fda6b6cdfdf2754f1e1211 23-Nov-2016 Calin Juravle <calin@google.com> Report non-primary dex files loads to PM

Scaffold for the reporting of non-primary dex files loads to the package
manager.

This will enable:
1) monitoring and compilation of secondary dex file
2) better way to track foreign dex file usage (used to determined the
compilation filter of apks).

Test: device boots
Bug: 32871170
Change-Id: Ib0fe076af2c734dd054f092247a1ec7e2a74a70d
ackageManagerService.java
d1c710d5cff55b632e91d95cdba158bbc3879bc8 14-Dec-2016 Michal Karpinski <mkarpinski@google.com> DO NOT MERGE [DPM] Management and retrieval of network logs
am: 4c47adef60

Change-Id: I39486c9d6116023f1ee9bd576b7fcd0fe20023a1
4460839e5ce43777e7f32841e4ab2e2ce0008257 13-Dec-2016 Ivan Podogov <ginkage@google.com> Finish resolving conflict from d23dc17

Test: Treehugger
Change-Id: If7fa9f7e300f3d810e41447369ccbbfbc3963b94
ackageManagerService.java
b42bee9d8ac10525b68c01e1a34c05bd7999382b 12-Dec-2016 Chad Brubaker <cbrubaker@google.com> Require targetSdk >= O for ephemeral installs

This ensures that platform and security features that are gated by
targetSdk are all enabled for ephemeral apps.

Test: adb install --ephemeral succeeds for CUR_DEVELOPMENT, fails for
N_MR1

Change-Id: I41b9ccc4995ba07d9a0c11b2918fa24c71892330
ackageManagerService.java
6c9116a6430ca5cd55b1b926213a5e8de77e4fc6 24-Nov-2016 Esteban Talavera <etalavera@google.com> Create DISALLOW_{ADD,REMOVE}_MANAGED_PROFILE user restrictions

Bug: 31952368

Test: runtest -c com.android.server.devicepolicy.DevicePolicyManagerTest frameworks-services
Test: runtest -c com.android.server.pm.UserManagerTest frameworks-services
Test: cts-tradefed run cts --module DevicePolicyManager --test com.android.cts.devicepolicy.UserRestrictionsTest

Change-Id: I240ab99c2409bbabffbc574bef202f2457026905
serManagerService.java
serRestrictionsUtils.java
2d895c3efd625e09e9f2cc4d0c7131b34f52f154 03-Dec-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: direct pin shortcut support.

Test: Manual test and all the unit tests:
adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
... to test8

Bug 32908854

Change-Id: I11b81656959cccfb4efa83f08380b915e6eb84a6
hortcutLauncher.java
hortcutPackage.java
hortcutRequestPinProcessor.java
hortcutService.java
903d6414e51ace98fa67fb5bf6f103ff9e4303d5 13-Dec-2016 Ivan Podogov <ginkage@google.com> resolve merge conflicts of b1e2da7 to nyc-mr1-dev-plus-aosp

Test: build police
Change-Id: Ifec1ab6760ebb94b0b411c9c60f07066e151206b
4c47adef60ca0326bdbe124dfdd335382e5c0787 12-Oct-2016 Michal Karpinski <mkarpinski@google.com> DO NOT MERGE [DPM] Management and retrieval of network logs

This CL follows up on ag/1530343 and adds:
1) Various network events.
2) Retrieval method in DPM and APIs in DeviceAdminReceiver.
3) Extension of NetworkLogger and it's NetworkLoggingHandler.

Test: runtest --path frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/NetworkEventTest.java
Bug: 29748723
Change-Id: I42a1a477e7c75c109a3982f809c22732b814e8b2
ackageManagerService.java
d23dc17754f1ef1416f4dfb36c9226626113f08c 13-Dec-2016 Svetoslav Ganov <svetoslavganov@google.com> Add Bluetooth toggle prompts - framework
am: b1e2da7c24

Change-Id: I29c038d23488c504c838a85bd97c255b84919aab
47e1f497c0f457fd010e35d7aba1c9987fd9ea0f 12-Dec-2016 Marie Janssen <jamuraa@google.com> Merge "DO NOT MERGE Add Bluetooth toggle prompts - framework"
5348393ac25ee358f777edb89c33c751e8d1b2a4 12-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Catch all exceptions from installd, log codes." am: 9a10ca3f4c am: 6f7b136b40 am: 5226bbb5a6
am: 8ad8c65c62

Change-Id: I4cc68172dcb4a737b5fe683271797b0d4909a82f
8ad8c65c6207bf05d3497439fe42f0bcda81a98e 12-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Catch all exceptions from installd, log codes." am: 9a10ca3f4c am: 6f7b136b40
am: 5226bbb5a6

Change-Id: I3a3903c4dfb9113bf9549504a1d9859fb6ee5687
5226bbb5a61046c90f2f1a14919d1f2ba3a460ad 12-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Catch all exceptions from installd, log codes." am: 9a10ca3f4c
am: 6f7b136b40

Change-Id: Ia62a8a11907fe5dd4e524fbe181a094500248850
72d633f430264181baf93f3344dfbcf269cd7c62 12-Dec-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Scope package manager queries for ephemeral apps"
c2ac5bde6f6e9cc95a476a2404f020246516ccfc 30-Jun-2016 Svetoslav Ganov <svetoslavganov@google.com> DO NOT MERGE Add Bluetooth toggle prompts - framework

If permission review is enabled toggling bluetoth on or off
results in a user prompt to collect consent. This applies
only to legacy apps, i.e. ones that don't support runtime
permissions as they target SDK 22.

Also added a configuration resource which controls whether
permission review mode is enabled. By default it is not and
an OEM can change this via an overlay. For now we also keep
the old mechanism to toggle review mode via a build property
which is still used and will be removed when clients have
transitioned.

bug:28715749
Change-Id: I77bca2305f9d0f20034b2c8fc5b58e0565d5e617
ackageManagerService.java
447a3ac16be99351c978c63107808f22e90c93f1 12-Dec-2016 Jeff Sharkey <jsharkey@android.com> Catch all exceptions from installd, log codes.

Now that installd is throwing both SecurityException and
IllegalArgumentException, it's time that we turned all these
into InstallerException.

Also extend ServiceSpecificException to include the contained
errorCode value when printing.

Test: builds, boots, apps install/uninstall fine
Bug: 13758960, 30944031
Change-Id: Ic9c1e99ae87f4442402ef528bf352c7978572c85
nstaller.java
ea3345d6a6063cef910a9197a1a4b286e7a70299 12-Dec-2016 Fyodor Kupolov <fkupolov@google.com> [DO NOT MERGE] Switch to using UMS.mUserStates
am: 7a1e682794

Change-Id: I666e7fe9602198b450c324b36d1ecebde8f1aedb
7bc3a70966f17bf16acbf4fe640dab0698866d72 08-Dec-2016 Todd Kennedy <toddke@google.com> Scope package manager queries for ephemeral apps

Ephemeral apps can only see their own components or those components
exposed via the "visibleToEphemeral" XML attribute.

Normal apps can only see other normal apps. There is no way to expose
ephemeral components to normal apps.

Bug: 33458220
Test: Manually install ephemeral/normal apps and ensure they can only see appropriate components
Change-Id: I6ae65fd2a6ddc9aa9691f02cd55d4953048966b0
phemeralResolver.java
ackageManagerService.java
d202a96073440c7d815a2de9f5136e0ef1e7e0e1 11-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Remove DEXOPT_OTA flag." am: 8584db972c am: 3dae5ca9d6 am: 91fca0f0ce
am: 4be6b800b4

Change-Id: I5adb5d7bc53d01e08675a5c05387546ae78763c9
c5b56942024a3211234cf35fed44e3e732143947 11-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge commit '7797e545239e81a9216994527badcc98178ebfcc' into dec10

Change-Id: I430a39241bd2d278eaf1e01b89be3ad368789f6d
4be6b800b4b817010db2f231857cbe034c4e111d 11-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Remove DEXOPT_OTA flag." am: 8584db972c am: 3dae5ca9d6
am: 91fca0f0ce

Change-Id: I7722af5c9fee1947c86c404239014d3dd500b80a
91fca0f0cebc8fc4f46967cdd20b95e9add34d43 11-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Remove DEXOPT_OTA flag." am: 8584db972c
am: 3dae5ca9d6

Change-Id: I260245cc751aeea170e849f2520d1ab700ff503b
7797e545239e81a9216994527badcc98178ebfcc 11-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Final push of installd to Binder; goodbye socket!" am: 1950377f91 am: 104fd011b2
am: 9ff67746e6

Change-Id: Idc2b65f975b80c4768280515bd35727644fb5711
9ff67746e60ce9e49d7c21e2af087c081873c544 11-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Final push of installd to Binder; goodbye socket!" am: 1950377f91
am: 104fd011b2

Change-Id: I4b2ae2329e8842def8682199c5ee8544c22c2be4
4f05cd8900bfb559d5de58b86fa01f07bddafb2c 10-Dec-2016 Jeff Sharkey <jsharkey@android.com> Remove DEXOPT_OTA flag.

Test: builds, boots
Bug: 13758960, 30944031
Change-Id: I266a39c6dc7948f784580e4ef1cf0bb8ee27d0e7
nstaller.java
taDexoptService.java
740f523b2571d1c4eb4a954e1faedea45dd7fa53 09-Dec-2016 Jeff Sharkey <jsharkey@android.com> Final push of installd to Binder; goodbye socket!

Move last two straggling installd commands to Binder and destroy the
socket-based communication channel forever.

Test: builds, boots, apps install fine, pre-OTA dexopt works
Bug: 13758960, 30944031
Change-Id: I9afb9f71858febde34a94f53839b2986493b68a0
nstaller.java
taDexoptService.java
ackageDexOptimizer.java
ackageInstallerSession.java
ackageManagerException.java
ackageManagerService.java
ettings.java
7a1e68279460cba8483ce289147284a27d38b648 05-Dec-2016 Fyodor Kupolov <fkupolov@google.com> [DO NOT MERGE] Switch to using UMS.mUserStates

UserManager.isUserUnlocked/isUserRunning/isUserUnlockingOrUnlocked now
return state from UMS.mUserStates that is pushed from ActivityManager.

Test: create managed profile using TestDPC and check Launcher3
Test: manually create unstarted managed profile and check launchers
Bug: 33232933
Change-Id: I6b619ba1880188eabdd6e3e4cc7eb60d3a22a977
serManagerService.java
0f6250823612b2a43784bef12f833ac850bf2e2f 09-Dec-2016 Jorge Lucangeli Obes <jorgelo@google.com> PackageDexOptimizer: fix typo in log message.

'oatDir' is the only token that has a space around the '='. None of the
other tokens in the log message do. Make the log message consistent so
that grepping is easier -- and the log message looks better.

Before:
PackageManager.DexOptimizer: Running dexopt (dex2oat) on:
/system/priv-app/Telecom/Telecom.apk pkg=com.android.server.telecom
isa=arm64 vmSafeMode=false debuggable=false
target-filter=interpret-only oatDir = null sharedLibraries=null

After:
PackageManager.DexOptimizer: Running dexopt (dex2oat) on:
/system/priv-app/Telecom/Telecom.apk pkg=com.android.server.telecom
isa=arm64 vmSafeMode=false debuggable=false
target-filter=interpret-only oatDir=null sharedLibraries=null

Bug: None
Test: Build, flash, grep for log message.
Change-Id: I84162ec3535e3f83a60a62d40cbaf8e74d2051c6
ackageDexOptimizer.java
0d0bbd01e93fc716aa4c51bc5d0ad4c0889ccd1b 09-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Prepare to move dexopt calls to Binder." am: d7b144a5e9 am: 35cbe8ffb0 am: 41d75809aa
am: 67c8b01f4d

Change-Id: I1a746e34856b8fa1471ccacd3a8bde1d06866679
67c8b01f4dc0f71ea048ebd6ac39d9408b9edb3b 09-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Prepare to move dexopt calls to Binder." am: d7b144a5e9 am: 35cbe8ffb0
am: 41d75809aa

Change-Id: I0b87126b4b312ef8fc3c71479d6d5725e96e6acc
41d75809aaeb27da5f0157b202a713f19414de56 09-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Prepare to move dexopt calls to Binder." am: d7b144a5e9
am: 35cbe8ffb0

Change-Id: Ice3c37568ae7185dfe028d3019abf5204aa93963
b7717682495e51f602004dfbfabdf767d3fbf3de 01-Dec-2016 Todd Kennedy <toddke@google.com> Add system API to install ephemeral apps

Test: manual; install using "adb install --ephemeral"
Change-Id: Idce214779fea5f3c4a0121542319044f9f0e0a42
ackageManagerShellCommand.java
c98c7bccdccbff1ceeda501e6a6f8c21d61649ca 07-Dec-2016 Jeff Sharkey <jsharkey@android.com> Prepare to move dexopt calls to Binder.

Since InstallerConnection is about to be replaced by a new installd
Binder interface, this change moves OtaDexoptService to override and
manually cook up the 'dexopt' command line that it expects to collect
from PackageDexOptimizer.

Since OtaDexoptService is designed to be run in isolation, add a new
mode to Installer which ignores calls that aren't being intercepted.

Also moves to a single dexopt() method instead of having overloads.

Test: builds, boots, fake OTA works
Bug: 13758960, 30944031
Change-Id: I3a6a115289f1542d6df3e2993b9720118b7d1e8d
nstaller.java
taDexoptService.java
ackageManagerService.java
cad7eb9c930da219fcdc61ff57bc6f6796e7874a 26-Oct-2016 Svetoslav Ganov <svetoslavganov@google.com> Don't accidentally delete renamed packages

Apps on the system image can change their package by declaring
their old one in the manifest. If a package is renamed it is
internally referred by its old name.

The reconciliation code was using the new package name for
renamed packages and was concluding the apk is orphaned thus
deleting it. This puts the package in a bad state where the app
is gone and the version on the system partition is disabled.

Also Play was showing an update for a renamed system app as
an install while it is an update because of the same reason,
it was using the new package name while the app is internally
referred by the old one.

The fix for both above is to internally normalize the package
name by using the old one if the package was renamed or the
package name as is.

Test: With the fix put the old calculator on the system image
and booted, then put the renamed calculator and booted, updated
calculator from play and rebooted - calculator keeps working.
Also did the above steps without the patch to put calculator
in a bad state and flashed the system with the patch which
fixed the broken calculator app.

bug:32321269

Change-Id: I98bfc05c399edfc9854ebcce44182fefa55ceeff
(cherry picked from commit e2c85890ac3941525288e08962b33d30618de801)
ackageManagerService.java
17e9b4be4609a9b68eeba6a2c5d3da79afc6c65d 08-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Yet another set of installd Binder methods." am: c69b210ec8 am: e5617f5d16 am: 75bede2227
am: f7a57d613d

Change-Id: I16e412c92eb87728c512c39b2c197b5c6d6179e5
f7a57d613d5ace769094f2cdea3f61a63280b1c4 08-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Yet another set of installd Binder methods." am: c69b210ec8 am: e5617f5d16
am: 75bede2227

Change-Id: Idf12305c995772340d3f9fbbd5eb299f3f05a19a
75bede2227fae5e122a24f4fab316aca386ec9fb 07-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Yet another set of installd Binder methods." am: c69b210ec8
am: e5617f5d16

Change-Id: I967af3436f4ab66663bddbadf07561c4a7411b38
c69b210ec812772be12a819d26241ad0e4be42bd 07-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Yet another set of installd Binder methods."
ba6f8c8bef19111cd6247df87392149b7963c36f 09-Nov-2016 Jeff Sharkey <jsharkey@android.com> Move dump() to dumpAsync(), more oneway calls.

When calling out to dump services hosted by external apps, use
dumpAsync() to avoid hanging if the remote process is wedged.

(cherry picked from commit 850c83e6da3b34a4eab804133420247fc9dbb8a1)

Test: builds, boots, runs with minimal logs triggered
Bug: 32715088

Merged-In: I70aa2666ae21dae8f09ded2063bed359c0b210c5

Change-Id: Ic2be10dc8478d613cea6e2c976b9987c250b86b7
phemeralResolverConnection.java
811825a582812e51412fee5d712259502a7f023b 06-Dec-2016 Chad Brubaker <cbrubaker@google.com> Add proto fields for READ_PHONE_NUMBER

Test: m
Change-Id: Ifc8c9eed3af6baa405714cda664cc9dc60969cb9
ackageManagerService.java
c24fa029bf9a2ee3c3657cb598e1595262ad2eeb 07-Dec-2016 Jeff Sharkey <jsharkey@android.com> Yet another set of installd Binder methods.

Pretty straightforward refactoring.

Test: builds, boots, apps install fine
Bug: 13758960, 30944031
Change-Id: Ide533a04e1e31475a16046722f48b1934d8cacd3
nstaller.java
ackageManagerService.java
dc46397a448671cd5fec888fc30e70df8e8b791b 07-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Move more installd methods to Binder." am: 3101778fb2 am: f058c4048a am: 2c01c43055
am: 173f073ff8

Change-Id: I34f90d25ecc26db6f3f07bc92cef2d7514de1c8a
173f073ff8e1046cd5335464bfacc5597e3b1daf 07-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Move more installd methods to Binder." am: 3101778fb2 am: f058c4048a
am: 2c01c43055

Change-Id: Iba90979d45d700e753a875e1a3b436ca6572fd5d
2c01c43055d6a2e9a7862bf9d91d526dedfc6336 07-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Move more installd methods to Binder." am: 3101778fb2
am: f058c4048a

Change-Id: I50ea69a6f264df7a674b8fb2fc19c02bdf5ca9db
3101778fb2b757e5416f4ebbd36d7df0d5d05daa 07-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Move more installd methods to Binder."
019ac85ef5c79c21daa29f9805ee8f98462f0e05 06-Dec-2016 Jeff Sharkey <jsharkey@android.com> Move more installd methods to Binder.

Test: builds, boots, apps install fine
Bug: 13758960, 30944031
Change-Id: Ic00968214cec03d67fff7964e5175ab9e6132b36
nstaller.java
cc3fad30975e66875588d87e7e6c7af9a35b62fd 01-Nov-2016 Mark Renouf <mrenouf@google.com> Workaround for javac compilation issue of lambda code

Since ag/32554459 some Robolectric tests are compiling
framework code with javac. For reasons unclear so far this
code fails to compile with javac:

> ShortcutService.java:408: error: variable ri might not have been initialized

https://android-build.googleplex.com/builds/submitted/3416256/angelfish-userdebug/latest/logs

Removing the lambda expressions corrects the issue.

(cherry picked from commit e065f7c5a9ad4e47f5490793401445660af37624)

BUG: 32554459
Test: m
Change-Id: I189c8ef02dc93b46ef6418c1ff14f2312097898a
hortcutService.java
f4da4f83203af316b537b7649e9f2687701f3470 07-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Move moveCompleteApp() to Binder." am: 019867cb52 am: 19426fef23 am: d917e23bbb
am: b7abefa16a

Change-Id: I4779344082c51ecd301be2b2df0947790403273d
b7abefa16a3e274bfa1ecb2dd84f5c00159a8cea 07-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Move moveCompleteApp() to Binder." am: 019867cb52 am: 19426fef23
am: d917e23bbb

Change-Id: I56d8e35174cce6a892f73f32b8246a377ba645ab
d917e23bbb8bda95f9ce512b1446f15926868454 07-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Move moveCompleteApp() to Binder." am: 019867cb52
am: 19426fef23

Change-Id: I15640b868729b0f8e418c7b9f8d5366deb054abc
19426fef23de12470599f84261632d20f2944b10 07-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Move moveCompleteApp() to Binder."
am: 019867cb52

Change-Id: I93e3d468b2a49f735c88e7a5146f0b013c6d49eb
82834baa358f55acb542e17da828b2d497cf8332 07-Dec-2016 Bill Yi <byi@google.com> Merge remote-tracking branch 'goog/stage-aosp-master' into HEAD
019867cb52ce82d8e09de5e346e2ab86bd24e5be 06-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Move moveCompleteApp() to Binder."
0c08a45028fbb87948700ce07d5c497e50b5b4a6 06-Dec-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add READ_PHONE_NUMBER to the list of dangerous permissions."
b2c312a742ad650c4f8c39e5ba7d94acd41b2357 09-Nov-2016 Jeff Sharkey <jsharkey@android.com> Move dump() to dumpAsync(), more oneway calls.

When calling out to dump services hosted by external apps, use
dumpAsync() to avoid hanging if the remote process is wedged.

Test: builds, boots, runs with minimal logs triggered
Bug: 32715088
Change-Id: I70aa2666ae21dae8f09ded2063bed359c0b210c5
Merged-In: I70aa2666ae21dae8f09ded2063bed359c0b210c5
phemeralResolverConnection.java
7f468a98f4e52a79dd13ae0489c8082b843855df 06-Dec-2016 Chad Brubaker <cbrubaker@google.com> Add READ_PHONE_NUMBER to the list of dangerous permissions.

Test: system_server no longer crahes when granting READ_PHONE_NUMBER
Change-Id: I45f66df9b9723a54ca7d1d29eac606136134d80a
ackageManagerService.java
c8ddc2d56ee8beab6534853007d7c05dea7f62da 06-Dec-2016 Jeff Sharkey <jsharkey@android.com> Move moveCompleteApp() to Binder.

Also start manually checking thread-locking, since Binder methods
don't funnel through the old transact().

Test: builds, boots, apps install fine
Bug: 13758960, 30944031
Change-Id: I661eade7dc8e060689ecbcb9b6d19528e5c4ca66
nstaller.java
0dd0dafdb974df4570a0a6d18e3ad10affe06c45 06-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Initial Binder interface for installd." am: 19fc36fa33 am: 2ab7bff525 am: 48eb4e390e
am: 043c4c575c

Change-Id: I49ba073ba2c955dd3467303bdf9f7ab14eb5ba71
043c4c575cc079c330fa508932581da303dfc4fe 06-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Initial Binder interface for installd." am: 19fc36fa33 am: 2ab7bff525
am: 48eb4e390e

Change-Id: I0f8015d3ca80d1f6a806b2ff7b739ea27feddc10
48eb4e390e37d36665302e0a923a9cfe6553135b 06-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Initial Binder interface for installd." am: 19fc36fa33
am: 2ab7bff525

Change-Id: I80f56bc8e531fd23ffc95f2f75c84add3f9a34e5
2ab7bff525a386dfc6a82eceffe73340e7005b96 06-Dec-2016 Jeff Sharkey <jsharkey@android.com> Merge "Initial Binder interface for installd."
am: 19fc36fa33

Change-Id: I22e910b705327eafa5c158ec43d6d86eb0b429d0
a909053664ae41e706fdb47329456452e993f81c 05-Dec-2016 Jeff Sharkey <jsharkey@android.com> Move dump() to dumpAsync(), more oneway calls.
am: c06f184ae9

Change-Id: I1f060cb7e20c732e7c6da412e2e9fb7335011ec8
5e2155058dac10f737d3b7369db78ff485c38e0f 05-Dec-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Move dump() to dumpAsync(), more oneway calls." into nyc-mr1-dev-plus-aosp
784c9deeb4f58169a9d904bcc71fbc58a21fd104 05-Dec-2016 Chad Brubaker <cbrubaker@google.com> Merge "Ignore permission and permission-group in ephemeral apps"
70b4d101fe92adf972eaf51ab91e77c46adf1b36 05-Dec-2016 Jeff Sharkey <jsharkey@android.com> Initial Binder interface for installd.

Start using new installd Binder interface, with a quick-disable
switch if something breaks.

Test: builds, boots
Bug: 13758960, 30944031
Change-Id: Ia6e55d49595c96ae928aefc8a6606ee690e58764
nstaller.java
85bfbf1f6218c6d6bcafe4f888aa188c10ee01a5 05-Dec-2016 Lenka Trochtova <ltrochtova@google.com> Introduce a new user restriction for disallowing Bluetooth. am: 13a0519394
am: 3e149d59f9

Change-Id: I2622c1f9a92ff7784787885859c4b5a7cf974964
3e149d59f950a7ce73b0d156499a156ac10c5d0f 05-Dec-2016 Lenka Trochtova <ltrochtova@google.com> Introduce a new user restriction for disallowing Bluetooth.
am: 13a0519394

Change-Id: I3d875e1a7baf69022d58902689fa9370bcb44dc6
63d5e4a7491b707235654cb081d2fc9074a5a65a 02-Dec-2016 Lenka Trochtova <ltrochtova@google.com> Introduce a new user restriction for disallowing Bluetooth.

Only the device owner will be able to set the restriction
and the restriction will prevent usage of Bluetooth on the
entire device - i.e. in all the users.

Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.UserRestrictionsTest
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.DeviceOwnerTest#testBluetoothRestriction

Bug: 32895300

Change-Id: I2875cf178cb16eca1965d0ba965d1cd3d8db2ad5
serRestrictionsUtils.java
13a0519394388f1d617a5c3ee4473229e4c9c7cd 02-Dec-2016 Lenka Trochtova <ltrochtova@google.com> Introduce a new user restriction for disallowing Bluetooth.

Only the device owner will be able to set the restriction
and the restriction will prevent usage of Bluetooth on the
entire device - i.e. in all the users.

Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.UserRestrictionsTest
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.DeviceOwnerTest#testBluetoothRestriction

Bug: 32895300

Merged-In: I2875cf178cb16eca1965d0ba965d1cd3d8db2ad5

Change-Id: I2875cf178cb16eca1965d0ba965d1cd3d8db2ad5
serRestrictionsUtils.java
57723684f49c877c53f7c3991984f5157b8c309b 05-Dec-2016 Tobias Thierer <tobiast@google.com> Merge "Migrate StrictJarVerifier and ShortcutPackageInfo to java.util.Base64" am: 1e498a96c1 am: 6e2d3fa82f am: 386ba42ec5
am: 589ff8395d

Change-Id: I0861533c48a0eaa1972c95eb796b53dd0b2f3b8e
f15cf38311c90ba34d633b4a81e80226adc08e43 02-Dec-2016 Lenka Trochtova <ltrochtova@google.com> Introduce a new user restriction for disallowing Bluetooth.

Only the device owner will be able to set the restriction
and the restriction will prevent usage of Bluetooth on the
entire device - i.e. in all the users.

Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.UserRestrictionsTest
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.DeviceOwnerTest#testBluetoothRestriction

Bug: 32895300

Merged-In: I2875cf178cb16eca1965d0ba965d1cd3d8db2ad5

Change-Id: I2875cf178cb16eca1965d0ba965d1cd3d8db2ad5
serRestrictionsUtils.java
589ff8395d711d7d796fbe481d048765db2303cb 05-Dec-2016 Tobias Thierer <tobiast@google.com> Merge "Migrate StrictJarVerifier and ShortcutPackageInfo to java.util.Base64" am: 1e498a96c1 am: 6e2d3fa82f
am: 386ba42ec5

Change-Id: I0b0e8139cc084fbdf9918dd700d9be337e0c47df
386ba42ec57abf9edad6b5b1fe13c7fdf08f84d7 05-Dec-2016 Tobias Thierer <tobiast@google.com> Merge "Migrate StrictJarVerifier and ShortcutPackageInfo to java.util.Base64" am: 1e498a96c1
am: 6e2d3fa82f

Change-Id: I925b0ca87bbd0f3be3f03865f70cafaaa1ef25ba
6e2d3fa82f85e6c1c6c8a07e4ed47e96a74c9c93 05-Dec-2016 Tobias Thierer <tobiast@google.com> Merge "Migrate StrictJarVerifier and ShortcutPackageInfo to java.util.Base64"
am: 1e498a96c1

Change-Id: I28b8deadc9386b8772bd94870809213fdddad7e6
c06f184ae92179414dfa133506e60cc05c6ed43a 09-Nov-2016 Jeff Sharkey <jsharkey@android.com> Move dump() to dumpAsync(), more oneway calls.

When calling out to dump services hosted by external apps, use
dumpAsync() to avoid hanging if the remote process is wedged.

Test: builds, boots, runs with minimal logs triggered
Bug: 32715088
Change-Id: I70aa2666ae21dae8f09ded2063bed359c0b210c5
phemeralResolverConnection.java
98a942d14d82a7fa62dab291a8f1bce3c37ea0ab 02-Dec-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Switch isUserUnlocked/isUserRunning to use UMS.mUserStates"
243344108da7c5733422a39f2eb5d59ae7acded1 02-Dec-2016 Chad Brubaker <cbrubaker@google.com> Ignore permission and permission-group in ephemeral apps

Ephemeral apps should not be defining permissions or groups that can be
seen on impact the rest of the system. They are ignored instead of
treated as an error to allow installed ephemeral apps to include them.

Test: Verified that permissions and permission-groups are ignored for
adb install --ephemeral

Change-Id: If5a3fee09916d12de7f6a1bc153937bf278f0360
ackageManagerService.java
55dac08a81bf22d6e0418de574079e29a6d6e0b6 02-Dec-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Added get-privapp-permissions command"
2e7e09685a69cc6b9e3418065507c6c7f843b446 02-Dec-2016 Fyodor Kupolov <fkupolov@google.com> Switch isUserUnlocked/isUserRunning to use UMS.mUserStates

UserManager.isUserUnlocked/isUserRunning now returns state from
UMS.mUserStates that is pushed from ActivityManager.

Test: manual
Bug: 33232933
Bug: 28957340
Change-Id: Ic5f56d7d577bc336acd2bf44fab7f74feac4f7b3
serManagerService.java
54365465897a0fbb2d61c3fb2460698384328ad4 02-Dec-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: Floating shortcuts shouldn't have target activities."
9f00d71787774bf79d4b398c28630f670765b791 02-Dec-2016 Tobias Thierer <tobiast@google.com> Migrate StrictJarVerifier and ShortcutPackageInfo to java.util.Base64

Previously, they weres using libcore.io.Base64, which is @deprecated.

The two implementations' encoders produce the exact same result.

The two implementations' decoders' behavior differs for malformed
input:
- In case of error, libcore.io.Base64.decode() returns null while
java.util.Base64.getDecoder().decode() throws.
- java.util.Base64 tends to be stricter about rejecting malformed
input; specifically, it allows neither whitespace nor unexpected
'=' characters (should only occur in the padding) whereas
libcore.io.Base64.decode() leniently allows them throughout the
input.
- if the input terminates prematurely, libcore.io.Base64 tends to
return fewer bytes (stops at a four byte boundary).

The behavior differences for malformed Base64 encoded data should
not affect ShortcutPackageInfo because it should only need to deal
with XML attribute values written by itself, which are well-formed.
Note that this CL does not lead to any known changes of the encoding
step, so values written by earlier versions should not cause problems
when read by later versions of ShortcutPackageInfo.

StrictJarVerifier may now reject or behave differently for .jar /
.zip files with malformed attribute values but this seems okay since,
per its name, it is meant to be strict. For example, after this CL,
StrictJarVerifier will no longer accept algorithm + "-Digest"
attribute values with extra whitespace or padding characters as valid.

Test: Confirmed that the two implementations' encoders produce the
same result by running the following code just before this CL:
assertEquals(
libcore.io.Base64.encode(allBytes()),
Base64.getEncoder().encodeToString(allBytes()));
where allBytes() returns a byte[] with values (byte) 0 .. (byte) 255
Test: Test that phone still boots after flashing code that includes
this CL.
Test: CtsLibcoreTestCases

Bug: 31292683

Change-Id: I775d32f329f693514a8f14d87e1ef0d7a757e6c3
hortcutPackageInfo.java
b1e2da7c24613ce393bca871069d379cd4378c26 30-Jun-2016 Svetoslav Ganov <svetoslavganov@google.com> Add Bluetooth toggle prompts - framework

If permission review is enabled toggling bluetoth on or off
results in a user prompt to collect consent. This applies
only to legacy apps, i.e. ones that don't support runtime
permissions as they target SDK 22.

Also added a configuration resource which controls whether
permission review mode is enabled. By default it is not and
an OEM can change this via an overlay. For now we also keep
the old mechanism to toggle review mode via a build property
which is still used and will be removed when clients have
transitioned.

bug:28715749

Change-Id: I94c5828ad6c8aa6b363622a26ff9da4fc2e2fac7
ackageManagerService.java
106ff7a0a1bef974ff04e9e79a25eb5e84555893 01-Dec-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Floating shortcuts shouldn't have target activities.

Previously, even floating shortcuts (pinned but not dynamic nor
manifest) had target activities. Now we're going to allow headless
apps to have pinned shortcuts, in which cases shortcuts won't have
target activities, let's just always remove target activities
from floating shortcuts.

Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
... to Test8.

Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsShortcutManagerTestCases
Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsShortcutHostTestCases

Change-Id: I10e5b87338cafb90e6566b3526f892c5330c73e9
hortcutPackage.java
hortcutService.java
b36c45fe3069bff85585759f6fad82b64d1e1953 01-Dec-2016 Makoto Onuki <omakoto@google.com> Fix issue with apps restored to lower versions. am: fac592f64c
am: affadd52af

Change-Id: I159f53023179cb67b7225969f4c7220ddd0c03dc
affadd52afb18fb02b9fd227e933afcf1ed85cd4 01-Dec-2016 Makoto Onuki <omakoto@google.com> Fix issue with apps restored to lower versions.
am: fac592f64c

Change-Id: I01601d1638a1ad23dcf2c57df75b81819ee3dce7
8874fcf97fc76d900c72ed213bcc8842fcd1f778 01-Dec-2016 ltrochtova <ltrochtova@google.com> Revert "Introduce a new user restriction for disallowing Bluetooth."

This reverts commit 69f9d321ac19e7137e07b411779339f9973eba1b.

Change-Id: I5859b262a741d1fe8e8b61e142eecf7d742d8d41
serRestrictionsUtils.java
51245c74f4efb62f12b9b16c8d05f7302c31c275 01-Dec-2016 Fyodor Kupolov <fkupolov@google.com> Added get-privapp-permissions command

Usage: cmd package get-privapp-permissions PACKAGE
Returns whitelisted signature|privileged permissions that specified
privileged app can use.

Test: Manual
Bug: 31008485
Change-Id: I3d9944390b011d4b56f110d1e57400241d36f371
ackageManagerShellCommand.java
69f9d321ac19e7137e07b411779339f9973eba1b 24-Nov-2016 Lenka Trochtova <ltrochtova@google.com> Introduce a new user restriction for disallowing Bluetooth.

Only the device owner will be able to set the restriction
and the restriction will prevent usage of Bluetooth on
the entire device - i.e. in all the users.

Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.UserRestrictionsTest
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.DeviceOwnerTest#testBluetoothRestriction

Bug: 32895300

Change-Id: Iae77647b1e48be6b8efbeccdff6a3d468a0e174d
serRestrictionsUtils.java
0d1fd8d09163566d2c7eb72037f63b6404ada642 12-Oct-2016 Amith Yamasani <yamasani@google.com> Secure MATCH_UNINSTALLED_PACKAGES across users

Introduce a new internal flag MATCH_ANY_USER for genuine uses
of searching through all apps on the device.

Some temporary accommodations for Launchers that reach across
to the work profile until we have a new LauncherApps API to do
that officially.

Bug: 31000380
Test: CTS tests added
Change-Id: I2e43dc49d6c2e11814a8f8d1eb07ef557f31af34
ackageManagerService.java
ackageManagerShellCommand.java
serManagerService.java
fd4f73c76c867e572f5a48b5516fb1f20959caf8 30-Nov-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Support disabled/log/enforce in ro.control_privapp_permissions"
d072d1415452abffd55a5742e3fef5abdaadf791 30-Nov-2016 Fyodor Kupolov <fkupolov@google.com> Support disabled/log/enforce in ro.control_privapp_permissions

Possible values:
- disable - the feature is completely disabled - signature|privileged
permissions are granted automatically without logging. Default behavior
- log - log grants of signature|privileged permissions to privileged apps
that were not whitelisted in /etc/permissions/privapp-permissions.xml.
- enforce - enforce that only whitelisted permissions are granted.
Only devices with ro.control_privapp_permission=enforce will pass CTS tests.

Test: Manual - device boots, permissions are granted
Bug:31008485
Change-Id: I24e0c75d2efc326c9fbec35efc92489313667212
ackageManagerService.java
e16a8abd7c6cdfbb220709e9775ddb25ca10389c 29-Nov-2016 Todd Kennedy <toddke@google.com> Don't tie ephemeral resolver/installer

The ephemeral resolver and installer can now be added at separate
times. It will be possible to replace the installer dynamically.

Bug: 33073532
Test: Manual. Verify the installer and resolver are set correctly with different configurations.
Change-Id: I8071de8c5baadd03c9eb3e756ed7445d2116d51f
ackageManagerService.java
36f97300ac462dcf78d225e1db03745bd6246bf0 30-Nov-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Require INSTALL_PACKAGES permission"
58feeac96b585867195444ce6c2dd794abe61869 29-Nov-2016 Kenny Guy <kennyguy@google.com> Merge "Allow overriding max profile in debugable builds."
6fc01e0483969c29470fc94045302be19a1c3ceb 29-Nov-2016 Philip P. Moltmann <moltmann@google.com> Merge "Create actions for permission and log revokations"
02c8990bd6125f05cb32561727d559dc9327a601 15-Nov-2016 Kenny Guy <kennyguy@google.com> Allow overriding max profile in debugable builds.

Support a system property on debugable builds to
override the max number of managed profiles to
allow easier dogfooding of multiple profiles.
Support 3 different badge colours for managed profiles.

Bug: 30473760
Test: runtest -c com.android.server.pm.UserManagerServiceCreateProfileTest frameworks-services
Test: runtest -c com.android.server.pm.UserManagerServiceUserInfoTest frameworks-services
Test: manual - attempting to create 2 profiles with adb fails, passes once I set the property.
Change-Id: Ie7fb19048a04a01572666f229283152254d0ffc3
serManagerService.java
bdcdeb4cc470130db9ddb7abe7763c2170755e22 22-Nov-2016 Narayan Kamath <narayan@google.com> PackageManager: Avoid unnecessary calls to derivePackageAbi during boot scans

In most cases, we can safely use the values from package settings instead.
We do the work when we're in the middle of an upgrade or the first boot,
since we have no choice.

This saves about 200-400ms on package manager startup on a freshly wiped
device with no app installs. Savings are likely to grow linearly with
the number of installed apps.

Bug: 22063656
Test: make + manual testing.

Change-Id: I1b2bdc4df45f334620c1fb94d78276f0095d5ff8
ackageManagerService.java
ackageSettingBase.java
0d8f4b75a5f41a3455a28839f0cff481bb6be53f 09-Nov-2016 Philip P. Moltmann <moltmann@google.com> Create actions for permission and log revokations

grants, denials and requests are logged in the package installer

Test: Revoked some permissions via settings and looked at event log.
Change-Id: I9a4ade82b68293f8aa9732c9ca288d37e9a7f611
ackageManagerService.java
fd6f4fb264d56726cd0e2fed731ad60bbe4aa06f 18-Nov-2016 Fyodor Kupolov <fkupolov@google.com> Parse packages in parallel

Introduced ParallelPackageParser. Parsing requests are processed by a
thread-pool (currently 4 threads). At any time, at most 10 results are kept
in RAM. This is enforced by the blocking queue.

scanDir has become a two-stage process:
1) Collects files for parsing and submit them to the parallel parser
2) Sequentially take elements from the parsing queue and process them by
calling scanPackageLI (as before)

Test: manual - device boots, all packages are parsed
Test: ParallelPackageParserTest passes
Bug: 30792387
Change-Id: I07a64da4d83e355b2b1f1ab350e6d8087dfd2feb
ackageManagerService.java
arallelPackageParser.java
e1cb95bbeec31971dcab6a39b4666a12214a68b3 28-Nov-2016 Nicolas Geoffray <ngeoffray@google.com> Merge "Use the new refined DexOptNeeded codes." am: d7e597a2e7 am: 99ae18486c am: 51b40ee3eb
am: fbeca51bc9

Change-Id: I7f6578d517a77dd24ab5dc785b7fdd0ab8fd5946
51b40ee3eb11595655552ed25269c2fe0c29cd9f 28-Nov-2016 Nicolas Geoffray <ngeoffray@google.com> Merge "Use the new refined DexOptNeeded codes." am: d7e597a2e7
am: 99ae18486c

Change-Id: I4d6a7a5ad56ce0e6d91620fc63f05faad8348e78
99ae18486cebe4d8a3bcf45f321b22f7be61daf1 28-Nov-2016 Nicolas Geoffray <ngeoffray@google.com> Merge "Use the new refined DexOptNeeded codes."
am: d7e597a2e7

Change-Id: I58fbb54b94350e633fdd38cfb984de87a1862fd2
79c9e063204185b508c32e18e49a5baaa98df4be 25-Nov-2016 Nicolas Geoffray <ngeoffray@google.com> Use the new refined DexOptNeeded codes.

bug: 30937355
Test: device boots, messages are printed correctly
Change-Id: Ia5274e3659471c2a52244d5838d207d407e79023
ackageDexOptimizer.java
84e347f01fa3a0675c3a8d6cc973228a4563b20d 24-Nov-2016 Narayan Kamath <narayan@google.com> PackageManager: Fix incorrect usage of flags.

assertPackageIsValid was checking policyFlags (which are PackageParser
parseFlags) for flags defined in the SCAN_* values. This was always
subtly and non-visibly broken, but turned into a full scale breakage
when change 5b29ecad4856622422eb903e34499506b2fb3e93 was merged, and
one of the flags that *happened* to have the same value in the PARSE_
and SCAN_ flagset changed.

Test: make, boot, update system app, update playstore app.
Bug: 33124572
Bug: 33126202

Change-Id: I482f420b2a9c8af38b17d174f1a2ec36c762f58e
ackageManagerService.java
683ed6c3569e0347c1fa5ab7591c7fba27bb21e8 23-Nov-2016 Narayan Kamath <narayan@google.com> Merge "PackageManager: Avoid creating encoders for appIds being written /config/sdcardfs"
a83fd306505fc5e2770011441ec6da533bc5d134 23-Nov-2016 Narayan Kamath <narayan@google.com> Merge "PackageManager: Remove obsolete SCAN_NO_PATHS / SCAN_DEFER_DEX flags."
5b29ecad4856622422eb903e34499506b2fb3e93 22-Nov-2016 Narayan Kamath <narayan@google.com> PackageManager: Remove obsolete SCAN_NO_PATHS / SCAN_DEFER_DEX flags.

SCAN_NO_PATHS hasn't been used in the past several years, and was
introduced to deal with ASEC containers, and those are now handled by
DefaultContainerService.

SCAN_DEFER_DEX has been made obsolete by the JIT work we've done in N.

Test: make & boot
Change-Id: Ib2ffa8bd3c31d645a7efc5d78b03ca0774590f07
ackageManagerService.java
6d051fc68d1b1f2c09eb2e58c26821e1e13935dc 22-Nov-2016 Narayan Kamath <narayan@google.com> PackageManager: Avoid creating encoders for appIds being written /config/sdcardfs

We know they will be ASCII, so use String.getBytes(US-ASCII) which is
much faster than creating a new ICU based CharsetEncoder for UTF-8 every time
we write one of these files (there will be a lot of them).

Test: make + manual.
Change-Id: I8eb62862ea1083e194d3f23ac68bb40aaae5efd5
ettings.java
b1df48d32632d0ba5a2389fb9fad2943dcb55562 23-Nov-2016 Baligh Uddin <baligh@google.com> Merge remote-tracking branch 'goog/cw-f-dev' into fix_merger

Bug: 32849428

* goog/cw-f-dev: (98 commits)
Revert "Catch KeyStoreException for setting profile lock"
Fix createConfirmDeviceCredentialIntent for wear for CTS.
Fix default dialog background colour for watch devices.
Catch KeyStoreException for setting profile lock
Add cross-links between FINE and COARSE location permissions. bug: 25371600
Fixed a bug with the emergency affordance in multi user
Zygote: Additional whitelists for runtime overlay / other static resources.
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Zygote : Block SIGCHLD during fork.
colors: add missing accent_material_{700,50} resources.
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Zygote : Block SIGCHLD during fork.
DO NOT MERGE ANYWHERE Revert "DO NOT MERGE ANYWHERE libhwui: make setSurface asynchronous"
...

Change-Id: I63468da5bfa21ed9ac5985bbdbf3a61d4c389aa0
08a04878b0d6ed4c661330751ac253c0b18ef537 22-Nov-2016 Todd Kennedy <toddke@google.com> Require INSTALL_PACKAGES permission

Although it's not technically necessary for the ephemeral installer
to hold the INSTALL_PACKAGES permission, it leads to a pretty
poor experience -- the user has to confirm ephemeral installation --
which is a primary reason for ephemeral apps.

Change-Id: Ic3f947d677964521cd4742f66c1c3fe808c4c55a
Fixes: 33073519
Test: manual; installed packages w/ and w/o INSTALL_PACKAGES and only the apps with INSTALL_PACKAGES were made the installer
ackageManagerService.java
078f538eb233a3581dc66737649d8a67e72e6468 22-Nov-2016 Todd Kennedy <toddke@google.com> Launch ephemeral intent

In MR1, the ephemeral application was launched via the supervisor.
In O, the ephemeral application is installed on the system as a
proper application and runs natively.

Bug: 30204367
Test: build & install the framework and run 'adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://www.tripadvisor.com/Tourism-g33020-San_Jose_California-Vacations.html"'
Change-Id: Iea496862aeb72c6bfde439620950ba951d859cc7
phemeralResolver.java
fac592f64c55004e9048e30e03d6dc65bdb4f00a 21-Nov-2016 Makoto Onuki <omakoto@google.com> Fix issue with apps restored to lower versions.

When restoring to a new device, if a restored app is not compatible
with the old version (e.g. lower version or different signature),
then we won't restore shortcuts, which is working as expected.

However when it happens, the shortcut manager forgot to "un-shadow"
the package information, causing the app to not have shortcuts at all.

Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests

Bug 32999759

Change-Id: I89832360114de0ce1c57d763bcaccab4fdb87b6d
hortcutPackageItem.java
hortcutService.java
194e4eeb0e9b77802c381d94f43b5e3b938c59e5 17-Nov-2016 Todd Kennedy <toddke@google.com> Phase-2 API takes a hostname

For phase-2, instead of taking a hash prefix, we will send the
hostname to the resolver.

Bug: 25119046
Test: build & install the sample resolver and run 'adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://www.tripadvisor.com/Tourism-g33020-San_Jose_California-Vacations.html"'
Change-Id: I6e621139e182f9a9cfcf608c26d4763f1379bdb2
phemeralResolver.java
phemeralResolverConnection.java
3e12f413d40e55da3d8a964740bc2aa9899c622b 17-Nov-2016 Todd Kennedy <toddke@google.com> Merge "Implement 2-phase resolution"
c41c889b3e9c801c5c2af025f42296bd99866409 16-Nov-2016 Chad Brubaker <cbrubaker@google.com> Merge "Use a 16 byte random suffix for installed apk directory name"
de4355dd590b3d0b5d0355d70da1231af31c5b54 16-Nov-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Log when priv permission is not whitelisted"
b633f9d01f484d1a17ebfcd5aa4d6000dff53773 16-Nov-2016 Fyodor Kupolov <fkupolov@google.com> Log when priv permission is not whitelisted

Log violations for now, we will start enforcing it later.

Test: Manual - device boots
Bug: 32935038
Bug: 32935364
Change-Id: I1957c334f98852a5a87e093e24c72dd2c223c08b
ackageManagerService.java
5e10e8f1b2126f031b976b853c3f150418f3b342 09-Nov-2016 Chad Brubaker <cbrubaker@google.com> Use a 16 byte random suffix for installed apk directory name

This prevents apps (both normal and ephemeral) from learning what
applications are installed by checking for the existence of
/data/app/com.example.package-1. /data/app and /data/ephemeral-app are
already 771 and so cannot be ls'd but because the directory names are
guessable it is still possible to learn if known packages are installed.

Apps can still learn if a package is installed and where via the
standard APIs but not by directly using the filesystem. This is
important for ephemeral apps since normal apps should not be aware of
installed ephemeral apps (unless needed) and ephemeral apps shouldn't be
aware of other ephemeral apps.

Test: adb install --ephemeral, verify the code directory has random
suffix
Test: runtest -c android.content.pm.PackageManagerTests frameworks-core
Test: cts-tradefed run commandAndExit cts -m CtsAppSecurityTestCases
Change-Id: Id4883f5cfb9664307cf8518e2db3fef0e2d632d0
ackageManagerService.java
1d687df2f7dab85c437e60023787f632f4efb0a1 16-Nov-2016 longhai <longhai@xiaomi.com> Merge "Fixed the issue when some apps were gone and couldn't be installed successfully after updating from KK to M via OTA." am: 1813ae0159 am: 2be54fde72 am: 5c152a3d7f
am: d7e2ae5fc7

Change-Id: I9b24f761959dfe7a88509b65273e31916d9ddfc1
26c48fac73cce07d0a41c567e97d9d3f02d3a5d3 16-Nov-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes I99813278,I6285042b

* changes:
Fix copypasta error.
Aggressively clear cached data when forgetting.
d7e2ae5fc752453e6c992b98fea82b5eae26b0f0 16-Nov-2016 longhai <longhai@xiaomi.com> Merge "Fixed the issue when some apps were gone and couldn't be installed successfully after updating from KK to M via OTA." am: 1813ae0159 am: 2be54fde72
am: 5c152a3d7f

Change-Id: Ida06ea3d42d66cb2f1cc124fe3498e579141d16c
5c152a3d7f7bcd003a833b8ebe4a2d1eeb33df11 16-Nov-2016 longhai <longhai@xiaomi.com> Merge "Fixed the issue when some apps were gone and couldn't be installed successfully after updating from KK to M via OTA." am: 1813ae0159
am: 2be54fde72

Change-Id: I14e1d5aa6bda143e2a87bba1ea65b8384c44e3a1
2be54fde7204884dd77cbf97076d7d452df1b85b 16-Nov-2016 longhai <longhai@xiaomi.com> Merge "Fixed the issue when some apps were gone and couldn't be installed successfully after updating from KK to M via OTA."
am: 1813ae0159

Change-Id: Iae1a0cd25495206d596aed7d68ce7936071f9c6e
1813ae0159cda05a6882c77714f25718fc67c311 16-Nov-2016 Treehugger Robot <treehugger-gerrit@google.com> Merge "Fixed the issue when some apps were gone and couldn't be installed successfully after updating from KK to M via OTA."
b501ef1e21e4314aa1177b6d59294b2b18d7d2a0 15-Nov-2016 Jeff Sharkey <jsharkey@android.com> Aggressively clear cached data when forgetting.

Otherwise the system server risks keeping open FDs to an adopted
storage device that could later be ejected.

Test: builds
Bug: 31596654
Change-Id: I6285042b4f0714dbf601c7dfa53efb704ea29d0b
ackageManagerService.java
2250d56a0b47b93016018340c8f4040325aa5611 08-Nov-2016 Sudheer Shanka <sudheersai@google.com> Rename MountService to StorageManagerService.

Bug: 30977067
Test: Existing tests pass
Change-Id: Ieac0f11c2b249dcd60441b14c1f391e6f8131d42
ackageManagerService.java
964d2ebb94c41d2cf1fb45b534e86c10e0ced3ac 09-Nov-2016 Fyodor Kupolov <fkupolov@google.com> Control privileged permissions for priv-apps

Added support for privapp-permissions config element. It allows to explicitly
control what privileged permissions applications should be granted.

Feature is controlled by ro.control_privapp_permissions property.
Possible values:
- 0/false, the feature is completely disabled - signature|privileged
permissions are granted automatically without logging. *Default behavior*
- 1/true, enforce that only whitelisted permissions are granted. Only
devices with ro.control_privapp_permission=1 will pass CTS tests.

Test: Manual
Bug:31008485
Change-Id: I93a8c2782cc72b3953f32c237086d08d82ac0d5b
ackageManagerService.java
01ad0c7e403794b272494f187d91f57bdfa07c9d 12-Nov-2016 Todd Kennedy <toddke@google.com> Implement 2-phase resolution

Bug: 25119046
Test: build & install the sample resolver and run 'adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://www.tripadvisor.com/Tourism-g33020-San_Jose_California-Vacations.html"'
Change-Id: I624b9028061aad35db80e0d51bfe0a39fb81806c
phemeralResolver.java
phemeralResolverConnection.java
ackageManagerService.java
dc589ac82b5fe2063f4cfd94c8ae26d43d5420a0 11-Nov-2016 Sudheer Shanka <sudheersai@google.com> Update usage of ActivityManagerNative.

- Remove references to ActivityManagerProxy.
- Add isSystemReady to ActivityManager.

Bug: 30977067
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test android.server.cts
adb shell am instrument -e class com.android.server.am.ActivityManagerTest,com.android.server.am.TaskStackChangedListenerTest \
-w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I07390b6124fb1515821f5c0b37baf6ae74adc8fa
ackageManagerService.java
hortcutService.java
serManagerService.java
serRestrictionsUtils.java
e07641d4fbdd0528c18305213e861a6e1aff4a3b 10-Nov-2016 Dianne Hackborn <hackbod@google.com> Start implementing background restrictions for eph apps.

This implements the additional intended path for checking
allowed background operations, APP_START_MODE_DISABLED, which
doesn't allow an app to launch in the background at all.

Also change the semantics of delivering broadcasts to manifest
receivers to always restrict those, not changing based on
whether the app is currently idle. This is the desired intended
behavior for apps as they explicitly update to work with
bg check.

And now that we have ephemerality associated with the uid state
in the activity manager, we can propagate this through the
relevant callbacks in IUidObserver so things watching these
changes can immediately determine whether they should do their
more aggressive shut down work for the uid rather than having
to walk through all their state looking for package associated
with that uid and whether they should be shut down.

Also remove the "lenient" bg check mode, since that was
just an early experiment that we won't actually use.

Add a new "make-idle" activity manager command to immediately
put a uid into the idle state (if possible) to make it easier
to test.

Test: manually against an eph app
Change-Id: I43a138ff281f69a9251d3f29ab6e13f48cff8ad6
ackageManagerService.java
hortcutService.java
c4f65e0da88955d3451d2a6e9b8f7b4814aa0b3e 09-Nov-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Move dump() to dumpAsync(), more oneway calls."
850c83e6da3b34a4eab804133420247fc9dbb8a1 09-Nov-2016 Jeff Sharkey <jsharkey@android.com> Move dump() to dumpAsync(), more oneway calls.

When calling out to dump services hosted by external apps, use
dumpAsync() to avoid hanging if the remote process is wedged.

Test: builds, boots, runs with minimal logs triggered
Bug: 32715088
Change-Id: I70aa2666ae21dae8f09ded2063bed359c0b210c5
phemeralResolverConnection.java
d0ac9d3bac179d2787ebfc11fe0d9c3d7e6d425e 09-Nov-2016 Jeff Sharkey <jsharkey@google.com> Merge "Detect non-oneway calls leaving system_server."
2fb2556833d9f6384004be9cbce4ba8321820909 09-Nov-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow shell to enable/disable individual component in test package"
1183883b2e60f5afcbb25706d70e51fcf4f89829 09-Nov-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Implement new API"
80361c9ea7f3ff694425b6bd9e42e8c933b1196c 09-Nov-2016 Dianne Hackborn <hackbod@google.com> Merge "Move code for handling uid obs "cutoff" to activity manager"
8f68c8b9a89e42cde7bccb00b90db13c206ab5f4 08-Nov-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Always scan all apps after each OTA for manifest shortcuts"
e5195dd17c5e1d8538049a5282c0d988988f63c8 20-Oct-2016 Todd Kennedy <toddke@google.com> Implement new API

This is the first swack at the new, 2-phase API. Adds the new methods
to the resolver service and makes the split name explicit on the
installer intent.

The 2nd phase will not yet be invoked; that's coming in a follow-on
change.

Bug: 25119046
Test: build & install the sample resolver and run 'adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://www.tripadvisor.com/Tourism-g33020-San_Jose_California-Vacations.html"'
Change-Id: I2df6fa64d46f17a86a2e32b19417632c594fb10f
phemeralResolverConnection.java
ackageManagerService.java
bbe6f49147e7a7c60b4a51f37415f1bfe13a7d9c 08-Nov-2016 Jason Monk <jmonk@google.com> Merge "Allow persistent changes to the vendor overlay theme"
5614bf5a1ae4522dfc1a041f003cebc9b25c8b93 08-Nov-2016 Dianne Hackborn <hackbod@google.com> Move code for handling uid obs "cutoff" to activity manager

To do this, I had to fix the PROCESS_STATE_NONEXISTENT constant
to be the last value (instead of the special magical -1 value)
so it semantically matches the public importance constants. I
think this is better anyway.

Also this fixes a big problem in the implementation, where we
weren't keeping track of the last proc state per uid...! Duh.

Test: manually ran testUidImportanceListener
Change-Id: Ie3008f824446089840f896885e6033472abb065e
hortcutService.java
13810374a47f783e89092a5232f0ac5da21da403 08-Nov-2016 Tony Mak <tonymak@google.com> Allow shell to enable/disable individual component in test package

Test: cts-tradefed run cts --module DevicePolicyManager --test com.android.cts.devicepolicy.ManagedProfileTest#testAppLinks_enabledStatus

Bug: 32695379
Change-Id: I0fa22f50f1aa344195b7c6bc1e6ee97879d91c46
ackageManagerService.java
248a0ef3aa119f92858a2bb95d20595824b8d07b 03-Nov-2016 Makoto Onuki <omakoto@google.com> Always scan all apps after each OTA for manifest shortcuts

(W/ reverting Ia05363b30a5eeb989dc4c44cf5dbd71cde96de96)

Test: FrameworksServicesTests

Bug 32590013

Change-Id: I8f45c330d0b102a6a112e774205e6611c1c61af3
hortcutPackage.java
hortcutService.java
2dc804be11444565e3d1d151c2a693db3ade94c0 07-Nov-2016 Jason Monk <jmonk@google.com> Allow persistent changes to the vendor overlay theme

This allows the overlay being used to be changed without a new build
but still will require a reboot to take effect. Should no longer be
needed once hierarchical resources are in place, and can be removed.

Also fix check in fd_utils to point at correct location.

Test: Manual
Bug: 32721178
Change-Id: I2a63aea0c87791c8eb845d735cb1182716c8174d
ackageManagerService.java
0a17db1cc5942ea000ca87bb72853de57a15ec64 04-Nov-2016 Jeff Sharkey <jsharkey@android.com> Detect non-oneway calls leaving system_server.

To protect system stability, any Binder calls leaving the
system_server must carefully be performed using FLAG_ONEWAY (or
the 'oneway' verb in AIDL) which prevents the call from blocking
indefinitely on the remote process.

In this CL, the system_server uses the new Binder.setWarnOnBlocking()
method to enable detection by default for all remote Binder
interfaces. It can also use Binder.allowBlocking() to allow
blocking calls on certain remote interfaces that have been
determined to be safe.

This CL adds the 'oneway' verb to several interfaces and methods
where it should have been added, and marks a handful of system
ContentProviders as being safe to call into. Also, we assume that
any services obtained from ServiceManager are part of the core
OS, and are okay to make blocking calls to.

Test: builds, boots, runs with minimal logs triggered
Bug: 32715088
Change-Id: Ide476e120cb40436a94b7faf7615c943d691f4c0
ackageManagerService.java
058f1e4468bd54d0ac39fdf81b4df7221b28721a 03-Nov-2016 Dianne Hackborn <hackbod@google.com> Implement system API for monitoring uid importance changes.

Changed the permission for registerUidObserver to be
PACKAGE_USAGE_STATS, which better matches the semantics of this
API and is accessible to system apps.

Test: Added testUidImportanceListener()

Change-Id: Ib47d02bd654fbe399a9c92550c89ecbd38f928dc
hortcutService.java
cbc59b8aa620ce6eea50bd787d2daa0d5232fe68 04-Nov-2016 Chad Brubaker <cbrubaker@google.com> Merge "Move ephemeral apps into the ephemeral SELinux domain"
37ea9a1f02a1247cf0afeab987e7ca460a9eadbf 04-Nov-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Send BOOT_COMPLETED when updating system apps"
c200bb7be484c116c0f8ae177a8ff6d41095ff34 03-Nov-2016 Fyodor Kupolov <fkupolov@google.com> Send BOOT_COMPLETED when updating system apps

Previously, when a system app was updated, it wasn't getting
BOOT_COMPLETED broadcast.
sendPackageAddedForUser was extended to support multiple userIds and also
send LOCKED_BOOT_COMPLETED. handlePackagePostInstall is now using the same
method as installExistingPackageAsUser

Test: pm install --user X -r systemAppV2.apk
Bug: 32242899
Change-Id: I75fe955aaf02d0a4c80b3604e3ef82316bf5dbc0
ackageManagerService.java
02e17d27b1d9289059fd18d512ae978f0dfd666e 03-Nov-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "[DPM] Management and retrieval of network logs"
668868baf59cdb9ec2cec4d144fe8143fdfe2815 02-Nov-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Do not exclude partial users that are not being removed"
fc686becb9851aa009512c285d489d5f8cf209ef 02-Nov-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Cross profile candidate should be considered"
9f2c93663c2de84f958eebef96a98458ebaf51a9 02-Nov-2016 Tony Mak <tonymak@google.com> Cross profile candidate should be considered

Bug: 32547783

Fixed the regression introduced in ag/1243573

Test: Manual test - Open a map link in work calendar, personal map is shown as an option.

Change-Id: If5651b5e09cf1916813e8f91dbdcdf53f9119ef2
ackageManagerService.java
f77ee4f1b79929a77f603e5e879f3616ae464e3e 12-Oct-2016 Michal Karpinski <mkarpinski@google.com> [DPM] Management and retrieval of network logs

This CL follows up on ag/1530343 and adds:
1) Various network events.
2) Retrieval method in DPM and APIs in DeviceAdminReceiver.
3) Extension of NetworkLogger and it's NetworkLoggingHandler.

Test: runtest --path frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/NetworkEventTest.java
Bug: 29748723
Change-Id: I42a1a477e7c75c109a3982f809c22732b814e8b2
ackageManagerService.java
6e99d3f0445698cee87e391c9cf2dd90932e8e13 02-Nov-2016 Fyodor Kupolov <fkupolov@google.com> Do not exclude partial users that are not being removed

Otherwise maxSupportedUsers limit can be exceeded by creating users in
parallel.

Test: Manual cmd line + UI guest create/switch/remove + UserManagerTest
Bug: 32485535
Change-Id: I490a70501f3643980bbfb1c95940b9ae3f20ccee
serManagerService.java
815fc3e53941473a9a8cbac52e2658b987609c75 01-Nov-2016 Mark Renouf <mrenouf@google.com> Workaround for javac compilation issue of lambda code am: e065f7c5a9 am: 6ce06e63a7
am: 72f59dd7cb

Change-Id: I603a1709e35ba1d34cdd6b8abe9fd981e59166c8
72f59dd7cbca520b0e1b996595b0f80c72dd2edb 01-Nov-2016 Mark Renouf <mrenouf@google.com> Workaround for javac compilation issue of lambda code am: e065f7c5a9
am: 6ce06e63a7

Change-Id: I9a43b4843667bdab5909765b1afa99c9f7b11053
e065f7c5a9ad4e47f5490793401445660af37624 01-Nov-2016 Mark Renouf <mrenouf@google.com> Workaround for javac compilation issue of lambda code

Since ag/32554459 some Robolectric tests are compiling
framework code with javac. For reasons unclear so far this
code fails to compile with javac:

> ShortcutService.java:408: error: variable ri might not have been initialized

https://android-build.googleplex.com/builds/submitted/3416256/angelfish-userdebug/latest/logs

Removing the lambda expressions corrects the issue.

BUG: 32554459

Change-Id: I189c8ef02dc93b46ef6418c1ff14f2312097898a
hortcutService.java
b8ce18a2813e45ddf31cae841a9519a4e09fe5e1 01-Nov-2016 Makoto Onuki <omakoto@google.com> Always scan the Settings app for updated shortcuts. am: ac2898228e am: f0644d03a2 am: 4eb38c75f4
am: 9a9274186e

Change-Id: I6e26f3df974ae4c9f014c30e25e0cd1598fee26f
9a9274186e8d88ec3e5f62c2bafc56f202c174e5 01-Nov-2016 Makoto Onuki <omakoto@google.com> Always scan the Settings app for updated shortcuts. am: ac2898228e am: f0644d03a2
am: 4eb38c75f4

Change-Id: Ifc5c7d4493703bb16788165ea60c8a35408b259b
f0644d03a220dcbfda80d8e441cda21d4e4ed439 01-Nov-2016 Makoto Onuki <omakoto@google.com> Always scan the Settings app for updated shortcuts.
am: ac2898228e

Change-Id: I64f476ec3b4003e87004ab6c05536f91e659d39e
ac2898228edea493c76287338adf6dd8ca21303a 31-Oct-2016 Makoto Onuki <omakoto@google.com> Always scan the Settings app for updated shortcuts.

The setting apps' version code is 25 for both DR and MR1, so the
shortcut manager will not notice when it's changed.

Let's just always scan this app.

Bug 32554059

Change-Id: Ia05363b30a5eeb989dc4c44cf5dbd71cde96de96
hortcutPackage.java
006b53a68149d22dc8174ed6c46175967e6f0764 31-Oct-2016 Chad Brubaker <cbrubaker@google.com> Merge "Add ephemeral protection level"
c19706a937abc5d025a59b354b3a0d89e7d62805 14-Oct-2016 Chad Brubaker <cbrubaker@google.com> Add ephemeral protection level

Ephemeral applications will only be able to be granted permissions that
have the ephemeral proteciton level, this allows us to tighly define
what behavior is OK for ephemeral applications.

This includes an initial small whitelist of permissions for ephemeral
apps, it may be expanded later.

Test: adb install --ephemeral, verified against both runtime and install
time permissions
Test: cts-tradefed run cts -m CtsPermission2TestCases
Change-Id: I854c44cf7a293d484b674cdd4fb5141e362a2f1a
asePermission.java
ackageManagerService.java
7e0c4521f952cbf92d177413e3fe6a8a28489cd0 31-Oct-2016 Nicolas Prévot <nprevot@google.com> Merge "Allow DO to remove user even if DISALLOW_REMOVE_USER is set."
df1b87db5d1b473511b4f06bbc85dd7b418b7031 25-Oct-2016 Nicolas Prevot <nprevot@google.com> Allow DO to remove user even if DISALLOW_REMOVE_USER is set.

BUG:32300784
Test: create user in TestDPC, set DISALLOW_REMOVE_USER restriction,
and remove this user.
Change-Id: I96ab02d594cd1a8ab14420e12357f2083da1ce63
serManagerService.java
f4fba91b5fd26f9873f36a8bc8cde368d343733f 28-Oct-2016 Fyodor Kupolov <fkupolov@google.com> [DO NOT MERGE] Only setSize if -s arg is specified am: b87a491de6 am: 7c9a91094d
am: c9102f2ae2

Change-Id: I28e06c6345e847ade9a89824675302fdf58e1ba9
7c9a91094d0429721d6524e057570fa83463801d 28-Oct-2016 Fyodor Kupolov <fkupolov@google.com> [DO NOT MERGE] Only setSize if -s arg is specified
am: b87a491de6

Change-Id: I33afbd12925a1afb79ed9b444948372ebbaf5e95
e97969b4d0c6eaeeb373d716238e47e49c80d992 28-Oct-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "[DO NOT MERGE] Only setSize if -s arg is specified" into nyc-mr1-dev
f9e2ad0b3c2efb3bd93bb8b4ce2580512563005a 30-Jun-2016 Svetoslav Ganov <svetoslavganov@google.com> Add Bluetooth toggle prompts - framework

If permission review is enabled toggling bluetoth on or off
results in a user prompt to collect consent. This applies
only to legacy apps, i.e. ones that don't support runtime
permissions as they target SDK 22.

Also added a configuration resource which controls whether
permission review mode is enabled. By default it is not and
an OEM can change this via an overlay. For now we also keep
the old mechanism to toggle review mode via a build property
which is still used and will be removed when clients have
transitioned.

bug:28715749

Change-Id: I94c5828ad6c8aa6b363622a26ff9da4fc2e2fac7
(cherry picked from commit ac69be543f89ea6e9a27204492e0a170d9b3450e)
ackageManagerService.java
b87a491de63069fb903c95727f57511c7e4eeaa0 27-Oct-2016 Fyodor Kupolov <fkupolov@google.com> [DO NOT MERGE] Only setSize if -s arg is specified

Calculate size of installed APKs only when INSTALL_EXTERNAL flag is set.
calculateInstalledSize is expensive and may take up to 20% of total
installation time.

Bug: 32180551
Bug: 29932779
Change-Id: I173d2b38820cc86cbfacecd1bacef57369d10af7
ackageManagerShellCommand.java
ed8259f3fdbd2438f3eb4f665529f51d1a33deae 27-Oct-2016 Jeff Sharkey <jsharkey@android.com> Only bind to RESOLVE_EPHEMERAL_PACKAGE once. am: 7765d7320d am: eeac5a064d
am: f46b2eeab6

Change-Id: If4c4ab8ddd7e15a93de6422d8724077f158b1047
eeac5a064dc4b783857a37515d331b3d8d13605d 27-Oct-2016 Jeff Sharkey <jsharkey@android.com> Only bind to RESOLVE_EPHEMERAL_PACKAGE once.
am: 7765d7320d

Change-Id: I2ca3b6d7938a461a6fe2d591b74985908c2d07bc
60ef4259f64547295c84b8f2b0978cb8be775952 27-Oct-2016 Jeff Sharkey <jsharkey@google.com> Merge "Only bind to RESOLVE_EPHEMERAL_PACKAGE once."
4593e425a88c1fab1b6526617a21d5c0105bf18f 27-Oct-2016 Fyodor Kupolov <fkupolov@google.com> Log removeUser

Test: manual
Bug: 32455935
Change-Id: If1756725a428278ec21aa4d2cccce0da6079c22b
serManagerService.java
7765d7320d8435a0e814d9f10039c7866f9d76a2 27-Oct-2016 Jeff Sharkey <jsharkey@android.com> Only bind to RESOLVE_EPHEMERAL_PACKAGE once.

We never unbind, so we only ever need one bind request; creating more
bind requests just wastes resources.

Test: builds
Bug: 32446301
Change-Id: I7d6c4a93b8f5bb8d9aed7a5041b193e19a2d65fc
phemeralResolverConnection.java
c65090b925ea7c28344f2ed7ef523a6a8129a2b4 27-Oct-2016 Jeff Sharkey <jsharkey@android.com> Only bind to RESOLVE_EPHEMERAL_PACKAGE once.

We never unbind, so we only ever need one bind request; creating more
bind requests just wastes resources.

Test: builds
Bug: 32446301
Change-Id: I7d6c4a93b8f5bb8d9aed7a5041b193e19a2d65fc
phemeralResolverConnection.java
bc3d8e8673aacc061cbc4c93756f3ea8e01d1bc3 26-Oct-2016 Svetoslav Ganov <svetoslavganov@google.com> [DO NOT MERGE] Don't accidentally delete renamed packages am: e2c85890ac am: 2a81b4c908
am: c893565d24

Change-Id: I3b0abcfcc23b114b38204c0c957acb1316698845
2a81b4c9084ed808feb2a17d0f298ef9decde1d8 26-Oct-2016 Svetoslav Ganov <svetoslavganov@google.com> [DO NOT MERGE] Don't accidentally delete renamed packages
am: e2c85890ac

Change-Id: Icbd85ddfc76e50553414bd47860370cdc442b796
e2c85890ac3941525288e08962b33d30618de801 26-Oct-2016 Svetoslav Ganov <svetoslavganov@google.com> [DO NOT MERGE] Don't accidentally delete renamed packages

Apps on the system image can change their package by declaring
their old one in the manifest. If a package is renamed it is
internally referred by its old name.

The reconciliation code was using the new package name for
renamed packages and was concluding the apk is orphaned thus
deleting it. This puts the package in a bad state where the app
is gone and the version on the system partition is disabled.

Also Play was showing an update for a renamed system app as
an install while it is an update because of the same reason,
it was using the new package name while the app is internally
referred by the old one.

The fix for both above is to internally normalize the package
name by using the old one if the package was renamed or the
package name as is.

Test: With the fix put the old calculator on the system image
and booted, then put the renamed calculator and booted, updated
calculator from play and rebooted - calculator keeps working.
Also did the above steps without the patch to put calculator
in a bad state and flashed the system with the patch which
fixed the broken calculator app.

bug:32321269

Change-Id: I98bfc05c399edfc9854ebcce44182fefa55ceeff
ackageManagerService.java
93bbe47d650b7b5e48d705257c0bdfa086300549 21-Oct-2016 Jakub Adamek <jakuba@google.com> Change name of overlay subdir 'sku'->'theme' am: 54dcaaba4f
am: 6bbb63ad91

Change-Id: I71dfaafbebaa7bd61d182405c734eef1ea7ff1eb
6bbb63ad91a707c77dd52f0b6caa12a720732ee1 21-Oct-2016 Jakub Adamek <jakuba@google.com> Change name of overlay subdir 'sku'->'theme'
am: 54dcaaba4f

Change-Id: I4536de644c20171e175cddaff0cd041fb05b3038
54dcaaba4fa0392c36864f99b9dc1da9c975a100 19-Oct-2016 Jakub Adamek <jakuba@google.com> Change name of overlay subdir 'sku'->'theme'

The name 'sku' does not fit well as we recommend to use the same
value for different SKUs if vendors wish to have the same colors
on those SKUs.

Bug: 32268656
Change-Id: Ib5e5a3386676453dafeb13a6a6bf91f81bb48a11
ackageManagerService.java
92b3f5aed74b76bcdae41a85987dd8817e3e3909 18-Oct-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "force appropriate size"
9caf94e535a1a7573ad61fbc487b74d122ca4d29 13-Oct-2016 Todd Kennedy <toddke@google.com> force appropriate size

during install, the user could specify an invalid size [ie. a negative
number].

also error out if we're given a path that's not a file.

Change-Id: I79e9ef82723495782146208eb5469722d1f8ed02
Test: manually ran 'adb install' with invalid arguments
ackageManagerShellCommand.java
8e33c15f39158f0bf510442b32c24f3bad27918e 17-Oct-2016 Jakub Adamek <jakuba@google.com> Search for RRO in Java both in SKU subdir and in vendor/overlay am: 4a6e246671
am: 845de5aaad

Change-Id: I42d4c39d90e2b885bf7d2f3653db82c16642dbaf
845de5aaad6cf1612183ab36984289edaa283812 17-Oct-2016 Jakub Adamek <jakuba@google.com> Search for RRO in Java both in SKU subdir and in vendor/overlay
am: 4a6e246671

Change-Id: I876e12838c88adb019af73ceff207b6b8bd60c0a
4a6e2466713e50d642b375b621265013d73e5d8e 17-Oct-2016 Jakub Adamek <jakuba@google.com> Search for RRO in Java both in SKU subdir and in vendor/overlay

Currently, if the "ro.boot.vendor.overlay.subdir" property is set, we
only search in the subdir. It seems more powerful to search both in
there and in the standard /vendor/overlay directory.

Also, RRO packages have the "priority" attribute in the <overlay>
attribute in AndroidManifest.xml which serves for disambiguation.

Bug: 32202741
Change-Id: I9ef44b8ca4ac0e92ba02e25b3672c6b274fe4639
ackageManagerService.java
12d23a13bb45cd4f83395f0f45f3382d7571effe 27-Sep-2016 bohu <bohu@google.com> Emulator: Fix CTS failure caused by removed MANAGE_USERS permission in Shell

BUG: 31648062
Change-Id: I9679c18c0e3611ebc9779408826f182ea8f1e88b
(cherry picked from commit 57f47e8490b68678fd123cdc111d5073ec994382)
serManagerService.java
72a73e347352302c72a4ef701bcba91336db22a9 13-Oct-2016 Wale Ogunwale <ogunwale@google.com> Track making activity resizeable based on sdk version separately.

To support resizeable home activities we need to make the home activity
resizeable only when the app explicitly says it is resizeable. To be able
to do that we need to track if we are allowing the app to be resizeable
due to the sdk version it is targetting separately from it explicitly
setting it so that activity manager and window manager can make the right
choices in a follow-up CL.

Bug: 30982291
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test android.server.cts
Change-Id: I10f53ee9e57a41a3edece91cf68c5e8ef4bf4489
ettings.java
0fb772e2dc326fa72a2ba3916ebefe87b81477fa 14-Oct-2016 Fyodor Kupolov <fkupolov@google.com> Allow calls from the same profile group

isManagedProfile/isUserUnlockingOrUnlocked should allow callers from
the same profile group.

Test: manual
Change-Id: Ic90a379ca324914c1f60a5af5214b33448d3a70e
Fixes: 32158068
serManagerService.java
c413f7078d2a69badcb4a2326a4a3d55c25da020 07-Oct-2016 Fyodor Kupolov <fkupolov@google.com> Switch UM to internal isUserUnlockingOrUnlocked

Internal version of UMS maintains a self-locking data-structure of user
states that is pushed from ActivityManager. Previously there could
be discrepancies between UMS.isUserUnlockingOrUnlocked and
UM.isUserUnlockingOrUnlocked, which is calling a blocking version
in ActivityManager.

Test: manual + UserManagerTests

Bug: 31995235
Bug: 31833240
Change-Id: Ibafe403f57cd32d9052bb55fe7273a861be1d037
serManagerService.java
0778401533adba2e084cb04e14f04c2561937c62 11-Oct-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Use the correct flags"
f1c5991a44156e56eae60ef653dacb3e80ba4508 11-Oct-2016 Todd Kennedy <toddke@google.com> Use the correct flags

Change-Id: Ieee49fb238d55ca7db635b18b67dbc2db809133e
Fixes: 32063793
Test: Manually ran the device
ackageManagerService.java
852638dad613c8cbeee6e7a52a46968a75b4e423 11-Oct-2016 Shunta Sato <Shunta.Sato@sonymobile.com> Fix: "adb install -s" adaptation for session based install am: 4f26cb5a36 am: 55bcb9f422
am: 4549426d6e

Change-Id: I400fc32717172cca401e3ccdae9a6b17687390b6
4549426d6e83ab317adcdd85b71d839b7305ef22 11-Oct-2016 Shunta Sato <Shunta.Sato@sonymobile.com> Fix: "adb install -s" adaptation for session based install am: 4f26cb5a36
am: 55bcb9f422

Change-Id: Id9dcfdd12f190744fe84136c0a53e2cfb6638516
55bcb9f42258258580ccfdff6020d43f0f27260e 11-Oct-2016 Shunta Sato <Shunta.Sato@sonymobile.com> Fix: "adb install -s" adaptation for session based install
am: 4f26cb5a36

Change-Id: I65d94a002a382c2a2b91d6b8348c003b9e6ab859
4f26cb5a36487b3f5b497804faebe16241c15d54 28-Jun-2016 Shunta Sato <Shunta.Sato@sonymobile.com> Fix: "adb install -s" adaptation for session based install

Internal implementation of "adb install" has been changed to
session install. As a result '-s' option doesn't work.
Size info is required when using '-s' option in session install.
PackageHelper.fitsOnExternal() returns false and moving app to SD is
failed when size info is not set.

So set size info when '-s' option is used.
And change identity on some method because shell doesn't have some
permission to access to asec.

Bug: 29932779
Author: Ryuki Nakamura <ryuki.x.nakamura@sonymobile.com>
Change-Id: I65edcc0f01ceecaaba17792ad329791a9253d603
ackageInstallerSession.java
ackageManagerShellCommand.java
6dc428f677f2b80b085466961e9495972e1c88c9 10-Oct-2016 Tony Mak <tonymak@google.com> Allow device owner to inflate managed profile

1. Modify DPM.isProvisioningAllowed to allow it to happen
2. Introduce hidden API createProfileForUserEvenWhenDisallowed for
ManagedProvisioning app to create profile under DO.
Apps with MANAGE_USERS permission can clear the
DISALLOW_ADD_USER restriction anyway, so they do not gain extra power.

Test: runtest -x frameworks/base/services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java
Test: cts-tradefed run cts --module DevicePolicyManager --test com.android.cts.devicepolicy.CustomDeviceOwnerTest#testIsProvisioningAllowed

Bug: 31895999

Change-Id: I10dc3043653130ae717a1d3d8256c9e73231bb21
serManagerService.java
45abcf44c5a1735905ec5a481dd396ef3fad6c54 07-Oct-2016 Chad Brubaker <cbrubaker@google.com> Move ephemeral apps into the ephemeral SELinux domain

This also removes AutoplayApp which was the previous (ununsed) N domain
and flag for ephemeral apps.
Test: Ephemeral apps now run in ephemeral_app
Change-Id: Ie339885c3996acbdcfe12452daa1d5edb3b93cda
ELinuxMMAC.java
ettings.java
ba039066d817608f0599dd2b8729ae5648699c28 08-Oct-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow some packages to be excluded during during work profile creation."
7cb54a34c44547b55200e4be15be397f6a363c55 16-Sep-2016 Sudheer Shanka <sudheersai@google.com> Allow some packages to be excluded during during work profile creation.

Bug: 31657192
Test: adb shell am instrument -e class com.android.server.pm.UserManagerTest#testAddManagedProfile_withDisallowedPackages -w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I37eab6084e0f911d0e2407186b789875588194a2
ackageManagerService.java
ettings.java
serManagerService.java
e119cccce0891eb85396815ca6bff630665b2e8b 07-Oct-2016 Todd Kennedy <toddke@google.com> Force APKs to be streamed
am: d220683d33

Change-Id: I617a4854f406dbdacf3b150df0bd72793112d95c
8cad623c92005bda8bc9cb7e6ca43c7d92a7df46 06-Oct-2016 Todd Kennedy <toddke@google.com> remove peekPackageLPr

no longer needed, so, removed

Bug: 30219944
Change-Id: I0cf8ef4e8e2abc1d98b1f584ae448f9097095c6d
Test: adb shell am instrument -w -e class com.android.server.pm.PackageManagerSettingsTests com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
ackageManagerService.java
ettings.java
ff35e661724952664c48282de42d9063a7c7444a 20-Sep-2016 Todd Kennedy <toddke@google.com> Break up scanPackageDirtyLI

Instead of having a single, thousand line method, break it
appart into several hundred line methods. Also, try to bring
order:
1. separate policy
2. separate package validation
3. separate package commit
Also inspect each block of code and determined which code needs
moving [in future changes].

Bug: 30219944
Change-Id: If028f692acf6c259e7140a770d61a717a3e9362d
Test: manual
ackageManagerService.java
ettings.java
4fc56e2c10f62c7c2edd336f7498819d04785bbd 06-Oct-2016 Nicolas Prévot <nprevot@google.com> Merge "Don't allow the shell to change admin-locked app permissions."
644cc7d5c529aee1c257463694224d36091c4a4f 05-Oct-2016 Dan Aminzade <monzy@google.com> resolve merge conflicts of 3629c67 to master

Change-Id: I254ab1f902b4a1b6cbd91ab5d07c946f055cef77
3629c6739536231d40295c8120ffe549c9db1bf5 05-Oct-2016 Dan Aminzade <monzy@google.com> Automatically grant location and body sensors permissions to system packages that handle the com.android.fitness.TRACK intent.
am: f8d60b19ce

Change-Id: Ic2cdc9d4562722dd97a0af8e62b5ae93554a077a
90e57bc278bc2d2a190c1b29ac2a0afbf3afe83a 05-Oct-2016 Dan Aminzade <monzy@google.com> Merge "Automatically grant location and body sensors permissions to system packages that handle the com.android.fitness.TRACK intent." into cw-f-dev
f8d60b19ce8bd61167a707e9e50621d5f61f2801 13-Sep-2016 Dan Aminzade <monzy@google.com> Automatically grant location and body sensors permissions to
system packages that handle the com.android.fitness.TRACK
intent.

BUG: 31432884
Change-Id: I57ff470fe31ca6a3e824152b7b7eafd9759e3118
efaultPermissionGrantPolicy.java
700e1e7ee8e4ed491768a35ed692a4e8f0ff0d4b 28-Sep-2016 Nicolas Prevot <nprevot@google.com> Don't allow the shell to change admin-locked app permissions.

BUG:27432532
Change-Id: I67f8794ea923edb5024033bb2a4474a1fb6d5fd9
ackageManagerService.java
9fe3b859919b04a3f3ac10ae974a866e3f20b11c 01-Oct-2016 Jakub Adamek <jakuba@google.com> Search for runtime resource overlays in Java in subdir. am: e9ac5b42d2
am: c78e3d45f6

Change-Id: Ie2c8ff3cc6016e96bc1c9c28106669a344d7246b
82de3006bdb140040da8ceeac41712a2ac9dcb87 30-Sep-2016 Makoto Onuki <omakoto@google.com> Fix DO user restrictions persisting in UMS

<device_policy_restrictions> was *not* written in <guestRestrictions>.

<guestRestrictions>
<restrictions no_sms="true" />
</guestRestrictions>
<device_policy_restrictions no_fun="true" no_adjust_volume="true" />

Fix the loading code.

Test: Manually set DO/PO restrictions, rebooted the device and checked with
dumpsys.

Bug 30949168

Change-Id: I8708a0b716852e3d981d2fe866f6628c0df80dcb
serManagerService.java
c78e3d45f68d2eb25d462901691910216fe447eb 30-Sep-2016 Jakub Adamek <jakuba@google.com> Search for runtime resource overlays in Java in subdir.
am: e9ac5b42d2

Change-Id: Ie574b44a4a374fc0eb4ce500e3463b733331ef97
e9ac5b42d242f9ff679b7ab2ed718163f0f7c799 28-Sep-2016 Jakub Adamek <jakuba@google.com> Search for runtime resource overlays in Java in subdir.

See go/sku-colors. This changes the directory to search for package
overlays if the right system property is defined. This allows
OEMs to specify different resources based on device SKUs.

Bug: 31692079
Change-Id: Ifae9ba03a4db517753ed9226048a7f912150294a
ackageManagerService.java
354736e196ff79962b3ddb52619a674044d773e2 23-Aug-2016 Dianne Hackborn <hackbod@google.com> New infrastructure to switch remaining commands to "cmd" calls.

This introduces a new feature of the IBinder command protocol
to allow the shell command implementation to call back into
its caller to ask it to open files in the calling context. This
is needed so that commands that have arguments specifying files
can open those files as the calling shell, not the system (or
whatever) process.

To test this all out, move the "am start" implementation over
to ActivityManagerShellCommand, in particular along with its
option to specify a file in which to write profiling data.

Test: Manual

Change-Id: I0c1e3857defefbd19a2ac29413aafbb34b1e48a3
taDexoptService.java
ackageManagerService.java
hortcutService.java
serManagerService.java
13018f37305f94c9a091d8f7ef4e6bc7235de781 20-Sep-2016 Andreas Gampe <agampe@google.com> OtaDexopt: Fix after-ota space measure

Actually measure the available space.

Bug: 31458900
Change-Id: I16ecee6c275229bc21e908b88b24152484025bc8
(cherry picked from commit 8d1d2ab5b94f011ed611259df387391f1a1fe60f)
taDexoptService.java
112e01480f62d42a0ce2527f7d98318cfec61b23 13-Sep-2016 Andreas Gampe <agampe@google.com> OtaDexoptService: Add tron logging

Log key properties of A/B OTA dexopting.

Bug: 31458900
Change-Id: Iba1e5a40ff8b4998d4d876800ee59940f01afb6e
(cherry picked from commit 77cc8172d31fff398b81a039b3fddc8acd1c609b)
taDexoptService.java
1920d7b434ea7424cae8249adec56856fb2484ae 10-Sep-2016 Andreas Gampe <agampe@google.com> OtaDexopt: Downgrade apps when low on space

When running low on space, attempt to "downgrade" apps to lower
states in the optimization flow to free up space before starting
the OTA.

Bug: 31347757
Change-Id: I3a44b106b83d86d7290f4c557267b319f28de12a
(cherry picked from commit dab38e000436bf8234955b0333eaecf389e65b6f)
taDexoptService.java
ackageManagerServiceUtils.java
33c592da0cac04172b6edaabf47ec09cd826bc8c 10-Sep-2016 Andreas Gampe <agampe@google.com> Installer: Support delete_odex command

Add support for deleting odex files.

Bug: 31347757
Change-Id: I29bca8751bcee8d6981c682fbbc816c73b78ac68
(cherry picked from commit e5fedb95761fbffbd80200440f32e99e0d8c6f90)
nstaller.java
71ea678683bccc5cc51365a91ffae4ea87a33fc2 07-Sep-2016 Andreas Gampe <agampe@google.com> Package Manager: Sort list of packages to dexopt

Sort the list by last-use-time, if available. Interleave the
dependencies with the packages.

Clean up the code a bit for better code reuse and ease of writing
filters.

This should help with prioritization under space constraints.

Bug: 31347757
Change-Id: Ia0ec62faf013a379dc4c80b18fd6b2bfbfa470c4
(cherry picked from commit d3e07d46d41e8411def67c2150a0bae064e900dc)
ackageManagerServiceUtils.java
a63757afb0d4d3313cbed8e6d05fb3c099c44d4e 28-Sep-2016 Todd Kennedy <toddke@google.com> Force APKs to be streamed am: e2d4f5fc31
am: f5b49fb278

Change-Id: I4ca4746acfe7c027a8251e6af54bb014c9649624
f5b49fb27810aca9abe00e315070faca323d5086 28-Sep-2016 Todd Kennedy <toddke@google.com> Force APKs to be streamed
am: e2d4f5fc31

Change-Id: I664df447803a22e8402ff354c10e1298d803fc3c
7c9aaa6ef610e99e1b46ba00ef305a7da55a2f18 28-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Force APKs to be streamed" into nyc-mr1-dev
63cc8b0b3909f2d5dde1bce9dac5051ca4d49528 22-Sep-2016 Todd Kennedy <toddke@google.com> Force APKs to be streamed

When using the new "cmd" command, APKs must be streamed instead of specifying
a file.

Change-Id: I977cd817ac545d7c5293f53b9fa4b155bea7449e
Fixes: 31251489
Test: manually installed packages using 'adb install', 'adb shell cmd package install' and 'adb shell pm install'
ackageManagerShellCommand.java
1f34323ccdc5fef1337bfea05caee914d6e75207 23-Sep-2016 liulvping <liulvping@xiaomi.com> Merge "Skip uninstalled package for getPackagesForUid()" am: f4c8c3590a am: 659cdfef75 am: fb55d69029
am: e37ed040b1

Change-Id: I3fd671695d4a0e2cc2d1e39164f350104189ca13
6b6ad04934ebd2b151211823f23717e8de9869b6 23-Sep-2016 Jeff Sharkey <jsharkey@android.com> Merge commit '8fb7520a6d7720f69661f6fae9fd868726359dec' into HEAD

Change-Id: I82b4752c4c8f8b0786f470695eac27102761fff7
20cb45c465532dfbe0e597371b60a2a4d754cc71 23-Sep-2016 Todd Kennedy <toddke@google.com> Add remote control of Instant Apps am: d15bb75af6 am: f308ffc915
am: 6f38e68456

Change-Id: I4e2344f16a82008023c63f278bce7e215d0874b8
e37ed040b1eba95765326c933c85f3c98bffcb45 23-Sep-2016 liulvping <liulvping@xiaomi.com> Merge "Skip uninstalled package for getPackagesForUid()" am: f4c8c3590a am: 659cdfef75
am: fb55d69029

Change-Id: Id468596684eb071a477beff2e3e7185ed36cd7a3
8fb7520a6d7720f69661f6fae9fd868726359dec 23-Sep-2016 Jeff Sharkey <jsharkey@android.com> Recursively restorecon when SELinux label changes.
am: 7e2bb3e6dd

Change-Id: I964b2173f556077f2718abd5b30e156e1a9e6639
d220683d339256790813348beedabe061aca643c 22-Sep-2016 Todd Kennedy <toddke@google.com> Force APKs to be streamed

When using the new "cmd" command, APKs must be streamed instead of specifying
a file.

Change-Id: I977cd817ac545d7c5293f53b9fa4b155bea7449e
Fixes: 31251489
Test: manually installed packages using 'adb install', 'adb shell cmd package install' and 'adb shell pm install'
ackageManagerShellCommand.java
6f38e684567c640fb9dbac55e1b3aab2b78c7a95 22-Sep-2016 Todd Kennedy <toddke@google.com> Add remote control of Instant Apps am: d15bb75af6
am: f308ffc915

Change-Id: If7a6884bb896c1bab38c7d0fe963c06125a44c26
fb55d69029320bbb5559a57b3024161815d61f3d 22-Sep-2016 liulvping <liulvping@xiaomi.com> Merge "Skip uninstalled package for getPackagesForUid()" am: f4c8c3590a
am: 659cdfef75

Change-Id: I253117165d33dccc8544587968503f2ef61484c3
e2d4f5fc313ecb4ba587b20fff6d346f8cd51775 22-Sep-2016 Todd Kennedy <toddke@google.com> Force APKs to be streamed

When using the new "cmd" command, APKs must be streamed instead of specifying
a file.

Change-Id: I977cd817ac545d7c5293f53b9fa4b155bea7449e
Fixes: 31251489
Test: manually installed packages using 'adb install', 'adb shell cmd package install' and 'adb shell pm install'
ackageManagerShellCommand.java
f308ffc915254644f339df23fb300c961c14e84a 22-Sep-2016 Todd Kennedy <toddke@google.com> Add remote control of Instant Apps
am: d15bb75af6

Change-Id: I0433b101966f65daeb5d1d2ea04cf648572a8e58
a08e68acb30732f2eac42f78dd3983d3401791c1 22-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Recursively restorecon when SELinux label changes."
7e2bb3e6dd1e016f74d174eb154ef44b72fe4b4c 22-Sep-2016 Jeff Sharkey <jsharkey@android.com> Recursively restorecon when SELinux label changes.

PackageManager has been pretty aggressive about asking installd to
restorecon over app data when it thinks something might have
changed. However, in the vast majority of cases these are no-op
requests, and we waste a bunch of time recursively walking all
private data, easily costing 60+ seconds on dogfooder devices.

This change relies on new installd "create_app_data" behavior that
kicks off a recursive restorecon if it detects that the top-level
SELinux label on the app private data directory changes. This means
that PackageManager no longer needs to track restoreconNeeded state.

Test: booted, verified that a label change triggered restorecon
Bug: 30768146
Change-Id: I0c8d4018cf8ff888d0ae07a82adc3d61a6002aad
ackageManagerService.java
ELinuxMMAC.java
141594b5ee928f99a9dc08b38f70301ef1e08a0b 22-Sep-2016 Jeff Sharkey <jsharkey@android.com> Recursively restorecon when SELinux label changes.

PackageManager has been pretty aggressive about asking installd to
restorecon over app data when it thinks something might have
changed. However, in the vast majority of cases these are no-op
requests, and we waste a bunch of time recursively walking all
private data, easily costing 60+ seconds on dogfooder devices.

This change relies on new installd "create_app_data" behavior that
kicks off a recursive restorecon if it detects that the top-level
SELinux label on the app private data directory changes. This means
that PackageManager no longer needs to track restoreconNeeded state.

Test: booted, verified that a label change triggered restorecon
Bug: 30768146
Change-Id: I0c8d4018cf8ff888d0ae07a82adc3d61a6002aad
ackageManagerService.java
ELinuxMMAC.java
03779f227af426058760fdc3cc40bedefaaa6179 22-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add remote control of Instant Apps" into nyc-mr1-dev
2527fa3067ce5ccc707203a06f00eea595d05308 06-Jun-2016 liulvping <liulvping@xiaomi.com> Skip uninstalled package for getPackagesForUid()

If a package with sharedUserId had been setInstalled
with false, then the result of getPackagesForUid()
should not include it.

https://code.google.com/p/android/issues/detail?id=212255

Change-Id: I7b984051db34ecc2d0ef9518786d51100ab9ac79
Signed-off-by: liulvping <liulvping@xiaomi.com>
ackageManagerService.java
1f2da9ba6f3ded0313e2283f65273a408eba46f4 22-Sep-2016 Stuart Scott <stuartscott@google.com> Continue if package is not in system am: 434c8db80f am: 0845b025aa am: b15c45a037
am: ab4e9b2fee

Change-Id: I945eafc684f3304543016ef0b5f42664b949ccab
ab4e9b2fee3212bab15961afc6fdcd048645f410 22-Sep-2016 Stuart Scott <stuartscott@google.com> Continue if package is not in system am: 434c8db80f am: 0845b025aa
am: b15c45a037

Change-Id: I8426be2a7217eb6eaf78f3e37fd787c065027411
b15c45a037cc4e43a879cbb33dacb70b0150ab4a 22-Sep-2016 Stuart Scott <stuartscott@google.com> Continue if package is not in system am: 434c8db80f
am: 0845b025aa

Change-Id: Id87f7ab2c549d176d82fbcf18479671320a74616
0845b025aad0ace454e0530b9217b7af72a42d34 22-Sep-2016 Stuart Scott <stuartscott@google.com> Continue if package is not in system
am: 434c8db80f

Change-Id: Ie2a9741583bb09ddcb27e28e18f29d63f371c8ff
434c8db80f39d75a76152cd9820769703a5bd9d4 21-Sep-2016 Stuart Scott <stuartscott@google.com> Continue if package is not in system

bug:29546655
Change-Id: Ieb17534d60db4643180b915f9b10b0c79a2224e2
efaultPermissionGrantPolicy.java
973edd19db752483f5958f974068c89fead1371b 09-Sep-2016 Svet Ganov <svetoslavganov@google.com> Don't show account access request UI until app launched.

Sync adapters that don't have account access cannot run until
the user explicitly approves in the UI. This is spammy given
the user may not use the app right away. This change doesn't
show the notificaiton until the app has run.

bug:31162498

Change-Id: I1f4f2d2e9426f78763590e8aa542b94d6e93e488
ackageManagerService.java
ettings.java
b2ad9bb689bb95d50ce8c5cff38cafd3198820ad 21-Sep-2016 Andreas Gampe <agampe@google.com> OtaDexopt: Fix after-ota space measure am: 8d1d2ab5b9 am: 3a38623360
am: e7b2f0ed27

Change-Id: I5f9afdd5d904a24b2e2cdd206df1caa9244a9a63
e7b2f0ed2784b7cb1bb4e6bbd3eeb2020f644c5e 20-Sep-2016 Andreas Gampe <agampe@google.com> OtaDexopt: Fix after-ota space measure am: 8d1d2ab5b9
am: 3a38623360

Change-Id: I0e9a989dc28b4ab4e33790a0603518e1f8eb6a70
3a3862336035bcbf36be847840cb4403976c15dc 20-Sep-2016 Andreas Gampe <agampe@google.com> OtaDexopt: Fix after-ota space measure
am: 8d1d2ab5b9

Change-Id: I82df8c8a4e53a4448a5eac6392b1a5005af3d589
8d1d2ab5b94f011ed611259df387391f1a1fe60f 20-Sep-2016 Andreas Gampe <agampe@google.com> OtaDexopt: Fix after-ota space measure

Actually measure the available space.

Bug: 31458900
Change-Id: I16ecee6c275229bc21e908b88b24152484025bc8
taDexoptService.java
798e6401cf443e0b233691175c6567478398921d 16-Sep-2016 Makoto Onuki <omakoto@google.com> Don't update publisher version code without scanning manifest am: c8c3329dd9 am: 318df80280
am: f4d5e96d0e

Change-Id: Ib121bbf11637d9586f6c20c12cf505e562bd913b
f4d5e96d0e130c4147fb3917f5c1220c2e40c108 16-Sep-2016 Makoto Onuki <omakoto@google.com> Don't update publisher version code without scanning manifest am: c8c3329dd9
am: 318df80280

Change-Id: I890f24f93127e59a426267cec4869007f55e6f91
318df80280d9ca5f78b58eae05b3a9816da4e40a 16-Sep-2016 Makoto Onuki <omakoto@google.com> Don't update publisher version code without scanning manifest
am: c8c3329dd9

Change-Id: Idcf25b8710a137b3920b1395df6e98cb4cfa6973
845096ffa36d38f010f4bc1b34c7891ccaf74e93 16-Sep-2016 Makoto Onuki <omakoto@google.com> Merge "Don't update publisher version code without scanning manifest" into nyc-mr1-dev
8b2ee3d611149bc9f009e41942384ea181d8caa3 16-Sep-2016 Makoto Onuki <omakoto@google.com> Fix system crash due to mismatching begin/finishBroadcast() am: 7bdb9ce978 am: f3c4729947
am: 47fc09457d

Change-Id: Ied3686b611a73b78d50d5737ec65522bfef6f63f
bfce228eda859a089995807d572b7894ce4b4a5f 16-Sep-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Recycle userIds after hitting the limit"
47fc09457d68fd81de6286d06e09048b9133fbd5 16-Sep-2016 Makoto Onuki <omakoto@google.com> Fix system crash due to mismatching begin/finishBroadcast() am: 7bdb9ce978
am: f3c4729947

Change-Id: Icbbc6521164e376501ec2473f40babf9aeb13462
f3c4729947af9ecc0e6a698c5a80e2655743b8cb 16-Sep-2016 Makoto Onuki <omakoto@google.com> Fix system crash due to mismatching begin/finishBroadcast()
am: 7bdb9ce978

Change-Id: I032370f8bdf9f6c0f7e75253b7f3950795f359ab
0f4533d8a185cdefbbe79b5eb8ff13eef924382c 19-May-2016 Fyodor Kupolov <fkupolov@google.com> Recycle userIds after hitting the limit

Previously the system had to be rebooted to allow reusing IDs of removed
users.

Now removed userIds will be recycled after hitting MAX_USER_ID limit.
In this stage all mRemovingUserIds are released, with the exception of ids
stored in an LRU queue - mRecentlyRemovedIds

Added debug flag RELEASE_DELETED_USER_ID to allow reusing of userIds
immediately after the user is deleted.

Bug: 28822373
Change-Id: Ibde562c69efc1533dbca2f1f8d919bee7473644f
serManagerService.java
fdfefdfbcb46ef92bcda5ffb1f9cd8d4774d4059 16-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "More refactoring"
d15bb75af67df53f7335bdb7d7468f387848d6fe 14-Sep-2016 Todd Kennedy <toddke@google.com> Add remote control of Instant Apps

Bug: 31470039
Test: manual
Change-Id: I82eb47f4d24fb88d0f264eca1176aec55364867c
ackageManagerService.java
3cd658e1a598e59738bc129c35eecf4cd0f20680 17-Aug-2016 Todd Kennedy <toddke@google.com> More refactoring

* Break apart getSettingsWithBenefits() into separate methods for creating
new settings and updating settings, etc...
* Add more hooks to test equality of setting clones
* Create tests for each subset of functionality

Bug: 30219944
Change-Id: I1fb3d07bb9279f93ba81ada2ff802989ec2c5965
ackageManagerService.java
ackageSetting.java
ackageSettingBase.java
ermissionsState.java
ettings.java
7bdb9ce97811782864d3b54616f233c041590c7e 15-Sep-2016 Makoto Onuki <omakoto@google.com> Fix system crash due to mismatching begin/finishBroadcast()

Bug 31449363

Change-Id: I514196355a2566c5e4f7f3af91fbf3c57cb67a48
auncherAppsService.java
63dc6f89c151e2a6b1efca94b8433caa9e4d7be5 14-Sep-2016 Andreas Gampe <agampe@google.com> OtaDexoptService: Add tron logging am: 77cc8172d3 am: 3cbdd5f452
am: 708da9dd73

Change-Id: I80dcab799f5c30e7050a6d7cf0e0e3aa7f9d8b1e
bf9751f6ddef6d2a782cb9b0248c2901cb41f3bc 14-Sep-2016 Todd Kennedy <toddke@google.com> enable instant apps am: 7ef97b6624 am: 828c5b8c36
am: b99c4bcb5c

Change-Id: Ie311e03372e3884b9d1676387c6256d96faa36cc
4fa2ccfebb55b17d05e5201425361e166c66eb43 14-Sep-2016 Andreas Gampe <agampe@google.com> OtaDexopt: Downgrade apps when low on space am: dab38e0004 am: 2268edb7de
am: aeb291478a

Change-Id: I6c3327d81ae1613fd5b7db7b0ed4206b5577fb71
c9dab9125b87817bce040ade6b381b247de0b537 14-Sep-2016 Andreas Gampe <agampe@google.com> Installer: Support delete_odex command am: e5fedb9576 am: dc8f2b6681
am: abc0a977ed

Change-Id: I1dc6183c8c793b1846b30497a7643ce22e358cc8
708da9dd73802f6a9e4ecf9bb9bed4476bc76a44 14-Sep-2016 Andreas Gampe <agampe@google.com> OtaDexoptService: Add tron logging am: 77cc8172d3
am: 3cbdd5f452

Change-Id: I4cb836a2e0f64951236a84fe36f91ac95f0adf42
3cbdd5f4529c5a93d113e87c4aa6fdd771c57f58 14-Sep-2016 Andreas Gampe <agampe@google.com> OtaDexoptService: Add tron logging
am: 77cc8172d3

Change-Id: Ib1c0aa4fe9977080e42cf2f03bb22d37690ea9cc
febb0200badf2047690cf4020bba279f853c89eb 14-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "OtaDexoptService: Add tron logging" into nyc-mr1-dev
f3a88c353d368dfdccbe5b6824ce5c2037d594d2 14-Sep-2016 Todd Kennedy <toddke@google.com> Add filter ordering am: c2e96d45d2 am: cdda4eed12
am: 792cac6fd6

Change-Id: I94c998b9b32c4e6d3e7162cda4ff8bc7723dd2d9
8e9852c7e878d3e51fa8e373f59f429f12b54934 14-Sep-2016 Todd Kennedy <toddke@google.com> Invoke service w/ action am: 7d59cb81f8 am: b45d86e429
am: 5384e2dc04

Change-Id: I3729e755e389b573e1c974fbfd72692ecc674a12
77cc8172d31fff398b81a039b3fddc8acd1c609b 13-Sep-2016 Andreas Gampe <agampe@google.com> OtaDexoptService: Add tron logging

Log key properties of A/B OTA dexopting.

Bug: 31458900
Change-Id: Iba1e5a40ff8b4998d4d876800ee59940f01afb6e
taDexoptService.java
b99c4bcb5c0bec46f7846554d9914076caeb438f 13-Sep-2016 Todd Kennedy <toddke@google.com> enable instant apps am: 7ef97b6624
am: 828c5b8c36

Change-Id: I825cea93c36ede01c04966c5f74bb1d7cccb37d9
828c5b8c367eb8f21bd5c691b7235287cc204d1c 13-Sep-2016 Todd Kennedy <toddke@google.com> enable instant apps
am: 7ef97b6624

Change-Id: I4a9a5f38380c9b7bd564b451eb358de044aea66a
6b3965a5dfa67daa3c124589864eec867a5a9cbb 13-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "enable instant apps" into nyc-mr1-dev
c8c3329dd918b8ea16d6317d19ddee12325800f3 13-Sep-2016 Makoto Onuki <omakoto@google.com> Don't update publisher version code without scanning manifest

- It was (theoretically) possible for shortcut manager to update
the version code for a publisher package without rescanning manifest
shortcuts, if backup happens right after unlocking a user before
SM searches for updated packages. If it happens, then SM will not
scan the manifest for this package until it's updated next time.

So don't refresh the version code during backup, which we only
have to do for launchers but not publishers.

- Also fix the owner-user-id for launchers. (Luckily it's not causing
any issues.)

Bug 31402152

Change-Id: I5d898eb3882b74edaca8b2d5f960849370ffc23b
hortcutLauncher.java
hortcutPackage.java
hortcutPackageInfo.java
hortcutPackageItem.java
hortcutService.java
aeb291478a619c99c4463bb44c140dad5715f7fd 13-Sep-2016 Andreas Gampe <agampe@google.com> OtaDexopt: Downgrade apps when low on space am: dab38e0004
am: 2268edb7de

Change-Id: Ie5c5256a8c3dc397693526d6324f9c0e1a03e83a
abc0a977ed5a31f42c64768e1fcd79f3731cd788 13-Sep-2016 Andreas Gampe <agampe@google.com> Installer: Support delete_odex command am: e5fedb9576
am: dc8f2b6681

Change-Id: Ib1ee3a50b64f727e1718b200299d1590916f3a98
2268edb7dea8934205abe5c76e838a927e5ee9f1 13-Sep-2016 Andreas Gampe <agampe@google.com> OtaDexopt: Downgrade apps when low on space
am: dab38e0004

Change-Id: I6811ec4676213236d564bf26191a967427cf84b7
dc8f2b6681d163eb4e70f9eb69a6d30c56089900 13-Sep-2016 Andreas Gampe <agampe@google.com> Installer: Support delete_odex command
am: e5fedb9576

Change-Id: Ia8258183d1646c583047df8dc386da1d291d930b
67ce5f0c90e366b02cb39cbe0fa6613f88056a40 13-Sep-2016 Andreas Gampe <agampe@google.com> Merge changes from topic 'installd_delete_odex' into nyc-mr1-dev

* changes:
OtaDexopt: Downgrade apps when low on space
Installer: Support delete_odex command
7ef97b6624054fff0d712d85336a45eee70bcc3f 09-Sep-2016 Todd Kennedy <toddke@google.com> enable instant apps

Change-Id: I91aca48efe3d2b0a5035ffdcff0d6a893ee515e1
Fixes: 30256615
ackageManagerService.java
dab38e000436bf8234955b0333eaecf389e65b6f 10-Sep-2016 Andreas Gampe <agampe@google.com> OtaDexopt: Downgrade apps when low on space

When running low on space, attempt to "downgrade" apps to lower
states in the optimization flow to free up space before starting
the OTA.

Bug: 31347757
Change-Id: I3a44b106b83d86d7290f4c557267b319f28de12a
taDexoptService.java
ackageManagerServiceUtils.java
c78be8772a88c9c39c3c67a8336fafafbad38a99 10-Sep-2016 Svet Ganov <svetoslavganov@google.com> [DO NOT MERGE] Don't show account access request UI until app launched. am: d63cde7ba4
am: 99d29ddf42

Change-Id: I1e6977d2478bf695d9840a72cba6e0e1b600b1e6
99d29ddf42a749c5077c32ba9229cd47b39ae4d0 10-Sep-2016 Svet Ganov <svetoslavganov@google.com> [DO NOT MERGE] Don't show account access request UI until app launched.
am: d63cde7ba4

Change-Id: I06a6b98c9c4a1cd67ed155d42cf4fe5149015675
32ce3c8797fd286e3771b05a53d4dcd1f6d2ceda 10-Sep-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "[DO NOT MERGE] Don't show account access request UI until app launched." into nyc-mr1-dev
e5fedb95761fbffbd80200440f32e99e0d8c6f90 10-Sep-2016 Andreas Gampe <agampe@google.com> Installer: Support delete_odex command

Add support for deleting odex files.

Bug: 31347757
Change-Id: I29bca8751bcee8d6981c682fbbc816c73b78ac68
nstaller.java
d63cde7ba4a96d5a07efd48d67e552cadb45d9ce 09-Sep-2016 Svet Ganov <svetoslavganov@google.com> [DO NOT MERGE] Don't show account access request UI until app launched.

Sync adapters that don't have account access cannot run until
the user explicitly approves in the UI. This is spammy given
the user may not use the app right away. This change doesn't
show the notificaiton until the app has run.

bug:31162498

Change-Id: I1f4f2d2e9426f78763590e8aa542b94d6e93e488
ackageManagerService.java
ettings.java
792cac6fd64039cce523979cd2bbdec55dff74c6 09-Sep-2016 Todd Kennedy <toddke@google.com> Add filter ordering am: c2e96d45d2
am: cdda4eed12

Change-Id: I6c4782393a5f694cba8238a05e60939169bd464f
cdda4eed1219738c79de88eb12b23b0293e56b04 09-Sep-2016 Todd Kennedy <toddke@google.com> Add filter ordering
am: c2e96d45d2

Change-Id: I9bc8994293a45684238c7d1377d30ef8c049ce81
5384e2dc044f7a99dbda22eca48eebad34f9a084 09-Sep-2016 Todd Kennedy <toddke@google.com> Invoke service w/ action am: 7d59cb81f8
am: b45d86e429

Change-Id: I289babb9660c36869fa1ad15c1d88abe40416cba
295f5108f1984a4aade683ae73da3b69f0a29cc4 09-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add filter ordering" into nyc-mr1-dev
b45d86e429c1faaae1232c38fe91d93594761b82 09-Sep-2016 Todd Kennedy <toddke@google.com> Invoke service w/ action
am: 7d59cb81f8

Change-Id: If31d387ac0da4fca2547c66780c7aa0987bfa357
0fae3e61717b53bbb64d5446aba546142e98368f 09-Sep-2016 Daniel Nishi <dhnishi@google.com> Fix a bug where the Deletion Helper could not delete packages. am: 26af56d28e
am: 70939124c2

Change-Id: I7600f1c4916d682e6240c00e18a266326eb90bf6
b64095df866906210dd7e14b19471d82a20b4af7 09-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Invoke service w/ action" into nyc-mr1-dev
70939124c2b7e16fc649002e82db470e0378adef 09-Sep-2016 Daniel Nishi <dhnishi@google.com> Fix a bug where the Deletion Helper could not delete packages.
am: 26af56d28e

Change-Id: I6f9d5e1eedd423dd6913a5a264b1df13bc4e67d4
f9cc32c87f879d0877d55d715b948d1641b42917 09-Sep-2016 Pierre-Laurent Coirier <plcoirier@google.com> [DO NOT MERGE] Grant fixed SMS & Phone permission to package handling the twinning settings intent.
am: 87e03713a2

Change-Id: I98a63c0761d22a60efb6d7628848dc73f2944e36
0df86bee98ee96724920de80ab289be53be5caad 09-Sep-2016 Pierre-Laurent Coirier <plcoirier@google.com> Merge "[DO NOT MERGE] Grant fixed SMS & Phone permission to package handling the twinning settings intent." into cw-f-dev
87e03713a249d0ca88ad1a23d361384e969d6d89 26-Feb-2016 Pierre-Laurent Coirier <plcoirier@google.com> [DO NOT MERGE] Grant fixed SMS & Phone permission to package handling the twinning
settings intent.

This change was never merged down from cw-e-dev to nyc-dev (there were a
merge conflict that was skipped to quickly unblock nyc-dev since this
change isn't needed for phone)

Original CL: ag/874613

The test part of this CL is already merged down to nyc (see ag/874315).

BUG: 27343350
Change-Id: I818424e94006910dc25bab7cccb24f7979c39c9e
efaultPermissionGrantPolicy.java
c2e96d45d27ab1465aaef89c1a3161708c714bcd 09-Sep-2016 Todd Kennedy <toddke@google.com> Add filter ordering

Filter ordering allows automatic disambiguation between multiple filters
that matching a pattern. Ordering currently only works for EphemeralResolveInfo
objects.

Bug: 30837021
Change-Id: Ia217218c7c7d159dbd75d7733c45556e690d06d2
ackageManagerService.java
7d59cb81f898ac190c9b9fa80c482078104a0730 08-Sep-2016 Todd Kennedy <toddke@google.com> Invoke service w/ action

GMS uses a service proxy and needs the action to be able to route
the connection to the proper service.

Bug: 30805203
Change-Id: I4e2177170c19dd7572226fc4f7eb36f67592e45d
phemeralResolverConnection.java
26af56d28ea50f71d59c87e366d708966cc0d1de 25-Aug-2016 Daniel Nishi <dhnishi@google.com> Fix a bug where the Deletion Helper could not delete packages.

Bug: 31096000
Change-Id: I780cf74dc6750110024dcb0008b47879597f0156
ackageManagerService.java
cda87c54d6126d046e7cb3a71c4b177d89c2d816 08-Sep-2016 Andreas Gampe <agampe@google.com> Package Manager: Sort list of packages to dexopt am: d3e07d46d4 am: c6340e7020
am: ff2cbd1d84

Change-Id: I7a58ff9b1961d4b85aed1f10f6d9de3c1681f593
ff2cbd1d84acbd1048a379f3534794752da8fd97 08-Sep-2016 Andreas Gampe <agampe@google.com> Package Manager: Sort list of packages to dexopt am: d3e07d46d4
am: c6340e7020

Change-Id: Ib24ebee1b0cfab80280dc4c644c1a9c37adb3965
d3e07d46d41e8411def67c2150a0bae064e900dc 07-Sep-2016 Andreas Gampe <agampe@google.com> Package Manager: Sort list of packages to dexopt

Sort the list by last-use-time, if available. Interleave the
dependencies with the packages.

Clean up the code a bit for better code reuse and ease of writing
filters.

This should help with prioritization under space constraints.

Bug: 31347757
Change-Id: Ia0ec62faf013a379dc4c80b18fd6b2bfbfa470c4
ackageManagerServiceUtils.java
c07581806363fbbbd614a1201bf2d902c72b92ab 07-Sep-2016 Mathieu Chartier <mathieuc@google.com> Merge "Avoid profile guided compilation for vmSafeMode" am: a817838e8b am: 7554be1e36 am: e65bf6d173
am: c49450e536

Change-Id: Ibbac1c391516999c2b9c7803e5f98353b6996477
750aec0ed01d1c9ed6611d90049b0bedbdeaddfc 07-Sep-2016 Calin Juravle <calin@google.com> [RFC] Special case system apps for profile optimizations am: 08313b0d95 am: 788e111cba am: 0bc450ac05
am: f0036acbfd

Change-Id: I494263f25297bcd134bcf1e7101c21e27c61f4f9
c49450e536da40e72d458a6527e8780bf91c9c56 07-Sep-2016 Mathieu Chartier <mathieuc@google.com> Merge "Avoid profile guided compilation for vmSafeMode" am: a817838e8b am: 7554be1e36
am: e65bf6d173

Change-Id: If800f4ea170dce4c3c3a478305b990748de3139e
f0036acbfd7ccd372e9b8ddbbb0de7bfd5834e04 07-Sep-2016 Calin Juravle <calin@google.com> [RFC] Special case system apps for profile optimizations am: 08313b0d95 am: 788e111cba
am: 0bc450ac05

Change-Id: I18324f1074a8c62002b88810ffcf61cd2efcd21e
e65bf6d1731cc78b15af84ef434351e3948100b8 07-Sep-2016 Mathieu Chartier <mathieuc@google.com> Merge "Avoid profile guided compilation for vmSafeMode" am: a817838e8b
am: 7554be1e36

Change-Id: I4d34ab801e08034c7d54818cc0f313efa88edf69
a817838e8be4902c2906d3d4abada8fd22461af4 07-Sep-2016 Mathieu Chartier <mathieuc@google.com> Merge "Avoid profile guided compilation for vmSafeMode"
893fbf87dc17a94a93348e874e099147e062c628 06-Sep-2016 Todd Kennedy <toddke@google.com> Release mPackages lock earlier am: 94f9be2ee2
am: 2ee7053cfc

Change-Id: If18e59f7a4575f88d0f196b0a4fbe869644392a7
18d954183a706484e5fcc390922ba3d3e12a9c7b 06-Sep-2016 Andreas Gampe <agampe@google.com> OtaDexopt: Special-case system app classpaths am: 3f95d0bb6a
am: 6c22810fb3

Change-Id: Id9b936123e43c0ced3f1ab4f4aab629b707562a1
be1adf2e728fb1700ad9a6f901ded11a7e0c97f9 06-Sep-2016 Andreas Gampe <agampe@google.com> OtaDexoptService: Run dexopt on all apps am: 14186731f9
am: 4775ba500c

Change-Id: Ib35dd0b8a268a1f9f3e5f9739a5f2eaaa320ef39
4cff287df2ffcf9e5a959dabc8b65961d9a737ae 06-Sep-2016 Andreas Gampe <agampe@google.com> Frameworks/base: Add compiler stats to Package Manager am: 7e619a912c
am: 723bbd880a

Change-Id: Ia02fbf2770aaf4186633421a6c11aa0b95dd8f64
0bc450ac052bc20fa88186adf4401b57f0007866 06-Sep-2016 Calin Juravle <calin@google.com> [RFC] Special case system apps for profile optimizations am: 08313b0d95
am: 788e111cba

Change-Id: I8466811b44b623e23117d6554e69cc80e2c4485f
30d58efb59ece9b668536192209c5354d736103d 06-Sep-2016 Calin Juravle <calin@google.com> Compile core-apps according to their own "reason" for A/B am: 9438528d99
am: 54a3247073

Change-Id: I9a95c7e64379757a00373f54521e035ff920ebe7
2a04b0876f3923a0c3acd0a2bfda1b2016351b10 06-Sep-2016 Andreas Gampe <agampe@google.com> Frameworks/base: Add new flow to OtaDexoptService am: d15300cf38
am: 32a092adf3

Change-Id: I7a49f0732cf24c2a86f798c6725a664e93092d7b
82f8ebc2b7654e6d9147efaa60db681e81a25cc6 06-Sep-2016 Andreas Gampe <agampe@google.com> Otadexopt: Expose progress percentage am: ff8ab4c9fa
am: 630a372a1d

Change-Id: I25937bf6a90076b37c5c322ccc8335fef3a9e6ee
53ad58b21a56311a3a6380cc6344f91bb424f221 06-Sep-2016 Alex Light <allight@google.com> cp preopted files from B partition during PM init. am: 2b6fc4c92d
am: 0b89b352d4

Change-Id: I7da5e74d61dd82c177bf4ca2a87085317e9973f5
0acdf65c55eec7cf5ff2ee615c35c0709faade70 06-Sep-2016 Jorim Jaggi <jjaggi@google.com> Only show optimizing storage dialog if dex opt dialog was shown am: 2578beccbe am: fd33b0194a
am: 9713b29e3c

Change-Id: I2ce3ec3836dd24e1ba306f9f991435aa196316d4
94f9be2ee2a40b390cc4de1f24a33d0b662a2d79 18-Aug-2016 Todd Kennedy <toddke@google.com> Release mPackages lock earlier

We cannot hold mPackages when calling into generatePackageDexopts().
This method takes Package Manager's mInstallLock. By holding mPackages,
we have lock inversion and hilarity ensues.

Change-Id: Ia11a158677051e3511702f38cde6780e75b256fb
Fixes: 30927731
(cherry picked from commit a8d4f489974f3ea8f73990cbabbce205343fb926)
taDexoptService.java
3f95d0bb6af6a155291cff3f6b61b2b25348127f 02-Aug-2016 Andreas Gampe <agampe@google.com> OtaDexopt: Special-case system app classpaths

Specialize system apps' shared libraries so that classpath checks
are elided.

Bug: 30568568
Change-Id: Id1f2555ef43984b616e01f8596701ccba77895b3
(cherry picked from commit c7e02c1d2a53e0f738d2a8383e03658b39d91ce6)
taDexoptService.java
14186731f98d326239922d093371d1e63b8c22a5 29-Jul-2016 Andreas Gampe <agampe@google.com> OtaDexoptService: Run dexopt on all apps

To avoid work after reboot, dexopt all apps. However, unimportant
apps are optimized with the first-boot reason (which is usually
interpret-only) for space reasons.

Bug: 30468718
Change-Id: Ia05d879957388967c69f9380e50d8a9834afe07d
(cherry picked from commit 115514b236ebe7cb3c90892891954b8c7ba69335)
taDexoptService.java
7e619a912cf6a53ede7d7eea67f8bc8ed1158e24 13-Jul-2016 Andreas Gampe <agampe@google.com> Frameworks/base: Add compiler stats to Package Manager

Add a simple class for storing compiler statistics. Capture compile
times for code paths from a package.

Bug: 29223204
Change-Id: I1b066de6a83a739470a42480eee0bfef88423eea
(cherry picked from commit 37e5fdc6b4963f3533caecdd92b129f79da69dd8)
bstractStatsBase.java
ompilerStats.java
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ackageUsage.java
08313b0d952b6d5fa6e7ed7e3a5e4a7154a7d2c9 12-Jul-2016 Calin Juravle <calin@google.com> [RFC] Special case system apps for profile optimizations

If the OTA updates a system app which was previously preopted to a non-
preopted state the app might end up being verified at runtime. That's
because by default the apps are verify-profile but for preopted apps
there's no profile.

Do a hacky check to ensure that if we have no profiles (a reasonable
indication that before the OTA the app was preopted) system apps get
compiled with a non-profile filter (by default interpret-only).

Bug: 30032273
Test: Andreas "has verified that Calin's change to A/B works as expected
and promotes things like SystemUI to speed. From my side, that's
ready to be merged"

Change-Id: I7a052a8ea76cab7f649dc993237ea05534d6c4b9
(cherry picked from commit 0bd776207999ccba17e5adb163710bd7b16ac907)
ackageManagerService.java
9438528d99a404ce10e567bbbb5f0cc9519fb5da 12-Jul-2016 Calin Juravle <calin@google.com> Compile core-apps according to their own "reason" for A/B

If the core apps are not preopted in the B OTA, and REASON_AB_OTA is not
speed (by default is speed-profile) they will be interepreted/JITed.
This in itself is not a problem as we will end up doing profile guided
compilation. However, some core apps may be loaded by system server
which doesn't JIT and we need to make sure we don't interpret-only.

Bug: 30032273
Change-Id: Idb11b1c01c4c4ceba043feb3a9ccc6958035d3b7
(cherry picked from commit 565621328dd4fc2e179a34494d0f8b8dc1b1eae9)
taDexoptService.java
d15300cf38ae3840309dc6cb6c093b17713fc277 24-Jun-2016 Andreas Gampe <agampe@google.com> Frameworks/base: Add new flow to OtaDexoptService

Add functionality to capture/intercept installd communication, and
use this to return the full communication for dexopt. These parameters
can be used to drive otapreopt_chroot directly.

Keep the old direct invocation alive until devices have transitioned
to a service that exposes this API.

In preparation for renaming of A/B OTA artifacts to include target
slot names.

Bug: 25612095
Bug: 28069686
Change-Id: I14728ee1266f3882cada8f08dd21891ed5f7a0cb
(cherry picked from commit cc241a580cb9b753d0dde0cea578feb74ad517e7)
nstaller.java
taDexoptService.java
taDexoptShellCommand.java
ff8ab4c9fade0dd95bac6df6506e1ce14dbd8e42 11-Jun-2016 Andreas Gampe <agampe@google.com> Otadexopt: Expose progress percentage

To be able to report progress of an A/B OTA dexopt, expose a
progress function that the script can query.

Bug: 25612095
Bug: 29223204
Change-Id: Ie8162946d18f6fa78649a40ad5d3949d31a181cd
(cherry picked from commit bf06232f4d440ced8230662a77ca0e8ece6383ca)
taDexoptService.java
taDexoptShellCommand.java
2b6fc4c92deac1572b68f3cfc326da0a230055a7 23-Jun-2016 Alex Light <allight@google.com> cp preopted files from B partition during PM init.

This allows us to save space on the system partition while still
having access to the preopted files.

We do this on first boot when the "ro.cp_system_other_odex" property
is set to 1. We do this during package manager initialization before
scanning the system to see which apks need to be optimized again.

Note that a separate script, run by init, is actually responsible for
finding and copying the files. We simply request that it runs.

Bug: 29278988

Change-Id: I8d7c790ad35b32a0ce1d87939f043419bae4d88a
(cherry picked from commit 3dafee6c1820bf0946bab04b290c5a757112d3e7)
ackageManagerService.java
9713b29e3ccd463bb7ee3dd89db67f18aafcd9ff 04-Sep-2016 Jorim Jaggi <jjaggi@google.com> Only show optimizing storage dialog if dex opt dialog was shown am: 2578beccbe
am: fd33b0194a

Change-Id: Ib9beeed392d134aa2a367e8758165ca05eef1b3e
41e4a376f1fa700ba5ad18ce0f9efb45478c5454 03-Sep-2016 Mathieu Chartier <mathieuc@google.com> Avoid profile guided compilation for vmSafeMode

Bug: 30688277
Bug: 30733908

Test: adb shell cmd package compile -m speed-profile comb.BBClient

Change-Id: I6783c80566b6b3b67025a3d258ebbdede0c7ca2d
ackageDexOptimizer.java
2578beccbeacd605728e018cf390c10cef72b48b 02-Sep-2016 Jorim Jaggi <jjaggi@google.com> Only show optimizing storage dialog if dex opt dialog was shown

This doesn't take long, so there is little reason to show it if
we didn't show the dex opt dialog.

Bug: 29643498
Change-Id: I955f9dfa233166a8a150deb2d115a591e6d82394
ackageManagerService.java
16c94f69899d06af69189648ba824cb5ac5a576e 01-Sep-2016 Todd Kennedy <toddke@google.com> Clear calling identity am: c25fbdec41 am: af34fdbee8
am: 62c087b430

Change-Id: I1aef6968e11cb77ddd828afe466d0d9484960b65
55d34d1626f30715e86a4b8b99cc23589d68b715 01-Sep-2016 Sudheer Shanka <sudheersai@google.com> resolve merge conflicts of 437062e to master

Change-Id: I7404a0ab39416bbd90d7c0fb1c478ec51436b06e
3e42403586d61e1ab48eb3e7b68a4514b476f97d 01-Sep-2016 Todd Kennedy <toddke@google.com> throw if >1 verifier found am: 5320ee42c6 am: 73a05d1865
am: f1582a94f0

Change-Id: I61dd0a596f7c46bd0c37c37d2e288bc7681991da
62c087b4308e45f458b61678fa0fd83c755ed57e 01-Sep-2016 Todd Kennedy <toddke@google.com> Clear calling identity am: c25fbdec41
am: af34fdbee8

Change-Id: I97e5a5905cd3491d38b287d39e864000f9c6d350
af34fdbee875a995f5c4826288e987fb2658566a 01-Sep-2016 Todd Kennedy <toddke@google.com> Clear calling identity
am: c25fbdec41

Change-Id: Ife652c8496369be624c60f68a3b3fa2bdd112fe7
072abeac5711e19e23c53354877e56eaf5c0526d 01-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Clear calling identity" into nyc-mr1-dev
437062e011bc870f14b3981c5cb66f23d2b56bca 01-Sep-2016 Sudheer Shanka <sudheersai@google.com> Allow package verifier and uninstaller to do silent uninstalls. am: bf6154a5ba
am: 51b6b7d507

Change-Id: I4443dcf82d9a40d0051618b65175018489e1dba2
51b6b7d507a9c6d33ada85e94b70f8a4435803ec 01-Sep-2016 Sudheer Shanka <sudheersai@google.com> Allow package verifier and uninstaller to do silent uninstalls.
am: bf6154a5ba

Change-Id: Iab55e58e02a2088c541406bc0b71aa14df7b028e
f1582a94f0212d881ad8693c813edf06b263b634 01-Sep-2016 Todd Kennedy <toddke@google.com> throw if >1 verifier found am: 5320ee42c6
am: 73a05d1865

Change-Id: I897cfe173beb551494dae1bf9c6fc682a1ee4915
0b69970e36dece05302b60a685a9bb0aa6546ed3 01-Sep-2016 Sudheer Shanka <sudheersai@google.com> Merge "Allow package verifier and uninstaller to do silent uninstalls." into nyc-mr1-dev
b118e414cddb767f72d712be45e8e0b52406c8bc 01-Sep-2016 Makoto Onuki <omakoto@google.com> Shortcut: Improve backup & restore am: fc4cf2da34 am: 27b36f4789
am: cecc0916a1

Change-Id: Ib4af06a42b6d940f422c749aeb706cafa828b49a
73a05d1865c2859981e1884bce19d1632ff2ec11 01-Sep-2016 Todd Kennedy <toddke@google.com> throw if >1 verifier found
am: 5320ee42c6

Change-Id: Ie59f45fa660564ecf073bde4e750d65cf2752467
c25fbdec414f78341870cfac554121caf7521927 01-Sep-2016 Todd Kennedy <toddke@google.com> Clear calling identity

Before getting the package uid, need to clear the calling identity

Change-Id: Id917288f5457baa7672d0355889a498bc9a92cb3
Fixes: 31058820
Test: cts-tradefed run commandAndExit cts --skip-connectivity-check --skip-device-info --disable-reboot -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testPackageInstallUserRestrictions
ackageInstallerSession.java
a1ce6ee444e105f2b7aac66912cf18e85baf58ad 01-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "throw if >1 verifier found" into nyc-mr1-dev
d280641d2ecbfa02e1abd18a3bf3b2050c35ba09 01-Sep-2016 Sudheer Shanka <sudheersai@google.com> Allow apps with CREATE_USERS permission to create demo users. am: 234d1afd79 am: 0be41fc1a9
am: ad520f877f

Change-Id: I7e7f759995e06cae7b8f6a0ba636f31f48b1f5ff
d47e4143ae31de8b74b1a77747bb596bc3ce4ba3 31-Aug-2016 Daniel Nishi <dhnishi@google.com> Merge "Fix a bug where the Deletion Helper could not delete packages."
2d78dc7437b069b66a7791b4a887fcd35cfcf43a 31-Aug-2016 Yi Kong <yikong@google.com> Merge "Track getxattr API change" am: c4c4a1e76e am: f897e1c3b6 am: 2b5a0d299d
am: be5137f4cb

Change-Id: I6a9f9b807b8dfc4aed83fe7d2610033dc63e4269
8402d225c0ef0ff7088c18d603c68c58edc844f6 31-Aug-2016 Todd Kennedy <toddke@google.com> Enable web action apps based on system setting am: efc1c4d501 am: 742f4de6cf
am: 66db34fbe2

Change-Id: Ic1726786e0baeaf758381f3a9a9324ea39b921be
bf6154a5ba3ec164d5f29465dcb65213cc641b22 26-Aug-2016 Sudheer Shanka <sudheersai@google.com> Allow package verifier and uninstaller to do silent uninstalls.

Bug: 30280938
Bug: 31146793
Change-Id: I450340d9bafd3c1b7c1bfb8ae9281a23cb8a0b5e
ackageManagerService.java
cecc0916a19a81f1dd02c02e2056edd2cb128798 30-Aug-2016 Makoto Onuki <omakoto@google.com> Shortcut: Improve backup & restore am: fc4cf2da34
am: 27b36f4789

Change-Id: I24e4739da81923ca2cf3cfdfd8c97b3fea53ec95
27b36f4789e6d56e059b46312748fcb9b6e97171 30-Aug-2016 Makoto Onuki <omakoto@google.com> Shortcut: Improve backup & restore
am: fc4cf2da34

Change-Id: I28f431158929dd585b0c7523ee6e16798650f98a
dec5726c43b988d58f73f1f6951644b056233f9b 30-Aug-2016 Makoto Onuki <omakoto@google.com> Merge "Shortcut: Improve backup & restore" into nyc-mr1-dev
ad520f877f8b57b83a21fb71c244e73eb95b2267 30-Aug-2016 Sudheer Shanka <sudheersai@google.com> Allow apps with CREATE_USERS permission to create demo users. am: 234d1afd79
am: 0be41fc1a9

Change-Id: I9da0eedb106d61c7041df78d0b287e6f28fe3069
0be41fc1a965c94b26c596f352ad095135b255ee 30-Aug-2016 Sudheer Shanka <sudheersai@google.com> Allow apps with CREATE_USERS permission to create demo users.
am: 234d1afd79

Change-Id: I65451cd9ce17c9af38ecd21e62ea96b27d027d01
65ce524bdefcfb4a967f5e87155b8920662b3207 30-Aug-2016 Sudheer Shanka <sudheersai@google.com> Merge "Allow apps with CREATE_USERS permission to create demo users." into nyc-mr1-dev
caf42418f630787e31668bb5996f24f6ea4beaa8 30-Aug-2016 Todd Kennedy <toddke@google.com> update shared libraries for system apps
am: 85a91def5c

Change-Id: If4054abdcf13d85e2fb4f4b9086aefdf92904724
85a91def5c741b91a409d6a3cd6ae1df289d8f21 28-Jul-2016 Todd Kennedy <toddke@google.com> update shared libraries for system apps

After removing updates for a system package, we weren't updating its
shared libraries when we should have. Make it so.

NOTE: This didn't affect device boot because we update all of the
shared libraries for all system applications after scanning packages.

Bug: 30266503
Change-Id: I8edf4344228fb3e793e7648ea70a041cb5db6af6
(cherry picked from commit 6058df65e645a81bdc7285dcd9f8b12b9f5b534f)
ackageManagerService.java
234d1afd7913bebd936c33eba93041aebfd8ac70 27-Aug-2016 Sudheer Shanka <sudheersai@google.com> Allow apps with CREATE_USERS permission to create demo users.

Bug: 31092477
Test: adb shell am create-user --ephemeral --demo <user-name>
Change-Id: Ia08a50ec4371466c62cdc9f5391e298a666b5081
serManagerService.java
be5137f4cb70ca47e4c929a878cfee2a9bf5ebfb 29-Aug-2016 Yi Kong <yikong@google.com> Merge "Track getxattr API change" am: c4c4a1e76e am: f897e1c3b6
am: 2b5a0d299d

Change-Id: I845657a3c8f14f38f0c3b490d16677620ba0bcc4
2b5a0d299dea53dd9e0e1679e869e69f337f3803 29-Aug-2016 Yi Kong <yikong@google.com> Merge "Track getxattr API change" am: c4c4a1e76e
am: f897e1c3b6

Change-Id: I47ac9cfbd5a38849dad542089cb3fa923a8cd3fe
c44a6e08e2e60672f83e50a7d6948bce1199f055 27-Aug-2016 Yi Kong <yikong@google.com> Track getxattr API change

Bug: 30992227
Change-Id: I788b3e51a536c7df7896f622038fe762f9848a2a
ELinuxMMAC.java
serManagerService.java
efc1c4d50104e9b9a7581c9b60703727805897f0 21-Jul-2016 Todd Kennedy <toddke@google.com> Enable web action apps based on system setting

Bug: 28140107
Change-Id: I4cff49165be6432404b9a616ca35bee249daab2a
ackageManagerService.java
80855e154e04977f2f9db8d080fee6e4b4abd83c 26-Aug-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Implement new ephemeral resolver design" into nyc-mr1-dev
5320ee42c6e9c7916ca5127c99f872b1b8008fd8 26-Aug-2016 Todd Kennedy <toddke@google.com> throw if >1 verifier found

still allows for no verifier to be defined.

Change-Id: I0b2208edf20c2680b0aaedb6c5efaa42ac1f952d
Fixes: 31086284
ackageManagerService.java
bda214155879586b95d4f82837b5a154dbc0694d 25-Aug-2016 Todd Kennedy <toddke@google.com> use directory timestamp during OTA am: 095d4125be am: 9366047713
am: e3761ac4d9

Change-Id: Id74d2d751607f20c340b877d43dca12361a0d044
4c43fbd1da217cde46fef62e05c9b4fd6ff116fe 25-Aug-2016 Daniel Nishi <dhnishi@google.com> Fix a bug where the Deletion Helper could not delete packages.

Bug: 31096000
Change-Id: I780cf74dc6750110024dcb0008b47879597f0156
ackageManagerService.java
fc4cf2da34335fd7e84c020f51eea1a341d3f134 24-Aug-2016 Makoto Onuki <omakoto@google.com> Shortcut: Improve backup & restore

* Catch RuntimeException from restore, in case restoring from a
partner device with an incompatible file format.

* When a restore target app is already installed, and
- if it has allowBackup=true, we'll restore normally, so all
existing shortcuts will be replaced. (but manifest shortcuts
will be re-published anyway.) We log a warning on logcat.

- if it has allowBackup=false, we don't touch any of the
existing shortcuts.

Bug 31057974
Bug 30766177

Change-Id: Ic3f7e860e7ea0d086fc589d8cbed8c4cebdd4bc6
hortcutPackage.java
hortcutPackageItem.java
hortcutService.java
hortcutUser.java
9366047713c07f00b4c6640b5fbb22c110aabb83 24-Aug-2016 Todd Kennedy <toddke@google.com> use directory timestamp during OTA
am: 095d4125be

Change-Id: I9c429b193f808181d2cec02c0caeda07058a35db
f50ff35ceaf0bd4fa676cf4262be1c63024aa7d3 24-Aug-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "use directory timestamp during OTA" into nyc-mr1-dev
6b457506a4006e619d9323fcc8c09619e15f8fdf 24-Aug-2016 Makoto Onuki <omakoto@google.com> Do not scan system apps unless after OTA am: 3366328245 am: 140f6f5b8c
am: b26e2ed76c

Change-Id: I339086fae6129c53970356cf86019258dd394604
4bb46d912f3e6174ee1b2dfcb9c6d2ba64864f6e 24-Aug-2016 Sudheer Shanka <sudheersai@google.com> Add installer app check in PM.deletePackage. am: 72de4ddb46 am: d7b7a88f64
am: 9caa29e199

Change-Id: Iac1ff23942a2d8357a229b883e34285f075a3a4e
095d4125be2117d1bbcdc815dffe6ecc0b7e651f 24-Aug-2016 Todd Kennedy <toddke@google.com> use directory timestamp during OTA

Previously the timestamp was generated using the directory and not the
APK [see b/29575840 and b/29610181 as to why that's bad]. In MR1, the
timestamp was generated using the most recent time of any of the APK
files.

The timestamp discrepancy causes problems during OTA to N MR1. Most
apps are incorrectly marked as "changed" which means a full parse and
verification pass on all packages. This can be a very lengthy process.

Bug: 30930797
Change-Id: Iaef7b318e1c1effbd74d996f88cbf3d6e77736cd
Test: manually updated the platform and noticed that existing packages were marked as "not changed"
ackageManagerService.java
140f6f5b8c11c9739480966d5f9b7e2d26fb8ca8 23-Aug-2016 Makoto Onuki <omakoto@google.com> Do not scan system apps unless after OTA
am: 3366328245

Change-Id: I6e901e26f61cd4bad8ba2a1b927f34d141b0423d
85c10342c19c789ae71dbf175f07ceca1f63e519 23-Aug-2016 Makoto Onuki <omakoto@google.com> Merge "Do not scan system apps unless after OTA" into nyc-mr1-dev
d7b7a88f64d8271fca343dc895dcbb1c995411f0 23-Aug-2016 Sudheer Shanka <sudheersai@google.com> Add installer app check in PM.deletePackage.
am: 72de4ddb46

Change-Id: I89a3068721f9682692fb455baae376db2690204c
0b3cf692f66f13dcb7bf8c6fec15bda84b24efee 23-Aug-2016 Sudheer Shanka <sudheersai@google.com> Merge "Add installer app check in PM.deletePackage." into nyc-mr1-dev
a3cb83451558a4f68a563af540fa12ee9aa3911a 23-Aug-2016 Todd Kennedy <toddke@google.com> Allow permission group updates am: 21bd9b824f am: 873b0f563e
am: 83581a81ef

Change-Id: I9a6bcbebb026503c1ae57d81aa6bdc7ec4cc2f57
d7337e51b52866c1b1faac6f2729b0427f158d59 23-Aug-2016 Todd Kennedy <toddke@google.com> Don't call into pkg mgr svc w/ lock held am: f29d07a62a am: 76a12e177c
am: 45b7d51083

Change-Id: Ie7dd466f9fc0d6f5e96b47abf74bf0df62e35ffe
873b0f563e17794d643222d4c2d4c8457fc490c0 23-Aug-2016 Todd Kennedy <toddke@google.com> Allow permission group updates
am: 21bd9b824f

Change-Id: I8f938705b6f25b2bd53410f5b496191ec2784a9c
76a12e177cf8d32da04f122d47efbf31a22186d0 23-Aug-2016 Todd Kennedy <toddke@google.com> Don't call into pkg mgr svc w/ lock held
am: f29d07a62a

Change-Id: Iffd22d7e33a0870236576033658d420c22426b97
3366328245621fa6e8fd764a4d3c2f073774d096 23-Aug-2016 Makoto Onuki <omakoto@google.com> Do not scan system apps unless after OTA

Bug 30956231

Change-Id: I4af34cdd39cfaf0b8712b9ded1ef119efa3e04b0
hortcutPackage.java
hortcutService.java
hortcutUser.java
ee2df0390e470ee0e940dfb15f87d30f9b2e24cc 23-Aug-2016 Todd Kennedy <toddke@google.com> Merge "Allow permission group updates" into nyc-mr1-dev
0060d6eda12060c13af7e77032bb25f41e718fde 23-Aug-2016 Todd Kennedy <toddke@google.com> Merge "Don't call into pkg mgr svc w/ lock held" into nyc-mr1-dev
fea1b776e96d10879769d3a3c17f297146605062 28-Jun-2016 Todd Kennedy <toddke@google.com> Implement new ephemeral resolver design

In the new design, the ephemeral installer can be returned from
queryIntentActivities which means any intent resolution could potentially
return the installer. Additionally, the new design calls for a platform
defined broadcast receiver that receives the status from the ephemeral
installer. This receiver then starts the final intent -- either to launch
the ephemeral application or to launch the fallback.

For more detail, see go/ephemeral-design

Bug: 30805203
Bug: 30273584
Change-Id: I6644bbb4f180d2d22c63af04b9857577516344a9
(cherry picked from commit 8e2d9d1d9050e93b15c54e992698325c7d4aa57c)
ackageManagerService.java
bab7c28e5ee51c3f4841ab114b8ee2646eaef2b4 18-Aug-2016 Todd Kennedy <toddke@google.com> DO NOT MERGE ANYWHERE: Release mPackages lock earlier

We cannot hold mPackages when calling into generatePackageDexopts().
This method takes Package Manager's mInstallLock. By holding mPackages,
we have lock inversion and hilarity ensues.

Change-Id: Ia11a158677051e3511702f38cde6780e75b256fb
Fixes: 30927731
(cherry picked from commit a8d4f489974f3ea8f73990cbabbce205343fb926)
taDexoptService.java
085a05cd864252314bcf5c339017a16b68105204 19-Aug-2016 Makoto Onuki <omakoto@google.com> Off-load unlocking users onto a worker thread

Bug 29645168

(cherry picked from commit 3107ff78454d54c0494911bf69ca952152af7cf0)

Change-Id: I3f8e768f6afeb6386a08ba9ac48e0e206395da2b
hortcutService.java
3107ff78454d54c0494911bf69ca952152af7cf0 19-Aug-2016 Makoto Onuki <omakoto@google.com> Off-load unlocking users onto a worker thread

Bug 29645168

Change-Id: I50dce4f9227b2f30470ddd5799d8e2cdb90d4d79
hortcutService.java
84bc761607c65281704439037cc85e73e50ac79a 19-Aug-2016 Makoto Onuki <omakoto@google.com> Merge "Add more utility methods for CTS"
fdb40b650eb5451597ec15af97c09ea3af4f460b 19-Aug-2016 Svet Ganov <svetoslavganov@google.com> Add resource based mechanism to grant default permissions am: 59020bffb7 am: 34d85c6087
am: e3697a3569

Change-Id: Idf2e194e617d44b8dc5cced9162e98e8d48977c4
07dea3d573589ec7828163d4007c39c7c2242725 19-Aug-2016 Todd Kennedy <toddke@google.com> Release mPackages lock earlier am: a8d4f48997 am: d8443b77cc
am: 5bcee670bc

Change-Id: I539468d9e4b478742e7274db903ce6cde8ad7984
34d85c6087bc88654f7bf51f51bef1c1f9984d6b 19-Aug-2016 Svet Ganov <svetoslavganov@google.com> Add resource based mechanism to grant default permissions
am: 59020bffb7

Change-Id: I34d675b7f2ef4fb439bb582c6b36cb00de16acd8
d44d46aa507de39b7160b5e1358db9faad3da7e5 19-Aug-2016 Svetoslav Ganov <svetoslavganov@google.com> Add resource based mechanism to grant default permissions

This CL adds a mechanism for an OEM to grant default permissions
using the build system. This allows permissions for which they
got default grant exceptions to be added without modifying the
platform code. The format is a simple XML listing the packages
and the permissions to be granted for a package. The XML file
is placed in etc/default-permissions.

bug:29546655
bug:30929033

Change-Id: Ib6d671dac9201812bd2c47010c2c4b1330ef6b6e
efaultPermissionGrantPolicy.java
ackageManagerService.java
b5fc2e6706dfa9884ee9d5ab802c9a66c370e9cb 19-Aug-2016 Makoto Onuki <omakoto@google.com> Add more utility methods for CTS

Also fix an exception message.

Bug 29612099

Change-Id: Id94656cd2701cf2bbc2883e45fba93ecae6d3148
auncherAppsService.java
9a6008a3349a2928783a0b90d3a7fe652eafa637 19-Aug-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Add resource based mechanism to grant default permissions" into nyc-mr1-dev
59020bffb7dde02a2cd4cb797cadfe56bb36db44 18-Aug-2016 Svet Ganov <svetoslavganov@google.com> Add resource based mechanism to grant default permissions

This CL adds a mechanism for an OEM to grant default permissions
using the build system. This allows permissions for which they
got default grant exceptions to be added without modifying the
platform code. The format is a simple XML listing the packages
and the permissions to be granted for a package. The XML file
is placed in etc/default-permissions.

bug:29546655
bug:30929033

Change-Id: Ifb0516d7e2d0b399532024438bc0f86068a2e4e2
efaultPermissionGrantPolicy.java
ackageManagerService.java
a8d4f489974f3ea8f73990cbabbce205343fb926 18-Aug-2016 Todd Kennedy <toddke@google.com> Release mPackages lock earlier

We cannot hold mPackages when calling into generatePackageDexopts().
This method takes Package Manager's mInstallLock. By holding mPackages,
we have lock inversion and hilarity ensues.

Change-Id: Ia11a158677051e3511702f38cde6780e75b256fb
Fixes: 30927731
taDexoptService.java
0ef13f485d1ddf5ea4ba8dc9559d547ca0dd5aad 18-Aug-2016 Narayan Kamath <narayan@google.com> BackgroundDexOptService: Check for low storage conditions. am: 8735f07a69 am: e16463c3f7
am: ac1295d87c

Change-Id: I0d74efb1cf4d72148bc9f44f37e11f49f4ec4583
77df6f315d6fbb22622ca46ae5735a5c73cc367d 17-Aug-2016 Svet Ganov <svetoslavganov@google.com> Remove permission review build property - framework

Change-Id: Ifcfd436f2d57a6006ef804292d2875434e4669da
ackageManagerService.java
8735f07a698218d311826a140d08d611d3c23db1 16-Aug-2016 Narayan Kamath <narayan@google.com> BackgroundDexOptService: Check for low storage conditions.

Abort the service (without an early reschedule) if we find that we're
running low on space. The low space check is performed (explicitly)
after every dexopt.

bug: 30865506
Change-Id: I8d31af8fe035701177f8b9a1eabb0b51f42027fe
ackgroundDexOptService.java
53f7d933be4e618a2ac61a67dd64b2b3a7ba80ea 15-Aug-2016 Todd Kennedy <toddke@google.com> Merge "More settings cleanup"
aafc036280079938b08cd960643da05cd0cae177 13-Aug-2016 Jeff Sharkey <jsharkey@android.com> Add property to force restorecon to run. am: 6da39a4406 am: b0648a173c
am: a8276cbb41

Change-Id: I0930617d5789444fe02632173a497a7076733403
6da39a4406a5768cefb99e5a5426fb22248523bc 12-Aug-2016 Jeff Sharkey <jsharkey@android.com> Add property to force restorecon to run.

As an optimization, we typically only run restorecon when
seapp_contexts changes. This CL checks a property that can be used
to always force a restorecon to help investigate boot timing.

Bug: 30213213
Change-Id: I4d65c1a4e4a0830ef4a32cd2fae1d3ab188b65cc
ELinuxMMAC.java
788c8423d19972389b82a23dec297eb27d819c86 10-Aug-2016 Todd Kennedy <toddke@google.com> More settings cleanup

* While parsing the packages.xml file, don't call getPackagesLPw(); we'll
never find a package unless something has gone horribly wrong. Instead,
build the PackageSetting like a sane person and add it to internal
structures.
* Add methods to create a proper copy of the PackageSetting object and
not just the data from one class in the middle of the hierarchy.
* Stop converting Sets into Lists back into Sets when creating
IntentFilterVerificationInfo objects
* Remove the name argument when adding a package setting; it should always
be the name in the package setting

Bug: 30219944
Change-Id: I7fa2c540621fb5d70a59b15919bfd31d8465e25d
ackageManagerService.java
ackageSetting.java
ackageSettingBase.java
endingPackage.java
ettingBase.java
ettings.java
50421f1a381a5f4ce06e3a3ea5d30c5606a1dedf 11-Aug-2016 Esteban Talavera <etalavera@google.com> Do not toggle OEM unlock if bootloader unlocked am: c48b20f8f1 am: 83583bd596
am: b9bef2fb7d

Change-Id: I87ffae46a63f1543b55e075cecffb1d2c2e1c160
83583bd5963ed9c5867a39437b5336809faf4109 11-Aug-2016 Esteban Talavera <etalavera@google.com> Do not toggle OEM unlock if bootloader unlocked
am: c48b20f8f1

Change-Id: Ic42a52cc9d71aa1192de0a052efb23a625673232
fd97e7bc8cac91d849bf40202870c2220fc04f7a 11-Aug-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Do not toggle OEM unlock if bootloader unlocked" into nyc-mr1-dev
c48b20f8f1d3e07e8a931b195669b0ab8895006c 11-Aug-2016 Esteban Talavera <etalavera@google.com> Do not toggle OEM unlock if bootloader unlocked

Bug: 30681215
Change-Id: Ia0fd55dd7b6b731d6f5733fc733621e99bd7b153
serRestrictionsUtils.java
0ea8fbdb5022405636c48b7842064645d8f3bacc 10-Aug-2016 Makoto Onuki <omakoto@google.com> Fix two shortcut manager issues am: 1e1732399a am: 07974e4f56
am: 4aa8d8b0f0

Change-Id: Ic0b8e958833b301f7809951c24ca3809a3797700
1e1732399a48c9521eea7a117f1f0e87ca64d2ab 10-Aug-2016 Makoto Onuki <omakoto@google.com> Fix two shortcut manager issues

- isUserUnlocked check is still racy
We used a local copy of each user state in mUnlockedUsers, and updated
it in the service lifecycle events. However because
SystemService.onUnlockUser() is called on Handler, there was a brief
window between when the user was actually unlocked and the shortcut
manager thought the user was unlocked.
So now check with activity manager for the latest state too. We still
check with the local copy first, because we want to consider STOPPING
as "unlocked".

- Messenger loses all bitmap icons.
Because we delay-save the shortcuts.xml file, if the device shut down
before we save the XML file but after removing the bitmap files,
we'd lose the bitmaps.

(Apparently SystemService.onCleanupUser() may not be called even when
a device is cleanly shutting down.)

So don't remove bitmap files synchronously, ever, and instead after
saving the XML just run the dangling file cleanup.

Bug 30784267
Bug 30730471

Change-Id: Ie58656efba2dca2b00582e145613bc56266a091e
hortcutService.java
3efe391c0f60b85b85d1556833c15379a645fcc1 10-Aug-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Checking for storage space before adding user"
ffb4fdd8e58b163a1901f8b41887cc7b9cb9f6c9 10-Aug-2016 Makoto Onuki <omakoto@google.com> Rescan apps after restore and re-publish manifest shortcuts am: 377b7970ad am: 51aec5dce5
am: 88223473e5

Change-Id: I26c47df340d751a4234b58fe27e3a1169e7010fb
21bd9b824f1bed7ccb412f1cd27e3f3a159ffe19 09-Aug-2016 Todd Kennedy <toddke@google.com> Allow permission group updates

When a package in updated, it may redefine a permisson group [specify a
new icon, text, etc...]. Udate our internal structures to the new package.

Bug: 30347537
Change-Id: I9fbaf7c68a4de658489cfd1c728473032dded98b
ackageManagerService.java
377b7970ad70e87f8137ea7d9e7a6b00de1826ae 09-Aug-2016 Makoto Onuki <omakoto@google.com> Rescan apps after restore and re-publish manifest shortcuts

Originally when I wrote backup & restore for ShortcutManager,
there was no manifest shortcuts, so there was no need to
handle preintalled apps specially.

However, now we have manifest shortcuts, which are published
when the user is unlocked, by the time restore happens preinstalled
apps may already have manifest shortcuts, which will be overwritten
by the restored shortcuts.

So we need to re-publish manifest shortcuts after restore.

Bug 30746028

Change-Id: I6afbae7790c9ed38483637f33c381ecb6f854677
hortcutService.java
f29d07a62a78f73a21d649f6737992c267d6f170 09-Aug-2016 Todd Kennedy <toddke@google.com> Don't call into pkg mgr svc w/ lock held

In general, there's no reason to hold the lock when calling into external
components. However, in practice, this can deadlock. When dumping its
state, Package Manager Service holds a lock while it calls into other
packages to dump their state. These other packages (such as Package
Installer Session) typically take their own lock to dump coherent state.
And, thus, a deadlock.

Bug: 30419998
Change-Id: I0807b8742316d084e381be8721d1b3d41143b82c
ackageInstallerSession.java
43bd311510d65ef22e9723acd0822929b395a210 09-Aug-2016 Makoto Onuki <omakoto@google.com> ShortcutManager improve app udpate check am: 64183d5188 am: bb5db91bf3
am: ce186d4722

Change-Id: Ia3818e54bba40b95c7feaa02d3948bdeae1dfe8e
c5e057c736dd6552586b104bcd06a6c12c573e28 09-Aug-2016 Suprabh Shukla <suprabh@google.com> Checking for storage space before adding user

If storage space is low, trying to create a user results in a crash.
Adding a check to abort user creation and log a warning in such a case.

Bug: 30270050
Change-Id: I121119aed340c7be337b2147c4386c9bb9f8ffdc
serManagerService.java
64183d518813cc65efcaeaf0d4c28de092b32868 08-Aug-2016 Makoto Onuki <omakoto@google.com> ShortcutManager improve app udpate check

- Don't use lastUpdateTime for system apps since it's not reliable.

- Scan downgraded apps too.

Bug 30708050
Bug 30734178
Change-Id: I98253f4c635466197548385275ab08c5e3a1a10b
hortcutPackage.java
hortcutService.java
8d69e9c93bc5cc7b2b046e80d6136c9427b43e58 05-Aug-2016 Todd Kennedy <toddke@google.com> Move EphemeralResolverService am: 31b95e0265 am: fa67fad84e
am: 8c073e0aad

Change-Id: I2fb2add1e4431c2c802430990f99807934878e84
fa67fad84e04d9a9e296d219a87c18794498c13c 05-Aug-2016 Todd Kennedy <toddke@google.com> Move EphemeralResolverService
am: 31b95e0265

Change-Id: I16533b342433fc1042e0d78e1be8e43a431031a6
9d9621f47251063ec2037e8ab9d33f3a589d6af4 05-Aug-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Move EphemeralResolverService" into nyc-mr1-dev
31b95e0265fecb60ba29baba6a5ea4de3d4a3367 04-Aug-2016 Todd Kennedy <toddke@google.com> Move EphemeralResolverService

It should not have been under com.android.internal

Fixes: 30673742
Change-Id: I2277aa4a4799fa59bf68af7c4cfcb4e1216aeb8d
phemeralResolverConnection.java
a28418bfe4977f483cb68c0e02e59747dbc37215 04-Aug-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Update foreground check. am: 33525d2f1a am: 386fd915fc
am: d7f86b7115

Change-Id: I4ebd4315910b35849e970319fa1e265e5b79a4b8
386fd915fcf294ee2f1fe0da60a03b26e300e07d 04-Aug-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Update foreground check.
am: 33525d2f1a

Change-Id: I08769ba85f38c6768515450696d49a9755c698fb
0fd8670fd548d801c96e5e51efc30bb3722f622d 04-Aug-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: Update foreground check." into nyc-mr1-dev
3dc99ea200e3d877af03bf2e67f00b173ee34222 04-Aug-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Break out static update method"
13715d521f340d24f1de6e06ceaaf2a945910c0d 01-Aug-2016 Todd Kennedy <toddke@google.com> Break out static update method

Simply getting package settings could changes stored state. Break out
the majority of the method to modify local variables and not change
any stored state. The top-level getPackageLPw() method will still
mutate stored state. This will be changed in a future CL.

Also add a set of tests to verify the behaviour of updatePackageSetting()

Bug: 30219944
Change-Id: I3360a36ce238e816246ee8ca7ecabfbbcdf0b89d
ackageManagerService.java
ackageSettingBase.java
ettings.java
f271b984b1fd4a6bb30d9286df239138952fa5a5 04-Aug-2016 Andreas Gampe <agampe@google.com> OtaDexopt: Special-case system app classpaths am: c7e02c1d2a am: 75e88534fc
am: bd70e99473

Change-Id: Ia4ced25fa7fd9ff6972c8b777fff1a2bd2d63a24
75e88534fc26467b80ff1a199e7b1353445d0a73 04-Aug-2016 Andreas Gampe <agampe@google.com> OtaDexopt: Special-case system app classpaths
am: c7e02c1d2a

Change-Id: I11bdba24aec736f1ef3e1023acab63a9680c6183
6bd0d6b754fa23b3b8bc8fdc3ebe2d8f996c225e 04-Aug-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "OtaDexopt: Special-case system app classpaths" into nyc-mr1-dev
33525d2f1a8116820f58fc90941cb53bcba54805 04-Aug-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Update foreground check.

- When the cached UID state says a UID is in the background,
check with AM and get the latest state, since the state
might just have been changed.

Bug 30640208

Change-Id: If448f6f21f290fa0fc13550d9c740f56aa8bfce0
hortcutService.java
1db5202fcae4e7ebc6044681e0b6c757fdd55dd9 03-Aug-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: rescan all apps after next OTA am: 4dd032d5a6 am: 74f4689f34
am: b997b64dcf

Change-Id: If5e939ae3718201c713ed59241cc8148e65a7078
391dfcfa6838c3b573e28fe22beca30ac5e34370 03-Aug-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Revert "Add per-user versions of set{Component,Application}EnabledSetting.""
38c67d3c0fdd27282d30a23784f98a3df704d6a9 03-Aug-2016 Sudheer Shanka <sudheersai@google.com> Revert "Add per-user versions of set{Component,Application}EnabledSetting."

This reverts commit 0e6bfff6c1ec17cf8f3cfb6e4853d3c0fa3ffb73.

Change-Id: I4eafa9fc052e9eba9e26fd32c09b5e759fe63b00
serManagerService.java
4dd032d5a66916920c3a5dac7bd9959e307f7316 02-Aug-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: rescan all apps after next OTA

- Normally when a user is unlocked, SM scans all updated apps
since the last scan to see if their manifest shortcuts have changed.

- There was a known issue that's been fixed already that'd result
in all shortcuts being removed.

- To work around this issue, let's scan all packages after the next
user unlock.

- This can be done by just renaming the XML attribute name to persist
the last app scan time.

Bug 30591723

Change-Id: Ie9f723ef30a1c991990d981193841cb203c094ad
hortcutUser.java
b3941d2aee8f562a5d16818cfdca7b45dd5e0749 02-Aug-2016 Makoto Onuki <omakoto@google.com> LauncherApps should also throw when user is locked am: 02f338e23d am: 897a4f84d0
am: 88870a84ed

Change-Id: I5f098c71a128c9e51b957e5b391b2d57eca663f9
c7e02c1d2a53e0f738d2a8383e03658b39d91ce6 02-Aug-2016 Andreas Gampe <agampe@google.com> OtaDexopt: Special-case system app classpaths

Specialize system apps' shared libraries so that classpath checks
are elided.

Bug: 30568568
Change-Id: Id1f2555ef43984b616e01f8596701ccba77895b3
taDexoptService.java
02f338e23d06499790c6948709afb1587416eb40 29-Jul-2016 Makoto Onuki <omakoto@google.com> LauncherApps should also throw when user is locked

otherwise it'd be racy.

Bug 30406401

Change-Id: I953eb6ae58e029d254d9fdbd5d05a0090b8d2391
auncherAppsService.java
hortcutService.java
a31a6f9f271af7baf4bae1bb1504470e24d3c2d7 02-Aug-2016 Makoto Onuki <omakoto@google.com> Revert \\"LauncherApps should also throw when user is locked\\" am: 2ec16b08ac am: e330d59c2e
am: 685091f203

Change-Id: Iacfdd622ce04a86f0f5f573a9e11dc7d1cccc932
e330d59c2e006403cfd37b537e1bb47f36f9e350 01-Aug-2016 Makoto Onuki <omakoto@google.com> Revert \"LauncherApps should also throw when user is locked\"
am: 2ec16b08ac

Change-Id: If702a26519de3c3fcf13f0bfb6bc7ebd7ca255ea
5faa852c5705542274a618c130ef7c98626a4e67 01-Aug-2016 Makoto Onuki <omakoto@google.com> Merge "Revert "LauncherApps should also throw when user is locked"" into nyc-mr1-dev
2ec16b08accd254b6c64f7b632575d07981380f1 01-Aug-2016 Makoto Onuki <omakoto@google.com> Revert "LauncherApps should also throw when user is locked"

This reverts commit bc4ad85d29cd4490ba71baaad58e2f4d68b7d325.

Will retry when the updated launcher is in.

Change-Id: I428dc93132615480df70aeca7977089af008c041
hortcutService.java
213e3abfabc86f50acb48e1ef4f2002cf84d9519 31-Jul-2016 Andreas Gampe <agampe@google.com> OtaDexoptService: Run dexopt on all apps am: 115514b236 am: b4eef29820
am: 52567b8e3d

Change-Id: I566e5c7edb2434892f298b7ae1678cca65b120b9
fc8e6c25f904361e1de3cfdf2cc6dbb33249906b 31-Jul-2016 Sudheer Shanka <sudheersai@google.com> Allow apps with CREATE_USERS permission to call UM.getProfiles. am: 7468091329 am: 59245383cf
am: 59348dc325

Change-Id: I10194ddb5f93f2af4a78dcbd6c3496df1cbc823e
07996bce98e5cda7623f722edb5de5eca74b9bc3 31-Jul-2016 Makoto Onuki <omakoto@google.com> LauncherApps should also throw when user is locked am: bc4ad85d29 am: 5ec63fc3c7
am: 3b5920b2a1

Change-Id: I60beb409a55297a9a2adaaf52f1ea1e185668c88
52567b8e3d6fd6e41dff8a3e9f6a5af83ba78c85 30-Jul-2016 Andreas Gampe <agampe@google.com> OtaDexoptService: Run dexopt on all apps am: 115514b236
am: b4eef29820

Change-Id: Ibbd22cd98dcb79efa6d6767689b0dd9bda3d04ca
b4eef29820f5cedf940f960fe860d884d608af6a 30-Jul-2016 Andreas Gampe <agampe@google.com> OtaDexoptService: Run dexopt on all apps
am: 115514b236

Change-Id: Ib9b6e69e95311b708d011d7d5c9175962cbf95f8
59348dc325b9ae4c8bc70ca5f9b463c5ef09c8db 30-Jul-2016 Sudheer Shanka <sudheersai@google.com> Allow apps with CREATE_USERS permission to call UM.getProfiles. am: 7468091329
am: 59245383cf

Change-Id: I474219d267d1dc1dbd3ba14426b09962e2eddbc5
3e2e8962b1766713ab56b79726c3161b8b997540 30-Jul-2016 Sudheer Shanka <sudheersai@google.com> Allow apps with CREATE_USERS permission to call UM.getProfiles.
am: 7468091329

Change-Id: I902c70cb066e24002c639dc6b87d080e7bf1cae7
58764e5ec6b60ca87638ca6cf42e952d558ac19b 30-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "OtaDexoptService: Run dexopt on all apps" into nyc-mr1-dev
115514b236ebe7cb3c90892891954b8c7ba69335 29-Jul-2016 Andreas Gampe <agampe@google.com> OtaDexoptService: Run dexopt on all apps

To avoid work after reboot, dexopt all apps. However, unimportant
apps are optimized with the first-boot reason (which is usually
interpret-only) for space reasons.

Bug: 30468718
Change-Id: Ia05d879957388967c69f9380e50d8a9834afe07d
taDexoptService.java
5ec63fc3c74c2f313a89e23463dce9cb9dfce7d4 29-Jul-2016 Makoto Onuki <omakoto@google.com> LauncherApps should also throw when user is locked
am: bc4ad85d29

Change-Id: Ic7bc111861634f2a38cd262a93f56976924c64ba
ba933b39ae6d6b6101fa876bcd0fbd68dc2c5cbf 29-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "LauncherApps should also throw when user is locked" into nyc-mr1-dev
7468091329834f8ea0c0a9f6b2b3a52fdeb90638 29-Jul-2016 Sudheer Shanka <sudheersai@google.com> Allow apps with CREATE_USERS permission to call UM.getProfiles.

Bug: 29189712
Bug: 30317026
Bug: 30235113
Change-Id: I899f13898773483ee627a974d70173b5aa962e9a
serManagerService.java
63b0cea9affc1310613f1a278f7de0c6876ae87b 29-Jul-2016 Todd Kennedy <toddke@google.com> update shared libraries for system apps am: 6058df65e6 am: 9815fd3b2e
am: e4adf5e69a

Change-Id: Ibf7a521a0bc8a3f3a52fcf295e1bed79a12be661
bc4ad85d29cd4490ba71baaad58e2f4d68b7d325 29-Jul-2016 Makoto Onuki <omakoto@google.com> LauncherApps should also throw when user is locked

otherwise it'd be racy.

Bug 30406401

Change-Id: Id6b0295933c5639fa23c56d737a7f0199cbd7497
hortcutService.java
4830a0c5cabdd8f2c983c3d7c20df5d440fc09ec 29-Jul-2016 Makoto Onuki <omakoto@google.com> Prevent shortcut access when user is locked am: 9c850012ca am: cab2462e38
am: 890f85d70f

Change-Id: Ie6653dcc55b37598a45987d938f07ba31e173ef5
6058df65e645a81bdc7285dcd9f8b12b9f5b534f 28-Jul-2016 Todd Kennedy <toddke@google.com> update shared libraries for system apps

After removing updates for a system package, we weren't updating its
shared libraries when we should have. Make it so.

NOTE: This didn't affect device boot because we update all of the
shared libraries for all system applications after scanning packages.

Bug: 30266503
Change-Id: I8edf4344228fb3e793e7648ea70a041cb5db6af6
ackageManagerService.java
72de4ddb461e132f381aad7386f815581fd2aad5 23-Jul-2016 Sudheer Shanka <sudheersai@google.com> Add installer app check in PM.deletePackage.

- Update PM.deletePackage to check if an app trying to delete a package
is the same app that installed it.
- Update system apps to be orphans to allow silent deletion. This will
make sure managed provisioning is not affected.

Fixes: 30280938
Change-Id: Ideab5a47eee2a00e7eefa9119112e37c3118783f
ackageInstallerService.java
ackageManagerService.java
2862ed2541411ea864505b8234da3e789dd104db 27-Jul-2016 Jeff Davidson <jpd@google.com> Add support for carrier \\"associated\\" apps. am: 24b9d96007
am: 19af77d2cb

Change-Id: I089db772e37b7d07a5423793aced78f2b3a9a1ae
cab2462e3803cb4fc9641ddfaeb0cf398a4c45e5 27-Jul-2016 Makoto Onuki <omakoto@google.com> Prevent shortcut access when user is locked
am: 9c850012ca

Change-Id: I0aac4593da85c26107a2ba333b6af9477d5f3983
19af77d2cb3d96cd5ef1c3c157522e9f05fe979d 27-Jul-2016 Jeff Davidson <jpd@google.com> Add support for carrier \"associated\" apps.
am: 24b9d96007

Change-Id: I1de92977f3a0635d88e6517210f6bbb06ab3d0f0
831dd7542fec3a8e8684ef1ab4521096f9bd819b 27-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Prevent shortcut access when user is locked" into nyc-mr1-dev
9c850012cacf0af4a392294566a8c7c897dc8771 27-Jul-2016 Makoto Onuki <omakoto@google.com> Prevent shortcut access when user is locked

Also add some test utility methods that'll be used by CTS.

Bug 30406401

Change-Id: I9396acebbdb3cbe64f6e85877ee62a2131cd6e61
hortcutParser.java
hortcutService.java
94ae1e739fd84a308609fff3b913d0963900ed6e 27-Jul-2016 Jeff Davidson <jpd@google.com> Merge "Add support for carrier "associated" apps." into nyc-mr1-dev
84746f5a9f289ff9c455b74862d3203d20cabc00 27-Jul-2016 Svetoslav Ganov <svetoslavganov@google.com> Pre-grant calendar permission to default email app am: 9df80d2628
am: cb4ca8a57e

Change-Id: Id1dac68e83f869a7f18f7439bb6341b98fdca0d7
9df80d2628c5429205cc726dac00c3905dff4a39 26-Jul-2016 Svetoslav Ganov <svetoslavganov@google.com> Pre-grant calendar permission to default email app

bug:30277932

Change-Id: I3c80e01ce720a7e7bf54cac82dc0ca0da152998d
efaultPermissionGrantPolicy.java
24b9d960071ecf24f1b7edf799f6a4edf20f2b95 21-Jul-2016 Jeff Davidson <jpd@google.com> Add support for carrier "associated" apps.

The platform currently supports the notion of default carrier apps.
These apps are set to DISABLED_UNTIL_USED until a SIM is inserted
which grants them carrier privileges, at which point they are enabled.
Apps are not touched if they have been updated from the version on
/system or if their state has been modified externally (e.g. by the
user).

This CL extends this notion to associated apps, which may not have
carrier privileges themselves, but should be enabled/disabled
alongside a particular carrier app. This should include helper apps
that should not be visible to users who don't use the given carrier
unless the user explicitly enables the app.

As additional protection, we add a check to ensure that we never
disable apps after the first time we've run. Since we need to store
this information in secure settings, we also move the call site from
PackageManagerService#main() to PackageManagerService#systemReady(),
which enables use of secure settings but still occurs before
third-party apps can be started.

Bug: 30141427
Change-Id: Iee72ba4e70e5ca97999c9147a65af82c670a23e8
ackageManagerService.java
7068bfc3834d0cd581881972d2516fefcad136c9 25-Jul-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Add Bluetooth toggle prompts - framework"
fe84fe01d7415ea86e37824c0aff0d988089b6c2 25-Jul-2016 Tony Mak <tonymak@google.com> Persist master volume mute across reboot am: c1205111a9
am: c33b549af8

Change-Id: Id5e57ebdf81824af0f86854d8668a05f8109e0e1
c33b549af8e67caab1edb73b83cb0527b3c64001 25-Jul-2016 Tony Mak <tonymak@google.com> Persist master volume mute across reboot
am: c1205111a9

Change-Id: Ia2badcd0fa06e8a8b74ffdfb26e525852d97cf07
0df1d34e6e1bb687205fa061b0ae60b34957b65a 25-Jul-2016 Tony Mak <tonymak@google.com> Merge "Persist master volume mute across reboot" into nyc-mr1-dev
ac69be543f89ea6e9a27204492e0a170d9b3450e 30-Jun-2016 Svetoslav Ganov <svetoslavganov@google.com> Add Bluetooth toggle prompts - framework

If permission review is enabled toggling bluetoth on or off
results in a user prompt to collect consent. This applies
only to legacy apps, i.e. ones that don't support runtime
permissions as they target SDK 22.

Also added a configuration resource which controls whether
permission review mode is enabled. By default it is not and
an OEM can change this via an overlay. For now we also keep
the old mechanism to toggle review mode via a build property
which is still used and will be removed when clients have
transitioned.

bug:28715749

Change-Id: I94c5828ad6c8aa6b363622a26ff9da4fc2e2fac7
ackageManagerService.java
7a39181c6c7542ebfe914a3ce54052f123df9ee4 23-Jul-2016 Todd Kennedy <toddke@google.com> Merge "Implement new ephemeral resolver design"
b0da71d9a14c9e0836e4ec82dba9b43bcc1c2237 22-Jul-2016 Makoto Onuki <omakoto@google.com> Fix intent flags am: 7e5c3e8542
am: bada0535d5

Change-Id: Iefd569a147aea40118be645bbfe55456ecced810
7e5c3e85420a255bd79242dd97b90340c6e3a4df 22-Jul-2016 Makoto Onuki <omakoto@google.com> Fix intent flags

Bug 30307198

Change-Id: If127001320dcabdc53ee73860dbb9983cb25b611
auncherAppsService.java
c1205111a92b52283078f1a2e86c8d32c5928b92 22-Jul-2016 Tony Mak <tonymak@google.com> Persist master volume mute across reboot

Fix: 30133263

Change-Id: I53450a504e40e55516acc88550f369a74a244eaf
serRestrictionsUtils.java
8653659cbe7ca57183704b6126916e22b7e0817d 22-Jul-2016 Todd Kennedy <toddke@google.com> Merge "Add more tracing"
1dc06e0aff3cedd54014822828214c4a473fbe59 22-Jul-2016 Benjamin Franz <bfranz@google.com> Block user from setting safe boot setting via adb am: 0ff13fce6f am: c86e8c3442
am: 428b3bdca8

Change-Id: I42419b8a5cf69e512d9cd536056c0767ef8aa39e
428b3bdca87a1483dfe5fedc548a6365f3b2e328 22-Jul-2016 Benjamin Franz <bfranz@google.com> Block user from setting safe boot setting via adb am: 0ff13fce6f
am: c86e8c3442

Change-Id: Ie9e1f4d447dd61ef7f5ef191d1309377fbbf4559
36eb7a13709073111e2397c9f542cb6f64f3f2b9 22-Jul-2016 Benjamin Franz <bfranz@google.com> Block user from setting safe boot setting via adb
am: 0ff13fce6f

Change-Id: I50db586478eb52d0a2f43e9150cc663c96e5779b
4a50d433c9b139f759da3979e8320be5841b6523 22-Jul-2016 Todd Kennedy <toddke@google.com> use printwriter instead of stdout am: b6e96e52e3
am: 3f3a2b2ef9

Change-Id: I30d27f5c07cea4367b0cbb144a293a728e63ad1e
4540a45e4db838a05e38172a32cf590e2cef2450 22-Jul-2016 Todd Kennedy <toddke@google.com> Skip failed package installs am: 6341244856
am: 3eadb90ae7

Change-Id: I44dfdde41c1b41f2ab30cc7f332ef0ebce93dd01
518b88eed32f3ec0986b1780f0a9e695f86a1e5e 22-Jul-2016 Makoto Onuki <omakoto@google.com> Unit tests for \\"cmd shortcut\\" am: 0b9d1db5c1
am: 7d9f3e2ba3

Change-Id: I08ea6a4a92bdd23357d11b4624bd10c3704d3734
df4e733bf729ec74757dd24c2a24867444fa01db 22-Jul-2016 Makoto Onuki <omakoto@google.com> Follow-up to multiple intents support am: 0eed441c0c
am: b6ed7b7552

Change-Id: I1034eaa7670c7fa983ddffcce295979ec86bde89
3f3a2b2ef9855ad34eb74c16bfbaa1b067563493 22-Jul-2016 Todd Kennedy <toddke@google.com> use printwriter instead of stdout
am: b6e96e52e3

Change-Id: I8c228e916578a6e3bb5b38f95bacc1aa21d7b5ad
3eadb90ae7eef2d594f162b32dceef191c27ae9a 22-Jul-2016 Todd Kennedy <toddke@google.com> Skip failed package installs
am: 6341244856

Change-Id: I1a937e6a2196981bc6d0aa8dd5b2cf1dbbd88648
7d9f3e2ba3deb870e95ec4eb479c9a74beba4d8b 22-Jul-2016 Makoto Onuki <omakoto@google.com> Unit tests for \"cmd shortcut\"
am: 0b9d1db5c1

Change-Id: I7461b7b5427a8c597bf5b3903c66a98a3dca25f8
b68b9e78ddee01063a8fae86d391adea06136f6b 22-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "use printwriter instead of stdout" into nyc-mr1-dev
8e62ae11096a6d3a0da03ec4f2633cc694be83ec 22-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Skip failed package installs" into nyc-mr1-dev
3fa345b5c2cf5d7fd8c87e44d1887f011787c548 22-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "Unit tests for "cmd shortcut"" into nyc-mr1-dev
8e2d9d1d9050e93b15c54e992698325c7d4aa57c 28-Jun-2016 Todd Kennedy <toddke@google.com> Implement new ephemeral resolver design

In the new design, the ephemeral installer can be returned from
queryIntentActivities which means any intent resolution could potentially
return the installer. Additionally, the new design calls for a platform
defined broadcast receiver that receives the status from the ephemeral
installer. This receiver then starts the final intent -- either to launch
the ephemeral application or to launch the fallback.

For more detail, see go/ephemeral-design

Change-Id: I6644bbb4f180d2d22c63af04b9857577516344a9
ackageManagerService.java
634124485611cb347f9e41a72df2920a76c32b8c 21-Jul-2016 Todd Kennedy <toddke@google.com> Skip failed package installs

If a package installation doesn't succeed [or hasn't succeeded yet], its
structures won't be setup so we should skip them when sending first
launch broadcasts.

Change-Id: I89a88480dc6d311a232cae5a236279b2f0a9df3a
Fixes: 30258737
ackageManagerService.java
cd029da32165f4a348431d825d2bbaa46282710f 21-Jul-2016 Todd Kennedy <toddke@google.com> Add more tracing

Allows us to track PackageManagerService startup

Bug: 30272038
Change-Id: I56fa7480fe640f4444d09a657889ec83685a7570
ackageManagerService.java
0eed441c0cf3bd03b8ac780e62fbeae5d7fcac4b 21-Jul-2016 Makoto Onuki <omakoto@google.com> Follow-up to multiple intents support

- More unit tests
- LauncherApps.startShortcut() now supports sourceBounds
(again)
- Updated the javadoc.

Bug 30218829

Change-Id: Iae208ffd4911d149246ccfd0c4380544c2aafffc
auncherAppsService.java
hortcutService.java
b6e96e52e379927859e82606c5b041d99f36a29e 21-Jul-2016 Todd Kennedy <toddke@google.com> use printwriter instead of stdout

stdout doesn't make it to 'adb', so, "adb install-multiple" claims to fail
even though it successfully commits the install

Change-Id: I4df8cfc134a2d6c06cca13c2fc49a5cc7a07cc4a
ackageManagerShellCommand.java
de1e6e4d2d37ceb736d6849b0caa8efe9fad66dc 21-Jul-2016 Makoto Onuki <omakoto@google.com> Merge \\"Support multiple intents in ShortcutInfo\\" into nyc-mr1-dev am: b84ce2e034
am: 9a6109f284

Change-Id: I0f1caf54cc544db0b73f8e3275005923904f57a8
440a1ea8e2204ecb171e0187318beb2f08f6012c 20-Jul-2016 Makoto Onuki <omakoto@google.com> Support multiple intents in ShortcutInfo

Also fix b/30230996.

TODO: Support the sourceBounds argument to LauncherApps.
startShortcut().

Bug 30218829
Bug 30230996

Change-Id: Ibb6c59d5b7c0a320c21d09436d016d0eac94644f
auncherAppsService.java
hortcutPackage.java
hortcutPackageInfo.java
hortcutParser.java
hortcutService.java
c5837520ba94ced2a71809343a1e43329a0c3eaf 20-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add per-user versions of set{Component,Application}EnabledSetting."
6dd51a4eee0fcd9151d9dd6db996b1fafec731ef 20-Jul-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Do not migrate apps data on every user start"
0e6bfff6c1ec17cf8f3cfb6e4853d3c0fa3ffb73 20-Jul-2016 Sudheer Shanka <sudheersai@google.com> Add per-user versions of set{Component,Application}EnabledSetting.

Change-Id: Id63b233308e92a4c360f38d4728c519ac2131ff0
Fixes: 30230444
serManagerService.java
d80c3620082e7aef9cec40e71810ba477a4a9ddd 20-Jul-2016 Fyodor Kupolov <fkupolov@google.com> Do not migrate apps data on every user start

Only migrate apps' data if lastLoggedInFingerprint of the user is
different from the current build.

Bug: 28750609
Change-Id: Id7e3cdd787b122a56b880abb62c9d173a6463ba6
ackageManagerService.java
serManagerService.java
e1f90ac94a2648cc3dfef5e12676f2343fa97edf 20-Jul-2016 Makoto Onuki <omakoto@google.com> Merge \\"Stop adding FLAG_ACTIVITY_RESET_TASK_IF_NEEDED when...\\" into nyc-mr1-dev am: ceadb1a86a
am: c74ed0d6dc

Change-Id: I0c66444e1352af26bf7c039271a5bee952eb5e52
347a6bd82059bc7581b1dcd229228f622c5cfca1 19-Jul-2016 Makoto Onuki <omakoto@google.com> Stop adding FLAG_ACTIVITY_RESET_TASK_IF_NEEDED when...

starting a shortcut.

- Also add API surface to support launching multiple intents

- Also add SM.isRateLimitingActive() which was supposed to be
added but was not due to a bad rebase.

Bug 30218829

Change-Id: I82d60ec0df1e2b889538705f9f8870ee727dd55d
auncherAppsService.java
0b9d1db5c1aab9017daf05abd0ba0f4de2c7192d 18-Jul-2016 Makoto Onuki <omakoto@google.com> Unit tests for "cmd shortcut"

Also removed unnecessary commands.

Bug 29612099

Change-Id: Id554163c861fb144cb5140d7eb709178347f7868
hortcutService.java
cd74b3050d2e271556cabc7870a9b8bc3ba67fed 18-Jul-2016 Makoto Onuki <omakoto@google.com> Merge \\"Implement dumpsys --checkin for shortcut manager\\" into nyc-mr1-dev am: 121480cda8
am: 3991a376e5

Change-Id: I3ccc92a0a9f6bfcce5207ef29db73063ec50a9f8
121480cda876f2a6ec3d5ce59c85922721b42890 18-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "Implement dumpsys --checkin for shortcut manager" into nyc-mr1-dev
939edb0dbc5a26be3bac72b69030bfaa7d16b259 18-Jul-2016 Ricky Wai <rickywai@google.com> Merge \\"Do not allow to disable package \\"android\\"\\" into nyc-mr1-dev am: a5111bfda4
am: e9e9f30085

Change-Id: I6159402639a440849357bd4ccd53bc4cb8fbab7a
a5111bfda47f0d6c044c2bdbe6ae8a1c099849d7 18-Jul-2016 Ricky Wai <rickywai@google.com> Merge "Do not allow to disable package "android"" into nyc-mr1-dev
1a7b160ca5bf1b0dcf70747e2d1b6457e2ce10bb 15-Jul-2016 Ricky Wai <rickywai@google.com> Do not allow to disable package "android"

Bug: 25337001
Change-Id: I837d70898f00d3c97c8ae1f5eadd0791ba045df6
ackageManagerService.java
80c3459b3f5f935bbcff6be9e2ac7117901c6b1a 16-Jul-2016 Andreas Gampe <agampe@google.com> Frameworks/base: Fix braino missing line am: 06eb24d95e
am: 46d5eca989

Change-Id: I6cdcd67e7bed24819eac5e11fc775ef8f243a8e0
06eb24d95ec0da2356bbe57fed15f7cdef3ebb7c 16-Jul-2016 Andreas Gampe <agampe@google.com> Frameworks/base: Fix braino missing line

This got accidentally deleted in cleanup.

Bug: 29223204
Change-Id: I018b44d517f226eca30f141a3397c82a4be19afb
ompilerStats.java
17e94691c2fe290d3ed9e06aa48709d062e82b40 16-Jul-2016 Makoto Onuki <omakoto@google.com> Merge \\"Don\\'t accept resource references in string fields\\" into nyc-mr1-dev am: 6fa0e4d518
am: 3d3e2e2b17

Change-Id: Ib5a83728239cfa074fb9800b76bc217dcf990b30
6fa0e4d518a67380fada76bb78b4e7b697b4d7a4 16-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "Don't accept resource references in string fields" into nyc-mr1-dev
d36651717e591ed687f4964d13656c0a52390dba 16-Jul-2016 Makoto Onuki <omakoto@google.com> Merge \\"Cache the default launcher.\\" into nyc-mr1-dev am: cf99263662
am: 6406be311c

Change-Id: If7d3f5325388242a196d78f8429c4aba65ef041e
c13a5c92ef2f576b45aa424084858770f335c8a9 16-Jul-2016 Andreas Gampe <agampe@google.com> Merge \\"Frameworks/base: Add compiler stats to Package Manager\\" into nyc-mr1-dev am: f52ce76d1f
am: a2bff32318

Change-Id: I0a1de16d538e11756df7bda4390c445d5591608e
76269928e677725e2d9b28e2e3aa79961a60a1d0 15-Jul-2016 Makoto Onuki <omakoto@google.com> Implement dumpsys --checkin for shortcut manager

Dump the very basic stuff for now.

We need to update GMS-core to actually collect the information.

Bug 28535604

Change-Id: I6ce17ee2014786a0ef97f3dc973b8a01c2d2a814
hortcutLauncher.java
hortcutPackage.java
hortcutPackageItem.java
hortcutService.java
hortcutUser.java
cf992636627ac881691d9273ca55f408e21f0b2a 16-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "Cache the default launcher." into nyc-mr1-dev
37e5fdc6b4963f3533caecdd92b129f79da69dd8 13-Jul-2016 Andreas Gampe <agampe@google.com> Frameworks/base: Add compiler stats to Package Manager

Add a simple class for storing compiler statistics. Capture compile
times for code paths from a package.

Bug: 29223204
Change-Id: I1b066de6a83a739470a42480eee0bfef88423eea
bstractStatsBase.java
ompilerStats.java
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ackageUsage.java
1030520822c42cc7357b463d301c7e97e928ba22 15-Jul-2016 Makoto Onuki <omakoto@google.com> Cache the default launcher.

Originally we always checked with PM for the default launcher,
which would take ~2ms.

Now we cache the result, and clears the cache when (any) preferred
activities change.

Bug 30126557

Change-Id: Iceef288cd372c8bb9b119aa493e5173d894f2302
ackageManagerService.java
hortcutService.java
hortcutUser.java
0ff13fce6fa4caa0cc61dae555881c4568020327 12-Jul-2016 Benjamin Franz <bfranz@google.com> Block user from setting safe boot setting via adb

Bug: 29900345
Change-Id: Id3b4472b59ded2c7c29762ddf008ee8486009dbb
serRestrictionsUtils.java
6a8581339ba4ac35f55906b9d55bf21a1e7c23ce 15-Jul-2016 Makoto Onuki <omakoto@google.com> Merge \\"Handle locale change and pacakge change in different way\\" into nyc-mr1-dev am: 83fa7a8255
am: 22963b8937

Change-Id: I39da795eeed8bb3d0e53b0ed02663cce1088cabf
83fa7a82558a41a18d959c7b9fb197b787c52779 15-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "Handle locale change and pacakge change in different way" into nyc-mr1-dev
6771d73703d35f2b28b8602dcbbed88fdffb9a0b 14-Jul-2016 Makoto Onuki <omakoto@google.com> Don't accept resource references in string fields

Detect it when a developer accidentally uses @string/... in string fields
and log an error rather than publishing shortcuts with wrong values.

Bug 30140672

Change-Id: I98a60afd7f52282019a94a7a8c30a85ea4c7806b
hortcutParser.java
a12eeeb4ef4fa1c6a07c984c334c83ecb373f05d 14-Jul-2016 Philip P. Moltmann <moltmann@google.com> Merge \\"Always trigger a write if no pages are written\\" into nyc-mr1-dev am: 965a706282
am: 0c1814a153

Change-Id: I7d7021e4ff9074bf60c22caa2b897245fe8a5f4b
e5b46f3bd58314715f5d8d42680c77380e8de299 14-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "Don't allow shortcuts with non-main activities" into nyc-mr1-dev
13260b6ff0438a02bd0f1c5bbcfb4fef71c82135 14-Jul-2016 Makoto Onuki <omakoto@google.com> Don't allow shortcuts with non-main activities

Bug 30122758

Change-Id: Id9ead6706d5460fec3d68c7457e3097f30a9a080
hortcutService.java
19e0f615caff71586d7e968d84f4d08ef2385396 14-Jul-2016 Nicolas Geoffray <ngeoffray@google.com> Merge changes I7a052a8e,Idb11b1c0 into nyc-mr1-dev am: 7366e8c16a
am: 5a7be749f7

Change-Id: Idb189d89f9cebcc6e9809e7f489c51baae5e8253
7366e8c16afb76ca1394385ab28be43e9ebb1898 14-Jul-2016 Nicolas Geoffray <ngeoffray@google.com> Merge changes I7a052a8e,Idb11b1c0 into nyc-mr1-dev

* changes:
[RFC] Special case system apps for profile optimizations
Compile core-apps according to their own "reason" for A/B
0bd776207999ccba17e5adb163710bd7b16ac907 12-Jul-2016 Calin Juravle <calin@google.com> [RFC] Special case system apps for profile optimizations

If the OTA updates a system app which was previously preopted to a non-
preopted state the app might end up being verified at runtime. That's
because by default the apps are verify-profile but for preopted apps
there's no profile.

Do a hacky check to ensure that if we have no profiles (a reasonable
indication that before the OTA the app was preopted) system apps get
compiled with a non-profile filter (by default interpret-only).

Bug: 30032273
Test: Andreas "has verified that Calin's change to A/B works as expected
and promotes things like SystemUI to speed. From my side, that's
ready to be merged"

Change-Id: I7a052a8ea76cab7f649dc993237ea05534d6c4b9
ackageManagerService.java
4e6cef49ef11bbb5bfc0e9f0fb865188492d88b0 14-Jul-2016 Makoto Onuki <omakoto@google.com> Handle locale change and pacakge change in different way

- Stop using a custom callback from AM to detect locale changes
and use the LOCALE_CHANGED broadcast instead.

- This would open up a chance where a publisher app fetches
its won manifest shortcuts after a locale change but
ShortcutManager hasn't updated string resources.

- So instead, at every entry point from ShortcutManager, check
if the locale has changed, and if so, update all resources
(and reset throttling).

- Do the same for package change events too. At every entry point
from ShortcutManager, check if the caller package has been updated,
or any target activities have been disabled. If so, rescan the
caller package.

- We do *not* do the same check at the LauncherApps entry points,
because the launcher should use the callback to listen to
shortcut changes.

- Also stopped using PackageMonitor for now because we want to
set a higher priority and changing PackageMonitor at this point
seems too much for DR.

Bug 29895275
Bug 30123329

Change-Id: Ib4a2f626a936c7328e2cc032324f5c3d1c3b9122
hortcutPackage.java
hortcutPackageItem.java
hortcutService.java
hortcutUser.java
20a5888bc798044d6cc648c149820cedfe445dc5 14-Jul-2016 Daniel Nishi <dhnishi@google.com> Merge \\"Give the default storage manager access to the storage permissions.\\" into nyc-mr1-dev am: 0e5ac11d30
am: dc327ee129

Change-Id: I764e9138b6517452719a91018f50cccb614e24ac
0e5ac11d3030e3d08ab6231c1185f5b84f9f3fd1 14-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Give the default storage manager access to the storage permissions." into nyc-mr1-dev
0aa50a8c1f0de98fbfa94528b9ac86b621cd71ae 14-Jul-2016 Todd Kennedy <toddke@google.com> Merge \"Merge \\"Remove subtle dependencies\\" into nyc-mr1-dev am: c8daad4290\" into nyc-mr1-dev-plus-aosp
am: d49214900b

Change-Id: Ic6c7a96df4013ddd6b3844ba8cb9fc99ff7a483c
c8daad429023077782bbbea4b1813f79b93e49a7 14-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Remove subtle dependencies" into nyc-mr1-dev
8d9d0fecf26b16cc2ea50d3eee4fcd696ff8585f 13-Jul-2016 Daniel Nishi <dhnishi@google.com> Give the default storage manager access to the storage permissions.

Bug: 29793168
Change-Id: Iffeb2f7d86103a245b9bc36e637044633e81bef1
efaultPermissionGrantPolicy.java
c7b4815f232b3bf3dd19e1f8f164303ebcb4692a 13-Jul-2016 Makoto Onuki <omakoto@google.com> Merge \\"Revert \\"Revert \\"Revert \\"Handle package broadcasts before apps do\\"\\"\\"\\" into nyc-mr1-dev am: 6eefe67b2c
am: a74fce83ae

Change-Id: I8dcd074a8075e38416da0d6e3570545f17d6bc15
28c4e806ea6cb12b3b83af8447b6647471a15d38 13-Jul-2016 Todd Kennedy <toddke@google.com> Remove subtle dependencies

There was a very subtle dependency on the method used to allocate a session
id and how that session id was stored. If the session id wasn't stored
in the same synchronized block where the allocation method was called, it
could have been possible to duplicate session ids. Instead of requiring
callers of the allocation method to know that the value must be stored
in a particular way, maintain a separate set of allocated session ids
that is updated by the allocation method and prevents any potential race
conditions.

Change-Id: Ibd793b3851bf1a994e00d86f621180cac598b86e
Fixes: 30089638
ackageInstallerService.java
f34c308dfd9cdda428b8ead8bf655de1608501a9 13-Jul-2016 Makoto Onuki <omakoto@google.com> Revert "Revert "Revert "Handle package broadcasts before apps do"""

This reverts commit 886ba78dfb105eb45416587b73b6c6b336448de5.

With the tests updated.

Change-Id: I162e6ca23c667f90feddc1e9f42b554a416295cf
ackageManagerService.java
hortcutPendingTasks.java
hortcutService.java
2adc0c392e3e98e8fccb16f219acbd8b8a3585e2 13-Jul-2016 Makoto Onuki <omakoto@google.com> Merge \\"Revert \\"Revert \\"Handle package broadcasts before apps do\\"\\"\\" into nyc-mr1-dev am: 98802f6007
am: 80dd14e061

Change-Id: I32fcfdc3fb90fe7b0ac14239a721769234c7cb2f
98802f6007eef7a36237087111c38a998a388903 13-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "Revert "Revert "Handle package broadcasts before apps do""" into nyc-mr1-dev
c3d9dcd9a2434e8d4e528ae41c0233f7d96bffe2 13-Jul-2016 Usman Abdullah <uabdullah@google.com> Merge \\"Grant Camera Permissions to DialerPackage\\" into nyc-mr1-dev am: 7280e66e04
am: 27fe9402ff

Change-Id: Iaa719ce6500eaffb0889e70c3f10f668e303693f
886ba78dfb105eb45416587b73b6c6b336448de5 13-Jul-2016 Makoto Onuki <omakoto@google.com> Revert "Revert "Handle package broadcasts before apps do""

This reverts commit efbbe7ea9db8adab6bff407db1d7fc54bbaf31ee.

Change-Id: I3dbb080db5121307f533a7d411f4f5d47225500e
ackageManagerService.java
hortcutPendingTasks.java
hortcutService.java
d0866414f962267ba2cee2f06cce70df4ff9568c 13-Jul-2016 Makoto Onuki <omakoto@google.com> Merge \\"Revert \\"Handle package broadcasts before apps do\\"\\" into nyc-mr1-dev am: 7f3187bb0d
am: 5f18bbe034

Change-Id: I05af5e8eb457c19e3dbce414e0e2351c936703ff
7280e66e04ab7ac604b06bb065879db4d1caf5e7 13-Jul-2016 Usman Abdullah <uabdullah@google.com> Merge "Grant Camera Permissions to DialerPackage" into nyc-mr1-dev
7f3187bb0d12d288bc7211549c08adeb5ff651aa 13-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "Revert "Handle package broadcasts before apps do"" into nyc-mr1-dev
e4ffde9cacfefb6d3e93ed07497d245c476cb1bc 13-Jul-2016 Mahaver Chopra <mahaver@google.com> Merge \\"Added UM.DISALLOW_OEM_UNLOCK, Removed Global.OEM_UNLOCK_DISALLOWED.\\" into nyc-mr1-dev am: 695a1c50a2
am: e64f60a455

Change-Id: Iedc9544179d3c3de8616375e51f7a60ddd1c8c3b
695a1c50a274c4ba423d910d3d4167a7493a6ea1 13-Jul-2016 Mahaver Chopra <mahaver@google.com> Merge "Added UM.DISALLOW_OEM_UNLOCK, Removed Global.OEM_UNLOCK_DISALLOWED." into nyc-mr1-dev
2c67d6f6c94091b778b9d3d6558ebbbdda56126b 13-Jul-2016 Fyodor Kupolov <fkupolov@google.com> Merge \\"Move grantDefaultPermissions back to onNewUserCreated\\" into nyc-mr1-dev am: 9cf5bf04d2
am: 6d2170ee5d

Change-Id: I047b104b2f1735c072e636ccfe366de411e3204c
9cf5bf04d2ececc616b2c8b6caf5e7df630aa1b8 13-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Move grantDefaultPermissions back to onNewUserCreated" into nyc-mr1-dev
723e10c4a94213bb70c6b639d28d28c1fcacb9a6 13-Jul-2016 Todd Kennedy <toddke@google.com> Merge \\"Don\\'t hold lock calling into PackageMgr\\" into nyc-mr1-dev am: c8967160aa
am: b5a2e31e57

Change-Id: I53f9fa9aed56ff9307894a8fa07ca337f2e41e0f
c8967160aa7b729abd133df7284481aff501513b 13-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't hold lock calling into PackageMgr" into nyc-mr1-dev
83118dd723e31a4b352c519e21e1021de651d8f9 13-Jul-2016 Makoto Onuki <omakoto@google.com> Merge \\"Don\\'t backup & restore disabled shortcuts.\\" into nyc-mr1-dev am: 4885b274c1
am: bc15e3ca2b

Change-Id: I457db12fdcc884a121b82320b7d32646133632ca
4885b274c1502b8e478e16d4418b7fd86ab6c865 13-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "Don't backup & restore disabled shortcuts." into nyc-mr1-dev
efbbe7ea9db8adab6bff407db1d7fc54bbaf31ee 12-Jul-2016 Makoto Onuki <omakoto@google.com> Revert "Handle package broadcasts before apps do"

And fix b/29939691 (don't try to load locked users) in a different way

Bug 29939691
Bug 29895275

Change-Id: Ib55f9c5d5547c54daa4e05c1e50bf4bbceaf1991
ackageManagerService.java
hortcutPendingTasks.java
hortcutService.java
5fd967d263ae8f12665eba072d949b140d13695e 12-Jul-2016 Fyodor Kupolov <fkupolov@google.com> Move grantDefaultPermissions back to onNewUserCreated

Otherwise pre-grants may not work on managed profiles because apps could be
uninstalled when the user is started

Bug: 29955102
Change-Id: I8fafaf1ca6193c1a13bd2f0b463ee30fe473e6b5
ackageManagerService.java
serManagerService.java
a2b109a0a8f9866161d7031c06990dc5e471a709 12-Jul-2016 Usman Abdullah <uabdullah@google.com> Grant Camera Permissions to DialerPackage

The Dialer apps now need camera permissions because they support video
calling. Having the app ask for permission at runtime is not reasonable
because this is difficult to do in situations like:
- incoming video calls
- outging emergency video calls

It also would lead to a poor user experience in the scenario mentioned
above.

We already do this for a couple other permissions including microphone
permissions, and since the idea here is the same we are requesting camera
permissions for the dialer app as well to support video calling.

bug=30036076

Change-Id: Ie2c1bdbcb97236e8497339512dcdb8d921641cf6
efaultPermissionGrantPolicy.java
04918fe02715d330cbefa16d055d5766264273c3 12-Jul-2016 Todd Kennedy <toddke@google.com> Don't hold lock calling into PackageMgr

There's a subtle deadlock; when dumping state, we obtain the package manager
lock before trying to obtain the package installer session lock. Meanwhile,
creating a new session obtains the locks in the reverse -- the package
installer takes the package installer session lock and then tries to obtain
the package manager lock.

Here, we avoid holding the package installer session lock before we call
into the package manager. Alternatively, we could consider not holding the
package manager lock when dumping package installer state. But, given the
scope of the dumping logic, that's a bigger change with other, unknown
side effects.

Change-Id: I11f08484cd335bb7ad3bc557808eb48d14bd29cf
Fixes: 30089638
ackageInstallerService.java
3d9805d50281882b4420ee2d4ede8a8bdd94d455 07-Jul-2016 Mahaver Chopra <mahaver@google.com> Added UM.DISALLOW_OEM_UNLOCK, Removed Global.OEM_UNLOCK_DISALLOWED.

Currently we used global setting to restrict user from enabling oem
unlock. As global settings can be chagned using adb, using user
restrictions instead.

Bug: 29893399
Change-Id: Ic83112a4838b8279bf50408a29ae205e0b8639ee
serManagerService.java
serRestrictionsUtils.java
f3ba2e04be20d33fee989e782ba1966322e7e263 12-Jul-2016 Makoto Onuki <omakoto@google.com> Don't backup & restore disabled shortcuts.

Also a backup & restore test where an app has manifest shortcuts.

Bug 30016960
Bug 29921267

Change-Id: I8c4c3ece50f26d778b2f8f42251c317eb25d1e14
hortcutPackage.java
be0e56e9d2b7c81852f81584e654de23d165f25c 12-Jul-2016 Makoto Onuki <omakoto@google.com> Merge \\"Throw ActivityNotFoundException when failed to launch shortcut\\" into nyc-mr1-dev am: 50752f7391
am: b1e0982173

Change-Id: I466a7c5985cb080e6e2780cfbafa3bb90cc58dbf
50752f7391a4fd299da1f1b3af1fe58dd4381426 12-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "Throw ActivityNotFoundException when failed to launch shortcut" into nyc-mr1-dev
565621328dd4fc2e179a34494d0f8b8dc1b1eae9 12-Jul-2016 Calin Juravle <calin@google.com> Compile core-apps according to their own "reason" for A/B

If the core apps are not preopted in the B OTA, and REASON_AB_OTA is not
speed (by default is speed-profile) they will be interepreted/JITed.
This in itself is not a problem as we will end up doing profile guided
compilation. However, some core apps may be loaded by system server
which doesn't JIT and we need to make sure we don't interpret-only.

Bug: 30032273
Change-Id: Idb11b1c01c4c4ceba043feb3a9ccc6958035d3b7
taDexoptService.java
19fa41d066c4b903c0700ceb32ad7b8bbfda1064 12-Jul-2016 Christopher Tate <ctate@google.com> Merge \"Merge \\"Don\\'t force fstrim on OTA\\" into nyc-mr1-dev am: bef41bf538\" into nyc-mr1-dev-plus-aosp
am: 826a6354a1

Change-Id: Ifc1188d094221ed20d04aaa1212f5cd51ad8b202
2afa465e2c718e63d33fd49e2cdef64c8214f057 12-Jul-2016 Makoto Onuki <omakoto@google.com> Merge \\"Handle package broadcasts before apps do\\" into nyc-mr1-dev am: ae13eee9c6
am: fcf7db9eed

Change-Id: Idfe3e8ed29c9a5fe8870527e5c5d7470455f4989
bef41bf538b9935898f5e5bcb8b990440946aaa9 12-Jul-2016 Chris Tate <ctate@android.com> Merge "Don't force fstrim on OTA" into nyc-mr1-dev
83f6d2da372de339dc563d6a7786be3facc52e76 11-Jul-2016 Makoto Onuki <omakoto@google.com> Throw ActivityNotFoundException when failed to launch shortcut

Originally the code used IIntentSender, but I had to switch to calling
startActivitiesInPackage() directly, because sendIntentSender() does
not support returning errors.

Bug 30035853

Change-Id: I5d7669c96a2f1805373c71aebf45b97ac1d01ff6
auncherAppsService.java
hortcutService.java
d589c185c5b9c81c67c68f28c4c08c2c434db64e 11-Jul-2016 Christopher Tate <ctate@google.com> Don't force fstrim on OTA

This avoids showing a (momentary) "Optimising storage" UI along the way,
which proved to be jarring.

Bug 30064543

Change-Id: Iaff0f32eea4170829d71a4f2bd270cc63d1da543
ackageManagerService.java
a2241834a54dc91e2eef858741f1a56a743c27b2 06-Jul-2016 Makoto Onuki <omakoto@google.com> Handle package broadcasts before apps do

- Have PM to call the shortcut manager directly before sending a
pacakge broadcast.

- The shortcut manager will enqueue a task to handle a package
broadcast, which will be executed on Handler.

- At the entry points of all external facing methods, block until
all pending tasks are finished.

Bug 29895275

Change-Id: Ib29fa3c9c8d9b9e0ca5c8f1e9da2a390324960a4
ackageManagerService.java
hortcutPendingTasks.java
hortcutService.java
82f9f15d4e02016ed3e279f1ea876a32aa623a3d 07-Jul-2016 Esteban Talavera <etalavera@google.com> Merge \\"Disallow OobConfig being suspended\\" into nyc-mr1-dev am: ccdad8f85b
am: 8ccaacde33

Change-Id: I28c0621afb77e4c2d6471b0390d4acf794f4d1ea
ccdad8f85b3dbdfb29f795d82fdd60d58cbd61df 07-Jul-2016 Esteban Talavera <etalavera@google.com> Merge "Disallow OobConfig being suspended" into nyc-mr1-dev
b567da4108a2fff888e492cbefff08f6cc70b101 07-Jul-2016 Sudheer Shanka <sudheersai@google.com> Merge \\"Enable the demo launcher package as well.\\" into nyc-mr1-dev am: b5b2c196a8
am: be22429bb6

Change-Id: Iba60a6a38d756141328597be8098eec6a0e24926
b5b2c196a8ba1121156b0b4e80dec7bc7f314d6e 07-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Enable the demo launcher package as well." into nyc-mr1-dev
194e4153844267634e44c4feada9670c8f433ccd 07-Jul-2016 Sudheer Shanka <sudheersai@google.com> Enable the demo launcher package as well.

Bug: 29922954
Change-Id: I81ad01d9ca5e3505df716bde2506e0f1e7f7a6b7
serManagerService.java
ffdf3aff813393ddbb7ee8ab6891fa7f365057a6 07-Jul-2016 Jeff Sharkey <jsharkey@google.com> Merge \\"Ignore serial number checks when emulating FBE.\\" into nyc-mr1-dev am: 12f6687bd5
am: f00768d3e5

Change-Id: I0ddf0ac52f93964050dd7c72ea1737e92695dfb9
12f6687bd597f8dcb89a8c1159afd6736c77411b 06-Jul-2016 Jeff Sharkey <jsharkey@google.com> Merge "Ignore serial number checks when emulating FBE." into nyc-mr1-dev
5133b6204c33be30b30daa21e61f2a7ad39b3da0 05-Jul-2016 Tony Mak <tonymak@google.com> Disallow OobConfig being suspended

Change-Id: I79d8e6b8bb77878767a0572a567a10ff08c0b6b8
Fix: 29892597
ackageManagerService.java
660d0fd89e563a2894b6bd3e3aa756ad4c216fc7 01-Jul-2016 Todd Kennedy <toddke@google.com> Merge \\"null check jarfile before using\\" into nyc-mr1-dev am: 15ba58b8a4
am: 656e13291a

Change-Id: If1e2cbc861ff8b55e714c36e053ab5bb90e19126
15ba58b8a48cb2bc64d1d71d7f96653c0f2ea34c 01-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "null check jarfile before using" into nyc-mr1-dev
5e8bff33627f791a8bf30a094b84ca2181bf2e1b 01-Jul-2016 Todd Kennedy <toddke@google.com> Merge \\"Use category DEFAULT home actions\\" into nyc-mr1-dev am: 7742a315fc
am: df649e3709

Change-Id: I9ed4c598e5d3e6cef02f821d44958297b942531f
7742a315fc0793e330beb14d538e9efca8e67c98 01-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Use category DEFAULT home actions" into nyc-mr1-dev
015eb8202a4b1ced01b36668bfc145bc7a70bae4 01-Jul-2016 Todd Kennedy <toddke@google.com> null check jarfile before using

Bug: 29937423
Change-Id: I14f8530523bedf6c287a7f89d3e54919d98454c9
ackageManagerService.java
88dece9144e4806ef54f41cc9273d7c07ee53371 01-Jul-2016 Makoto Onuki <omakoto@google.com> Merge \\"Make sure re-published dynamic shortcuts are always enabled\\" into nyc-mr1-dev am: 7df9ce075f
am: 39e24512a1

Change-Id: Icfb06157a5fda86708c5a56afe9491ad902caaae
a1fbcadb57e4bb18eef948bed837c1626ec6c387 01-Jul-2016 Makoto Onuki <omakoto@google.com> Merge \\"ShortcutManager: Make sure persisted default launcher still exists.\\" into nyc-mr1-dev am: 5b080d4e90
am: dfbe377b1d

Change-Id: I83ae3f8be3291c3bc2d8a9a4eb3fe5b66957ce19
7df9ce075fddc8f3b4e5f177b41bab864c759e8b 01-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "Make sure re-published dynamic shortcuts are always enabled" into nyc-mr1-dev
5b080d4e90d8cf87343a1c9dfbb75992d1b8d654 01-Jul-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: Make sure persisted default launcher still exists." into nyc-mr1-dev
bbfb1c174a83d8f87cc072e3a6d4a17528f1e5b7 01-Jul-2016 Todd Kennedy <toddke@google.com> Use category DEFAULT home actions

When querying for activities that support action HOME, only consider
those that also have category DEFAULT.

Bug: 29899206
Change-Id: I0cd95c90dff5ed90896205eb6c0ec9be1306eb25
ackageManagerService.java
ee6b6e4a1861336f8db52d8c93dbf32ee9615cfa 30-Jun-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Make sure persisted default launcher still exists.

- Also make sure to ignore unexported activities.
(e.g. unexported activities shouldn't have shortcuts.)

- Also add unit tests for package manager related operations.

- Also remove stale TODOs (per-activity shortcut count check is
implemented already.)

Bug 29699769
Bug 29516954

Change-Id: Ia18301baf6bec1ad71ae195d9ae3d10bd8386fc4
hortcutPackage.java
hortcutParser.java
hortcutService.java
ff14f73152775f91fe211729e2cb16a5da6933ab 01-Jul-2016 Makoto Onuki <omakoto@google.com> Make sure re-published dynamic shortcuts are always enabled

- Originally there was explicit code to take over the disabled flag,
which was simply not necessary.

- Also fix the startShortcut() tests that have temporarily
been disabled.

(Also remove the stale TODOs to avoid conflict with Ia18301ba)

Bug 29633681

Change-Id: I58b12ad6918d7fef4b79059b0c2c7f2df6e32269
hortcutPackage.java
076673c24ebc9c1c3f567d2f91a3cf88d7b23b0a 01-Jul-2016 Fyodor Kupolov <fkupolov@google.com> Merge \"Merge \\"Performance optimizations in generatePackageInfo\\" into nyc-mr1-dev am: 4d9af67fe2\" into nyc-mr1-dev-plus-aosp
am: d6340b4226

Change-Id: Id0f1d008b69e2cf7ef3029a724f767a74139c4de
4d9af67fe28427652add68645eb62fbffd5b80a7 01-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Performance optimizations in generatePackageInfo" into nyc-mr1-dev
475c908a6d7411d3a9b1ceaccbda246fd8254bec 01-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Improvements on 'list packages' command:"
5e57a20c09512c676bc1ac938c5a2516ba260f72 30-Jun-2016 Fyodor Kupolov <fkupolov@google.com> Performance optimizations in generatePackageInfo

In PM.generatePackageInfo, granted permissions (returned by permissionsState.
getPermissions) are only used if the package has a non-empty list of
requested permissions. Added a shortcut to handle that. In my tests
this shortcut is triggered in ~20% calls to PM.generatePackageInfo.

Also added an early continue in PermissionsState.getPermissions. Calling
hasRuntimePermission was not necessary in 90% cases.
Also changed ArraySet to be created with capacity for all mPermissions --
this is the typical scenario, previously it was going through multiple
grow operations.

Bug: 29879962
Change-Id: Ic4d8914d1c4f4df447deee2e3e3a15a2594e90ef
ackageManagerService.java
ermissionsState.java
60efbf25865ae395548c38be42b856e6ede22f7d 30-Jun-2016 Makoto Onuki <omakoto@google.com> Merge "Start shortcuts as if publisher apps did using PendingIntent" into nyc-mr1-dev
7877b8add811aafd7f57f731c8e22c9fe6a319c8 29-Jun-2016 Fyodor Kupolov <fkupolov@google.com> Optimized onUnlockUser

Offload work to the handler thread to allow AM to proceed with unlocking
the user.

Also optimized generatePackageInfo by not computing GIDs when GET_GIDS
flag is not set.

Bug: 29619732
Change-Id: Ib9dea53ea0d74038baeed67f21077305da61e46e
ackageManagerService.java
ea11db15bd0cfe6ecbc44dd80a988ddf0e8c1ce7 25-Jun-2016 Makoto Onuki <omakoto@google.com> Start shortcuts as if publisher apps did using PendingIntent

Bug 29639471

Change-Id: I2aad115669b431cbea785ba92040b1958117ab47
auncherAppsService.java
eece986386869be86b6a4be96296496f93d72bdf 29-Jun-2016 Felipe Leme <felipeal@google.com> Improvements on 'list packages' command:

- Removed redundant -lf (which behaves like -f).
- Added missing options to help.
- Added a --uid UID option to filter packages by UID.
- Added a -U option to display the package UID.

Change-Id: Ia55520377771c1aecd98cb8ccce04d9530ad951a
Fixes: 29872396
ackageManagerShellCommand.java
bc8e0052fdf92efd0471b97092ee6a7e1eb2320d 30-Jun-2016 Makoto Onuki <omakoto@google.com> Merge "Fix updateShortcuts() with icons" into nyc-mr1-dev
01e51e59dda2253dbbb2ab7eb3f951bf5fa940be 30-Jun-2016 Makoto Onuki <omakoto@google.com> Merge "Address API council feedback (continued)" into nyc-mr1-dev
d6880797f72e1e397e18c6e709c0125f795c7d2e 29-Jun-2016 Makoto Onuki <omakoto@google.com> Address API council feedback (continued)

Got a second set of comments.

Bug 29757958

Change-Id: Ib3a3ffd28bc3e35eb0218b0819870eb5c6ebadb5
hortcutService.java
7281cf276ac084562c0382e4002b0ddce93c95b2 29-Jun-2016 Alex Light <allight@google.com> Merge "cp preopted files from B partition during PM init." into nyc-mr1-dev
dd097812fa84b898a46cb5dd253422e78779a150 29-Jun-2016 Makoto Onuki <omakoto@google.com> Fix updateShortcuts() with icons

But 29822569

Change-Id: I72a0903ccc8acffc42f40d9df7b99ed6de26b66d
hortcutPackage.java
hortcutService.java
b71081e4e9655d200a2332ade1fbf8a6c0b6825b 29-Jun-2016 Amith Yamasani <yamasani@google.com> Merge "An API to check if running in a demo user" into nyc-mr1-dev
1c41dc8ec59db15cfc050f420f857fcbf0ff2bf0 29-Jun-2016 Amith Yamasani <yamasani@google.com> An API to check if running in a demo user

Add an API to query if the calling app is running
in a demo user sandbox. This allows apps to customize
the starting experience to a potential customer.

Change-Id: I50e40f9a8c66da4b5672c1dc64606d7bedba3f8c
Fixes: 29833923
serManagerService.java
0271fd661dc547e15495e31913d5cde4f122dde9 28-Jun-2016 Suprabh Shukla <suprabh@google.com> Improving the Reset Demo Warning dialog

Removing explicit call to setView which was distorting the layout
of a standard AlertDialog. Used the correct unicode characted for
apostrophe. Also removed calls to enable demo mode launcher for user 0.

Bug: 29520255
Change-Id: Id876f01f8e51c02634c03fce1ea93a15b111fc27
serManagerService.java
d06f87399be44995fbe4690d7c7e73f41424fa2e 28-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Frameworks/base: Add new flow to OtaDexoptService" into nyc-mr1-dev
a52c9d90cb1e70ca777265c6ca565c13ff4e0d04 28-Jun-2016 Jeff Sharkey <jsharkey@android.com> Ignore serial number checks when emulating FBE.

When emulating FBE, we may have chmod 000'ed the directory to emulate
it being locked, which results in us failing to read the serial
number, causing a unintentional data wipe.

To avoid this, ignore the serial number check when emulating FBE,
which is a developer-only feature.

Bug: 29231715
Change-Id: Idb056ab378174004d1430b5e7c20db17de28231e
serManagerService.java
cc241a580cb9b753d0dde0cea578feb74ad517e7 24-Jun-2016 Andreas Gampe <agampe@google.com> Frameworks/base: Add new flow to OtaDexoptService

Add functionality to capture/intercept installd communication, and
use this to return the full communication for dexopt. These parameters
can be used to drive otapreopt_chroot directly.

Keep the old direct invocation alive until devices have transitioned
to a service that exposes this API.

In preparation for renaming of A/B OTA artifacts to include target
slot names.

Bug: 25612095
Bug: 28069686
Change-Id: I14728ee1266f3882cada8f08dd21891ed5f7a0cb
nstaller.java
taDexoptService.java
taDexoptShellCommand.java
88a4c5ba4e7a2b1f0e68beb2fef477210311396e 27-Jun-2016 Amith Yamasani <yamasani@google.com> Merge "Don't reuse userids that are being cleaned up on boot" into nyc-mr1-dev
dc52eaaa982f59e6c3369f3a485a4fd8e05253c1 27-Jun-2016 Steven Ng <stevenckng@google.com> Merge "Disallow disable / hide device provision app" into nyc-mr1-dev
ae26189aa9a1a2d20ca2006d591d50d7338eb917 27-Jun-2016 Amith Yamasani <yamasani@google.com> Don't reuse userids that are being cleaned up on boot

During the current session, if we're cleaning up some
old users, mark them as being in the remove pile so
that the userIds are not reused right away. Otherwise
there's a potential for confusing the file-based crypto
layer.

Bug: 29635364
Change-Id: I57a868fbe6c58a02ffcea63809d25eba01360e1e
serManagerService.java
3dafee6c1820bf0946bab04b290c5a757112d3e7 23-Jun-2016 Alex Light <allight@google.com> cp preopted files from B partition during PM init.

This allows us to save space on the system partition while still
having access to the preopted files.

We do this on first boot when the "ro.cp_system_other_odex" property
is set to 1. We do this during package manager initialization before
scanning the system to see which apks need to be optimized again.

Note that a separate script, run by init, is actually responsible for
finding and copying the files. We simply request that it runs.

Bug: 29278988

Change-Id: I8d7c790ad35b32a0ce1d87939f043419bae4d88a
ackageManagerService.java
b08790c3b2f3bdb0c2e2f7ff46e4584fb1127769 23-Jun-2016 Makoto Onuki <omakoto@google.com> Shortcut: Only "main" activities can have shortcuts.

- Don't publish shortcuts when their target activities are not main.
- Only scan manifest shortcuts for main activities.
- When an app is updated, remove shortcuts that no longer belong to
valid main activities.

- Also re-publish manifest shortcuts after 'clear data'
- Also listen to PACKAGE_CHANGED and disable/re-publish shortcuts
properly.

Bug 29355786
Bug 29582255
Bug 29601844

Change-Id: I6c701ce669cf30a227bc2af4aa01de467ef73e3a
hortcutPackage.java
hortcutParser.java
hortcutService.java
hortcutUser.java
9d48a731d0a7c016b58bc9c1afc4acd94200650f 24-Jun-2016 Steven Ng <stevenckng@google.com> Disallow disable / hide device provision app

+ Rename functions in ProtectedPackages.
+ Add a Set in ProtectedPackages to store protected package.

Bug: 29116229
Change-Id: Ib7dd93a158c09ebbf70f4d57c1afbd2c5102edbd
ackageManagerService.java
rotectedPackages.java
2a6f79d45f5deae42567a298188da2ed7533e029 24-Jun-2016 Makoto Onuki <omakoto@google.com> Merge "Make "cmd package set-home-activity" more CTS friendly" into nyc-mr1-dev
3bdbf985e1e6131caec71e21c08827333771a091 24-Jun-2016 Makoto Onuki <omakoto@google.com> Make "cmd package set-home-activity" more CTS friendly

- Print "Success" when it went well.
- Catch all exceptions and print error message, not just
RemoteExceptions

- Update the shortcut manger test utility to match the new behavior

Bug 29612099

Change-Id: If6a80241ea5e8ef0b2d3f961d1442e730b908764
ackageManagerShellCommand.java
d73d2a3a3d9169cc9222f0f187d58800da4964ba 24-Jun-2016 Todd Kennedy <toddke@google.com> Merge "fix last modified time" into nyc-mr1-dev
8051a0a3958f8ff75ce36cd5b4eb09dfc95662b1 23-Jun-2016 Todd Kennedy <toddke@google.com> fix last modified time

For cluster packages [i.e. packages that are split among multiple APKs]
the codePath is the directory containing the APKs. This normally works
well since the directory is created newly on update. However, it breaks
down during OTA when the directory modification time may or may not
change.

Specifically for cluster packages, we determine the packages "last
modified time" as the date of the newwest APK added to the package.

Bug: 29575840
Bug: 29610181

Change-Id: Ia0a40cf6aaf4102f35e9319ebdb95074b1740c90
ackageManagerService.java
eaa1c9ae4248810ed30c52d85e348712f5621a50 23-Jun-2016 Jeff Sharkey <jsharkey@android.com> Merge \"When uninstalling, only kill the requested user.\" into nyc-dev
am: 060d5a0e0a

Change-Id: I3975462d7f027cc4fd449c56ba0c5f6442369a1b
85f449eaba207d5d3a72bd091855a02ff019404c 23-Jun-2016 Jeff Sharkey <jsharkey@android.com> When uninstalling, only kill the requested user.

When an app is being uninstalled for a specific user, only kill the
app under that user; leave the app running under other users.

Bug: 28875343
Change-Id: Ie60753cfd22df10a2b17d8c3732b6f19d2fe1fb9
ackageManagerService.java
5d1d63708662262733cfa0262f9e8d7b9543907e 22-Jun-2016 Jeff Sharkey <jsharkey@android.com> Merge \"Avoid runtime restart when storage is missing.\" into nyc-dev
am: 18553f5f73

Change-Id: I9303aa177f25f27db7090bf2464218d690aaeafe
11f197c3fe24c5fdccf3c2feacb22bc16d73d5fc 22-Jun-2016 Jeff Sharkey <jsharkey@android.com> Avoid runtime restart when storage is missing.

When primary shared storage is completely missing, catch the thrown
exception and treat as if ejected.

Bug: 29461637
Change-Id: I8eb5cdeb01983efbf26da3d32ab19a6630662156
ackageManagerService.java
f5cf319dc92a5b9ed6197ee5ecc9eba37eaeb63c 22-Jun-2016 Nicolas Prevot <nprevot@google.com> Merge \"Don\'t allow showing an activity if user is stopping or shutting down.\" into nyc-dev
am: 2058553b8d

Change-Id: Ie6995527fb31b9b5f0c272726c80754927770c55
2058553b8d57ac7156aad6387c0e9b397ce6f265 22-Jun-2016 Nicolas Prévot <nprevot@google.com> Merge "Don't allow showing an activity if user is stopping or shutting down." into nyc-dev
1219c924bdf98fd5342fe5bb7cd09da1012d2e1a 20-Jun-2016 Nicolas Prevot <nprevot@google.com> Don't allow showing an activity if user is stopping or shutting down.

BUG:29264996
Change-Id: I9fc97c5dc37e6d5656b82b277954b5963eb345c4
serManagerService.java
4504b0e40c8e1bca6d826faf04526bcf01b673d7 22-Jun-2016 Todd Kennedy <toddke@google.com> Merge \"Revert \"Parse \"vendor/priv-app\" to find privileged applications\"\" into nyc-dev
am: c211539769

Change-Id: I305fd763e69bc6d4836193397cb63f632e26a6a9
c211539769dfaa507cfaf7dc22e9feb56065018c 22-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Revert "Parse "vendor/priv-app" to find privileged applications"" into nyc-dev
3c67b3e47ca680d9e1b0aff69e8a8ea796dedaae 22-Jun-2016 Makoto Onuki <omakoto@google.com> Merge "Shortcut Manager: Address API council feedback and fix TODOs" into nyc-mr1-dev
56b9656372b51eee6f1849cd2f1428ace78729bc 22-Jun-2016 Todd Kennedy <toddke@google.com> Revert "Parse "vendor/priv-app" to find privileged applications"

This reverts commit 02708b1ac41e12029b806085f8ff76a0e2c916b5.

Change-Id: Ie1ba362a9f5ee46516a79c35bd4a6e45f84b6a32
ackageManagerService.java
b5a012fd6f088629746057a3902b5926f9fe8e08 21-Jun-2016 Makoto Onuki <omakoto@google.com> Shortcut Manager: Address API council feedback and fix TODOs

Bug 29515722
Bug 29516909
Bug 29515090
Bug 29516954
Bug 29515088

Change-Id: Ibe1d27033cbd0fd50d37e3d9945b47551211c568
hortcutService.java
bede3bfb1e7182bdab6433a0860d8428ebe4cd15 21-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Added explicit cast so it compiles on Eclipse." into nyc-mr1-dev
409b0a13e1f2f3f62e4827b835700c4cf2b77f06 21-Jun-2016 Todd Kennedy <toddke@google.com> Change prefix based upon mask

The mask may not be all F's.

Change-Id: I50ff4e4fb95af2037b84a1531b60dd9c0986bf86
ackageManagerService.java
bc7e15eedc0f9e8d37b53af618834c017708e008 21-Jun-2016 Jeremie GARCIA <jeremie.garcia@intel.com> Merge \"Parse \"vendor/priv-app\" to find privileged applications\" into nyc-dev
am: 8a1bc54ab0

Change-Id: I651efd38fa6dd6433a13e5eb7569d882866cbc1e
8a1bc54ab050daac935536f7fc5a8b9130e3eed3 21-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Parse "vendor/priv-app" to find privileged applications" into nyc-dev
02708b1ac41e12029b806085f8ff76a0e2c916b5 05-Nov-2015 Jeremie GARCIA <jeremie.garcia@intel.com> Parse "vendor/priv-app" to find privileged applications

Change-Id: Icbbafba96b7880f51ca3afcee53d5f3dd5b86a45
Signed-off-by: Jeremie GARCIA <jeremie.garcia@intel.com>
Signed-off-by: Zhiquan Liu <zhiquan.liu@intel.com>
Bug: 29488499
ackageManagerService.java
901c03faba8c73194e694222477ce8d2c594d324 20-Jun-2016 Makoto Onuki <omakoto@google.com> Merge "Launcher shortcut callback should deliver manifest shortcuts too" into nyc-mr1-dev
be880349fa58efc8781eafe28cd603e8a8d3c1c9 20-Jun-2016 David Brazdil <dbrazdil@google.com> Merge \"Fix NPE in reading package-usage.list file\" into nyc-dev
am: ec3f8409b8

Change-Id: I29238af5df6b96a28960edfadfb1c66f595a670f
acc21f572dfb88f8fa08ea95c77c5ce212b86efb 20-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "fix resolver" into nyc-mr1-dev
ec3f8409b84e555f21290372de911ff704406e72 20-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix NPE in reading package-usage.list file" into nyc-dev
2aaa7c189805259de6023d3110dc1503514dd84a 20-Jun-2016 Narayan Kamath <narayan@google.com> Merge \"PackageManager: Don\'t fail app installs if dexopt fails.\" into nyc-dev
am: 5ae42bb661

Change-Id: I7892f2f35f6f43d98d4a01ff9c5bb64df486d11b
958b3410bf9d5a9c8afdc7571d514b242926101e 20-Jun-2016 Todd Kennedy <toddke@google.com> fix resolver

Change-Id: I31649d0f85b7b6553a6ecf38fd7c08279b85a0a6
ackageManagerService.java
83dce3642abb44fb83384a2e95ce2b89bfd80e20 20-Jun-2016 David Brazdil <dbrazdil@google.com> Fix NPE in reading package-usage.list file

A zero-length file is a valid package usage file of version 0 but
checking against the version 1 magic would throw a NPE.

Bug: 29491065
Change-Id: Ie54b1dd3218e4b1251c29db0c784a5ddf605394f
ackageManagerService.java
4d6b87ffdf06df3303239130ced685bc1a3fae50 17-Jun-2016 Makoto Onuki <omakoto@google.com> Launcher shortcut callback should deliver manifest shortcuts too

- Also include "activity" in the key fields, as this is now an
important field.

- Also optimize ShortcutInfo parceling for the "key field only" case.

Bug 29394043
Bug 29451629

Change-Id: I61b2bc2f61ad6ebdcbaf6d02f1bd88777c45a7f0
auncherAppsService.java
99407db8ddb70141a9582b4d9f5d5012067748fe 20-Jun-2016 Narayan Kamath <narayan@google.com> PackageManager: Don't fail app installs if dexopt fails.

bug: 29493857
Change-Id: I953de204319b943d9389bb4c787f859e169e8d21
ackageManagerService.java
f746a1be2f905ec0a55f7d8230b8ef7d9b542e2e 18-Jun-2016 Fyodor Kupolov <fkupolov@google.com> Merge \"Call AppOpsService from the handler thread\" into nyc-dev
am: 1347cdb2e1

Change-Id: Ia3adf0e08a7612c39b6e2e040c1bde2efb46dea9
a65d8b660986520a8d7b6ec4c363ce13e4560667 17-Jun-2016 Makoto Onuki <omakoto@google.com> Merge "Update manifest shortcut XML schema" into nyc-mr1-dev
df6da040e00cba255cad64d2d231aae62928607a 16-Jun-2016 Makoto Onuki <omakoto@google.com> Update manifest shortcut XML schema

Use the standard <intent> tag instead of custom tags.

- Also fix setDynamicShortcuts(), which was broken in the previous CL.
- Also tolerate runtime exceptions while parsing XMLs
- Also fix b/29422018 while I'm at it

Bug 29390156
Bug 29077932
Bug 29422018

Change-Id: I2756c9d66c6d7b2962a982d9e57a7d84a5755b28
hortcutPackage.java
hortcutParser.java
hortcutService.java
1347cdb2e1adf2e892e2bb0640b546bb86d1cec2 17-Jun-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Call AppOpsService from the handler thread" into nyc-dev
e1eb4cd0e74e0908547b48712dde5ecf0909cbc3 17-Jun-2016 Sudheer Shanka <sudheersai@google.com> Merge \"Allow apps with CREATE_USERS permission to create restricted users.\" into nyc-dev
am: 48ee87d4a7

Change-Id: Ib61fe36aef8fc992e87ccaa692cc2712caf36570
48ee87d4a7e6a1f9127875fd4ecf99f62d1faedb 17-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow apps with CREATE_USERS permission to create restricted users." into nyc-dev
ec30ca35aa6bb51643d266b73f3c93d30c96ac3f 17-Jun-2016 Fyodor Kupolov <fkupolov@google.com> Call AppOpsService from the handler thread

Otherwise it may cause deadlocks, for instance if
updateUserRestrictionsInternalLR is called with AMS lock held.

Bug: 28888422
Change-Id: I455c7392f206ff0bb6c99ec5c4a531921a115070
serManagerService.java
186768150f0ed1f68a331d175c0808b2031667c9 16-Jun-2016 Mahaver Chopra <mahaver@google.com> Merge "Global.OEM_UNLOCK_DISALLOWED should only restrict when enabling oem" into nyc-mr1-dev
092d9613676e841093ed1992b559aea455d56548 16-Jun-2016 Todd Kennedy <toddke@google.com> Merge \"Make sure we\'re locked\" into nyc-dev
am: 32d67fab83

Change-Id: I2f80a7af0ddd6f282cde6c8d9ea79e0c614fba6b
32d67fab83d96a9c05d03a44fcb44e0410bb61df 16-Jun-2016 Todd Kennedy <toddke@google.com> Merge "Make sure we're locked" into nyc-dev
53d414745c60407b032db543219616b0b74d1557 16-Jun-2016 Sudheer Shanka <sudheersai@google.com> Allow apps with CREATE_USERS permission to create restricted users.

Bug: 29189712
Change-Id: I0f2677adddb22c11cb5a3e38763b0967d9cbd541
serManagerService.java
3d5604dc901aa11e31ca353347b3be348583d289 15-Jun-2016 Todd Kennedy <toddke@google.com> Make sure we're locked

Before calling a method ending with LPw, we need to have the mPackages lock.
Make sure we do that.

Also, ditch the iterator for traversing an ArraySet.

Bug: 29356333
Change-Id: I67df971f2961b577f31153cef46fb153458d6965
ackageManagerService.java
d444ff120774ef87710ee3106534ea7ca44baa5d 16-Jun-2016 Mahaver Chopra <mahaver@google.com> Global.OEM_UNLOCK_DISALLOWED should only restrict when enabling oem

Bug:29409746
Change-Id: I5254456cc2364c93809cebbe2d134a873873790d
serRestrictionsUtils.java
c5ffdb9ee48905bacab0d5986d3eff2b399acd5e 16-Jun-2016 Amith Yamasani <yamasani@google.com> Merge \"More thorough cleansing of expired users\" into nyc-dev
am: 4f2b1b455e

Change-Id: I5714f73a9b90c0cb8fee653abf799374acfc6232
f93ce176dec4691165c78bf25fe36fbf3a93a096 13-Jun-2016 Felipe Leme <felipeal@google.com> Added explicit cast so it compiles on Eclipse.

BUG: 29399275

Change-Id: Id9f49ca85b2b7ab89340e27527ff652047e059ae
auncherAppsService.java
70a91541e9eb2acc6ee5a34785abdc420127a5ec 15-Jun-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManger: Auto-adjust ranks." into nyc-mr1-dev
9e1f5595bd7ffe3af6ca35b3235dfca0ecd07978 08-Jun-2016 Makoto Onuki <omakoto@google.com> ShortcutManger: Auto-adjust ranks.

Spec: go/shortcutmanager-spec-ranks

Bug 28984376
Bug 28536066

Change-Id: Ibffb92233c62792af06eeadc5a9a6379d0506a3c
hortcutPackage.java
hortcutParser.java
hortcutService.java
d04aaa323c3a788d26f18fc66e0a59b47e525b38 13-Jun-2016 Amith Yamasani <yamasani@google.com> More thorough cleansing of expired users

If any /data/system_[c|d]e folders were not erased
when the user was removed (maybe due to a reboot),
make sure they're cleaned up on restart as well
as when the userId is recycled later.

Mark the users' system folders with the correct
serial number for later verification.

AccountManager shouldn't be querying accounts of
partially created/destroyed users.

Change-Id: I4313756b7464f34cd5ce4fb296d61daa50b41fcb
Fixes: 29285673
ackageManagerService.java
serManagerService.java
32015d0519803c56ed81d3dc34e53ac09364f65a 15-Jun-2016 Chris Tate <ctate@android.com> Merge "Implement wildcard support for autoVerify web-link intent filters" into nyc-mr1-dev
1f096663e873d4543be0a9b721068d65e334b70f 15-Jun-2016 Sudheer Shanka <sudheersai@google.com> Merge \"Allow apps with CREATE_USERS permission to call UM.getUserInfo.\" into nyc-dev
am: 159c13801b

Change-Id: Ic83a0ae31afac6b94fcfba8ceee986326fb300ab
76de2c0cdff0361b50ce4d7c832a0b9ba87d0272 15-Jun-2016 Christopher Tate <ctate@google.com> Implement wildcard support for autoVerify web-link intent filters

Bug 28851367

Change-Id: I87bc104bd93f21d6504dcc40d59b5f97c7a277ff
ntentFilterVerificationState.java
accaa08c98d5c4dd012149e452d6fb19ce0c134b 15-Jun-2016 Sudheer Shanka <sudheersai@google.com> Allow apps with CREATE_USERS permission to call UM.getUserInfo.

Bug: 29355382
Change-Id: Iaf73c453156e3a989660d05124b0c0938619abd7
serManagerService.java
a97045b2456b63a9c699a8cc8af66b0e8e95c519 11-Jun-2016 Todd Kennedy <toddke@google.com> New API w/ multiple prefixes

Use the new API that contains multiple hash prefixes and a mask. Also
do some small refactoring necessary to handle multiple prefixes and
use a common implementation of the hash generation

Change-Id: Ib52f767ea6aadc30c67c5bdee949e9f9c5f04e44
phemeralResolverConnection.java
ackageManagerService.java
78f16950c62c68ccc6a5547f7388afd9b1c77fde 13-Jun-2016 Makoto Onuki <omakoto@google.com> Merge \"Push DO/PO package names from DPMS to PM\" into nyc-dev
am: f419bd9e03

Change-Id: Ic3071f3a712da72fd141ef37ac6aabe6dbd09355
f419bd9e03574d63581694f646f1b1136e7574d8 13-Jun-2016 Makoto Onuki <omakoto@google.com> Merge "Push DO/PO package names from DPMS to PM" into nyc-dev
b71c36b000ac5757cf6d5fc3d560afb95e16852a 13-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Otadexopt: Expose progress percentage" into nyc-mr1-dev
5b8f5fd38be1ea9aa3202f747d14f3b8f4b61c01 13-Jun-2016 Makoto Onuki <omakoto@google.com> Merge "Fix some exception messages and enhance unit tets" into nyc-mr1-dev
84d2c0de2ec7ccc9fbbcf8e3357b0ac1eb5f9f56 13-Jun-2016 Ricky Wai <rickywai@google.com> resolve merge conflicts of 6f1ed20 to nyc-mr1-dev

Change-Id: I9fe1e50f99382cbd8cd90f77ef99d081b472bb81
6f1ed200b3aa01af88eb309a55a428ceac56a9a2 13-Jun-2016 Ricky Wai <rickywai@google.com> Merge "Disable quiet mode after UserManager.trySetQuietModeDisabled() is unlocked" into nyc-dev
d8bdb89f9a27955ce991a8e0553e16907a9b2cc0 11-Jun-2016 Tetsutoki Shiozawa <tetsutoki.x.shiozawa@sonymobile.com> Merge \"Solve the infinite loop on clearExternalStorageDataSync\" into nyc-dev
am: d25c718a12

Change-Id: I93d2a6fe287491b957e2851de2ead9d878702e63
d25c718a12725c9721dfc79deb0c27f15aa65d58 11-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Solve the infinite loop on clearExternalStorageDataSync" into nyc-dev
a1d38b3c95cd6a38ee7336fd90729d3b3be6ae25 11-Jun-2016 Makoto Onuki <omakoto@google.com> Fix some exception messages and enhance unit tets

Bug 29275393

Change-Id: Idaa8564d41f86de2a2cbefa4ff3c08b89a3a6dd2
hortcutPackage.java
bf06232f4d440ced8230662a77ca0e8ece6383ca 11-Jun-2016 Andreas Gampe <agampe@google.com> Otadexopt: Expose progress percentage

To be able to report progress of an A/B OTA dexopt, expose a
progress function that the script can query.

Bug: 25612095
Bug: 29223204
Change-Id: Ie8162946d18f6fa78649a40ad5d3949d31a181cd
taDexoptService.java
taDexoptShellCommand.java
a2ef5c89c0945960510716eebe7965002d535789 10-Jun-2016 Sudheer Shanka <sudheersai@google.com> Merge \"Reduce shell power over user management.\" into nyc-dev
am: 1b4124fc95

Change-Id: Ia54f3ad9a8594e101407db6b52b378ae8bec72a2
99bf020f707553601b4830aefe264d54d1f7fbfd 08-Jun-2016 Tetsutoki Shiozawa <tetsutoki.x.shiozawa@sonymobile.com> Solve the infinite loop on clearExternalStorageDataSync

5000 msec timeout is set for waiting DefaultContainerService, but
it's not working. It's not possible to exit a wait loop even if it
takes over 5000 msec.

Bug: 29232999

Change-Id: I74a45637e0a3fa5a7b151e6b3dc0b3aaece96d53
ackageManagerService.java
f5cea03eb036c05cacc711ff90c97a48ffb2bc17 09-Jun-2016 Sudheer Shanka <sudheersai@google.com> Reduce shell power over user management.

Remove MANAGE_USERS permission from shell and whitelist it for
some specific functionality.

Bug: 29189712
Change-Id: Ifb37448c091af91991964511e3efb1bb4dea1ff3
serManagerService.java
e2e1ef0581c188014a0b11bbf46325b82d959720 10-Jun-2016 Todd Kennedy <toddke@google.com> fix prefix generation

when performing bitwise operations, java promotes byte's to int's.
this is normally okay except when the value is negative. in that
case, java extends the sign bits. this means that after shifting,
all of the upper bits are most likely going to be all f's. instead,
undo the sign extension by pulling out just the 8 bits we're
interested in.

Change-Id: I89f7244f6b675be2cca4a185a7002b5f8a6eece1
ackageManagerService.java
af41485757c5da4bff8dafdc2f77d1d9a1ae446d 02-Jun-2016 Todd Kennedy <toddke@google.com> Ephemeral changes for debug builds

The installer/resolver must typically be specified in a baked in XML
file. But, to aid development, allow the installer/resolver to be
added dynamically on debug builds.

Change-Id: I8617bb2a33a51fc596579bdaadb27a11c3740c14
ackageManagerService.java
b1dd80bcfe8d495478d185a5d88fc2cb981e9c47 07-Jun-2016 Ricky Wai <rickywai@google.com> Disable quiet mode after UserManager.trySetQuietModeDisabled() is unlocked

Bug: 29150970
Change-Id: Ie04cec116564147272896e4a5ca076bbc08e60b1
serManagerService.java
7f7fd69333ddb40e220af818b8e4a7053cbd9f86 09-Jun-2016 Narayan Kamath <narayan@google.com> PackageManagerService: fix NPE while renaming foreign dex markers.
am: cf70a17a71

Change-Id: I0c70e239d046272b8165cfa885901fb543f2c100
cf70a17a7100e06d873d15edcfa4497685476327 07-Jun-2016 Narayan Kamath <narayan@google.com> PackageManagerService: fix NPE while renaming foreign dex markers.

The User passed in to scan*LI is null during the initial boot scan
and maybeRenameForeignDexMarkers wasn't expecting it. We attempt to
rename markers for all users if that happens.

bug: 29167406
Change-Id: I892dcc542e75d62d72c062b8ce5506ef85df5fc2
ackageManagerService.java
29cd5b839b00cbb5bc8b2244b1ed5176d36d52e1 09-Jun-2016 David Sehr <sehr@google.com> Merge \"Simplify code paths computation, allow adb root to dump\" into nyc-dev
am: 1c4da6654f

Change-Id: Iad4d8712725819b35d9d25956fd82ff70ef3467d
ac063d64ea133461338a1bf89f949bc5b3825565 08-Jun-2016 David Sehr <sehr@google.com> Simplify code paths computation, allow adb root to dump

Bug: 28748264
Change-Id: I1aefa5d98e80b58d6ed500c5d2d610569cf25c3a
ackageManagerService.java
c29f62c7388f550da2c7368c5dbc0aec7d1564fe 07-Jun-2016 Makoto Onuki <omakoto@google.com> Push DO/PO package names from DPMS to PM

Bug 29126573

Change-Id: I95ea1559f6acf5d2f0e1b0953568cdfc938e83b9
ackageManagerService.java
rotectedPackages.java
3bb436600654e4da253a4b77a86c1dbfa208da8e 08-Jun-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: deal with changing resource IDs on app update" into nyc-mr1-dev
3e27d1254b5ceab88a4180842db3c9feec6b5b75 08-Jun-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: Optimize package scanning" into nyc-mr1-dev
157b1628fd84dc3ef0355fddd8d281618f94d33e 03-Jun-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: deal with changing resource IDs on app update

- When an app is upgraded, all the resource IDs may change. So
if a shortcut is previously published with an icon for res ID 100
and the publisher is upgraded, resource #100 may refer to something
different.

- So now the service also remembers resource names for icon resources,
as wells as string resources. When an app is updated, the service
fetch the updated resource IDs by name.

- Also extract all string resources when a shortcut is published
and persist them, so that even when the original string resources are
removed from the app, the launcher can still show the extracted strings.

- When the system locale changes, re-extract all string resources.

- Also really hide the constants in ShortcutInfo that were
accidentally made public.

Change-Id: I23c29b45c1de5d76175229190a1533c9c62c5960
hortcutPackage.java
hortcutParser.java
hortcutService.java
eff498946ff83495641d8ed9663f3253ffb5ea03 08-Jun-2016 David Sehr <sehr@google.com> Merge \"Add usage line for dump-profiles\" into nyc-dev
am: a85c1e8e69

Change-Id: I62cf1d3c0ea6295500fbb730dfa75e7046c8c06d
6dd9fb7004e888ec1efc4676cd3e4d42b7ac68c9 01-Jun-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Optimize package scanning

SM needs to check all packages when a user is unlocked in case
any apps have been upgraded while the user was not running,
in which case it'll publish the manifest shortcuts.

Currently it actually scans all apps' manifests.

This CL optimizes it by remembering the last scan time (for each user)
and checks only the packages that have been updated since then.

Bug 29069154

Change-Id: Id10b6be8915fe7c1e26daccde7951ddbd01ea452
hortcutService.java
hortcutUser.java
cae13b0afff4b1ef3da25a31f2eb9b16faa14a4b 07-Jun-2016 David Sehr <sehr@google.com> Add usage line for dump-profiles

Previous commit did not include the usage line to be printed when user types
adb shell cmd package

Bug: 28748264
Change-Id: I0a684dbc44c8cc5ec7cd4eba82ce18feed53368c
ackageManagerShellCommand.java
23dca600054c7141560c373046fbe6f4eed88254 06-Jun-2016 Narayan Kamath <narayan@google.com> PackageManager: Rename foreign use markers on app installation.
am: 110a12dff1

* commit '110a12dff13276baa12e8587449a1a7f3a318451':
PackageManager: Rename foreign use markers on app installation.

Change-Id: I9b3450fe63781dff6c7b36053019a98e135ca71d
78f8b9b111ad8de5fefeb11e8db29d25bfdad83b 06-Jun-2016 Narayan Kamath <narayan@google.com> PackageManager: Dexopt core-apps during service bringup.
am: 258aa3e56b

* commit '258aa3e56b02b95e8e855ef949a29babe178b4a5':
PackageManager: Dexopt core-apps during service bringup.

Change-Id: I2fe2508835b564f8d69a5aa743c6f9ea9f1575cc
110a12dff13276baa12e8587449a1a7f3a318451 02-Jun-2016 Narayan Kamath <narayan@google.com> PackageManager: Rename foreign use markers on app installation.

The foreign use markers contain the codePath for a given executable
dex file, so we'll need to rename them when the codePath changes
during an application update. If we don't do this, we might compile
that are used widely across processes (such as GMS core) with
suboptimal filters.

This seems like a messy and brittle design in general, and will be
rewritten post N so that we don't rely on file system topology.

bug: 28998083

Change-Id: Ie4f3995ba52f098edb911b5a388c63696bbd77ac
ackageManagerService.java
258aa3e56b02b95e8e855ef949a29babe178b4a5 01-Jun-2016 Narayan Kamath <narayan@google.com> PackageManager: Dexopt core-apps during service bringup.

Code from these apps can be loaded by the system_server and so
we need to make sure they're compiled before their package contexts
are requested. Leaving them interpreted will cause performance issues.

On a Nexus 6P with WITH_DEXPREOPT=false, this adds an additional
26 seconds to every upgrade / first-boot and ends up optimizing a total
of 20 apps.

bug: 28639246
Change-Id: Ief3c0048fda4f1b1742fbf3e2476e65fa607a18a
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
ac042501c816fa9a65aed005060ebdcfc0a0f3b2 21-May-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Implement usage report API

Bug 28536054

Change-Id: I293e8eaad523e3b0d76d562fc381601633451ed3
hortcutService.java
a9f262d649fd1b3b1980a564facc4f1388c541be 02-Jun-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: Implement max # of shortcuts" into nyc-mr1-dev
a28576cb7201b468908346b4807892706870df92 02-Jun-2016 Amith Yamasani <yamasani@google.com> Merge "Setup user restrictions for demo user" into nyc-mr1-dev
7001a6154088c87a31d56641762ff0c2a48f1d57 27-May-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Implement max # of shortcuts

- Each activity (launcher icon) can have at most 5 dynamic +
manifest shortcuts.

Bug 28536066

Change-Id: Id34371d51c4a1c5e3df7debe3b71b535eb157b6c
hortcutPackage.java
hortcutPackageItem.java
hortcutParser.java
hortcutService.java
462db089d4cd6d290e76ca76c0c159f52dcf0dc1 02-Jun-2016 Zoltan Szatmary-Ban <szatmz@google.com> Merge "Only reset global restriction owner on DO->PO for the right user" into nyc-dev
am: 2002061f34

* commit '2002061f349edfbf583b115af647f0ca34cf749e':
Only reset global restriction owner on DO->PO for the right user

Change-Id: If1782d4b767ec46b14e8c1e31245fd9f99a93bf0
2002061f349edfbf583b115af647f0ca34cf749e 02-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Only reset global restriction owner on DO->PO for the right user" into nyc-dev
52c21e34536948ffb02323ffbb2288716854665a 31-May-2016 Amith Yamasani <yamasani@google.com> Setup user restrictions for demo user

Prevent certain actions by demo user
Also eliminate immersive mode confirmation when device is
in demo mode.

Bug: 27280140
Change-Id: I6955b7bb5c1ae13e1df36cef822b6fd39cb51e46
serManagerService.java
2855609944f0683efec2985f88ee167c9b7941d9 02-Jun-2016 David Sehr <sehr@google.com> Merge "Installer connection support for dump_profiles" into nyc-dev
am: 7c5bcfc21a

* commit '7c5bcfc21ac87c56c57b1929ce04481fa0e116c7':
Installer connection support for dump_profiles

Change-Id: I6cf3d4fe88577ef1d149c3c4b1c3ee7160d9c7e6
f02954ccd5f536577fa4564ede76c5ec61fbbf88 02-Jun-2016 Jeff Sharkey <jsharkey@android.com> Merge "Release AssetManagers when ejecting storage." into nyc-dev
am: 380f3b12a4

* commit '380f3b12a4725a0534d62ada7c6f3bd67ebd0d01':
Release AssetManagers when ejecting storage.

Change-Id: I54282cfcf53279f87e66cc1263ae9663fe94bc04
60585d12e717d6dd02c89cf177159dbb1c7b4fc9 02-Jun-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: API rename" into nyc-mr1-dev
7c5bcfc21ac87c56c57b1929ce04481fa0e116c7 02-Jun-2016 David Sehr <sehr@google.com> Merge "Installer connection support for dump_profiles" into nyc-dev
380f3b12a4725a0534d62ada7c6f3bd67ebd0d01 02-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Release AssetManagers when ejecting storage." into nyc-dev
98bf12f99989ba2550fac83ee48ecbb6f1582f07 26-May-2016 Jeff Sharkey <jsharkey@android.com> Release AssetManagers when ejecting storage.

When ejecting a storage device, the system process needs to rapidly
release any open FDs to prevent itself from being killed by vold.

This change examines all ResourceImpls cached inside the system
process and evicts any that reference the storage device being
ejected. (ResourcesManager will gladly recreate any evicted entries
when asked again in the future.)

Also replace broken use of WeakHashMap, since we want the values to
be weak references, not the keys.

Bug: 28867548
Change-Id: Ib9cfc66497149b6d3f8d49213e9779408a331d2a
ackageManagerService.java
41846b061226af72eaffbdea4dc44fa2bbd087b1 01-Jun-2016 Narayan Kamath <narayan@google.com> Merge "PackageManager: Don\'t clear app profiles during system upgrades." into nyc-dev
am: 93193135b1

* commit '93193135b184a2f1c7518d8beeff7c51b2880606':
PackageManager: Don't clear app profiles during system upgrades.

Change-Id: I1eddbe894b3f4a2583973a98f3dc0d8adf8af16c
eddbfecb8dd751161339a9ed16d07ce2e108a575 01-Jun-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: API rename

The words "title" and "text" implies that "text" is a secondary label
that's shown with the title, but it turned out the launcher would show
only one of those depending on how much space it has.

So now we change them to "shortLabel" and "longLabel"

Note we're only changing the API surface -- in order to mimimize
the impact to the code, internally we'll keep using the old names.

- Also remove "shortcutRank" while I'm here -- it should be implied
from the order of the XML elements.

Bug 29057378

Change-Id: I3203f63b0318c7462c1c61fef43cf9755fa8c008
hortcutPackage.java
hortcutParser.java
93193135b184a2f1c7518d8beeff7c51b2880606 01-Jun-2016 Brian Carlstrom <bdc@google.com> Merge "PackageManager: Don't clear app profiles during system upgrades." into nyc-dev
34a6258b2a7a55733ce80b2b88753dff91c12d52 01-Jun-2016 Narayan Kamath <narayan@google.com> PackageManager: Don't clear app profiles during system upgrades.

They don't need to be cleared and will remain valid as long as
the application itself hasn't changed.

bug: 28998083
bug: 29067239
Change-Id: I2e4a4ee1b168da81073b8e70b12918db592fe691
ackageManagerService.java
a87770828637813dacd176ba3c8d3810f7ed6ab8 25-May-2016 David Sehr <sehr@google.com> Installer connection support for dump_profiles

Bug: 28748264
Change-Id: I22322b5a0716a030d9873edcc6dfd7f3ef2d3bca
nstaller.java
ackageManagerService.java
ackageManagerShellCommand.java
4fb65090324ff0696e5d38795eaeebf70c72e253 31-May-2016 Todd Kennedy <toddke@google.com> Merge "Remove STOPSHIP" into nyc-dev
am: 1c39a112b4

* commit '1c39a112b43e50da4e801d634e28ae7a130c0dcb':
Remove STOPSHIP

Change-Id: Icc176dca4735f3b03c8e1b47015792ecc202d398
1c39a112b43e50da4e801d634e28ae7a130c0dcb 31-May-2016 Todd Kennedy <toddke@google.com> Merge "Remove STOPSHIP" into nyc-dev
7c34fd3ccdfc2ca6dade22f6ee9cb3a57638b669 31-May-2016 Nicolas Geoffray <ngeoffray@google.com> Merge "Look at last used app when filtering." into nyc-dev
am: ce289e937e

* commit 'ce289e937ee6b001cd14824e5dec3c6010b51e61':
Look at last used app when filtering.

Change-Id: I7c1c693cc76d5067733e5b424dbdac1dcb55c288
ff078da846a8d719d2724bd035d987d8e943afbe 31-May-2016 Nicolas Geoffray <ngeoffray@google.com> Merge "Cleanup performDexOpt with instruction sets." into nyc-dev
am: 89f4bff149

* commit '89f4bff149c62baf8371118aed2c4e6ac29976c5':
Cleanup performDexOpt with instruction sets.

Change-Id: Id973c65cbe87f54a743bfcb89fbe7e4aea45d1c8
ce289e937ee6b001cd14824e5dec3c6010b51e61 31-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Look at last used app when filtering." into nyc-dev
89f4bff149c62baf8371118aed2c4e6ac29976c5 31-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Cleanup performDexOpt with instruction sets." into nyc-dev
fa78b219b7dc006a2863fc0a6d2ff68324797f8f 26-May-2016 Nicolas Geoffray <ngeoffray@google.com> Look at last used app when filtering.

In order to cover cases where a device hasn't been used
for a while.

bug:28969280
Change-Id: I897e833ed83912b848f25a7a81fe59f0ee655be1
ackageManagerServiceUtils.java
aabbfc5565a6fee8b1fbdaa26f050ee6617b3370 27-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Revert "Revert "Remove ActivityManager calls with PM.mInstallLock held""" into nyc-mr1-dev
8a5536d53ef1eea92e1a2b997744a27ce904134c 27-May-2016 Zoltan Szatmary-Ban <szatmz@google.com> Only reset global restriction owner on DO->PO for the right user

Bug:28972648
Change-Id: I4ef727205bbd8ec319672480bac7b519b33d2a58
serManagerService.java
22fcc68e6be0edaa98f3dacf79d580a5e5d50005 17-May-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Support manifest shortcuts

- Now apps can publish shortcuts via AndroidManifest.xml
(Sample: I5b127150)

- Rename some APIs per API council feedback

- Publishers can now "disable" shortcuts.
(https://docs.google.com/presentation/d/1raUn1QBURDb1yrd6mSmVxII9ezNh3MWukODdtufJ29U/edit#slide=id.g13ef592464_7_39)

Bug 28785283
Bug 28536066

Change-Id: I4a126841e43e40139bb4baa6d0f98ad7b3a75ac1
hortcutLauncher.java
hortcutPackage.java
hortcutPackageInfo.java
hortcutPackageItem.java
hortcutParser.java
hortcutService.java
hortcutUser.java
ea1b9d7958b4201ca288ea16ed8a8454de6bbca9 27-May-2016 Amith Yamasani <yamasani@google.com> Revert "Revert "Remove ActivityManager calls with PM.mInstallLock held""

Added the missing import.

This reverts commit c51e725644be6d46e25c29e8774b542d52c29400.

Change-Id: Icd63619a12e10dee628e568a6200d429a9936cf0
ackageManagerService.java
serManagerService.java
fb6cf77a6721f2af4df09b33d649f66ad79559f6 27-May-2016 Nicolas Geoffray <ngeoffray@google.com> Cleanup performDexOpt with instruction sets.

Always use the packages' derived instruction sets.

This fixes a bug where otas and background dexopt would only
look at one instruction set.

bug:28994818

Change-Id: I730b59d24943c71de30adb485a823fd79c6806a6
ackgroundDexOptService.java
ackageManagerService.java
ackageManagerShellCommand.java
c51e725644be6d46e25c29e8774b542d52c29400 27-May-2016 Bart Sears <bsears@google.com> Revert "Remove ActivityManager calls with PM.mInstallLock held"

This reverts commit ac06a4907bff7d5ee0612dbb85180222e1455791.

Change-Id: I27bedbd221a8d416b9040a96063e66a1ca69fe2e
ackageManagerService.java
serManagerService.java
5d531e4f6caedbcc2b6a9c7a549b83e37d694c7d 27-May-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Remove ActivityManager calls with PM.mInstallLock held" into nyc-dev
am: a4dbdaf5e9

* commit 'a4dbdaf5e96273dccd474e31700d84a1ad907503':
Remove ActivityManager calls with PM.mInstallLock held

Change-Id: I3be800fc5de9fa3c06f0bf6158a0dbf2a05b165e
ac06a4907bff7d5ee0612dbb85180222e1455791 25-May-2016 Fyodor Kupolov <fkupolov@google.com> Remove ActivityManager calls with PM.mInstallLock held

UserController now pushes user state to UMS.

PM now checks user running/unlocking/unlocked state by calling
UserManagerInternal.

Bug: 28090199
Change-Id: I20e62b37f78238f28dd81f49f876732bbd3c6b34
ackageManagerService.java
serManagerService.java
dd86aa141e02ffaf277996fc1701141ea13e090e 24-May-2016 Mahaver Chopra <mahaver@google.com> Merge "Disallow OEM unlock when DISALLOW_FACTORY_RESET applies" into nyc-mr1-dev
830e32cdccdeeeadc5f07ba006b2b5779f8be65d 17-May-2016 Mahaver Chopra <mahaver@google.com> Disallow OEM unlock when DISALLOW_FACTORY_RESET applies

Bug: 28339424
Change-Id: I4b6dc6f186ea60a13e778f52d574e615b0b19b74
serRestrictionsUtils.java
a09c9e0fc48816096349aac8960a3b49101d90a3 24-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Adding RetailModeService to handle retail mode" into nyc-mr1-dev
cc30b0e7901f753fabbfa08f10d0b3f9b5a54144 20-May-2016 Suprabh Shukla <suprabh@google.com> Adding RetailModeService to handle retail mode

The service listens for the global setting DEVICE_DEMO_MODE and switches
device to demo mode when it is changed to 1. Also, acquires the wakelock
to
keep the screen on and puts up a notification to wipe and reset the demo
session when in demo mode.

Bug: 27280140
Change-Id: If1843016889ec2c50818c67432d60f33063e0986
serManagerService.java
6954259edbbd233eaa6c45835c1b0d00759c52d5 23-May-2016 Fyodor Kupolov <fkupolov@google.com> Additional clean up in onUserRemovedLPw

mDefaultPermissionsGranted, mFingerprints should be cleaned up.

Bug: 28913107
Change-Id: I3758985fe742d38e43538b5221fc3f436c55cb16
ettings.java
dbf0dbd8c216e801b3d95f83d13ae05c1ba0ea39 18-May-2016 Amith Yamasani <yamasani@google.com> Merge "Retail mode flag and some clients for it" into nyc-mr1-dev
ebbf0b6b21a236ee835846e912387d96ae91ebad 18-May-2016 Amith Yamasani <yamasani@google.com> Merge "Fix a deadlock in system server" into nyc-dev
am: ab0744344d

* commit 'ab0744344db3e626f1a249f285289b66653cf6bb':
Fix a deadlock in system server

Change-Id: Ib223cf25d4ac53225e9e8791bdae497956dc8471
3603bc6e3f73421f59a53ff9f5f9d19bc33074f7 18-May-2016 Amith Yamasani <yamasani@google.com> Fix a deadlock in system server

Don't call into DPMS with PackageManager lock held. Doh!

Bug: 28828415
Change-Id: I08437d849236374acc0d804fe31aba703af385ba
ackageManagerService.java
16d3fae49449c8f0411f2cfc8323a86b0c965aa1 18-May-2016 Narayan Kamath <narayan@google.com> Merge "PackageManager: Fix reference profile canonicalization." into nyc-dev
am: 9f33e5cccc

* commit '9f33e5cccc8816ed8d41716eb172ec28b9935946':
PackageManager: Fix reference profile canonicalization.

Change-Id: I089272599a7d03b6e4b210cf5cc2c38a5659eeeb
6d99f796711882ba60977c211d0f92252fe7ad4a 16-May-2016 Narayan Kamath <narayan@google.com> PackageManager: Fix reference profile canonicalization.

Foreign dex markers are named in the runtime by calling realpath(3) on the input
dexfile path and replacing "/" with "@". On the Java side, we're using
File.getCanonicalPath, which is similar but isn't quite the same. It tries
to call realpath() directly, but if that fails, it resorts to a series of
increasingly desperate measures to calculate a "canonical path". We just
use realpath instead.

Also, don't attempt to delete a profile if canonicalization fails.

bug: 28740848
Change-Id: Ie5d5af590187e793db633342a42b923865e5c005
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceUtils.java
eb437d4dffb310857e19bb619778dc5b6b7febff 29-Apr-2016 Amith Yamasani <yamasani@google.com> Retail mode flag and some clients for it

Bug: 27280140
Change-Id: Ide33e941b9c71eb925b5977d0b0d62198537ca14
serManagerService.java
4d7e92b56bcf02e96e474ce44ff6f019d4fa5a08 17-May-2016 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #27532364: Security Vulnerability in IIntentSender.send" into nyc-dev
am: 607844efa5

* commit '607844efa59f79bd9fab55eb75f217d21cd15f5f':
Fix issue #27532364: Security Vulnerability in IIntentSender.send

Change-Id: Iaf3102ba03cf2242b02030aa24df8282ed3fbdc8
607844efa59f79bd9fab55eb75f217d21cd15f5f 17-May-2016 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #27532364: Security Vulnerability in IIntentSender.send" into nyc-dev
8295332d83d1e664a7ef3a731370ae71242688a1 17-May-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: API changes for DR" into nyc-mr1-dev
fc66ec971cf67773bc99553881c480db26221165 17-May-2016 Zoltan Szatmary-Ban <szatmz@google.com> Merge "Introduce system API to get source of user restriction" into nyc-dev
am: 690c2ea117

* commit '690c2ea117f90b7759ac280a1c84f5966b1e7938':
Introduce system API to get source of user restriction

Change-Id: Iab98753f85774d741c5126395d56af194c8b0ca8
690c2ea117f90b7759ac280a1c84f5966b1e7938 17-May-2016 Zoltan Szatmary-Ban <szatmz@google.com> Merge "Introduce system API to get source of user restriction" into nyc-dev
4803983717442b1099b9679b3b0d822cb8511509 17-May-2016 Narayan Kamath <narayan@google.com> Merge "PackageManager: Clear foreign-dex markers when the app is uninstalled." into nyc-dev
am: a8b4f75978

* commit 'a8b4f7597842b17b44e1ea859f218d610789e277':
PackageManager: Clear foreign-dex markers when the app is uninstalled.

Change-Id: I840fb5710bddcbdc69f7899b7432afe1f660de4e
a8b4f7597842b17b44e1ea859f218d610789e277 17-May-2016 Narayan Kamath <narayan@google.com> Merge "PackageManager: Clear foreign-dex markers when the app is uninstalled." into nyc-dev
0250ae2c1b1b3b75a9b1f3c995be031efef50bcf 17-May-2016 Amith Yamasani <yamasani@google.com> Merge "Allow Shell to change component enabled state" into nyc-dev
am: 19b34eccfe

* commit '19b34eccfee9d14e6888c4813cc369bd4b3a7e81':
Allow Shell to change component enabled state

Change-Id: I8b472bf3149b1e721ea90a8a6fed12549e3f1510
19b34eccfee9d14e6888c4813cc369bd4b3a7e81 17-May-2016 Amith Yamasani <yamasani@google.com> Merge "Allow Shell to change component enabled state" into nyc-dev
20c95f854e54b71caa49f0efe07d47d1e6afd435 12-May-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: API changes for DR

See https://goto.google.com/shortcutmanager-spec-dr for
the details.

This CL contains changes to ShortcutInfo and all the new API
entry points, but not the implementation of the new APIs.

- ShortcutInfo.activityComponent is now mandatory.
- Publishers can now disable shortcuts. ShortcutInfo can now have
"disabled message".
- ShortcutInfo now supports string resources for all the String
fields.
-> When launcher fetches shortcuts, ShortcutService will
automatically load resources and expose as strings.
- LauncherApps now supports getShortcutIconDrawable() and
getShortcutBadgedIconDrawable() to be consistent with
LauncherActivityInfo.

- ShortcutInfo.weight is replaced with "rank".

- Added ShortcutManager.reportShortcutUsed(), which will be used for
usage tracking / suggestion.

Bug 28536054
Bug 28536066
Bug 28564134
Bug 28594168

Change-Id: Ib8245b39bb1e753991a9de89c0b73accacd90355
hortcutPackage.java
hortcutService.java
bf12565276484a9ba003f760e8a61bbecc6815f7 13-May-2016 Amith Yamasani <yamasani@google.com> Allow Shell to change component enabled state

But make sure that we don't allow Shell or other apps
to disable an active profile or device owner.

Also limit exactly what states Shell can switch apps
between, similar to Settings UI.

This is required for some CTS tests

Bug: 27924655
Change-Id: I958f0d1de7f0bc1f5a0cbf853d57dfdeb2f9ad59
ackageManagerService.java
89033ea614fe70730172749b6444f78705b66fad 17-May-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Delay grantDefaultPermissions until user\'s first start" into nyc-dev
am: 6eb923cb64

* commit '6eb923cb64f38dcb23fd3ca15793a13a900b1630':
Delay grantDefaultPermissions until user's first start

Change-Id: I16a8505e69e06faf9932c9a173ef8c07ebfddb59
6eb923cb64f38dcb23fd3ca15793a13a900b1630 17-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Delay grantDefaultPermissions until user's first start" into nyc-dev
b45d9833aa3e8bbfdb819c7bcd104c95c8424f05 16-May-2016 Fyodor Kupolov <fkupolov@google.com> Delay grantDefaultPermissions until user's first start

Bug: 28765487
Change-Id: I6a7b0a9fc85964def1e991aafe967977080dfdab
ackageManagerService.java
serManagerService.java
e47ebb554cce5ee6f3c9a841eba4e93918420784 16-May-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Added scheduleWritePackageListLocked" into nyc-dev
am: a7b826b08a

* commit 'a7b826b08aa1b185b0e46b648e5c2ed7f818ae09':
Added scheduleWritePackageListLocked

Change-Id: Ie6642a2bc103c1691659750b93657b4082b6273e
a7b826b08aa1b185b0e46b648e5c2ed7f818ae09 16-May-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Added scheduleWritePackageListLocked" into nyc-dev
1475701100d07af2fad563891082d7712e385950 12-May-2016 Narayan Kamath <narayan@google.com> PackageManager: Clear foreign-dex markers when the app is uninstalled.

Also:
- Adds a missing call to clearProfiles to a callSite that was clearing other app data .
- Fixes a bug where the wrong package was being passed to clearAppProfilesLIF. We should
use the "old" (pre-upgrade) package and not the "new" (post-upgrade) package.

bug: 28510916
Change-Id: Ia926acda2c72d39bad51143e3f923643d9c3a0af
ackageManagerService.java
0c4e6a8da3405f742e5cef8afdf579d58b6f1246 14-May-2016 Dianne Hackborn <hackbod@google.com> Fix issue #27532364: Security Vulnerability in IIntentSender.send

We need to make IIntentSender oneway... but when the system is
calling that for itself, it needs to be able to return a result code.

Solution: instead of directly calling the interface, we have a new
IPC through the activity manager. If the thing being used is the
activity manager impl, it can do the synchronous send and return
the result directly in place. If not, you only get asynchronous
sending and thus never a failure result back (too bad for you!).

Change-Id: I4096e5b00063e8dba66230585a2dfe67e35e8092
ackageManagerShellCommand.java
a53d9cace1ff124e23ae54dbb68c9a58947a8ce1 13-May-2016 Adam Powell <adamp@google.com> Merge "Show package icon/label for resolved package-targeted implicit intents" into nyc-dev
am: e89dc40706

* commit 'e89dc40706f325e039de7dd6714223908dfb9b17':
Show package icon/label for resolved package-targeted implicit intents

Change-Id: I254e8d1a0b3cc45e3c030ca1cec7e7ecc5dbd91e
e89dc40706f325e039de7dd6714223908dfb9b17 13-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Show package icon/label for resolved package-targeted implicit intents" into nyc-dev
86100d18ad0bd5ae3267a0e0944d15f4fe94078a 13-May-2016 Adam Powell <adamp@google.com> Show package icon/label for resolved package-targeted implicit intents

If we're going to show metadata about a resolved implicit intent that
is targeted to a single package with multiple potential targets,
populate the ResolveInfo with the label and icon of the target
package's ApplicationInfo and set resolvePackageName. This helps use
cases such as EXTRA_INITIAL_INTENTS in ChooserActivity, where
sometimes apps set target packages but not components.

Bug 28739056

Change-Id: I8070d341fccc139463c5ac8d66db45fce02252e5
ackageManagerService.java
c30808b413deff60fafa047d9cc15c275feb3c63 13-May-2016 Fyodor Kupolov <fkupolov@google.com> Added scheduleWritePackageListLocked

Call scheduleWritePackageRestrictionsLocked and
scheduleWritePackageListLocked when a new user is created.

Bug: 28750034
Change-Id: I442551855e2eece7a1610750c6802a785bfb2fb5
ackageManagerService.java
ettings.java
26edcba2c950701ff2dd8794687552bc37e4dfc8 12-May-2016 Makoto Onuki <omakoto@google.com> Merge "Remove ShortcutManager" into nyc-dev
a68dc2ed5588a16ec7432e46e899ce54103805bb 12-May-2016 Richard Uhler <ruhler@google.com> Merge "Fix --reset argument to \'cmd package compile\'." into nyc-dev
am: e4a3e5e8f1

* commit 'e4a3e5e8f13c4290e3e4c5667bedcd66ce699e63':
Fix --reset argument to 'cmd package compile'.

Change-Id: I26533be1c9c2dac22b8ff4a5882abc8ded832255
e4a3e5e8f13c4290e3e4c5667bedcd66ce699e63 12-May-2016 Richard Uhler <ruhler@google.com> Merge "Fix --reset argument to 'cmd package compile'." into nyc-dev
9f706d50bca14b5b0c57381ce067826a8353fd3d 12-May-2016 Calin Juravle <calin@google.com> Merge "Do not clear profiles after OTAs" into nyc-dev
am: 4ee1c943ab

* commit '4ee1c943ab5f7f69355d1413bca981812a804a67':
Do not clear profiles after OTAs

Change-Id: Icf79d5c8eef4006fba3a5eb118d9882b02b36fb7
4ee1c943ab5f7f69355d1413bca981812a804a67 12-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Do not clear profiles after OTAs" into nyc-dev
538c440c33fc2b9e0bf0c680ddbb14f9a079ff6a 11-May-2016 Makoto Onuki <omakoto@google.com> Remove ShortcutManager

Bug 28704708

Change-Id: If7b739adeec38d81d554fc1cf34c81194f5d67b9
auncherAppsService.java
hortcutService.java
36ecd08dc1627a7ed9c0ef498b41c40a66d646b0 11-May-2016 Todd Kennedy <toddke@google.com> Remove STOPSHIP

Instead of tracking a one-off variable, use the version code to
properly determine a pre-N OTA.

Bug: 27872764
Change-Id: Ib80b96ebddfa8bec398e02137ec26ce006164921
ackageManagerService.java
ettings.java
5f201e682545c93ee93c9f17215b986f55bce348 11-May-2016 Richard Uhler <ruhler@google.com> Fix --reset argument to 'cmd package compile'.

Bug: 28562124
Change-Id: If5c2161e79ee1666943b591ac652ae9075e84390
ackageManagerShellCommand.java
3bb6351a4e258937be3c36d5b239f44312e998c6 11-May-2016 Ricky Wai <rickywai@google.com> Merge "Use userHandle not credentialOwnerUserId to check if it needs to show lock" into nyc-dev
am: ca34ab06ec

* commit 'ca34ab06eca921f8c193dfa7d0b500b6892890e6':
Use userHandle not credentialOwnerUserId to check if it needs to show lock

Change-Id: I0015c35a2f4b024c22f9bf2e2d43dc6ca25db046
ca34ab06eca921f8c193dfa7d0b500b6892890e6 11-May-2016 Ricky Wai <rickywai@google.com> Merge "Use userHandle not credentialOwnerUserId to check if it needs to show lock" into nyc-dev
9cc7ad65a13b5d40566ea18be41a3c5a3610d4ab 11-May-2016 Ricky Wai <rickywai@google.com> Use userHandle not credentialOwnerUserId to check if it needs to show lock

It is possible that unified keys stored in keystore is not migrated,
while work mode is off and upgrade happens.
At this moment, user not able to turn on work mode as work is not unlocked,
and user cannot unlock work as parent's has a challenge.
mLockPatternUtils.isSecure(userHandle) should be the same as
mLockPatternUtils.isSecure(credentialOwnerUserId), except it is a unified
lock and work profile does not setup a lock/key in keystore yet(migration).

Bug: 28689675
Change-Id: Ia0755caa10ff94a25cf26c3e5907ecd33abd866e
serManagerService.java
9580593e5d031296ce64697cb382d2cc457c2676 11-May-2016 Todd Kennedy <toddke@google.com> Merge "Fix secondary ABI instrumetion" into nyc-dev
am: f09f069936

* commit 'f09f0699369c02a6a46fbff68c02b00a7c703697':
Fix secondary ABI instrumetion

Change-Id: I0ad719338b8cbcf9cf90526d2e0196aa25ff07ad
f09f0699369c02a6a46fbff68c02b00a7c703697 11-May-2016 Todd Kennedy <toddke@google.com> Merge "Fix secondary ABI instrumetion" into nyc-dev
1390fb708ec00f93097dc557023d02d378cc2616 11-May-2016 Narayan Kamath <narayan@google.com> Merge "Log optimizing apps dialog time in seconds (and not decis)." into nyc-dev
am: 7fa5016977

* commit '7fa5016977edd5eb3dea154b76c4767de546fcb1':
Log optimizing apps dialog time in seconds (and not decis).

Change-Id: I3b4e4ed2ad8cc4c6ebff3d5407f3ad1373737e2e
b3e435439cad94e5f20c7c9e0c4a5fa321c68443 11-May-2016 Narayan Kamath <narayan@google.com> Log optimizing apps dialog time in seconds (and not decis).

bug: 28528058
bug: 28544474
Change-Id: Ib95d5625640c3c8d27d1844c49188570d7196ee2
ackageManagerService.java
6694dbef38c3fe2c5ceef19d0ddd57b6d5b0b587 10-May-2016 Calin Juravle <calin@google.com> Do not clear profiles after OTAs

Bug: 28689868
Change-Id: I21b75eb6918915b16b0d1a06e753a56822834a2d
ackageManagerService.java
5a3477d52e3a1509880aaf989a7de124d6091af7 11-May-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Push unlocking/unlocked state to UserManager" into nyc-dev
am: fdc675968c

* commit 'fdc675968c818a1913b870dd16077f6fe785ee3f':
Push unlocking/unlocked state to UserManager

Change-Id: Ice3c4078d4deb85dd1b1eee2924be19f28fb6a85
fdc675968c818a1913b870dd16077f6fe785ee3f 11-May-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Push unlocking/unlocked state to UserManager" into nyc-dev
e713efcac103f3d8083ec9d5b00c528af7266b21 10-May-2016 Todd Kennedy <toddke@google.com> Fix secondary ABI instrumetion

When installing an APK that supports multiple ABIs, the ABI installed
can be forced to the secondary ABI [i.e. On devices that support both
32 and 64 bit variants, the 32-bit version can be forced when it's
the secondary ABI.] In this case, instrumenting the class always tried
to use the primary ABI. Instead of blindly using the primary ABI and
dropping the secondary ABI, we propagate both ABIs and make a
decision on which one should be chosen.

Bug: 28406240
Change-Id: I7ebb2fd264d2281912afd30f6d73ccb460f9cf85
ackageManagerService.java
c51b2876ec5c0af449469a0f76bb38c51cfcff04 05-May-2016 Makoto Onuki <omakoto@google.com> Refactoring ShortcutManager + bug fixes.

- Don't pass the ShortcutService instance as an argument. This tiny
optimization is no longer meaningful now that PackageShortcut and
PackageLauncher have reference to ShortcutUser.

- Rename mLauncherComponent to mDefaultLauncherComponent for clarity.

- Don't instantiate ShortcutPackage instances when not needed.

- Don't allow intents with a null action.

- Also improve javadoc.

Bug 28592642
Bug 28474517
Bug 28557169

Change-Id: I8790d3494bf3b92c143c02824b0ed0e514504baa
hortcutLauncher.java
hortcutPackage.java
hortcutPackageInfo.java
hortcutPackageItem.java
hortcutService.java
hortcutUser.java
3ff41200470a05c662d636a22b70d20d44a5917a 10-May-2016 Makoto Onuki <omakoto@google.com> Merge "Clean up dangling bitmaps." into nyc-mr1-dev
eed1ea95412baa2061669443cdd409b1cd62901f 10-May-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Don\'t throw runtime exceptions for permission flags" into nyc-dev
am: 01da140ace

* commit '01da140aced14162d6d1bf4a0b2bf33e23b9c2c4':
Don't throw runtime exceptions for permission flags

Change-Id: I5add764e1665c24e54bc3d461ef0ad8ca6c880a0
01da140aced14162d6d1bf4a0b2bf33e23b9c2c4 10-May-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Don't throw runtime exceptions for permission flags" into nyc-dev
6c915ead38db0a2a6393c40d4fbac959399439c5 10-May-2016 Fyodor Kupolov <fkupolov@google.com> Push unlocking/unlocked state to UserManager

Push unlocking/unlocked state to UserManagerInternal when it's changed in
UserController. Use UserManagerInternal.isUserUnlockingOrUnlocked when
updating flags for filtering in PackageManager.

Bug: 28629076
Change-Id: I8440af090f533f93870d0cff0e3871e114c37efa
ackageManagerService.java
serManagerService.java
abefb9d36590db23f59a7e7f4d342c9d8553f1d0 10-May-2016 Narayan Kamath <narayan@google.com> Merge "Use MetricsLogger.histogram for optimizing app statistics." into nyc-dev
am: 6795f0ba19

* commit '6795f0ba198170c5cc044e04be65dd1171d5f7a5':
Use MetricsLogger.histogram for optimizing app statistics.

Change-Id: I5e25f823c11d5f5f85b27c5d7b42f054514acd9e
7e01af424355b5bbac64126fef4e3d37c9c41dd7 10-May-2016 Svetoslav Ganov <svetoslavganov@google.com> Don't throw runtime exceptions for permission flags

We were thrwing undocumented runtime exception when
one gets the permission flags - now we just return
default result of the package is gone.

bug:28657926

Change-Id: I42554a86b9304ff83fe9385f3eea930b8ebf0c63
ackageManagerService.java
a01f04a4ec756715d3fa8ecf7c51c2d6c9a71de2 10-May-2016 Narayan Kamath <narayan@google.com> Merge "Patrially revert 4ec026930bfbbb5d8923f359c8." into nyc-dev
am: 9bfc33f8ae

* commit '9bfc33f8aeea4d958fa2315cd8b6e6234464c8ab':
Patrially revert 4ec026930bfbbb5d8923f359c8.

Change-Id: Ieb05a88326f0e6f11a74f1d82e11391a5af9c962
966210b7218a99f57d7e9b40f7d2c0ff69151776 10-May-2016 Narayan Kamath <narayan@google.com> Use MetricsLogger.histogram for optimizing app statistics.

bug: 28528058
bug: 28544474
Change-Id: Icbe26e9699eade08725e38914f07d7584e77b608
ackageManagerService.java
3496fdbd2f84de3c8e8070be7d669b94ea1ca769 10-May-2016 Narayan Kamath <narayan@google.com> Patrially revert 4ec026930bfbbb5d8923f359c8.

In preparation for using MetricsLogger.histogram / count. The main
purpose of this change is to remove the (now bogus) action IDs
associated with this logging.

bug: 28528058
bug: 28544474

Change-Id: Id79de2d34c3f937a327ac21d44e55c18047bce85
ackageManagerService.java
264c5a60f619178a2320e38cdecc5ff1b22ab0de 10-May-2016 Calin Juravle <calin@google.com> Merge "Revert "Enable profile merging for post-OTA package verification"" into nyc-dev
am: 9b40edab61

* commit '9b40edab61ca9bf3b9f5931bbfc266eb6c6216e6':
Revert "Enable profile merging for post-OTA package verification"

Change-Id: Ifa08f475a9dd3830e0c7175757a4a5b22d6b3fd8
9b40edab61ca9bf3b9f5931bbfc266eb6c6216e6 10-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Revert "Enable profile merging for post-OTA package verification"" into nyc-dev
eac07576b746bdd0c120fe735ccddc0e0305e1af 10-May-2016 Narayan Kamath <narayan@google.com> Merge "Add a command to print package dexopt status." into nyc-dev
am: eaeb3a21ae

* commit 'eaeb3a21aecbf284cd60c236d68f10a859ed7e4b':
Add a command to print package dexopt status.

Change-Id: I860692ca798c6e96be6210946d2ba661db8faae2
88eea9e580a6b2ee804a092f851b5325355fcdce 02-May-2016 Narayan Kamath <narayan@google.com> Add a command to print package dexopt status.

Can be invoked like so :

$adb shell dumpsys package dexopt
$adb shell dumpsys package dexopt <packageName>

bug: 27494108
Change-Id: Ie91f744aeac772e0e22abc9c805df9290a4e2418
ackageDexOptimizer.java
ackageManagerService.java
cc72e549ab8a96c37822eb90785a68c8dffcab5c 10-May-2016 Jeff Sharkey <jsharkey@android.com> Merge "Fix package cleanup when parsed APK missing." into nyc-dev
am: b3b7763d5d

* commit 'b3b7763d5d35f4e85f3c5245abb9ab526b0e4c23':
Fix package cleanup when parsed APK missing.

Change-Id: If387d9dc16358af03e95693e9794bfe6bbfa22b6
b3b7763d5d35f4e85f3c5245abb9ab526b0e4c23 10-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix package cleanup when parsed APK missing." into nyc-dev
aab8cbfa234e1c53f909ac4bebeccbe2ddbeda05 10-May-2016 Jeff Sharkey <jsharkey@android.com> Fix package cleanup when parsed APK missing.

Recently the uninstall logic was changed to require a parsed APK to
succeed, but we need uninstall to succeed when the APK lives on an
ejected storage device.

To fix that case, create a fake parsed package with just enough
information for the delete to proceed.

Fix package movement bug that sent an invalid user ID to installd;
we need to explicitly ask for each user.

Bug: 28658206
Change-Id: Icf417661f07688c7523f0d082528adec2ac70cc6
ackageManagerService.java
8412cf4daaa437003f4a79a82aa35465c4f0d418 09-May-2016 Calin Juravle <calin@google.com> Revert "Enable profile merging for post-OTA package verification"

This reverts commit 5da9dad2dd04586dbd665e6a73bfee1d0ed92a89.

Bug: 28612421

Change-Id: Idbbb24241362a70b697ae2d648ea47996f5239c6
ackgroundDexOptService.java
ackageManagerService.java
4500ff51050b99ecd4f873ab5998dc5382a02af8 09-May-2016 Richard Uhler <ruhler@google.com> Merge "Remove inconsistent \'cmd package compile\' documentation." into nyc-dev
am: 12f2984dbf

* commit '12f2984dbf10e89124afd7bf8242f564e5a176aa':
Remove inconsistent 'cmd package compile' documentation.

Change-Id: I00eb70c24edb5338294d0d43abcd3bcdf2121ef0
12f2984dbf10e89124afd7bf8242f564e5a176aa 09-May-2016 Richard Uhler <ruhler@google.com> Merge "Remove inconsistent 'cmd package compile' documentation." into nyc-dev
8c0b791721c14eac79cbd16626273296e755302d 06-May-2016 David Brazdil <dbrazdil@google.com> Hide \'Optimizing apps\' dialog if not M->N upgrade
am: ee057752cc

* commit 'ee057752cce759520e3ba7a022f8616504c12fa0':
Hide 'Optimizing apps' dialog if not M->N upgrade

Change-Id: I63e8184e42851a40ccb8d0df837dc96bf85eb8c5
ee057752cce759520e3ba7a022f8616504c12fa0 27-Apr-2016 David Brazdil <dbrazdil@google.com> Hide 'Optimizing apps' dialog if not M->N upgrade

Recent changes reduced the amount of time spent optimizing apps at
post-OTA boot. Instead of briefly showing the 'Optimizing apps'
dialog, we hide it completely.

The dialog is still shown for OTAs from a pre-N version of Android
since they can take a non-negligible amount of time (still much less
than in M).

Bug: 27350503
Change-Id: I5f6dae0c69799e1fc522f36453d2671b333bef0e
ackageManagerService.java
568a969f605043a044d08f3a58e7c1176a8d5572 04-May-2016 Richard Uhler <ruhler@google.com> Remove inconsistent 'cmd package compile' documentation.

Bug: 28562124
Change-Id: I89e6cd0d7ebb717bf1b143b615f717a1f6573549
ackageManagerShellCommand.java
8a2c41426a9d0bafc06fe8a31c8a76cf71281efd 05-May-2016 Adam Powell <adamp@google.com> Merge "Have the Resolver/Chooser activities handle resize config changes" into nyc-dev
am: a75d4877af

* commit 'a75d4877af7fa045cc91b2d60d3801aa098608de':
Have the Resolver/Chooser activities handle resize config changes

Change-Id: I428ddcedf28316cbaf8a6fa4f77ad5ee86949559
a75d4877af7fa045cc91b2d60d3801aa098608de 05-May-2016 Adam Powell <adamp@google.com> Merge "Have the Resolver/Chooser activities handle resize config changes" into nyc-dev
e783460274047ab38e3b9c4294339ff130fe566c 08-Apr-2016 Zoltan Szatmary-Ban <szatmz@google.com> Introduce system API to get source of user restriction

Clients can query who has set a particular user restriction on a user.
Currently the result can be a combination of none, system/user, or admin.

Bug: 27830375
Change-Id: I50ea9db0a59ffe3abbdcbb1a436d9ace7a35a851
serManagerService.java
f3eef0712d5cb8fa30f25219e28281599e97d36f 05-May-2016 Narayan Kamath <narayan@google.com> Merge "PackageManager : Log stats about the optimizing apps dialog." into nyc-dev
am: 1ef61df23c

* commit '1ef61df23c37b34fb7444ef8bbf802f276204484':
PackageManager : Log stats about the optimizing apps dialog.

Change-Id: I39161841480a925b36764e6d7ebd278fc9ac0103
4ec026930bfbbb5d8923f359c80b465d4b0ccda2 03-May-2016 Narayan Kamath <narayan@google.com> PackageManager : Log stats about the optimizing apps dialog.

Logs the following parameters :
- Total time spent optimizing apps.
- Total number of apps that were dexopted.

TESTED: with adb logcat -b events:
05-04 15:24:16.303 2065 2065 I sysui_action: [402,3]
05-04 15:24:16.303 2065 2065 I sysui_action: [403,34]
05-04 15:24:16.303 2065 2065 I sysui_action: [404,0]
05-04 15:24:16.304 2065 2065 I sysui_action: [405,163]
05-04 15:24:16.304 2065 2065 I sysui_action: [406,12168]

This shows that:
- 3 apps were optimized
- 34 apps were skipped
- 0 apps failed to optimize
- dialog showed a total of 37 (3 + 34 + 0) apps
- system has 163 optimizable packages
- a total of 12.2 seconds was spent in the optimizing apps dialog

bug: 28528058
bug: 28544474
Change-Id: I9eb5229a1589ca0df57d3fc03102992fa90a877f
ackageManagerService.java
46ef0579dddd6480306fa58553a6e3180aedf9c7 05-May-2016 Adam Powell <adamp@google.com> Have the Resolver/Chooser activities handle resize config changes

Both of these activities do additional work and look janky when
rebuilding for a config change, especially in the presence of
multiwindow. As neither of them use layouts or other resources that
vary based on configuration, mark them as handling the relevant config
changes.

Bug 27171954

Change-Id: I38df1d875bcb063d72316b586c4d3f8074c4fad9
ackageManagerService.java
df286c2916e8505c7a2082bced577c20514e4a2d 05-May-2016 Robin Lee <rgl@google.com> Merge "Disallow suspending the default dialer" into nyc-dev
am: ecf4622618

* commit 'ecf4622618bb963d913a3e217c92da61f305d79e':
Disallow suspending the default dialer

Change-Id: If8c5c4625c877ce222f3fcb9adeee1726bfdcc11
ecf4622618bb963d913a3e217c92da61f305d79e 05-May-2016 Robin Lee <rgl@google.com> Merge "Disallow suspending the default dialer" into nyc-dev
5b9d876ef5bf4613d9ef89148c1ab021c473c02e 04-May-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManaegr: bug fixes" into nyc-mr1-dev
85694526039fb0a80ab74b2dc3ab17bacc1a4a59 04-May-2016 Makoto Onuki <omakoto@google.com> ShortcutManaegr: bug fixes

Fixes 28590035
Fixes 28586105

Change-Id: Ia11d29e4996ad5b47b279a3c04d9586695cdc0a5
hortcutService.java
0dc591b48d96c7b5ac809197c2fb758dccec15a2 04-May-2016 Robin Lee <rgl@google.com> Disallow suspending the default dialer

This is the only case that still had to be protected by priv-app, so
that check is removed at the same time.

Bug: 27635033
Change-Id: Ifd5e59ab56eb45f0651cb25882ead920c758ae51
ackageManagerService.java
ettings.java
c8cc38c8c56770dd3ff2a7e2fbb3267c6a9a14d0 04-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Avoid restart when inserting/ejecting adopted." into nyc-dev
379d52be47be88b86f0d446c27d47e80bb81cfd1 04-May-2016 Jeff Sharkey <jsharkey@android.com> Avoid restart when inserting/ejecting adopted.

When rapidly inserting/ejecting an adopted storage device, we might
still be trying to prepare the storage device. Catch the exception
to avoid a runtime restart, and keep rolling forward, since we'll
probably be handling the ejected event in a few moments to clean up
any packages.

Bug: 28467146
Change-Id: Ib923663ae6d63259c1b5792b68dfe760612ab838
ackageManagerService.java
6c1dbd577bcf2b8bccb9a0d04d741ff7337898f2 03-May-2016 Makoto Onuki <omakoto@google.com> Clean up dangling bitmaps.

Bug 28471799

Change-Id: I48785ccc533a7499d46e35264c6a0cbf0c5398d5
hortcutPackage.java
hortcutService.java
hortcutUser.java
28309fec2f104e181c22ab03ba3cec7f8756e4b7 03-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Added option to reset network policies for a given user." into nyc-dev
7d164d35a41d2aa351f0a27faf05fc67ba262c07 03-May-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: finishing touches" into nyc-dev
d17fda40cdcf875002086fbe98bf34ba7cbdb03c 29-Apr-2016 Felipe Leme <felipeal@google.com> Added option to reset network policies for a given user.

BUG: 28429571
Change-Id: I675e4ee5484a865f6819d7a0eef34133be11306f
ackageManagerService.java
d4d1512b64df37157f3fa9c205f1dd3738b47e21 03-May-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Disable unused features" into nyc-dev
a7532cfa46bc0c0a795aaaafe89d0727927b3cd7 02-May-2016 Svet Ganov <svetoslavganov@google.com> Disable unused features

The multi-package APKs feature was not validated and is now disabled.
Also the ephemeral work was postponed which requires disabling of the
ephemeral cookie APIs.

bug:28514747

Change-Id: Iab7f11c503a76bcc414408dfebdf200843db814e
phemeralApplicationRegistry.java
599de361cb7832fec18a51a62cbf44af4df27020 03-May-2016 Jeff Sharkey <jsharkey@google.com> Merge "Apply non-FBE migration early during boot." into nyc-dev
f0143cc1c6f9d81e70246f7254f52f23d65ac72c 02-May-2016 Jeff Sharkey <jsharkey@android.com> Apply non-FBE migration early during boot.

On non-FBE devices, we offer to migrate CE/DE storage of certain
system apps during boot. However, if this migration happens after
app code has started to run, we end up clobbering open files such
as databases.

The right way to solve this is to apply all migration early during
boot (in the PMS constructor) before any app code can start.

Bug: 28512897, 28525109
Change-Id: I17eb9a09e5862d873b86c05ce35874a34386e433
ackageManagerService.java
f2812853b820ad994be2b9c42e7905f61e4a0106 02-May-2016 Sudheer Shanka <sudheersai@google.com> Merge "Allow any app to silently uninstall the orphan packages." into nyc-dev
4d36b3a8c5ba1289d851ef337e46709bba333100 27-Apr-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: finishing touches

- Change back the throttling quota to 10 calls / day
- Foreground apps are no longer throttled, and when an app comes to
foreground the call counter will be reset.
- When the system locale changes, reset throttling for all packages
for all users.
See LocalService.onSystemLocaleChangedNoLock() for how it's performed.
Because the reset must happen before any other apps have a chance to
publish shortcuts, the logic is not straightforward.

- Added an internal API to reset the throttling upon inline-reply
from a notification.

- Stop supporting icons from "content:" URIs
- Improved javadoc on several APIs.

Also internal refactor needed to this:
- ShortcutUser.getAllPackages()/getAllLaunchers() are no longer
accessible to outer code to prevent accidentally adding/removing the
content. Outer code should use forAllPackages() / forAllLaunchers().

Bug 27923857

Change-Id: I002511193d1d33718163bb1dabe77610bde58198
hortcutLauncher.java
hortcutPackage.java
hortcutPackageItem.java
hortcutService.java
hortcutUser.java
4e4fca43b0fb1320ce0265640d33b700cd886da8 02-May-2016 Todd Kennedy <toddke@google.com> Merge "Restrict updates of system packages" into nyc-dev
0e9e5ea58600a7b6aed1b307affdc400bfa9b33b 29-Apr-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Only platform defined permissions need a review." into nyc-dev
fdd241a1e026afeeb68d30cb3d999ee9506769ce 28-Apr-2016 Todd Kennedy <toddke@google.com> Restrict updates of system packages

By declaring a <restrict-update> tag in its manifest, a system package
can restrict its update to be the singular package that has the same
given hash. An update's hash is the SHA-512 across all its APKs [i.e.
for splits, the SHA-512 is calculated over the concatenation of the
base plus all splits].

The restriction only applies to system packages.

Bug: 28398205
Change-Id: Iec493fc8ef27edee53f1d437cb0caaa78782f329
ackageManagerService.java
3d92f4ea37e6785605a8d62f1971f2dfe4569638 29-Apr-2016 Svet Ganov <svetoslavganov@google.com> Only platform defined permissions need a review.

The only permissions a user can control for a legacy app in
runtime style without crashing the app are the ones defined
by the platform because we have app ops only for these and
also we contorl the access to data guarded by them.

bug:27102458

Change-Id: Ifd1350d056b4fe29739ab8fdc5cbea89fa2e4037
ackageManagerService.java
d1c30db548da90d5bc092821c6fee4b4ef060bbb 28-Apr-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: When app's data is cleared, remove all shortcuts," into nyc-dev
8c2fb9edae4413074186e3d84ccff0eba41b2cae 28-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Introduce "unlocking" vs "unlocked" nuance." into nyc-dev
9ac59d0438833eee817e4b4e5c03ce5ec8fcf4dc 26-Apr-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: When app's data is cleared, remove all shortcuts,

as if it's uninstalled.

Fixes 28196831

Change-Id: I1a410372f9e344a10567b00057fa0770eac9fd76
hortcutService.java
ce18c8167766f92856f94a8e88e19de4698960e6 28-Apr-2016 Jeff Sharkey <jsharkey@android.com> Introduce "unlocking" vs "unlocked" nuance.

There is a narrow window of time during user unlock where we're
reconciling user storage and dispatching the "unlock" status to
various internal system services. While in this "unlocking" state,
apps need to be told that the user still isn't actually "unlocked"
so they don't try making calls to AccountManager, etc.

The majority of internal services are interested in merging together
both the "unlocking" and "unlocked" state, so update them.

Clarify naming in AccountManagerService to make it clear that a local
list is being used, which mirrors the naming in MountService.

To match UX/PM requested behavior, move PRE_BOOT_COMPLETED dispatch
after the user is unlocked, but block BOOT_COMPLETED dispatch until
after all PRE_BOOT receivers are finished to avoid ANRs.

Bug: 28040947, 28164677
Change-Id: I57af2351633d9159f4483f19657ce0b62118d1ce
ackageManagerService.java
serManagerService.java
9f013fe71ecf03c9c9696599ba82715d84e45365 28-Apr-2016 Jeff Hao <jeffhao@google.com> Merge "Some cleanup for <uses-library> change." into nyc-dev
07318065b22ba13ae003d7803a3e48e441f9f6e5 28-Apr-2016 Chris Tate <ctate@android.com> Merge "Make sure FIRST_LAUNCH is after PACKAGE_ADDED" into nyc-dev
bd784e961c560a2069e2df75fb17282013c198d2 28-Apr-2016 Jeff Hao <jeffhao@google.com> Some cleanup for <uses-library> change.

Addresses comments made in:
https://googleplex-android-review.git.corp.google.com/#/c/976512

Bug: 26880306
Change-Id: I382fb39f3bb5de5a03506f5526d909cf55530542
taDexoptService.java
ackageManagerService.java
5cf5578a457e448dda9fd47943e91f0f3b67690f 26-Apr-2016 Christopher Tate <ctate@google.com> Make sure FIRST_LAUNCH is after PACKAGE_ADDED

If an app undergoes restore during install, it is considered 'started'
and the FIRST_LAUNCH broadcast needs to go out. However, this must not
take place until after the restore operation has fully completed, in
order to avoid publishing the app's existence while it may still be in
an incoherent state. We now make this broadcast part of POST_INSTALL
in the restore case.

Bundled apps are in the 'started' state regardless, so no FIRST_LAUNCH
broadcast is ever sent for them -- this CL does not change that
existing behavior even in the case of setup-time data restore of
factory-installed packages.

Bug 28173625

Change-Id: Ibcc3758576662dc447b75476173a0d008a9fe4da
ackageManagerService.java
ettings.java
8c57aeaa8f27423b843fa043fb86b0b57c906ead 21-Apr-2016 Sudheer Shanka <sudheersai@google.com> Allow any app to silently uninstall the orphan packages.

Bug: 28302564
Change-Id: If6f2111e35ec94c7eb5b80a08bbf63fd58698c27
ackageInstallerService.java
ackageManagerService.java
ackageSettingBase.java
ettings.java
62e7d26a0c267ac76f641a17e66e4f9c11b887c9 27-Apr-2016 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #28403313: Improve package manager query commands" into nyc-dev
c7b9482b0c4bb2d378e63541b96be45c50094e05 16-Mar-2016 Jeff Hao <jeffhao@google.com> Support to pass <uses-library> option through to dex2oat.

This change takes an app's shared libraries specified by <uses-library>
and passes it through to dex2oat to be used during compilation.

Part of a multi-project change.

Bug: 26880306

(cherry-picked from 7b331b6a8ae8d9f10482b292439457de98abd32a)

Change-Id: I523b1b74775e7ed27072498509e743f1f10b1164
nstaller.java
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
14e7acd58c8b4f9f2fd517cded5c4e3099fd5989 27-Apr-2016 David Brazdil <dbrazdil@google.com> Fix infinite loop during package-usage.list file upgrade

When upgrading from version 0 to version 1 of the file
'/data/system/package-usage.list', the PackageManagerService can get
stuck in an infinite loop if one of the listed packages does not
exist, e.g. because it had been uninstalled. Fix the issue by
refactoring the loop.

Bug: 28409278
Change-Id: Ia312bd0d04f696240445b710dd6a68b93c5d5946
ackageManagerService.java
1415d267864cb7f6017abfb9359d8ea9302bcb64 27-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't hold lock when calling externally" into nyc-dev
97ef0e77afa3be6255b70c8567843ac298386251 27-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't override pre-release target sdk" into nyc-dev
fc5f6e6c80954c837a98d963789f6a30f3b87ad1 27-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix two multi-user bugs in package upgrade." into nyc-dev
e542e0cb9b2fbde1cfa7ff36af9cd370af459a49 27-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Set installed flag of all users if system app is installed later" into nyc-dev
d5e295f9192522176796271cb29558a53d37c875 27-Apr-2016 Todd Kennedy <toddke@google.com> Don't hold lock when calling externally

Wound up in a deadlock. We held mPackages lock and called the mount
service. This called into the AppOps service which tried to obtain
its lock. On another thread, we held the AppOps service lock which
called into PackageManager service and tried to take mPackages.

Ideally, we'd never hold an internal lock when calling externally.
In practice, that's not always fixable [for example, code change
would be too great to not hold the AppOps lock when calling into
the PackageManager service].

Bug: 28169075
Change-Id: If0a7f1361c7be9385b1f629f68ebc0556b08ab06
ackageManagerService.java
b1072718130b998e6d25bc3358eefa62b4fa5a2d 27-Apr-2016 Todd Kennedy <toddke@google.com> Don't override pre-release target sdk

If a package targets a pre-release SDK [eg a letter version] it should not
be allowed to be upgraded by a release SDK [eg a number version]. If one
absolutely must upgrade to a release SDK, use the "--force-sdk" option
during install.

Bug: 28345311
Change-Id: Ic9fb209968e7c5da2c80c5ca4c0f44f5125f610a
ackageManagerService.java
ackageManagerShellCommand.java
e75c0b9873d56e2569d0c5dff78f8872b8c8e97f 27-Apr-2016 Jeff Sharkey <jsharkey@android.com> Fix two multi-user bugs in package upgrade.

When upgrading a package, we need to fill in the "origUsers" field
so that we can clone the installed state correctly. This was done
for child package, but never set for the parent package.

Also fix a bug where a secondary user requested a package to be
moved. Because that move was pushed onto a Handler, the calling
userId appeared to be the device owner instead of the user that
actually requested the move. (Later in the upgrade flow there is
code that force-installs the package for the requesting user.)

Bug: 26729822
Change-Id: I2d2a007c73558f29a3f8c1408ec373fce6e87761
ackageManagerService.java
d6e4aa499a6cda1538afcdde780c7ecb47bd12ae 26-Apr-2016 Dianne Hackborn <hackbod@google.com> Fix issue #28403313: Improve package manager query commands

Change-Id: I69122cb2ba04e7d8e5e2ff1aaeb840a28dfc3e14
ackageManagerShellCommand.java
f71d7feef22db9e0cab2f32edc7440aedb86fdfe 26-Apr-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Ensure local settings caches are not stale" into nyc-dev
53a441ca8eda5a3e6209a952b1bbd32a39e19a1c 20-Apr-2016 Svet Ganov <svetoslavganov@google.com> Ensure local settings caches are not stale

We used the system proterties as a shared memory mechanism
to propagate information to local settings caches when the
content has changed and the cache should be cleared. The
system properties are unfortunately updated asynchronously
leading to cases where clients may read stale data.

This change adds a simple int array data structure backed
by shared memory which guarantees individual values are
atomically read and updated without memory tear. Multi-
index opearations are not synchronized between each other.

The settings provider is using the new data structure to
propagate the settings generation which drives when caches
are purged.

We have a single memory array keeping the generation for
different settings tables per user. Since memory array is
not a compact data structure and the user space exceeds
the memory array size we use an in-memory map from keys
to indices in the memory array where the generation id of
a key is stored. A key is derived by the setting type in
the 4 most significant bits and the user id in the 28 least
significant bits.

The mapping from a key to an index is cleared if the user is
removed and the corresponding index in the memory arry is
reset to make it available for other users. The size of the
memory array is derived from the max user count that can be
created at the same time.

bug:18826179

Change-Id: I64009cc5105309ef9aa83aba90b82afc8ad8c659
serRestrictionsUtils.java
ea3064a586decfe308d8252f1c2f3545c0fa9829 19-Feb-2015 Kenji Sugimoto <kenji.xb.sugimoto@sonymobile.com> Set installed flag of all users if system app is installed later

If an application(in /data) that other user installed it initially
is appended as system app later, owner user can not use the system app.

The reason this issue occurs is that the owner user's installed flag
is set false when the application was installed by other user
and the installed flag is not updated when the application is appended
as system app later.

So, we fix like as setting the installed flag to true
when the application is appended as system app.

Bug: 28183865
Change-Id: I0b4da5e0bb77fb3baf86d0453e6637a230b104ba
ettings.java
3eaf72dc67ef0911bee0cc0d1db088cb70b044ca 26-Apr-2016 David Brazdil <dbrazdil@google.com> Merge "Change app selection policy for post-OTA verification" into nyc-dev
90e269917e1d8f9fadb12c3528b8c360b2271e82 18-Apr-2016 David Brazdil <dbrazdil@google.com> Change app selection policy for post-OTA verification

Changes the policy for selecting packages which will be pre-verified
during post-OTA boot animation.

For Nx to Ny, an app is pre-verified if used in the foreground in the
last 7 days, or if its APK was loaded by other apps.

For M to N (or early N builds without detailed stats), an app is
pre-verified if it has any recorded use in the last 7 days.

Bug: 27902702
Bug: 27350503
Change-Id: I2b38daf017ecd0e5aa5ed596ed9351cffa03dbcb
ackageDexOptimizer.java
ackageManagerServiceUtils.java
5da9dad2dd04586dbd665e6a73bfee1d0ed92a89 26-Apr-2016 David Brazdil <dbrazdil@google.com> Enable profile merging for post-OTA package verification

Currently post-OTA verification will attempt to compile with
'verify-profile' but does not merge the profiles prior to calling
dex2oat. As a result, we may miss some or all classes that need
verification.

Bug: 27688727
Change-Id: I1aa93cad2686513594cb37f6d3d181ae5c718d1d
ackgroundDexOptService.java
ackageManagerService.java
711ffe620ed06c8517cad8d4d0a8f4fca588f921 26-Apr-2016 Makoto Onuki <omakoto@google.com> Merge "When app is updated, save the new version code, and update shortcuts with resource based icons." into nyc-dev
436308f88b8f165f834a6b37f7638d6d4b7a6ca7 25-Apr-2016 Jeff Sharkey <jsharkey@google.com> Merge "Destroy both CE and DE data when corrupted." into nyc-dev
02179da30ecec5770341d42c0545f62b33b687ce 25-Apr-2016 Jeff Sharkey <jsharkey@android.com> Destroy both CE and DE data when corrupted.

When we find either a CE or DE data directory that has been corrupted,
destroy both CE and DE data together, since internal services like
AccountManager get confused if they find DE data without matching CE
data.

Bug: 28346537
Change-Id: Iaf3694c20e4664536af25a2afeb45fe8a90d8171
ackageManagerService.java
7881cf8f818317cc6efe4d6a4c42da94d6bab223 15-Apr-2016 Ricky Wai <rickywai@google.com> Make "work mode on dialog" show personal challenge in unified work lock

Bug: 28183335
Change-Id: Ib212b283b9561f88899f6e7ea130944391b6e558
serManagerService.java
5a91b615232374084a45752d7c09c25265e263ed 22-Apr-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Disallow disable of the system shared libs." into nyc-dev
ca82e616d3131570bf2ee29778f4796f343720d5 20-Apr-2016 Brian Carlstrom <bdc@google.com> Add reasons to notifyPackageUse calls

This is so we can record more specific times in PackageUsage.
If file with only one timestamp per package is found, the value is
copied to all usage slots.

Bug: 27902702
Change-Id: I8affe43c735e54620a9204433aad367cfddfded7
ackageManagerService.java
ackageManagerServiceUtils.java
b40667eccdd797d08560c33e696625509f90d52b 22-Apr-2016 Rubin Xu <rubinxu@google.com> Merge "Remove MANAGED_PROFILE_AVAILABILITY_CHANGED broadcast" into nyc-dev
49425d612cee3864a316e9ecb6ec3faeae519b1e 20-Apr-2016 Rubin Xu <rubinxu@google.com> Merge "Kill foreground apps when turning off work" into nyc-dev
f33e2da0378a20bfc096fabcd3d8ef255e39eaeb 19-Apr-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Call defuse even when restrictions bundle is empty" into nyc-dev
069ed7003b3de1f87d28413cc2debc9042386d3c 19-Apr-2016 Todd Kennedy <toddke@google.com> Merge "Always perform has code check" into nyc-dev
f720a9d91eb964b7772e3d42aae6bef83f531aac 15-Apr-2016 Todd Kennedy <toddke@google.com> Always perform has code check

Move code checking from the package parser and into the block
where we implement policy.

Bug: 28132476
Change-Id: Ie5cacacbf80289ff8d85acc5b57e58ea7216859c
ackageManagerService.java
0d88d54c34fef668c6ba74249b7f0003bff823a7 19-Apr-2016 Fyodor Kupolov <fkupolov@google.com> Call defuse even when restrictions bundle is empty

Bug: 28259217
Change-Id: I3e9ba60ee80d1fedef4844d264b312418c287be4
serManagerService.java
214bea1b599ba2deccfca6e72a77bf411c724696 19-Apr-2016 Jeff Sharkey <jsharkey@android.com> Ignore user serial numbers in core-only mode.

When booting in core-only mode, our data partition is a tmpfs which
doesn't support xattrs, so we can't set/enforce user serial numbers.

Bug: 28254840
Change-Id: Id83c551c7c603a4cd5043e06f7161441b2dfaa8b
ackageManagerService.java
f8451b98150564b340207327d0951f44753338d1 01-Apr-2016 Rubin Xu <rubinxu@google.com> Kill foreground apps when turning off work

While work apps will all be killed as we stop the profile user when
turning off work, this can sometimes take a while. So let's kill the
foreground apps as soon as work profile is being turned off to make
the user experience nicer.

Bug: 27631526
Change-Id: Icdd3799385a98ee531b0b4247e8ede78f6f10da8
serManagerService.java
fed6c65f2a05a75f75d0a258da214770ff9168de 18-Apr-2016 Jeff Sharkey <jsharkey@google.com> Merge "Iterate through all known users after moving." into nyc-dev
ad14b884f4110e03ec7b5ba7b913be25d19aa95c 18-Apr-2016 Jeff Sharkey <jsharkey@google.com> Merge "Consistent creation/destruction of user data." into nyc-dev
be73a8068ff3babe5b0a4f12656731ba8eea6149 15-Apr-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Categories should be Set, not List.

Bug 27923857

Change-Id: Ife859da8e66478174f6c4463316886a23e5aa4e0
hortcutPackage.java
426e4206f9bd1eb2c16abc6ba36b1b88bc00b322 15-Apr-2016 Jeff Sharkey <jsharkey@android.com> Iterate through all known users after moving.

installd no longer supports USER_ALL when destroying app data.

Bug: 28174913
Change-Id: I23496eda7269ad1ad58007de0f44cb89a2291ecb
ackageManagerService.java
fcf1e55821b694df3b8434f40aa3b6d3c3e7ea50 15-Apr-2016 Jeff Sharkey <jsharkey@android.com> Consistent creation/destruction of user data.

Preparing and destroying users currently needs to be split across
installd, system_server, and vold, since no single party has all the
required SELinux permissions.

When preparing user directories on a storage device, always enforce
the serial number and destroy data if we run into a mismatch. When
deleting a user, write the updated user list first before we start
destroying data. Also start reconciling users on internal storage
at boot, so we can recover from stale data left behind from partially
destroyed users.

Check both CE and DE user directories when reconciling user storage
on a newly mounted storage device.

Bug: 27896918
Change-Id: I4536c82b0196e2720628c4f73fccb742c233350b
nstaller.java
ackageManagerService.java
serManagerService.java
39686e8cdec3550c941d376929084f59ac0d78cd 14-Apr-2016 Makoto Onuki <omakoto@google.com> When app is updated, save the new version code, and update shortcuts
with resource based icons.

Bug 28152054

Change-Id: I14f537c08b1a0ba48dd508b0c42fc1d3ed4f5eb0
hortcutPackage.java
hortcutPackageInfo.java
hortcutService.java
hortcutUser.java
d022ac21ebcb441314b80b6d8f0656939f2480e5 13-Apr-2016 Todd Kennedy <toddke@google.com> Fix parse flags

Setting PARSE_IS_SYSTEM to the parse flags happens long after the
APK is actually parsed. So, we fail to pick up the boot aware and
protected storage attributes. Instead, always pull them from the
manifest, but, remove the flags if the package is not actually a
system package.

Also, we were incorrectly skipping certificate verification if
the flag PARSE_IS_SYSTEM was set. However, this flag is used for
_any_ system package -- whether it's physically on /system or if
it's an unbundled update. Instead, we should only skip this step
if the flag PARSE_IS_SYSTEM_DIR. We can implicitly trust any
APK actually stored in /system.

On a different note ... At some point, we will break apart the
parse flags into actual parse flags [i.e. those that change
physically parsing an APK] and policy flags [i.e. those that
change the interpretation of the APK contents].

Bug: 28116074
Bug: 28088617
Change-Id: I85246b0cb18fb5647df3618107910e288137fbc7
ackageManagerService.java
1c685d2a2b4fe8b5c2b31b7c53aa8455fc1530ee 15-Apr-2016 Makoto Onuki <omakoto@google.com> Merge "Remove all icon bitmaps when a publisher is uninstalled." into nyc-dev
19c2a57c24fa337030ff31867380b685e9a5b586 15-Apr-2016 Rubin Xu <rubinxu@google.com> Remove MANAGED_PROFILE_AVAILABILITY_CHANGED broadcast

Bug: 27532254
Change-Id: Iaca17355d3ec75fa09c36a5353f40d678cc2c812
serManagerService.java
f02420c5e1bcc8b2c278f272aca633fe6d2b4e88 04-Apr-2016 Benjamin Franz <bfranz@google.com> Maybe decrypt user when quiet mode is disabled

When quiet mode is disabled for a user and that user is not currently
decrypted, we show a confirm credentials screen to trigger decryption
of that user. Only if that was successful, do we actually disable quiet
mode.

Bug: 27764124
Change-Id: Ib1f649194d89e225dad62c14f3ddba1fa3d79da2
serManagerService.java
0033b2a190feeda8b41dd62b489aca3a19a09d5b 15-Apr-2016 Makoto Onuki <omakoto@google.com> Remove all icon bitmaps when a publisher is uninstalled.

- Also show the directory sizes on dumpsys.

Bug 28196831

Change-Id: I3202fcd3151da3b26b436732e8103caf93aba525
hortcutService.java
hortcutUser.java
a9c2500a6863dabdd786f17a25ce0bf3683109a2 14-Apr-2016 Svetoslav Ganov <svetoslavganov@google.com> Disallow disable of the system shared libs.

bug:28173410

Change-Id: If731f2d90312a083bb940f83431ba3eccf213947
ackageManagerService.java
4ef1982af8f6669b6ab0ea2468f63503bc3453c5 13-Apr-2016 David Brazdil <dbrazdil@google.com> Remove UsageStats post-OTA package update filter

Filtering packages for boot-time post-OTA update with
UsageStatsManager idleness API is too aggressive and leaves out even
apps used heavily in the foreground. Remove for now.

Bug: 27902702
Bug: 28161327

Change-Id: I7912f9ad5d8c6206c19068a76383e370d24818db
ackageManagerService.java
9e5922cf73d32077587bf74c7a086b0d3274da16 13-Apr-2016 Nick Kralevich <nnk@google.com> Merge "change directory name" into nyc-dev
e91dba06f9240451510a4542c463ef9d2cdb1f42 13-Apr-2016 Nick Kralevich <nnk@google.com> change directory name

external/sepolicy was renamed system/sepolicy

Change-Id: Id27cd8c22d966958e481c9ed0171f637b3ffe2c0
ELinuxMMAC.java
fc5f9f512752ccf72707cc59927ad31f7828e1ec 13-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't kill apps when only clearing caches." into nyc-dev
7b6c731fd83d9dbb5b42021ac42f8164b64dbacc 13-Apr-2016 Jeff Sharkey <jsharkey@android.com> Don't kill apps when only clearing caches.

Bug: 28152575
Change-Id: I469e87a75ce7ce6ddfeb934e00f8087cddcaa30a
ackageManagerService.java
0a6a6dbe9107a3e31d74293f853b46ae0e5b9e7b 13-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Added api to delete cache files for a given user" into nyc-dev
78c9eb8947538f63d2e06684663d400991dfff8f 13-Apr-2016 Suprabh Shukla <suprabh@google.com> Added api to delete cache files for a given user

Added an api to delete application cache files for a specific user. This
allows settings to clear cache files for work profile apps as well.

Bug: b/25338468
Change-Id: I52d4944a7a03b6d63ad44dd6bb868aec62815eab
ackageManagerService.java
2376f9d35f43db645a3f043cdfaa2f4fd3e27640 13-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't count system partition code against size." into nyc-dev
d1b8d6d342d049e00d9a304c291c6c024aa3c0a0 13-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Set label for links to resolver activities." into nyc-dev
f8173ca8ac0efef39c79d732fd9eee80d1066302 13-Apr-2016 Philip P. Moltmann <moltmann@google.com> Set label for links to resolver activities.

Also: Add specific labels for capture-image-intent.

Fixes: 20134921
Change-Id: I3678def1089512a8340f19110645a03379c26cee
ackageManagerService.java
1d616f0d880d0a4109e811221f3c3ff2e016013b 13-Apr-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: Address API review feedback." into nyc-dev
959586b9a9ca96a70c2232af0f99696a369d1b1d 13-Apr-2016 Jeff Sharkey <jsharkey@android.com> Don't count system partition code against size.

Bug: 28136734
Change-Id: I2b843b13c493bbf78c2ad9dd7d75faa302e3a11b
ackageManagerService.java
65136ac6a4f6fb2423a0768b451782dcd0e960d5 13-Apr-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Keep read/write external storage as built-in permissions" into nyc-dev
1fe7dfa66aaf37045c62094438ab3db2ee5403c5 12-Apr-2016 Sunny Goyal <sunnygoyal@google.com> Merge "Changing LauncherApps to resolve activity by component name" into nyc-dev
b6d3523dfb5d73ddda4b750a82c059cdc42acf8e 05-Apr-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Address API review feedback.

- "delete" -> "remove"
- add/deleteDynamicShortcut() now takes a list.
- Throttling default settings is now 2 calls / hour.

- Add categories to ShortcutInfo.
- getIconResourceId() is now public

Bug 27923857
Bug 27548047

Change-Id: I8457b30e4b2f7c63ab2988648b37178fd16ea45b
hortcutPackage.java
hortcutService.java
bc20320f7f224d1cc5be3c436a1a5ece2067f2ec 12-Apr-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: First cut of CTS" into nyc-dev
45d3e977487da262a58bbfc5650c99a2d94aba9f 31-Mar-2016 Sunny Goyal <sunnygoyal@google.com> Changing LauncherApps to resolve activity by component name

This makes the behavior of resolveActivity similar to isActivityEnabled.
Not that starting this activity may still fail due to other reasons.

Bug: 27549770
Change-Id: I924d7aa2305c64fd319ca1e38058f9f956c0c256
auncherAppsService.java
5ba0d3e3a3035b67d2ce3a59975145b1e0061ef4 11-Apr-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: First cut of CTS

Bug 27548047

Change-Id: Idd7a768ea4fee44c2cf6e3bd473cea9e67f5f7cd
auncherAppsService.java
hortcutService.java
b53874e71459af4461d12fa626a39d02d98cf2b3 11-Apr-2016 Jeff Davidson <jpd@google.com> Merge changes from topic 'carrier-app-race' into nyc-dev

* changes:
Disable preinstalled carrier apps earlier in boot.
Move CarrierAppUtils into frameworks/base/telephony.
f86ce783c6726694ad9f6d5e9b5d3b58c3b7e09c 11-Apr-2016 Todd Kennedy <toddke@google.com> Merge "Add systrace for resolveIntent()" into nyc-dev
42cf25f735d0984e908bc30a948c631b39f2fd42 11-Apr-2016 Todd Kennedy <toddke@google.com> Merge "Don't allow userID changes on upgrade" into nyc-dev
e5313a842a5e41cde624386448d1e77cb0fbfae7 11-Apr-2016 Svet Ganov <svetoslavganov@google.com> Keep read/write external storage as built-in permissions

These are permissions that were mapped to gids but we need
to keep them listed event though they are no longer mapped
to gis until an upgrade from L to the current version is to
be supported. These permissions are built-in and in L were
not stored in packages.xml as a result if they are not defined
in the platform.xml while parsing packages.xml we would
ignore these permissions being granted to apps and not
propagate the granted state.

From N we are storing the built-in permissions in packages.xml
as the saved storage is negligible (one tag with the permission)
compared to the fragility as one can remove a built-in permission
which no longer needs to be mapped to gids and break grant
propagation.

bug:27185272

Change-Id: I65e05c4f7edd9a934888b4d0974100aa4e9a9453
ettings.java
390a81302f13a0285e58e550cf786255ce5f8bd8 11-Apr-2016 Makoto Onuki <omakoto@google.com> Merge "Add UserHandle to ShortcutInfo, and simplify LauncherApps APIs." into nyc-dev
4c74334c4425e43dfb53bc2ef707eebb1bef7d5b 11-Apr-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Added getProfileIds method returning array of userIds" into nyc-dev
ace80c56d7c63dadead34539b643f69a1b7336e8 11-Apr-2016 David Brazdil <dbrazdil@google.com> Retry compiling a previously failing package after update

BackgroundDexOptimizer (BDOS) keeps a list of packages it attempted
to compile but dexopt failed. Once such a package is put on the list,
it is never removed from it until reboot.

This CL modifies BDOS to accept notificiations from
PackageManagerService on recently installed packages and removes
their names from the list.

Bug: 28082762
Change-Id: I0c3d3f657bd3ff5f0a61dfeef1d8174ed7be0b74
ackgroundDexOptService.java
ackageManagerService.java
80932c1418f22fa2ab49aa1eea8337b8f29b9bcc 08-Apr-2016 David Brazdil <dbrazdil@google.com> Assume package failed to compile unless proven otherwise

BackgroundDexOptService keeps a list of packages which failed to
compile so that they are not revisited. If compilation takes so long
that the background job is killed, the offending package is not
recorded.

This patch records the package before dexopt is called and removes it
from the list if dexopt succeeds.

Bug: 28082762
Change-Id: If7388e159b999287b60f19dc99cf4dde61ec64c8
ackgroundDexOptService.java
6a3b2d2bc63254a412eb546ed371fce8f4337434 08-Apr-2016 David Brazdil <dbrazdil@google.com> Refactor return values of performDexOpt

PackageDexOptimizer.performDexOpt would return DEX_OPT_PERFORMED if
dexopt succeeded on the package and DEX_OPT_SKIPPED otherwise, even
if dexopt failed. This patch fixes that and cleans up the code.

PackageManagerService.performDexOpt* would return true only if
PackageDexOptimizer.performDexOpt returned DEX_OPT_PERFORMED.
Consequently, it would return false when dexopt was not needed. This
patch refactors the code to return true unless PackageDexOptimizer
returns DEX_OPT_FAILED and documents the behaviour.

Bug: 28082762
Change-Id: Ica73e67ab02025ef5619746bb8c465c96b72846b
ackageDexOptimizer.java
ackageManagerService.java
37a87698f5b13e8d24475cb05d48a3da7339192c 07-Apr-2016 David Brazdil <dbrazdil@google.com> Update packages in post-boot background job

Adds a post-boot job which scans all optimizable packages and updates
those whose OAT files are out of date. This is meant to offset the
fact that on OTA we only update the most used packages.

Bug: 27901338
Change-Id: Ia4d4362ecead1ca63d08d62c6814dad4b810f7cc
ackgroundDexOptService.java
4288419787120ce85a241a4b315d7d2123aa2d4a 10-Apr-2016 Jeff Sharkey <jsharkey@android.com> Use inode numbers for CE storage.

Certain operations, such as clearing/destroying app data, or just
counting on-disk size, require us to know the CE storage directory
of a particular app. To facilitate these operations, offer a method
to get the inode of a CE directory, and accept that inode number
for later operations. Collect and store the inode number in
PackageUserState for future use when that user's CE storage is
still locked. This design means it's safe to clear/destroy app
data in both CE/DE storage at the same time.

Move most installd-related methods to a uniform calling convention
that accepts a single parent PackageParser.Package, and internally
fans out to handle all "leaf" packages under that parent.

In previous releases, we started installing apps using a new
directory-based layout, where all app code, unpacked native libraries,
and optimized code is bundled together. So now we only have a single
path to measure for code size. This fixes several outstanding bugs
that were causing sizes to be miscounted for apps supporting multiple
architectures.

Fix a subtle bug in PackageSettings that would cause "notLaunched"
to be parsed incorrectly.

Bug: 27828915, 27197819
Change-Id: Ia582cf3550553292bde4bb4313367111332913ec
nstaller.java
ackageManagerService.java
ackageSettingBase.java
ettings.java
d4041db120d7500e73e0132b03dfeffb84d402f5 09-Apr-2016 Jeff Sharkey <jsharkey@android.com> More freezing of apps when doing surgery.

We're still hearing rare reports of apps running while the system
is trying to do surgery on app code/data. To fix this once and for
all, start guarding all PackageManager critical sections by freezing
and then killing the app before doing surgery.

This is done by introducing a new PackageFreezer class which can be
used in try-with-resources blocks. It also handles child packages
uniformly, and it uses CloseGuard to defensively un-freeze packages
if a caller leaks without closing.

The set of frozen packages is now maintained outside of PackageSetting
to support newly installed packages. Add docs for the various locks
and method syntax conventions, including the new "LIF" syntax which
indicates the caller is responsible for freezing the package being
worked on.

Bug: 27698554
Change-Id: I64c4c48123060ccb4d4c50c2fbf3ef223c01e659
ackageManagerService.java
ackageSettingBase.java
ettings.java
8ed9ece93dca5c7266ca7d9c5fabe7c9a6b214e7 10-Apr-2016 Jeff Sharkey <jsharkey@android.com> Revert "Keep read/write external storage as built-in permissions"

This reverts commit 4086750e30d04715d5be3ca6eaa75a4a1fa41d56.
ettings.java
30f37594e02e09903c56e1325cec85081f2aadb8 09-Apr-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Keep read/write external storage as built-in permissions" into nyc-dev
4086750e30d04715d5be3ca6eaa75a4a1fa41d56 09-Apr-2016 Svet Ganov <svetoslavganov@google.com> Keep read/write external storage as built-in permissions

These are permissions that were mapped to gids but we need
to keep them listed event though they are no longer mapped
to gis until an upgrade from L to the current version is to
be supported. These permissions are built-in and in L were
not stored in packages.xml as a result if they are not defined
in the platform.xml while parsing packages.xml we would
ignore these permissions being granted to apps and not
propagate the granted state. From N we are storing the built-in
permissions in packages.xml as the saved storage is negligible
(one tag with the permission) compared to the fragility as one
can remove a built-in permission which no longer needs to be
mapped to gids and break grant propagation.

bug:27185272

Change-Id: I440f6ceb7bc4710dece1a2fadabc995b18fc2a83
ettings.java
c289922beed948220bc876feb5929ab4f86096e9 08-Apr-2016 Todd Kennedy <toddke@google.com> Merge "Fix NPE for MATCH_FACTORY_ONLY" into nyc-dev
421d8f5fab1c4f1729d735935264d6fc3054a073 08-Apr-2016 Todd Kennedy <toddke@google.com> Fix NPE for MATCH_FACTORY_ONLY

Bug: 28087606
Change-Id: Ib86c5189aa9a9ca87504625dd19bdeab56fd4967
ackageManagerService.java
f7593344ddb9739df629783482aba81da984ffa0 08-Apr-2016 Todd Kennedy <toddke@google.com> Don't allow userID changes on upgrade

Changing userID's on upgrade lead to all sorts of bad behaviour, so,
don't allow it.

Bug: 28075981
Change-Id: I4861603f4607d7bd85fa24951a62a00dadd6eeec
ackageManagerService.java
abe8442951ff88aa01ed882adb54fb1b3472ca3e 07-Apr-2016 Makoto Onuki <omakoto@google.com> Add UserHandle to ShortcutInfo, and simplify LauncherApps APIs.

- Also fixes the bitmap recycle bug in the service.

Fixes 28053541

Change-Id: I2b244feda0f85c60e2c15af427fcad95ad5e6da5
auncherAppsService.java
hortcutPackage.java
hortcutService.java
cea732185fd1b8560a3732116b6092975c254437 08-Apr-2016 Selim Gurun <sgurun@google.com> Merge "Corrections to processing abioverride flag" into nyc-dev
0e868a193e926d799c0a53b071d05cda4b0e59ed 08-Apr-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Fix a NPE in PackageInstallerService" into nyc-dev
3baa87653ead8982fcb114274a3778161763a894 08-Apr-2016 Svet Ganov <svetoslavganov@google.com> Fix a NPE in PackageInstallerService

bug:28051747

Change-Id: Ic38786e1ab4b4f6d0f9b1782d3bb46af04c61aa7
ackageInstallerService.java
b4e39f5b2fcb74259a0a33ac4ad3d07a0073204f 08-Apr-2016 Sudheer Shanka <sudheersai@google.com> Merge "Prevent apps from uninstalling packages that are not installed by them." into nyc-dev
7f98aa4aa93497692f200c553d2d6fff402e3de2 07-Apr-2016 Fyodor Kupolov <fkupolov@google.com> Added getProfileIds method returning array of userIds

Previously many usages of UserManager.getProfiles and getEnabledProfiles
were only using ids of returned users. Given that the list of users needs
to be parceled and unparceled for Binder calls, returning array of ids
minimizes memory usage and serialization time.

A new method getProfileIds was introduced which returns an array of userIds.
Existing method calls were updated where appropriate.

Bug: 27705805
Change-Id: Ic5d5decd77567ba0f749e48837a2c6fa10e812c0
serManagerService.java
8f035a3c1725570c0932d64ec45b999fd12fcd86 08-Apr-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Make ext libs a part of AOSP and mandatory" into nyc-dev
5c8acb4380874d7793ba4e44fd3f7baa9a0cb692 08-Apr-2016 Selim Gurun <sgurun@google.com> Corrections to processing abioverride flag

Bug: 28043974

One of the parameters to Settings class wrongly passes the secondaryCpuAbi
as CpuAbiOverrideString causing mayhem for multiarch libraries. Use the
correct param.

Further, for multiarch, the cpuabioverride flag is ignored. Remove the
check for cpuabioverride when checking for use32bitabi flag.

Change-Id: I7eff057031e3ddb18fcce6f380658a522af8b64d
ackageManagerService.java
ettings.java
828166bca4b21c38e59c1d6d651555095dee33a3 08-Apr-2016 Svetoslav Ganov <svetoslavganov@google.com> Make ext libs a part of AOSP and mandatory

bug:27698377

Change-Id: Ic98d18f90f9b735e49ff6a7801835b6432ec86de
ackageManagerService.java
e68b127525c23e8e0cbe1e9dee75534d99e2833d 07-Apr-2016 Jeff Davidson <jpd@google.com> Disable preinstalled carrier apps earlier in boot.

Preinstalled carrier apps start in state DEFAULT (== ENABLED); the
telephony stack marks them as DISABLED_UNTIL_USED during
initialization, and eventually ENABLED once a SIM for that carrier is
inserted.

However, this can cause a race as telephony initialization may happen
after the carrier app is started, while it is still in the DEFAULT
state. In this case, the app is disabled, and though PackageManager
will subsequently kill it, this may lead to a race as the app will
briefly remain running while disabled. In this state, crashes are
likely to occur in the app.

So, make sure we perform the first disable as soon as PackageManager
is ready. This ensures the app is not started until it has been
explicitly enabled.

Bug: 27821069
Change-Id: I771d7dde7880fd98b1df3d011be44164abf402f4
ackageManagerService.java
d67ac0a9060468973157d76cac01cf35fa722527 07-Apr-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Lock down access to getProfiles for 3P apps" into nyc-dev
9d8da4cdf182643cd015bbf7a8ae1da9e53eb8b4 07-Apr-2016 Todd Kennedy <toddke@google.com> Merge "Only parse an APK once" into nyc-dev
70f08d9eb176b47568b92c9486c2ac702911a864 07-Apr-2016 David Brazdil <dbrazdil@google.com> Merge "Do not update idle apps on OTA" into nyc-dev
d9d438ac4e851275abb4ddc6671f74701e07b4fc 06-Apr-2016 Todd Kennedy <toddke@google.com> Only parse an APK once

During package installation, we were parsing the APK twice; once
in the context of the PackageInstaller and once in the context
of the PackageManager. Instead, the installer should just pass
the certificates to be used further in the process.

If the PackageManager doesn't receive certificates [or, if there's
an error using them], it will fallback to re-parsing the APK.

Bug: 27502465
Change-Id: I94ce551af54eaa9916228e933134debe50867d21
ackageInstallerSession.java
ackageManagerService.java
c533b566ff60041d4964765ce09a3da78e8866ca 01-Apr-2016 Fyodor Kupolov <fkupolov@google.com> Lock down access to getProfiles for 3P apps

MANAGE_USERS permission is not required if calling userId is the same as
requested user id. Theoretically this allows any 3P app to read UserInfo
state including PII fields like name and icon. The change clears PII fields
if the caller doesn't have MANAGE_USERS permission.

Bug: 27705805
Change-Id: Ic69c8cc6aafb7ac72b4fc2b9691cb8e4bef3fb2c
serManagerService.java
29283375831d6ccf04b60d02af03e4268d79c454 05-Apr-2016 Sudheer Shanka <sudheersai@google.com> Prevent apps from uninstalling packages that are not installed by them.

Bug: 27404193
Change-Id: Ib8868d6522fc3e41526c6909fc6ea531f344e676
ackageInstallerService.java
ackageManagerService.java
ettings.java
9745ea35361141a94e775920a941f913af01134a 06-Apr-2016 Lenka Trochtova <ltrochtova@google.com> Merge "Put disallow-safe-boot restriction to system settings to make it accessible during boot." into nyc-dev
e11eb10e8d994b49e6e04cd14fccb402f8f48ec9 06-Apr-2016 Russell Brenner <russellbrenner@google.com> Merge "Match SUW package after FBE reboot" into nyc-dev
4bb80305fbb1e9552392b139ba367317d8dffba2 06-Apr-2016 Todd Kennedy <toddke@google.com> Merge "Move cert tracing to PackageParser" into nyc-dev
0f4bc2b8002b927290dc84403bb0255e4c4a9079 06-Apr-2016 Todd Kennedy <toddke@google.com> Move cert tracing to PackageParser

Tracing for cert collection in PackageManagerService was only
catching one of a couple usages. Move tracing lower in the
call stack to ensure tracing exists for all calls.

Also added a new tag to differentiate between verifying v1 & v2
signatures.

Bug: 27502465
Change-Id: Ie29f326e44f32cdbea1572714689c82f07ca12ba
ackageManagerService.java
6474f0e02b9a00c1f69f985c0d73cf7f8c0fb073 24-Mar-2016 Lenka Trochtova <ltrochtova@google.com> Put disallow-safe-boot restriction to system settings
to make it accessible during boot.

BUG: 26251884

Change-Id: I1dee58dfc2aa746e0e97a6675c611c6e313ec91c
serRestrictionsUtils.java
d69c9e7efbb4983527acf5c4feca9d1fde7b611d 06-Apr-2016 Russell Brenner <russellbrenner@google.com> Match SUW package after FBE reboot

Add MATCH_DIRECT_BOOT_* flags when querying for SUW package.

Bug: 28027590
Change-Id: Ibd454340053ce24299f316e92cd6ec6b350d695e
ackageManagerService.java
ae4cde1ccebd41c9ca1af555c0a1a2580c3d7e1c 06-Apr-2016 David Brazdil <dbrazdil@google.com> Do not update idle apps on OTA

Modifies the PackageManagerService.updatePackagesIfNeeded to filter
out packages which are considered idle by the UsageStatsManager.

Bug: 27902702
Change-Id: I8847dfc283e0246265009effb6394bb774848eb3
ackageManagerService.java
0fd0f893dd5fc45f14ef1c33f359cd7fcbb52432 06-Apr-2016 David Brazdil <dbrazdil@google.com> Re-enable Optimizing apps dialog

Bug: 27350503
Change-Id: I98ae03571817792265780c9283b395c323638e14
ackageManagerService.java
f2cf5987a6aea262187208ad269ceb1534955704 05-Apr-2016 Alex Klyubin <klyubin@google.com> Merge "Permit package downgrades on debuggable platforms." into nyc-dev
80189cdece046e2e915e07c0ee166b6375dbde84 05-Apr-2016 Tony Mak <tonymak@google.com> getProfiles should only returns non-partial user info

Bug: 26928524
Change-Id: I537bb0a9632cad603717a367b81d5e072452a6d7
serManagerService.java
63d1ee45eee7e01bd098c7a9694daaea300c1133 05-Apr-2016 Rubin Xu <rubinxu@google.com> Merge "Split ACTION_MANAGED_PROFILE_AVAILABILITY_CHANGED into two." into nyc-dev
40ccfdd831ce76e2f1df84a9d4b865f5cf8b65aa 04-Apr-2016 Alex Klyubin <klyubin@google.com> Permit package downgrades on debuggable platforms.

This is to make it easier to test on debuggable builds. Debuggable
platform builds trade off being as close as possible in behavior to
non-debuggable builds and being more testable/debuggable. Thus,
debuggable platform builds make no security guarantees and it is thus
acceptable to disable this security mechanism on debuggable platform
builds to help with development/testing/QA.

Bug: 27327503
Change-Id: I19340b95f08c57ff2aba59a08babb6a941c93c3a
ackageManagerService.java
e23283a6fa0ec8cf8448eb0e04db163ec919066f 05-Apr-2016 Makoto Onuki <omakoto@google.com> Do not enable binder exception logging.

Bug 28005618

Change-Id: Ie13fd5b6d1fcbf27ad480501e30b5cb1774e8b48
auncherAppsService.java
24b74150fb669b92a1e6dec3bf8ef1aa46d91092 04-Apr-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: More command for CTS, more tests.." into nyc-dev
ac21497f174504472e92b99500709518b8ab2d71 04-Apr-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: More command for CTS, more tests..

and fix flakey tests.

Bug 27548047

Change-Id: Ia5f189278f6111850277ca16aa747469f48c5f14
auncherAppsService.java
hortcutService.java
e95057ade126e9e159fe05b69c32f85f7891490f 01-Apr-2016 Rubin Xu <rubinxu@google.com> Split ACTION_MANAGED_PROFILE_AVAILABILITY_CHANGED into two.

Add more comment to EXTRA_QUIET_MODE

Bug: 27532254
Change-Id: I68a217561afca8b87f523c62393cdad097d5b75d
serManagerService.java
6dffdf82857e4016c6fb953039b0508cb1fd0f71 04-Apr-2016 Todd Kennedy <toddke@google.com> Merge "Fix intent filter priorities" into nyc-dev
23c8292acc0d45a0f19f3ea8107d48cc52d87dc5 04-Apr-2016 Martijn Coenen <maco@google.com> Merge "Grant NFC tag app default permissions." into nyc-dev
893e097157c68d94dbcb22e21cbc8d3b39965670 04-Apr-2016 Svet Ganov <svetoslavganov@google.com> Kill app if revoking a permission while resetting app prefs

bug:25895994

Change-Id: I78616ab5f9addbd91d2f4d12a8161544f482ec43
ackageManagerService.java
2e210c4d0f766e52ea4c087a1d54213c36a4e0ea 30-Mar-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: implement backup & restore

Also:
- Fix cross profile pinning. Now ShortcutLauncher correctly keeps
track of target package user IDs.

- Add performance stats for package manager calls and show them on
dumpsys.

Bug 27548047

Change-Id: I2472980b2955b6c70947aaaa9b76f75d0616db6e
hortcutBackupAgent.java
hortcutLauncher.java
hortcutPackage.java
hortcutPackageInfo.java
hortcutPackageItem.java
hortcutService.java
hortcutUser.java
5585dd971e265cbb3a515bb759710646c5bc6f63 29-Mar-2016 Todd Kennedy <toddke@google.com> Fix intent filter priorities

There are now three rules that guard intent filter priorities:
1) Only privileged applications will be granted a >0 priority
filter [previously, _all_ system applications could do this]
2) There are certain actions that are considered protected [eg
ACTION_VIEW, ACTION_SEND, ...] and even privileged applications
will NOT be granted a >0 priority filter. There is one, and
only one, exception for the SetupWizard.
3) Updates will NOT be granted a priority greater than the priority
defined on the system image.

Bug: 27450489
Change-Id: Ifcec4d7a59e684331399abc41eea1bd6876155a4
ackageManagerService.java
7efb7eff63ba7c57de918afba9140d74a816ecc6 01-Apr-2016 Todd Kennedy <toddke@google.com> Add systrace for resolveIntent()

Bug: 27792581
Change-Id: I2dfd362c1e04c124827118e3822536832e79b537
ackageManagerService.java
3ccb35421d642e96048d5cdeb60043634933267d 01-Apr-2016 Russell Brenner <russellbrenner@google.com> Merge "Add new protection level for setup wizard" into nyc-dev
02424676c68e23f44432ef0e379d65ddd9c3a786 01-Apr-2016 Todd Kennedy <toddke@google.com> Merge "Allow retrieving info /system components" into nyc-dev
b23346639b66783c1662fd8ffa5345ef5cef336c 23-Mar-2016 Russell Brenner <russellbrenner@google.com> Add new protection level for setup wizard

Adds PROTECTION_LEVEL_SETUP, a privileged permission for use only by
the setup wizard.

Bug: 20016740

Change-Id: Ib95e349c54d5d12465bf43162975dfb628ef2434
efaultPermissionGrantPolicy.java
ackageManagerService.java
d6ee0ba57906f83f45ca2a2cd835d7ff6e7a88df 01-Apr-2016 Todd Kennedy <toddke@google.com> Allow retrieving info /system components

Generally we return info for the latest installed package; which could
either be a built-in [i.e. on the /system partition] package or a user
updated package. In certain circumstances, we want to be able to get
the version on the /system partition regardless of whether or not the
user has updated it. We do this by passing MATCH_FACTORY_ONLY to
getPackageInfo().

Bug: 27469181
Change-Id: I8dd1d110e2d72e5c6f024812d0b5d15d8b217347
ackageManagerService.java
406101ec115f6fc749d60f94ab188954dc7f94f5 31-Mar-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Set build fingerprint for the new user" into nyc-dev
83c2424141d2fdc3ce22c42620b4355feedf3efe 31-Mar-2016 Fyodor Kupolov <fkupolov@google.com> Set build fingerprint for the new user

This change will prevent PRE_BOOT_COMPLETED from being sent to new users

Bug: 27939609
Change-Id: I0e49a467c792c972e0e3fc76e06842a80810e14b
serManagerService.java
47c170a7460e8455ffc07981916c400fa980433a 31-Mar-2016 Andreas Gampe <agampe@google.com> Package Manager: Use new DexFile function to upgrade filter

In case an app is shared, do not simply use "full" for compilation.
Instead, upgrade the asked-for filter to the non-guided version.

Bug: 27921071
Change-Id: I54735b61732e6a5c9dc62425d04bc740dd365083
ackageDexOptimizer.java
ackageManagerServiceCompilerMapping.java
aa604694450539b4c99901b0714efaa79db3c87d 31-Mar-2016 Andrei Stingaceanu <stg@google.com> Merge "AfW - suspend apps - API polish" into nyc-dev
2c0ae91f2d22b2c9a3b506d3a7f60bc31f72c57d 31-Mar-2016 Jeff Sharkey <jsharkey@google.com> Merge changes Ifecff4f1,Ia302de46 into nyc-dev

* changes:
Make preferred activities direct-boot aware.
Make Parcelable classes final, API cleanup.
0436b1d5a21a2f42d77992a4429f01601676d3e8 31-Mar-2016 Jeff Sharkey <jsharkey@android.com> Make preferred activities direct-boot aware.

When matching a list of ResolveInfo against the preferred activity
list, we shouldn't mutate the preferred set based on activities that
might be hidden due to the user being locked.

Bug: 25578136
Change-Id: Ifecff4f11c7fddef3eed04325d396f7c43d6703a
ackageManagerService.java
27c49d5790647cc0bb81cc76a999ae65fe4a34cc 31-Mar-2016 Jeff Sharkey <jsharkey@google.com> Merge "Fix a deadlock due to wtf in BaseBundle" into nyc-dev
2387932b74699c4d5baa493271e999e31b09d2b8 31-Mar-2016 Amith Yamasani <yamasani@google.com> Fix a deadlock due to wtf in BaseBundle

Use Slog.wtf instead of Log.wtf, so that it is
asynchronously reported.

Mark incoming application restrictions as defusable
since they are being unparceled.

Bug: 27811728
Change-Id: I166de69a74417e439ec5ef9159fbbfbfe711dde6
serManagerService.java
1bd064f04b77f2f1ba5edd487372887753a49ac6 30-Mar-2016 Andreas Gampe <agampe@google.com> Merge "Package Manager: Remove force-compile on boot" into nyc-dev
ecb34651be8b69de5aaedf9a9651d366e336d3a3 30-Mar-2016 Andreas Gampe <agampe@google.com> Package Manager: Remove force-compile on boot

With ART commit d1537b569b6, the underlying issue is fixed.

Bug: 27618311
Bug: 27676766
Bug: 27693977
Bug: 27915086
Change-Id: Ib6e85e47daf3d2ceab1e5abe615610790ac6947f
ackageManagerService.java
ca0ee285bb28ee5698d7cf2680e2fa6ca337cefd 30-Mar-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: Support secondary text field." into nyc-dev
284b165d7d14bb2cde8a4c87a24792c04398fb10 30-Mar-2016 Martijn Coenen <maco@google.com> Grant NFC tag app default permissions.

Bug: 25535025
Change-Id: I7fbe261c9c48844b7a6833c85df2268afc5215e0
efaultPermissionGrantPolicy.java
b67b5b9f3c947fc6d835459f0e880eb5fcaad50b 30-Mar-2016 David Brazdil <dbrazdil@google.com> Merge "Move OTA package update before fstrim, hide "Optimizing apps" dialog" into nyc-dev
f5c444ffd4fdce4fab939fcd88f163288dc804c5 30-Mar-2016 David Brazdil <dbrazdil@google.com> Move OTA package update before fstrim, hide "Optimizing apps" dialog

This patch moves the updating of packages before performing fstrim,
which runs asynchronously anyway, and stops showing the UI dialog.

Bug: 27350503
Change-Id: I6fceda10d7696f9badb97978fb9dc7927d698a4b
ackageManagerService.java
d65bdcad08c3b2df041136db75ab686e666196ec 30-Mar-2016 Calin Juravle <calin@google.com> Merge "Fix profile deletion in package manager" into nyc-dev
e3ae7ec14a3204ee502219b6bb46dc9ab8e24a36 30-Mar-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Support secondary text field.

Bug 27548047

Change-Id: I2d184bab2c26e351b7326945fa0cacf826f16d1e
hortcutPackage.java
d5b745a9e64734483bc43c781ad809b2a75bd1ba 30-Mar-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: proper work profile support" into nyc-dev
cd57599273738c30cc209894d1f87731c9defb16 29-Mar-2016 Jeff Sharkey <jsharkey@android.com> Delay vold connectors until published, fix NPE.

If they connect too quickly, PackageManager could end up trying to
obtain the yet-unpublished MountService.

Fix NPE in UserManagerService when trying to persist fingerprints,
and fix write ordering to always write [id].xml before userlist.xml
to avoid battery pull issues. Simlarly, delete [id].xml only after
updating userlist.xml.

Bug: 27869443
Change-Id: I43d8552e5e37b9ca4137cca3e3e76684c7dee605
serManagerService.java
9da23fc6ac565b38129d52f4f8f174c833a9bd01 29-Mar-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: proper work profile support

Bug 27548047

Change-Id: I8acea3355f8974a551f53814624dec30732f7b2f
hortcutLauncher.java
hortcutPackage.java
hortcutPackageInfo.java
hortcutPackageItem.java
hortcutService.java
hortcutUser.java
53937849fcb4f2e33072997bd8a7cee40137495c 29-Mar-2016 Michal Karpinski <mkarpinski@google.com> Merge "Moving app process logging from AMS to PMS" into nyc-dev
f41024461bf14a768ee39edf5f857e45725ee0fe 29-Mar-2016 Paul Crowley <paulcrowley@google.com> Merge "Continue to remove users when destroyUserKey fails." into nyc-dev
b52a461851f322b0edf3cb9383da5f449b533311 21-Mar-2016 Michal Karpinski <mkarpinski@google.com> Moving app process logging from AMS to PMS

Bug: 26796347
Change-Id: I21894c2edb41929f6ecd3880667c53e00acef677
ackageManagerService.java
rocessLoggingHandler.java
2d71f41beab55fdc038f07ec109e4223fb162343 28-Mar-2016 Calin Juravle <calin@google.com> Fix profile deletion in package manager

- there's no need to call deleteProfiles during uninstall. The app data
will be destroyed and profile clean up is part of that process. This
allow profile data belonging to other users to survive.
- the 'destroy' if-then-else branches were reversed.

Bug: 27081617
Bug: 27896463

Change-Id: I5b532a5fd6fea1852f0e6920d4e024bd43f9f99a
ackageManagerService.java
efc4a344a173ae20ec72b8c05c45b794687fda87 22-Mar-2016 Andrei Stingaceanu <stg@google.com> AfW - suspend apps - API polish

* renamed getPackageSuspended => isPackageSuspended
* does not return false for an error, instead throws
NameNotFoundException if the package could not be
found, or if there is an unknown RemoteException,
wraps it in a RuntimeException and rethrows.

Bug: 27532430
Bug: 22776761
Change-Id: Iee00600089b1c0556a3312b10456826464fa8f9f
ackageManagerService.java
ackageManagerShellCommand.java
d99c6f04bbb68f8be78f2c3ca625a3a8d5645275 28-Mar-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Fix work profile

- Pinned shortcuts need to know not only which package
has pinned them, but also on which user's, due to work profile.

- Launcher can always launch shortcuts that it has pinned.

Bug 27548047

Change-Id: I23b4e7dfbb6ecc42099d31008bcfd61d44e2c7fb
auncherAppsService.java
hortcutLauncher.java
hortcutPackage.java
hortcutPackageInfo.java
hortcutService.java
hortcutUser.java
7b71a6f622fcad9d2c5b2788133330693ab2655c 28-Mar-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: Cleanup package info handling" into nyc-dev
905e8855e7df111f835fecde32598479058fe4df 28-Mar-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Cleanup package info handling

Bug 27548047

Change-Id: I598b25d1901230cec6fb3760fe5efeff3b3fef96
hortcutPackageInfo.java
hortcutService.java
7d47079acf1c8a3143606542c69832863711662a 28-Mar-2016 Andreas Gampe <agampe@google.com> Merge "[STOPSHIP] PackageManager: Add package setting flag for N upgrade" into nyc-dev
ec1a2da6e086347c73618d63d0409910ebd47efb 28-Mar-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: Handle package broadcasts." into nyc-dev
bed38b9fd4e5cd1014871ee247b130afd53ff63c 28-Mar-2016 Calin Juravle <calin@google.com> Merge "Read "dalvik.vm.usejitprofiles" for package compile command" into nyc-dev
fc41ea320f203afa182c7f5816b2ae8072132dd1 26-Mar-2016 Andreas Gampe <agampe@google.com> [STOPSHIP] PackageManager: Add package setting flag for N upgrade

First upgrade to N level needs to compile apps with the first-boot
reason, as profiles are missing. The SDK level check does not work
for the preview, as the version is not incremented, yet.

Add a flag to the package settings to track the status.

Note: STOPSHIP, this will be reverted before release.

Bug: 27689078
Bug: 27872764
Change-Id: Ifd460d5235348f041ef64c9b61068af47113ddcb
ackageManagerService.java
ettings.java
8bc758b4569bc2c6ea29b144762920bd047c6057 28-Mar-2016 Calin Juravle <calin@google.com> Read "dalvik.vm.usejitprofiles" for package compile command

Bug: 27859630
Change-Id: I8c6fff6762646e4abe5b72428c23ceefa90b1f53
ackageManagerShellCommand.java
b5e72702e4ddfaba9f3d723446e60408e169800b 28-Mar-2016 Jeff Sharkey <jsharkey@google.com> Merge "Freeze apps during upgrade, check if uninstalled." into nyc-dev
d9435ea0514d70923a8e7ba51ee677aa4e0d36ba 28-Mar-2016 Calin Juravle <calin@google.com> Merge "Don't check if forward locked apps are used by others" into nyc-dev
c9b329ed8e422d7be0717b41efc2007493d71504 28-Mar-2016 Jeff Sharkey <jsharkey@android.com> Freeze apps during upgrade, check if uninstalled.

When an app is actively being upgraded, mark it as being "frozen"
to prevent it from being launched in a weird state. Also verify that
app is actually installed before letting Zygote fork it, working
around race conditions during user setup.

When the ProcessRecord of an ActivityRecord is inconsistent,
warn about it, but correct it and keep moving if the UIDs match.

Bug: 27200022, 26205678
Change-Id: I6628cf1cece5613f07647e0acc2d49265e69dc69
ackageManagerService.java
9948c37e482f59f43b4ff7418f39fe4388f44a3e 28-Mar-2016 Andreas Gampe <agampe@google.com> Merge "PackageManager: Introduce first-boot dexopt reason" into nyc-dev
bd91e2f3f6aca512a02be645b2515b5e3331e177 22-Mar-2016 Jeff Sharkey <jsharkey@android.com> Update PRE_BOOT_COMPLETED for FBE.

Now that CE data isn't available until after a user is unlocked, we
need to delay the PRE_BOOT_COMPLETED broadcasts. This is done by
adding a new RUNNING_UNLOCKING user state to the UserController
lifecycle.

We now track the last fingerprint a user was logged in under, and we
dispatch PRE_BOOT receivers when that fingerprint changes. To work
around battery pull issues, we only persist the updated fingerprint
once all PRE_BOOT receivers have finished. This is less granular
than the original solution, but it's still correct. We only consider
a user as "logged in" once it transitions into the RUNNING_UNLOCKED
state.

When starting a process, track if the user was "unlocked" when
started, so that we only spin up unaware providers in processes
started before user unlock.

Add generic IProgressListener to communicate PRE_BOOT progress and
strings up to lock screen. For now, LockSettingsService just blocks
until finished, but it could display these strings in the future.

Bug: 27220885
Change-Id: I349439776b885acd32f6a578d8951ffd95640be2
serManagerService.java
6823f6d038c296cadda20e0b8d75ae08cbf677c3 26-Mar-2016 Andreas Gampe <agampe@google.com> PackageManager: Introduce first-boot dexopt reason

On first boot and when upgrading to N, there are no profiles for
apps. Add a new dexopt reason to allow to adjust the compiler
filter for this case.

Bug: 27689078
Change-Id: I7d68e02fe129c8dd12cb210df555bbb6dfc1487b
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
0acbb14574d859b5f1cc0b7c6bbdfbeba38f3e55 23-Mar-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Handle package broadcasts.

- Do a cleanup when an app is gone.
- Record the app version and signatures.
- Also make saveToXml() capable of saving for backup.

Bug 27548047

Change-Id: I7eb2bbec7665b4d625630e7312c0f2a8b03c5ffa
hortcutBackupAgent.java
hortcutLauncher.java
hortcutPackage.java
hortcutPackageInfo.java
hortcutPackageItem.java
hortcutService.java
hortcutUser.java
91293794bfe2ed9ac7bbb7b652d3fb78665d3b0f 25-Mar-2016 Paul Crowley <paulcrowley@google.com> Continue to remove users when destroyUserKey fails.

destroyUserKey can fail if the user is partially created; even when
something fails it still destroys all it can. Its failure shouldn't
halt user removal.

Bug: 26847403
Change-Id: Iab1f551d19fd777198387b463b270c2508d07fd5
serManagerService.java
619f4682a3ba41d1d39356f16c9b1ec394b01464 25-Mar-2016 Makoto Onuki <omakoto@google.com> Merge "Fix potential crash loop" into nyc-dev
c5475d42a45ba48477257879e7a5b2af54a23f98 25-Mar-2016 Makoto Onuki <omakoto@google.com> Fix potential crash loop

Bug 27548047

Change-Id: I10648ccb2fd17464e18308846b910efa129ce126
auncherAppsService.java
9fa025491da8c6493d9286a7d4980105b649406e 25-Mar-2016 Calin Juravle <calin@google.com> Don't check if forward locked apps are used by others

Forward locked apps don't share their code so there is no point moving
from profile guided to full compilation.

Bug: 27334750
Bug: 26080105
Change-Id: I195d48504435bc66e890470f04056c4279d0bb2f
ackageDexOptimizer.java
e1cf49e0d7b82f3e8486663b44cf4be419d207c4 25-Mar-2016 Calin Juravle <calin@google.com> Merge "Delete app profiles only during updates and uninstalls" into nyc-dev
e37ce3db8fe86ff347e57d5e33bf824f8fe97f4a 25-Mar-2016 Andreas Gampe <agampe@google.com> Merge "PackageManager: Move compilation reasons to PMS" into nyc-dev
43fc2447df2354fcb7b843a86b1c266946ca5702 25-Mar-2016 Andreas Gampe <agampe@google.com> PackageManager: Move compilation reasons to PMS

Move the reasons to PackageManagerService (making them public) so
they can be used by clients.

Bug: 27189430
Change-Id: I30e1f823f9297e95c5b1e389004a4fd3052d5702
ackgroundDexOptService.java
taDexoptService.java
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
ackageManagerShellCommand.java
9cfba3502079f5919ec065da2f8d86fe35c475da 25-Mar-2016 Dianne Hackborn <hackbod@google.com> Fix issue #25817435: Batterystats missing UIDs for secondary users

Change-Id: I9ad907571f04b5825d234758347659544a4de6ab
ettings.java
a7f2bccca3f27a2ad12397ffb52d47fceea76018 24-Mar-2016 Andreas Gampe <agampe@google.com> Merge "Frameworks/base: Refactor package manager" into nyc-dev
bdd30d86ef98456161069d11481b2ccd25a11b4e 20-Mar-2016 Andreas Gampe <agampe@google.com> Frameworks/base: Refactor package manager

Introduce a mapping between dexopt reasons and compiler filters. Use
reasons in package manager and other classes, where possible.

Change PackageDexOptimizer to accept a compilation filter. Adapt for
the split-out profile merging. Pass compilation filter to installd.

Bug: 27689078
Change-Id: I8c0ea6f10fbfdbd096adecc52abfd2466d048fdc
ackgroundDexOptService.java
nstaller.java
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerServiceCompilerMapping.java
ackageManagerShellCommand.java
df4c40df2f49ec4366dd2c549c0f30e5262af49b 23-Mar-2016 Amith Yamasani <yamasani@google.com> Merge "Localize owner's name to current locale until changed" into nyc-dev
6f48d6ef35df55e092d18619fe1f92a2593682d4 23-Mar-2016 Amith Yamasani <yamasani@google.com> Localize owner's name to current locale until changed

Don't set a name for the system user and always return a localized
name until the user explicitly sets a name.

Bug: 27814125
Change-Id: I7972a45d77c07d9efbd67d5b360bacee46247a66
serManagerService.java
d6d27e3afb9046b4d5041c9ae484054b175fca39 23-Mar-2016 Calin Juravle <calin@google.com> Delete app profiles only during updates and uninstalls

Apps code doesn't change across OTAs so keeping profiles alive will help
have a base for OTA time optimizations (e.g. verify based on profiles to
speed up app startup).

Split claring and destroying the profiles in two different methods,
consistent to how application data is cleared/destroyed.

Bug: 27081617
Bug: 27688727
Change-Id: Ie375499075be990f4f046c8cc2029d80321d5eb5
nstaller.java
ackageManagerService.java
362636da4b402fcc62401f03080d056d91e74329 22-Mar-2016 Jeff Sharkey <jsharkey@google.com> Merge "com.android.cts.appsecurity.AdoptableHostTest may trigger below dead lock in system_server in the board with external adoptable storage as below stack:" into nyc-dev
3145924596ad0db9e8f1f5aead90fb50127243cb 22-Mar-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Extract helper classes.

Bug 27548047

Change-Id: I08656291a8dd509fde169f229ca9c503362254f3
hortcutLauncher.java
hortcutPackage.java
hortcutService.java
hortcutUser.java
8a8e68ce3b2b84174661dda1eb089db80c853b65 22-Mar-2016 guoyin.chen <guoyin.chen@freescale.com> com.android.cts.appsecurity.AdoptableHostTest may trigger below dead
lock in system_server in the board with external adoptable storage
as below stack:

"Binder_4" prio=5 tid=60 Blocked
at com.android.server.pm.UserManagerService.exists(UserManagerSer
vice.java:411)
- waiting to lock <0x06858aff> (a android.util.ArrayMap) held by
thread 19
at com.android.server.pm.PackageManagerService.checkUidPermissio
n(PackageManagerService.java:3193)
at android.app.ActivityManager.checkComponentPermission(ActivityM
anager.java:2647)
at com.android.server.pm.UserManagerService.checkManageUsersPermi
ssion(UserManagerService.java:678)
at com.android.server.pm.UserManagerService.getUsers(UserManagerS
ervice.java:272)
at android.os.UserManager.getUsers(UserManager.java:966)
at com.android.server.MountService.resetIfReadyAndConnectedLocked
(MountService.java:800)
at com.android.server.MountService.forgetAllVolumes(MountService.
java:1806)
- locked <0x077010cc> (a java.lang.Object)
at android.os.storage.IMountService$Stub.onTransact(IMountService
.java:1859)
at android.os.Binder.execTransact(Binder.java:453)

"PackageManager" prio=5 tid=19 Blocked
at com.android.server.MountService.getVolumeList(MountService.jav
a:2708)
- waiting to lock <0x077010cc> (a java.lang.Object) held by threa
d 60
at android.os.storage.StorageManager.getVolumeList(StorageManager
.java:883)
at android.os.Environment$UserEnvironment.getExternalDirs(Environ
ment.java:83)
at android.os.Environment.isExternalStorageEmulated(Environment.j
ava:719)
at com.android.server.pm.PackageManagerService.isExternalMediaAva
ilable(PackagkageManagerService.java:9453)
at com.android.server.pm.PackageManagerService.startCleaningPacka
ges(PackageManagerService.java:9493)
- locked <0x06858aff> (a android.util.ArrayMap)
at com.android.server.pm.PackageManagerService$PackageHandler.doH
andleMessage(PackageManagerService.java:1331)
at com.android.server.pm.PackageManagerService$PackageHandler.han
dleMessage(PackageManagerService.java:1133)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)

Signed-off-by: guoyin.chen <guoyin.chen@freescale.com>
ackageManagerService.java
8673b2899e775014336efff44ea88dcac2b25bdd 21-Mar-2016 Tony Mak <tonymak@google.com> Revert getUserInfo change and add isManagedPorfile(int userId)


Bug: 26469166
Change-Id: I60b70170ddc80432fc8f638b1f63c4e9f5212785
serManagerService.java
da70ee48e6c3fedb3e8c824e28612ff42e01ff12 22-Mar-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: Clean up for uninstalled packages." into nyc-dev
cdc78f7137b8036dd96c92ff15fc04ee8fc49c5c 21-Mar-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Clean up for uninstalled packages.

Bug 27548047

Change-Id: I95ca832af496fbf71023eb27a7e2647c124ffb86
hortcutService.java
07ece5936d0a1d504de3addc46adffcc9e7c8c4a 21-Mar-2016 Samuel Tan <samueltan@google.com> Merge "Disallow guest user from changing Wifi settings" into nyc-dev
d9453b8ba17f93643d9b98b19247f5b243d25dc0 14-Mar-2016 Samuel Tan <samueltan@google.com> Disallow guest user from changing Wifi settings

Disallow existing and newly created guest users from
changing Wifi settings.

BUG: 27411179
TEST: Flashed device, switched to existing guest user, and verified
that Wifi settings are disabled.
TEST: Flashed device, created new guest user, and verified that Wifi
settings are disabled.

Change-Id: Ia1bf4cce0369017b62f69d317c7ab2e30e3949b3
serManagerService.java
45c1827c37ba9d8ed3c644aee89e993e4e5288b1 18-Mar-2016 Makoto Onuki <omakoto@google.com> Merge "Improve ShortcutSrvice" into nyc-dev
a0a58a2fd5cbc1bb8056227bb04f276b364c6e96 17-Mar-2016 Jeff Sharkey <jsharkey@google.com> Merge "Refactoring FBE APIs based on council feedback." into nyc-dev
aa8b94aa79df94d77d0f7698ce532ac98f197a99 17-Mar-2016 Makoto Onuki <omakoto@google.com> Improve ShortcutSrvice

- Delayed save
- Reset logic update

Bug 27548047

Change-Id: Ibd52f90a7986991974301b7ff1f1d8520f9ef0d9
auncherAppsService.java
hortcutService.java
8a372a0a280127743ce9a7ce4b6198c7a02d2a4f 16-Mar-2016 Jeff Sharkey <jsharkey@android.com> Refactoring FBE APIs based on council feedback.

Mostly consists of removing the word "encryption" from most APIs,
since we can't actually make promises about the data being encrypted.

Bug: 27531029
Change-Id: Iace9d7c4e64716abf86ed11847c40f3947e1d625
efaultPermissionGrantPolicy.java
auncherAppsService.java
ackageManagerService.java
ettings.java
hortcutService.java
fb3f3f5b283095cff67ce78b554700958543d4f5 17-Mar-2016 Makoto Onuki <omakoto@google.com> Merge "Support multi-launcher" into nyc-dev
f9124ecad9ec20f572df8cdca6f985ef3f97210d 17-Mar-2016 Benjamin Franz <bfranz@google.com> Merge "Flush package restriction changes for a user." into nyc-dev
1b21124d126792e77cdac40c7342adb3486f004b 17-Mar-2016 Makoto Onuki <omakoto@google.com> Merge "Add "pm set-home-activity"" into nyc-dev
4828a59d68570270875d43d29b1ee25b799a923d 16-Mar-2016 Makoto Onuki <omakoto@google.com> Add "pm set-home-activity"

This is needed to change the default launcher on CTS for
ShortcutManager.

- When the default set with DPM.addPersistentPreferredActivity() is
still stronger.

- Ideally we should unify the code with HomeSettings, but I couldn't
find a good way to do this.

- I didn't make it to work to set the default for any intents
because building an intent filter from a command line would be
painful.

Bug 27548047

Change-Id: I66b153c20c7796147f77214b483112629f9d80c5
ackageManagerService.java
ackageManagerShellCommand.java
b531d086a61077ebc6c756f2294754b1bdb81616 16-Mar-2016 Tony Mak <tonymak@google.com> getUserInfo fail when app trying to get self user info

isSameProfileGroupLP return false when user has no profile, we should
check callingUserId != userId explictly.
Please notice that isSameProfileGroup handles this case, but we would like
to avoid the permission checking of isSameProfileGroup.

Change-Id: Ibb2d09eaaf7e8f099445490aa9ec287e86945125
serManagerService.java
4dc008cda2980fabb6acbf8a3b7096d1090ee36f 16-Mar-2016 Tony Mak <tonymak@google.com> Fix NotificationListenerService fail to mirror work notification

1. Instead of getting application info in runtime, just retrieve the
one in the context to avoid cross user operation.

2. Functions in PackageManager that retrieve badged icon now return
badged icon if the targer user is managed profile instead of checking
whether target user is a managed profile of the user in mContext.

3. Relax the restriction of getUserInfo, if the caller is asking a user
in the same profile group or having the manage user permission, we let
it go.

Bug: 26469166

Change-Id: Ia1ffc5743f7d94bd489cdb7571eaed51499ebdd9
serManagerService.java
bbb3ff2b2a29d42771a9ce2fe2d6f576cff62617 09-Jul-2015 Sudheer Shanka <sudheersai@google.com> Flush package restriction changes for a user.

Change-Id: I7c4481f820b6b368487d00de6c783e64cec99f4b
ackageManagerService.java
de66737ae9c5d5c94155820fad65224a83d04c3d 15-Mar-2016 Makoto Onuki <omakoto@google.com> Support multi-launcher

Each launcher can have its won set of pinned shortcuts.
- Shortcuts pinned by others should look like not pined to this
launcher. This affects how ShortcutQueryFLAG_GET_PINNED works,
as well as what ShortcutInfo.isPinned() returns.

- When pinning a shortcut, it should be a visible one to itself --
a non-dynamic shortcut that's pinned by another launcher but
not by the caller is not visible, so this launcher cannot pin it
either.

- Also clean up the dynamic shortcut adding.

Bug 27548047

Change-Id: Ia478a2ea19b7d35557ec6ea42384c79a84d6b8de
hortcutService.java
4dbe0ded4ae9faaef580be80184fca0749e27198 15-Mar-2016 Makoto Onuki <omakoto@google.com> Fix launcher side callback

- Fix crash in work profile case
- Calculate shortcuts for each caller
- Add tests

Bug 27548047

Change-Id: I1a5b6a96956abac75d01eb5cc1cec9a9e8e379a3
auncherAppsService.java
hortcutService.java
4554d0e5b69433ddaa698e976ee584f7f4f14948 14-Mar-2016 Makoto Onuki <omakoto@google.com> Make "reset-throttling" per-user

Also don't reset the counter when the time is invalid

Bug 27549307

Change-Id: Ib9ad030e348ec5e32936709f1284e3c76e88e254
hortcutService.java
49f6fbcd1f516ec543ada6aeab62eb51a3cdf712 14-Mar-2016 Makoto Onuki <omakoto@google.com> Merge "Implement the launcher side permission." into nyc-dev
2d5b465fa9235e66ec176f6d6ffaaa0c18143e41 12-Mar-2016 Makoto Onuki <omakoto@google.com> Implement the launcher side permission.

Only the default launcher can call the LauncherApps shortcut APIs.

Bug 27548047

Change-Id: I6d597fcad80c5201a2f93b8cbecd567fc79926d8
auncherAppsService.java
ackageManagerService.java
hortcutService.java
fb5f2e572a5756c1213d1c9852ff55c5fd49e9ac 14-Mar-2016 Andreas Gampe <agampe@google.com> Merge "Frameworks/base: Extract packages after cache pruning" into nyc-dev
5a032c33e4f585b482a9bb36005ebcd337fcd2cb 14-Mar-2016 Robin Lee <rgl@google.com> Merge "Specifically block suspending the package verifier." into nyc-dev
d7f9220a7cb7ea3b219c18a7ccd44b080fb23a39 12-Mar-2016 Andreas Gampe <agampe@google.com> Frameworks/base: Extract packages after cache pruning

In case the runtime pruned the dalvik cache on boot, run the package
extraction logic, so we have working oat files.

As the system server only runs in the primary ABI, this is best effort
and won't hit if only the secondary ABI has been pruned.

Bug: 27618311
Change-Id: I178d18d731a9dce5cb11ed0874c9c9c9d36d7d8e
ackageManagerService.java
ab5ba2ef2a08440193d76cf2eb1fa8537394e44d 14-Mar-2016 Robin Lee <rgl@google.com> Specifically block suspending the package verifier.

Bug: 27635033
Change-Id: I65684239e0c1bcd710753ec76e436328a33f0967
ackageManagerService.java
5fe29adc81d2c43c816d8dbeb5d6bba215aadf6e 11-Mar-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager refactor: per-user information class" into nyc-dev
3f4b1ca97ad7c31bdbe2ba29264841fb58683e81 11-Mar-2016 Makoto Onuki <omakoto@google.com> ShortcutManager refactor: per-user information class

Bug 27548047

Change-Id: Id6de8bfbad6281daec5e89be85ba8b140b599268
hortcutService.java
1374af2c7be265701b9b402b7d4749ffe716ef01 11-Mar-2016 Todd Kennedy <toddke@google.com> Merge "Add minSdk to dumpsys" into nyc-dev
89d60189cd53a7f0e20c23bb42d4cd4c3dbc20b4 11-Mar-2016 Todd Kennedy <toddke@google.com> Add minSdk to dumpsys

Bug: 27526333
Change-Id: I0148275013ebab899bcb63c07d71a840539c1863
ettings.java
d51b363c0dff6bad46093db474ae314db33d0157 11-Mar-2016 Makoto Onuki <omakoto@google.com> Merge "Fix caller validation on secondary user." into nyc-dev
7a6a05f0ccc8c57496d0a1e2b0882ab7de3175e5 11-Mar-2016 Makoto Onuki <omakoto@google.com> Test for ShortcutManager.updateShortcuts(), also

... fix bugs

Bug 27548047

Change-Id: Ia55d35521912dcba2fb1bb9c20588a83d1a2d004
auncherAppsService.java
3ee7f71d5f1dc018fdafee9d890290909ad299df 11-Mar-2016 Makoto Onuki <omakoto@google.com> Fix caller validation on secondary user.

Bug 27548047

Change-Id: Ibf01bc0f9d3dc76cc23403bf076e2faa7d033234
auncherAppsService.java
34d1c919fd4f6b9f1adb7d62dd16ba1fa8e91c79 10-Mar-2016 Makoto Onuki <omakoto@google.com> Guard against null bitmap path

Bug 27548047

Change-Id: I7130652f5ae6f7ff6bd4ae6a3ace31986a49be30
hortcutService.java
be4f470038bec4179c86459534c7e21653589bdf 10-Mar-2016 Makoto Onuki <omakoto@google.com> Merge "Refactor ShortcutService" into nyc-dev
7abfe1b95bef2e5d0e22451220430b138d9abb2d 10-Mar-2016 Makoto Onuki <omakoto@google.com> Merge "Fix crash-loop on wiped FBE device." into nyc-dev
f3a572b5c0cab23a435bd90414d25de84e00398e 10-Mar-2016 Makoto Onuki <omakoto@google.com> Fix crash-loop on wiped FBE device.

Bug 27595678

Change-Id: I02708b3c9e5472c5548bda7e6e15189614056471
hortcutService.java
cd6fa30fda78ce26cfe8e741d60867248b0ead7a 25-Feb-2016 Oleksandr Peletskyi <peletskyi@google.com> Allow user to get his own icon.

Fixed behavior in order to let user without MANAGE_USERS permission
to obtain his own icon or any icon of the user's 'user group'.

BUG: 27583869
Change-Id: I71a86b0816db1d9c4543db375de504395a726a8d
serManagerService.java
41066a61b912f22dd0342a002b4b5e060719cec9 10-Mar-2016 Makoto Onuki <omakoto@google.com> Refactor ShortcutService

Move PackageShortcuts to the top level.

Change-Id: If19a7dd979f8697e54a45c3aa654bad235f6259d
hortcutService.java
495d124a67daa1f070ca0ca0be0c14377675200a 10-Mar-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManaegr: load config from settings, also..." into nyc-dev
f96eee36df0cc987bafd1f01ce69504191efb8b8 10-Mar-2016 Todd Kennedy <toddke@google.com> Merge "remove splits" into nyc-dev
eb9b05392ad047863244f9e07a3b10e9c0561e39 08-Mar-2016 Todd Kennedy <toddke@google.com> remove splits

Individual splits can now be removed for an application. The
application will be terminated if it's running when a split is
removed.

To remove a split, either use either "uninstall":
$ adb shell cmd package uninstall <PACKAGE> <SPLIT>

or "install-remove":
$ adb shell cmd package install-create -r -p <PACKAGE>
$ adb shell cmd package install-remove <SESSION> <SPLIT>
$ adb shell cmd package install-commit <SESSION>

For "install-remove" you must use '-r' and '-p' when creating
the session.

Bug: 27547051
Change-Id: I4d71a19ad45e39f6622d9ab6791ea8c4230a79e0
ackageInstallerSession.java
ackageManagerShellCommand.java
4362a66dba0b4cfa9fadb6c8af10c590e4ba880d 09-Mar-2016 Makoto Onuki <omakoto@google.com> ShortcutManaegr: load config from settings, also...

support "cmd override-config" and "cmd reset-config" to help CTS.

Bug 27548047

Change-Id: Id6c9e6f41a2238856dd3470d88d88d0e7e686f26
hortcutService.java
4a07c34ca86fddb75332eba22a4d7b9bd48205db 09-Mar-2016 Makoto Onuki <omakoto@google.com> Merge "ShortcutManager: add remaining APIs." into nyc-dev
d5a3f3df4097e4a57e0d31fba994c91d8996abf8 09-Mar-2016 Paul Lawrence <paullawrence@google.com> Merge "Add API to IMountService to get encryption state" into nyc-dev
5504622fb01ab9774b5e73d05f86ee03a8b68ab7 08-Mar-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: add remaining APIs.

- Icons are now persisted. (under /data/system_ce, as PNGs)
- the "load icon" APIs in LauncherApps are supported.
- Implement updateShortcuts()

- Addressed all the comments on the previous CL
- @hide the newly added constructor for PersistableBundle

- Enhance incoming shortcut validation
- A lot of internal clean-up.

Bug 27548047

Change-Id: I8e3c1ccd3e0a997a6d271c84d81170f0c022b60e
auncherAppsService.java
hortcutService.java
43204b8357d781f284037fb8b7b7050ed04a2103 09-Mar-2016 Makoto Onuki <omakoto@google.com> Implement LauncherApps.startShortcut().

Bug 27548047

Change-Id: I357732e22be0959fb573fd6cdaee7c6b439ef7c4
auncherAppsService.java
hortcutService.java
20be5d62471d520eed3a52d90c11944464a71c07 26-Feb-2016 Paul Lawrence <paullawrence@google.com> Add API to IMountService to get encryption state

Bug: 18002358
Change-Id: If7d9c9a5ed38ac37849fcf638ec10c76d2f419a1
ackageManagerService.java
ed58f5f0aa580dd4a6dc0fd5dc957862309db8d9 08-Mar-2016 Makoto Onuki <omakoto@google.com> Merge "Introducing ShortcutManager" into nyc-dev
cf0469520e1c49a48a1d04c79883e7405ed3a059 08-Mar-2016 David Brazdil <dbrazdil@google.com> Fix 'cmd package compile' help message

Change-Id: I6d4fc505b509569793c5e61410327b4c69487a43
ackageManagerShellCommand.java
ce389e53b158b6737d3fb4232bbac22fcb07b0e5 08-Mar-2016 David Brazdil <dbrazdil@google.com> Rename 'all' compile mode to 'full'

The name of the full-AoT compile mode is confusing. We should change it.

Change-Id: I9cba83e398fb4ae0efb1a25ff257ba79ab105386
ackageManagerShellCommand.java
9aa6db03f0a317b8414af760b8b1ee6331bedc46 08-Mar-2016 David Brazdil <dbrazdil@google.com> Add option to clear profile data to 'cmd package compile'

Adds an option which clears all profile data of a given package.

Bug: 27516490
Change-Id: Ie83ef1f06ca47d35ffb206c29341dc68166afeb3
nstaller.java
ackageManagerService.java
ackageManagerShellCommand.java
990fb6b5c91be62078a698ee1c01e24d33364c85 01-Mar-2016 David Brazdil <dbrazdil@google.com> Add option to compile all packages with 'cmd package compile'

To help investigate performance regressions, an option is added to
'adb shell cmd package compile' to compile all packages with the
given mode.

Bug: 27391290
Change-Id: I70a3a518e08b54535bb34f13f0cedda3a1f7085f
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerShellCommand.java
66c96591e2ddb464c67e60dbf4193ef4ec8a620b 24-Feb-2016 Philip P. Moltmann <moltmann@google.com> Add "app printer activity" and always keep the print service state
updated. Also fiddle with the UI to use more standard values.

To be sure the print service state alwasy updated I changed
PrintManager.getPrintServices to return a loader which just wraps a
registerListener/getList/removeListener combo.

I also added a new function to enabled/disable a print service to be
keep all updating logic inside the PrintManagerService->UserState.

Then I changed all code to use this new interface.

Detailed comments:

PrintServiceInfo:
- I had to add the enabled state to the PrintServiceInfo as some users
of PrintManager.getPrintServices want all services but then display
different data depending on the enabled state. Of course I could have
created two PrintManager.getPrintServices-loaders to load the two
separate list of services. I think it is much easier to add this
property though. It is updated every time new data is returned to the
PrintManager.getPrintServices-loader.

AddPrinterActivity:
- This is shown as a dialog-style overlay to indicate that the user will
return to the select-printers activity. It contains of three list that
are updated via separate loaders.
- The recommended services will be added later to keep this path set
small.

PrintActivity:
- There are two small places where we have to update the data when we
get a new list of print services.
- In very, very rare conditions it can happen that the print service
of the current printer gains or looses the "advancedOptions"
activity
- If we have no enabled print services we want to show "Add printer"
instead of "All printers...".
- Also the print registry is not the only loader anymore, hence we have
to assign loader ids to it to not conflict with the other loaders in
this activity.
- Small bug in onPrintersChanged: If a printer is selected and the print
service of this printer gets disabled the holder goes into "removed"
state which disables the printer. When the print service is then
enabled again, we forgot to re-enable the holder.

PrinterRegistry:
- The registry assumed that the FusedPrinterProvider was the only loader
in the activity. This is not true anymore, hence it has to assign the
appropriate loader ids.
- The FusedPrinterProvider has an internal loader, hence we have to
forward a loader Id into it.
- The PrintRegistry is only called backed for a single loader, hence no
need to check the loader-id.

SelectPrinterActivity:
- The AddPrinterDialog was removed as we now have the
AddPrinterActivity.
- Added a loader for the enabled services to update the empty state.
- Added dedicated loader Id for the PrinterRegistry again.
- If we have no enabled services, the SelectPrinterActivity chainloads
the AddPrinterActivity as this is the only thing the user can do
anyway. "Save a click". This should only happen when the activity is
create the first time.
- Moved the "add printer" from the menu item to the list of printers as
suggested by UX and Zach.

PrintManagerService, UserState and IPrintManagerParamtersTest:
- As the only place where the print service state is updated is now the
userstate, we have no more sychronization problems. Whohoo.
- The users can now register for changes to the print services similar
as they can register for changes to the print jobs.
- UserState.getPrintServices is the only function can exposes any
knowledge of the print services to the outside world.

Change-Id: I9be2c7300431e06aaff9bdf7eb36120d869b56ac
efaultPermissionGrantPolicy.java
fdc5ba8f43e09cfbc8f5de0bf819b7684094953e 05-Mar-2016 Jeff Sharkey <jsharkey@google.com> Merge "Move more PM calls to ParceledListSlice." into nyc-dev
d5896630f6a2f21da107031cab216dc93bdcd851 05-Mar-2016 Jeff Sharkey <jsharkey@android.com> Move more PM calls to ParceledListSlice.

Since the data returned by these calls can grow unbounded based on
various GET flags, we need to switch 'em over.

Bug: 27391893
Change-Id: Ie849ca30dbaaa91158da4c83675657715629a0ee
efaultPermissionGrantPolicy.java
ackageManagerService.java
ackageManagerServiceUtils.java
ackageManagerShellCommand.java
6f7362d92573e4ae693bc513dca586d6a4eb087b 04-Mar-2016 Makoto Onuki <omakoto@google.com> Introducing ShortcutManager

What's supported:
- Most APIs are implemented, except for SM.updateShortcuts(),
the icon APIs in LA, and LA.startShortcut().
- Persisting information, except for icons
- Throttling

In addition, now PersistableBundle has a public copy
constructor from a Bundle. (Do we want to @hide it?)

TODOs:
- Add icon support
- Implement missing APIs
- Listen to PACKAGE_* broadcasts and do clean-up
- Support multi-launcher apps (pinned shortcuts per launcher)
- Dev option to reset throttling
- Load throttling config from Settings
- Backup & restore
- Figure out LauncherApps permissions (BIND_APPWIDGETS??)
- Other minor TODOs in the code
- Better javadoc

Note: This requires Idf2f9ae816e1f3d822a6286a4cf738c14e29a45e

Bug 27325877

Change-Id: Ia5aa555a4759df5f79a859338f1dc5e624cd0e35
auncherAppsService.java
hortcutService.java
a561e3a3b782be3aa859b8c93f78205db1b429d7 04-Mar-2016 Jeff Sharkey <jsharkey@google.com> Merge "Log FBE related flags when dumping packages." into nyc-dev
e1fd7f09d5149055b8ad7bcf24846ecd8d87027a 04-Mar-2016 Suprabh Shukla <suprabh@google.com> Merge "Not clearing data for a package that is a DO or PO" into nyc-dev
effcd935940e4d3c2acb2a2a8bc22d5bf6f9cc64 04-Mar-2016 Jeff Sharkey <jsharkey@android.com> Log FBE related flags when dumping packages.

Bug: 27455726
Change-Id: I18146431792d5be0808ff6044174eff328039251
ettings.java
40a6e6a10e0b411fd7434d586f2323674b11b757 04-Mar-2016 Todd Kennedy <toddke@google.com> Merge "dump apk signing version" into nyc-dev
d04525214b9a999339cd553a22b95b52debecde5 02-Mar-2016 Suprabh Shukla <suprabh@google.com> Not clearing data for a package that is a DO or PO

Added a check inside PackageManagerService to make sure data for a
package with a DO or PO for the running user is not cleared. Currently,
the 'pm clear' command goes through without any such checks.

Bug: b/27243904
Change-Id: I87d4ad2db031f47946f34627a5ee465ef144f85e
ackageManagerService.java
66c5553c2e418724ea20b2234a8590e889f0ffe4 27-Feb-2016 Todd Kennedy <toddke@google.com> dump apk signing version

bug: 26905579
Change-Id: I5c2682904f2fb83ffce572fe2eb35c38e1b72f01
ettings.java
0fe4945006fe6c4f5c518dde57728af1c99cb0b3 04-Mar-2016 Andreas Gampe <agampe@google.com> Merge "Frameworks/base: OtaDexopt needs to move artifacts on boot" into nyc-dev
e8498cd0066113068f2b0294144837546f213bd1 03-Mar-2016 Todd Kennedy <toddke@google.com> Merge "Splits without restart" into nyc-dev
abcbe2f62e6278d8aeb0b8c302d23aeae59899d4 26-Feb-2016 Andreas Gampe <agampe@google.com> Frameworks/base: OtaDexopt needs to move artifacts on boot

Make OtaDexoptService a bootstrap service. It needs to start
immediately after the PackageManagerService so that it can move
A/B artifacts into their new place.

Add a method to Installer for the move.

Bug: 25612095
Change-Id: Idcf759b3c947088b416d54d2fa269ef27daf93ab
nstaller.java
taDexoptService.java
ackageManagerService.java
0c9ef61944e883219dd167f765a504ab8cdb7710 03-Mar-2016 Calin Juravle <calin@google.com> Merge "Better handling of various types of compilation in DexOptimizer" into nyc-dev
925cc2a066889bb8b02493fafd5344bf8b2e9136 03-Mar-2016 Jeff Sharkey <jsharkey@android.com> More protected broadcasts!

Bug: 26144973
Change-Id: I56f047d7e4b9d7bcf1ac40c98ee381badd909057
ackageManagerService.java
693f997cc8b8c2ba8d3ed29627b2641dd86392a5 25-Feb-2016 Calin Juravle <calin@google.com> Better handling of various types of compilation in DexOptimizer

From the runtime perspective extract-only/profile-guide-compiled/fully-
compiled oat files are up-to-date and don't need dex2oat. However,
wihout knowing the exact "class" of the aot file we are not able to do a
full compilation of something previously only-extracted, or limit
profile-guide compilation to only previously profile-guide or extract-
only oat files.

GetDexOptNeeded now accepts a mask of desired types of compilation
that the runtime takes into account when advising what's needed.

This CL adds the necessary handling in DexOptimizer.

Also:
- removes the contraint to use extract-only oat files only when
profiles are enabled.
- removes mDexOptPerformed which interfere with the different types of
compilation and only saved a call to GetDexOptNeeded.

Bug: 27189430
Change-Id: Iced2bdcc3aa7866ff888a3bace43f4b71fffb353
taDexoptService.java
ackageDexOptimizer.java
ackageManagerService.java
39bfee5e3674faea992c32204abc1c03429b8cda 24-Feb-2016 Todd Kennedy <toddke@google.com> Splits without restart

In specific cases [as determined by the installer], we can install
splits without restarting the application. The split must be purely
additive [i.e. it should not modify class(es)/resource(s) defined
in the base or other splits. Otherwise, the behaviour could be
inconsistent [e.g. if a modified class was already loaded, the
modified version won't be loaded until the process is restarted].
The platform does not perform any verification that the split is
purely additive.

Bug: 26463098
Change-Id: I3526c3b1b847a8e0afabc7a4787fa770422196b7
ackageManagerService.java
ackageSettingBase.java
f7d47f91feeffb75761b339cb14c631cc18d3728 02-Mar-2016 Jeff Sharkey <jsharkey@android.com> Start unaware persistent apps after user unlocked.

Otherwise we'll never start them. In particular, this fixes NFC.

Bug: 27360562
Change-Id: I9d430b1e377e63b35060b234f585ac180a369ad2
ackageManagerService.java
8b609f3a96f9576c258ffd38cea2853cd2129ebf 02-Mar-2016 Jeff Sharkey <jsharkey@google.com> Merge "Make preferred activities encryption aware." into nyc-dev
258be56dcddd414e101dc3eb2853b0abd7cf1423 01-Mar-2016 Jeff Sharkey <jsharkey@android.com> Make preferred activities encryption aware.

Not all built-in apps are encryption aware, so match them all when
setting up preferred activities.

Bug: 27429841
Change-Id: I0fd2195714fac95d031813bab73125a5c7b6c81a
ettings.java
4f858aaa5a7ef493e79e6d35a8d526f5d8de97e9 01-Mar-2016 Todd Kennedy <toddke@google.com> Merge "Revert "Revert "Remove deprecated methods / classes""" into nyc-dev
e1ac71fe9924add9368d118932e6c2bf0dfb2d70 01-Mar-2016 Calin Juravle <calin@google.com> Merge "Restrict the cases when we profile guided compile an apk" into nyc-dev
c453905afc9c4c320ac599b748d89fbb85c3e079 01-Mar-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Fixed handling of blockUninstall setting" into nyc-dev
5fea67e88e9c5a98a047546af87ecfce01d48298 01-Mar-2016 Amith Yamasani <yamasani@google.com> Merge "Heed user shell restriction for pm calls" into nyc-dev
a67932374dbbfbe4c6440d223fc7922b313dd957 24-Feb-2016 Todd Kennedy <toddke@google.com> Revert "Revert "Remove deprecated methods / classes""

This reverts commit 5cbeb5902633646fbc0a1be252081e77aaaee7b4.

Change-Id: Id96010364d65e6131221ebbcc8ce5889a2da256c
ackageManagerService.java
c4967e71614c46a860564d60dda34bf8b928bd3e 19-Feb-2016 Fyodor Kupolov <fkupolov@google.com> Fixed handling of blockUninstall setting

Previously, if one user has blockUninstall, it will block uninstalling
the package for all users. Now the package is uninstalled for all users,
excluding the ones that have blockUninstall setting.

Bug: 24616123
Change-Id: Ie4a68ef97fbef4711b18ccd311e39f32ab4b8efe
ackageManagerService.java
5ebdefd0dbfb1861858b33efd729e6114e67d888 01-Mar-2016 Amith Yamasani <yamasani@google.com> Heed user shell restriction for pm calls

Make sure that a restricted user cannot use adb shell commands
to grant/revoke runtime permissions.

Bug: 27418014
Change-Id: I518b09f56ca7d77cc2bfa1d0b4faaf129e19000d
ackageManagerService.java
80d78dc92bed0873d03e357e025f994af1217577 01-Mar-2016 Svetoslav Ganov <svetoslavganov@google.com> Proper grant default permissions to default SMS and Phone

We grant default permissions to the default SMS and
Phone apps when they are selected as such to ensure
they can do their job. We don't grant default permissions
to apps if the version on the system image does not
declare them. This is correct for default grants on
first boot or a new user creation. This is a problem
for default Phone and SMS as we want to grant them
the permission as a result of a deliberate user action
and therefore should not care if the version on the
system image declares the permission.

As a result if an SMS app that ships as a stub to reduce
image size is later updated to the full version and
made the default SMS it would not get the default grants
while an installed third-party app that did not ship
on the system image would get the grants.

This change ensures the default SMS and Phone get
their default grants regardless whether the verion on
the system image declares the permissions.

bug:25288760

Change-Id: I2fecf5cbce4ebabb145a3f29abb555bcb65d54d6
efaultPermissionGrantPolicy.java
6ac25c5641f7ce1ccb5387e69210d0d3d21b515d 29-Feb-2016 Svet Ganov <svetoslavganov@google.com> Fix uninstalling apps with damaged/gone APK files

bug:27394497

Change-Id: I0d0317f2d7168be4412a24d34a9f23f04c6d8601
phemeralApplicationRegistry.java
ackageManagerService.java
ca6abfd9d6c815053a89cf5c2bac11375b7de487 29-Feb-2016 Jeff Sharkey <jsharkey@android.com> Delay migration until after user is prepared.

We don't have a vold connection early in the PackageManagerService
constructor, so we can only migrate the system user at boot. We now
migrate other users only after they're explicitly unlocked by
UserManagerService.

Bug: 27330415
Change-Id: I29f21714acf65a598b8df496af0f7d2cb1d247c4
ackageManagerService.java
b15a71913eaea4d2e7063437b3d1a8db5d98c221 28-Feb-2016 Jeff Sharkey <jsharkey@android.com> Avoid NPE when deleting package during boot.

Bug: 27314561
Change-Id: I7cf854a9db6224ad927ca8c9b4c2641b2841fe7e
ackageManagerService.java
800efcc7f533ddce66c0c7b34c837d3323512d2a 26-Feb-2016 Jeff Sharkey <jsharkey@android.com> configfs is special; don't delete dir contents.

Bug: 27342722
Change-Id: I63e8316a6a6260869b4fdd94fde59b5ec3d7b30a
ettings.java
e6ddf45e6b78c83a60a050f3999eab86f712a403 25-Feb-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Call prepareAppDataAfterInstall without mPackages lock" into nyc-dev
3fb5b5d29c1cdb2ec094da6eff37ee6298470bbd 25-Feb-2016 Fyodor Kupolov <fkupolov@google.com> Call prepareAppDataAfterInstall without mPackages lock

prepareAppDataAfterInstallInternal may call into ActivityManager which will
try to obtain a lock in a reversed order, which causes a deadlock.

Bug: 27336728
Change-Id: I91bb74cd06c6aa6cee057bab5972b0275d12125b
ackageManagerService.java
d479b52d12fc782f18df6b5ae15c19e022f0ec14 24-Feb-2016 Calin Juravle <calin@google.com> Restrict the cases when we profile guided compile an apk

Do not use profile guided compilation if the apk is loaded by another
app. The decision if an apk was used or not by another app is done
by looking into the foreign profile directory. Apks which where
loaded in others apps will have a file marker in the profile directory.
The marker is named after the canonical location of the apk file where
'/' is replaced by '@'.

Also, refactor the profile paths to the Environment.

Bug: 27334750
Bug: 26080105
Change-Id: Ic2ac5a7a231670ecb4462166c34fdd5b4c631178
ackageDexOptimizer.java
86ea8f002c921921ae2e3f205e0e7d48c1e375a7 23-Feb-2016 Andrei Stingaceanu <stg@google.com> Suspend packages - decline suspending privileged apps

Because there is a high risk of making the system instable.

Bug: 22776761
Bug: 26949256
Bug: 26949428
Bug: 26683041
Change-Id: I73b3f05c13b5023db5176e709320ca6e2e5f6354
ackageManagerService.java
c008d3f196da804eada77e00119addf2a08544de 25-Feb-2016 Alex Klyubin <klyubin@google.com> Merge "Disallow downgrading of non-debuggable packages." into nyc-dev
84a698934b3ccb5d41584ae712e268f51a7fe713 25-Feb-2016 Maria Garcia Puyol <mariagpuyol@google.com> Merge "Grant permissions for EmergencyInfo app" into nyc-dev
fe01ea05dd196acaf95a61e169f6b75654ae0875 24-Feb-2016 Todd Kennedy <toddke@google.com> Merge "Revert "Remove deprecated methods / classes"" into nyc-dev
5cbeb5902633646fbc0a1be252081e77aaaee7b4 24-Feb-2016 Todd Kennedy <toddke@google.com> Revert "Remove deprecated methods / classes"

This reverts commit 9706c01f9b92cee64bb84782138735225c8588e0.

Change-Id: I14c53ab140220e48f6728b1173ea58760bbeb7f9
ackageManagerService.java
921dd754ab49df0cd580ff96503f7616c4c85f4a 24-Feb-2016 Alex Klyubin <klyubin@google.com> Disallow downgrading of non-debuggable packages.

An attacker could downgrade a package to an older version with known
security vulnerabilities and then use some of the vulnerabilities to
access the application's data. This would constitute a bypass of
Android Application Sandbox. Thus, downgrading while keeping
application data is no longer permitted.

To help developers debug their apps, packages marked as debuggable can
still be downgraded while keeping their data. This does not put the
installed base at risk because, as a security measure, most
application stores reject packages marked as debuggable.

To downgrade a non-debuggable (i.e., release) package, uninstall the
package (thus wiping its data), then install the older version of the
package.

Bug: 27327503
Change-Id: Iac75ed3c3831b5d925dfd8b660527cfa95813da8
ackageManagerService.java
fe939916a6d9bd092b782e6fd21856b574467d88 24-Feb-2016 Tony Mak <tonymak@google.com> Merge "Fix personal apps are not shown when tapping "personal" in activity chooser" into nyc-dev
ca67844e0c6b564970b8d329009c0d110888a3fc 24-Feb-2016 Todd Kennedy <toddke@google.com> Merge "Remove deprecated methods / classes" into nyc-dev
53ec2b6127255c9cd556be55265b4ec53aeb65bc 24-Feb-2016 Tony Mak <tonymak@google.com> Fix personal apps are not shown when tapping "personal" in activity chooser

It is introduced in ag/842541.
function isMatch return flage when Flag that are neither
MATCH_ENCRYPTION_AWARE and MATCH_ENCRYPTION_UNAWARE.

We should call updateFlagsForResolve before resolving any intent in order
to make sure the flag is set properly.

Bug: 26614039
Change-Id: I4da34a34cb515557d0f5948a4c9ec4da9bfeb3f4
ackageManagerService.java
1ddda4793c26fd249590fd3549cf060ecb7c157b 12-Feb-2016 Lenka Trochtova <ltrochtova@google.com> Prevent ephemeral user from being re-entered after stop.

Once the ephemeral user stops, the user's deletion is scheduled.
It takes a while before the user actually disappears and it is not
desirable for the user to be re-entered in the meantime.
Mark the user as disabled on stop and check this flag
in the activity manager to prevent the user from being switched
to again. Also hide the user from user-switching UI.

BUG: 26795729
BUG: 26780152

Change-Id: I83a61674958954b5a210114b88ffa5ae55922c1f
serManagerService.java
2d2908020f9b773e5ae0654fff4f6461d5742e19 24-Feb-2016 mariagpuyol <mariagpuyol@google.com> Grant permissions for EmergencyInfo app

Bug:27142320
Change-Id: Ib2d824db40d052630e2d4a4a128e832e0546b91b
efaultPermissionGrantPolicy.java
65698a963822590180af3cd82a4e869f6aa94730 23-Feb-2016 Nicolas Geoffray <ngeoffray@google.com> Merge "Revive the "Optimizing apps" dialog" into nyc-dev
d6fd63d47f97d069821c1c761e36c7904a22b3fb 12-Feb-2016 David Brazdil <dbrazdil@google.com> Revive the "Optimizing apps" dialog

Since we do spend some non-trivial time extracting APKs at OTA, we
should show a descriptive dialog. Currently the screen would read
"Optimizing storage" which is misleading.

bug:26813999

Change-Id: I4954e3b486840b5d806db8b45242fdc8ca9d0379
ackageManagerService.java
5cd52bee32250e14f5eca14d9e82535a0f2f4f87 23-Feb-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Expose removed permissions flag as system API" into nyc-dev
2a1376d9dfb362a18ba110d8e172f96021f1d879 23-Feb-2016 Svet Ganov <svetoslavganov@google.com> Expose removed permissions flag as system API

There are some permissions that were removed from the platform
and guard nothing but legacy apps may be checking them before
calling APIs. Hence, these apps should get the permissions as
expected despite them being a no-op. To address this the platform
declares removed permissions as normal permissions that are hidden
such that legacy apps can always get them. These permissions are
not shown in the UI. Play needs a way to filter out these
permissions like the platform as they have permissions UI too.

bug:23361760

Change-Id: I10f442dfc09a299ddc5480d8bf2db0bd786aec62
ettings.java
9cea80cdddbecadb304eb7c8373cf1ed397f433a 16-Feb-2016 Svet Ganov <svetoslavganov@google.com> No overlay when permissions shown - framework

bug:26973205

Change-Id: I88395e47649191bb7db6dd8723c49e741ef4f1e4
serManagerService.java
024f979dfdae1938afc3c509ea9762c06784cef5 17-Feb-2016 Lenka Trochtova <ltrochtova@google.com> Allow ephemeral users on the split-system-user systems only.

BUG: 27143201

Change-Id: I37f3ca7366648dbf07df39a7a972857e0ff78a9a
serManagerService.java
4ab36372fb7f2f8236d9fa308ec508582fc52607 19-Feb-2016 Makoto Onuki <omakoto@google.com> Merge "Clean up on UserManagerService and DPMS" into nyc-dev
2a3c3da0fc07ef37abc45cfb0166bdf5f7f202b6 18-Feb-2016 Makoto Onuki <omakoto@google.com> Clean up on UserManagerService and DPMS

- Avoid the ART warning about 4.1 compatibility
- Avoid integer overflow in DPMS

Bug 27243525
Bug 27242859

Change-Id: I92af323287e348fbd0eff31e6cf9823be8e41024
serManagerService.java
5eb148bab6ea49c4c646649692ae6769b9c4e54c 19-Feb-2016 Yohei Yukawa <yukawa@google.com> Merge "Stop granting default Contacts permission to IMEs." into nyc-dev
2271ba3627d18b65ed5ea63218cee7f9562acd31 02-Feb-2016 Jeff Sharkey <jsharkey@android.com> Push mapping of package name to appId to kernel.

The new sdcardfs kernel driver needs to know this mapping for
deriving UID permissions, so push the data through /config when
supported by the kernel. This also has the nice benefit of letting
us push only the deltas of what actually changes, instead of
re-parsing the entire "packages.list" file.

The mappings for newly installed apps are pushed before the app is
allowed to run, removing some latent race conditions. Also cleans
up stale mappings when packages are uninstalled, and whenever the
system server reboots.

Bug: 19160983
Change-Id: Iace92efb69616c96b34c0d9d911e4b54e5fd8a67
ackageManagerService.java
ettings.java
726c45970e35e3fff3eeb4d86c3b772db73adcc7 18-Feb-2016 Yohei Yukawa <yukawa@google.com> Stop granting default Contacts permission to IMEs.

This partially reverts the previous commit [1], which allowed special
components to be granted some pre-configured default permissions.

With this CL, we no longer grant Contacts permissions to pre-installed
IMEs. Rationals are:

1. Even without this CL, not the all pre-installed IMEs are granted
Contacts permission by default, because it was done during the boot
time where InputMethodManagerService is not yet completely
initialized. The current behavior is confusing not only for users
but also for developers.
2. In almost all the cases, IMEs are supposed to be able to work
without Contacts permission. Hence it is not too late to ask users
to grant the permission to the IME after the initial setup is
completed.
3. It is difficult to add new features such as File-Based Encryption
(FBE) with keeping the current implementation, because currently we
dynamically call mSettings.setCurrentUserId(userId) just to
enumerate what IMEs will be enabled for a given user. Adding
another condition (whether the user has already unlocked the device
or not) would make things more complicated.

Note that LatinIME has already support the case where Contacts
permission is not granted by default. It does not ask users for
anything until Setup-Wizard is completed, and requests Contacts
permission only when the user taps a message in the suggestion strip
that suggests users to use contacts name for typing suggestions.

[1] If8b8cadbd1980ffe7a6fc15bbb5f54a425f6e8f9
adc1cf46045ae756d3a9ccbccf6b0f894e4c1edd

Bug: 24756974
Bug: 26743676
Change-Id: Ief2a40b5971b3eb97d765f934d20ce7f2ef25665
efaultPermissionGrantPolicy.java
ackageManagerService.java
18026642213698fc095a9510c2431862d3a7f310 18-Feb-2016 Jeff Sharkey <jsharkey@android.com> Sigh, safe mode.

There are still system internals making assumptions about component
details always being available when requested directly, so relax this
even further to only filter resolve results.

Bug: 27165374
Change-Id: I216fd362516064741e9b80636b99e2d0477d4a58
ackageManagerService.java
fc482c30b7a3c2cf7bc14d5c86de758a16f6433d 17-Feb-2016 Makoto Onuki <omakoto@google.com> Merge "[framework] Don't allow apps on external storage to be active admin" into nyc-dev
f34db0a17ee035c165a4e81e9192f73d2455bd1c 17-Feb-2016 Makoto Onuki <omakoto@google.com> [framework] Don't allow apps on external storage to be active admin

Bug 27149287

Change-Id: I6d959d2e66dc0b19f78e6135fbdcf45ca8551958
ackageManagerService.java
05bdf88bdfed76f01a1db8eb73b57a43d939f512 17-Feb-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Remove isPackageInstalled" into nyc-dev
369aad0e23a1ca1417018c540730915760fe2ed3 17-Feb-2016 Winson <winsonc@google.com> Don't exclude app info from recents.

Bug: 27216373
Change-Id: Idc419f8922664c618ac6ddc8287b57c89084a2a3
auncherAppsService.java
eb84b1843a3f6805c6109c1d9d023550229a3fc5 26-Jan-2016 Andrei Stingaceanu <stg@google.com> Suspend packages - one call for multiple packages

Refactor setPackageSuspended into setPackagesSuspended. The rationale
is that the consumers of this API are likely to want to remove
multiple packages at once. Rather than calling the API N times, call
it just once.

The good part is that we already have the broadcast intent for
suspended packages take an array so only one broadcast. Less stress
on the system.

Another good part is that (right now) we only have one consumer of
this API and it will be easy to make changes once this CL goes in.

As a shell command, for consistency only allowed one package at
a time.

Bug: 22776761
Change-Id: Ic8b8cf64d0a288ea3a282bb7b72f9d663b3b0049
ackageManagerService.java
ackageManagerShellCommand.java
9496df19ae7552370ec37cfb62cce3d919b0b116 12-Feb-2016 Andrei Stingaceanu <stg@google.com> Suspend packages - decline suspending the active launcher

Bug: 26953019
Bug: 26683041
Bug: 22776761
Change-Id: I7b65abff03aa32f5db8dce68364467a588facdac
ackageManagerService.java
5ae4e73ef0747c2d08a901f1a76d8fb8ee64a53a 17-Feb-2016 Andrei Stingaceanu <stg@google.com> Merge "Suspend packages - new API for retrieving the suspended status" into nyc-dev
9706c01f9b92cee64bb84782138735225c8588e0 13-Feb-2016 Todd Kennedy <toddke@google.com> Remove deprecated methods / classes

Now that we've moved the majority of system components to the
PackageInstaller, we can remove the majority of the "installPackage"
methods and the VerificationParams/ContainerEncryptionParams
classes. There are still some lingering references to the two
installPackage() methods left [both internal and external; play
is using these methods via reflection].

Bug: 24542768
Change-Id: Ib65323d842d9f0e7fed60e37e6b5f103c94c859b
ackageManagerService.java
415dd94ae5c71aaef62b66463724544b44b1f41f 11-Feb-2016 Svetoslav Ganov <svetoslavganov@google.com> Fail fast when trying to delete a non-existing pacakge.

bug:26921392

Change-Id: I518cc43f3b1b28bd239093feead46107c62eb419
ackageManagerService.java
37fc7a7fc0aefc44162fa38d49d3079ced899f26 16-Feb-2016 Jeff Sharkey <jsharkey@android.com> More protected broadcasts.

These actions are owned by the system and should not be sent by
third-party apps for security reasons.

Bug: 27171917, 27169730, 27172357, 27163393
Change-Id: I3161cd3c1c37d26a92723b22878dc5aef6f30c47
ackageManagerService.java
355b232d7998cfc9b29d42a0356390e25191bcbd 12-Feb-2016 Andrei Stingaceanu <stg@google.com> Suspend packages - new API for retrieving the suspended status

Instead of always rebuilding the full ApplicationInfo for a
package when callers are only interested in the suspended status
add a new fast API in Packagemanager (which only checks the
suspended user setting for the requested package and returns
a boolean) and change the appropriate caller code too.

Bug: 26794775
Bug: 22776761
Change-Id: Ide8428ef734479360d5a8a75fd8e0ed8ddf2da7a
ackageManagerService.java
ackageManagerShellCommand.java
115d2c189a46f535778d9dd0923f703ff2f888fe 16-Feb-2016 Jeff Sharkey <jsharkey@android.com> Add feature versions for devices and apps.

We're starting to see more instances of device features that will
increment separately from the SDK API level, such as camera HAL,
GPU capabilities, Bluetooth, and other hardware standards.

This change adds the ability for device features to specify a
version, which is defined to be backwards compatible. That is, apps
requesting an older version of a feature must continue working on
devices with a newer version of that same feature.

When a version is undefined, we assume the default version "0".

Bug: 27162500
Change-Id: If890bf3f3dbb715e8feb80e7059a0d65618482ea
efaultPermissionGrantPolicy.java
ackageManagerService.java
ackageManagerShellCommand.java
c6ca265902d41a0553d15f660647410db6a3e889 15-Feb-2016 Jeff Sharkey <jsharkey@android.com> Filter components, prevent app start in safe mode.

When device is in safe mode, we're trying to keep third-party code
from running to give us a stable platform. The ideal approach would
be to treat these apps as temporarily "uninstalled" when in safe mode,
but not all system internals are ready for this.

Instead, go back to previous behavior where we simply filtered
non-system components. This isn't perfect, since there are still
cracks through which components can leak out (GET_ACTIVITIES, etc).

So as a last-ditch sanity effort, refuse to fork any third-party apps
while running in safe mode.

Bug: 27165374
Change-Id: I044ede02e923c499159faf59b12e79b97fe77fba
ackageManagerService.java
f4ff39c92be840d5f53c42cb02cef6b03a1ca70f 04-Feb-2016 Svet Ganov <svetoslavganov@google.com> Multi packages per APK - broadcasts

This change introduces the ability to have multiple packages per
APK. The feature is currently restricted to privileged apps and
updates to such apps.

In essence the manifest can have multiple child package declarations.
A child package can declare everything an Android package can except
some tags or attributes that are not applicable and instead inherited
from the parent when needed. For example, the target SDK of the parent
applies to all children.

A child package can be updated only through the parent package.
A package with multiple child packages is installed, uninstalled
atomically - no partial installs where some child packages are not
installed.

This change ensures that we send package broadcasts for child packages
when they are updated, removed, disabled, replaced, etc.

Sample app:ag/848432

Change-Id: I25b29c98152dcad9ede4d4eb040cc897b7f93426
ackageManagerService.java
ettings.java
b1b302660cf5b1b1c5b342cc90eca93b8f66890c 09-Feb-2016 Kenny Guy <kennyguy@google.com> Support FBE for managed profiles.

Allow launcher to see and attempt to launch non-crypto
aware application when profile is locked.
Hide unlock notification until parent user is unlocked.
Have unlock notitication use confirm credentials to unlock
the profile.
Updated notification strings as per suggestions in mocks
to make it clearer between users and profiles.

Bug: 27038260

Change-Id: If2d2c8148670d814544f4edd44193d15da32a289
auncherAppsService.java
d284612d8f12be8f6ab8fb275e71bbfa6c422b9a 12-Feb-2016 Fyodor Kupolov <fkupolov@google.com> Remove isPackageInstalled

It's not required to check whether package is installed before sending a
broadcast.

Change-Id: I132e49087faad28b637f98cf79d7ec56dcb26ecd
serManagerService.java
50b5616dcc7ba8a235f3e2f4c7507372a41224ba 12-Feb-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Clear calling identity before setting restrictions" into nyc-dev
aa72470acb85d903471aac4da0c443b77b0eb55b 12-Feb-2016 Fyodor Kupolov <fkupolov@google.com> Merge "During update enable system apps for requested users only" into nyc-dev
09f856805902078931aa5de006bc5e2c5403dfa6 11-Feb-2016 Philipp Weiß <phweiss@google.com> Merge "DPM.createAndManageUser should work even with DISALLOW_ADD_USER set" into nyc-dev
b62d690e7e931a07a9503ccbd7cc107b1af3fc64 11-Feb-2016 David Brazdil <dbrazdil@google.com> Address minor comments after go/ag/858723

Change-Id: I549bd3290ae47d46b2ef10553466db2c29296ee9
ackageManagerServiceUtils.java
e9c440638e27a123a82feb5e4677ce1242785288 10-Feb-2016 phweiss <phweiss@google.com> DPM.createAndManageUser should work even with DISALLOW_ADD_USER set

For this, the DPM calls a new function
UserManagerInternal.createUserEvenWhenDisallowed() instead of
UserManager.createUser(). This calls
UserManagerService.createUserInternalUnchecked().

Also, only the system user is allowed to call this method, otherwise
a security exception is thrown.

Bug: 26952210
Bug: 26786199
Change-Id: I69c16354898d68592d13f5f53b840551f7ad4779
serManagerService.java
6b4736d604fd91aaedc6f3fe9be5a1e757aab86c 04-Feb-2016 David Brazdil <dbrazdil@google.com> Apply 'used in last 7 days' filter to OTA package extraction

Bug: 26813999

Change-Id: I5f1eddb1d5e9f0bbaab62d86e6ccf3cc097c4edb
(cherry picked from commit e292175fbd495a63b48560439d2a84b239f91e18)
taDexoptService.java
ackageManagerService.java
ackageManagerServiceUtils.java
406e9d44fd7c401c9352a9b40e3e0c0f428847fe 10-Feb-2016 Jeff Sharkey <jsharkey@google.com> Merge "Consistent naming for internal storage APIs." into nyc-dev
8212ae0aee1700b9c287ebadf15af8dacdc8eae6 10-Feb-2016 Jeff Sharkey <jsharkey@android.com> Consistent naming for internal storage APIs.

Also completely remove a few confusingly named deprecated APIs.

Change-Id: Ia7e4ea3190a97f0a7dfa9bebf2118da0866ec38f
ackageInstallerService.java
ackageManagerService.java
ad5619d44701ef488e8d4bd41cb7a98f362097c7 10-Feb-2016 Makoto Onuki <omakoto@google.com> Use Slog.e() instead of Slog.wtf() for unknown restrictions

Slog.wtf() normally indicates a bug in the system, but in this case
it's a caller side issue, so e() is more suitable.

Bug 26918715

Change-Id: I94980cb9dafd34e6c5672bf833fec921df14e6a1
serRestrictionsUtils.java
e0feadcaac89739a4ae66055f75ee048d004b66f 10-Feb-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Add an API to query the package name of the services shared lib" into nyc-dev
d7b1f41109abee60ec8529369a85d84300b1d678 10-Feb-2016 Svet Ganov <svetoslavganov@google.com> Add an API to query the package name of the services shared lib

The servcies shared lib contains components apps can invoke such
as services to bind to, activities to start, UI choosers, etc.
This lib is built from AOSP code but an OEM may chage its
package name. For example, Google renames the package names for
GMS apps from android.foo.bar to com.google.android.foo.bar.
While we have more than one shared lib that are a part of the
platform (currently shared and services libs) the serivces lib
is the only one clients need to start components in, thus need
to know its package name. This change adds an API to query the
package name of the services shared lib. The API is hidden as
currently the only clients are a part of the system.

Change-Id: Ied48fa4819024522791764b22b3336d4f4b42cc3
ackageManagerService.java
9e912ba0fb3dd7fc1b01f4bef37eb5189ef273fe 10-Feb-2016 Fyodor Kupolov <fkupolov@google.com> Clear calling identity before setting restrictions

Previously Settings.Secure.putIntForUser was failing with AppOps package
mismatch exception when createRestrictedProfile method was called from
a shell process.

Bug: 24212155
Change-Id: I47ecfa572b110d627e5b049aa98ed4d10b2e1374
serManagerService.java
4b72aab7fb063f99406577d4ac0beaeac174982a 10-Feb-2016 Fyodor Kupolov <fkupolov@google.com> During update enable system apps for requested users only

When a system package is updated, we now enable the package only for
requested users, i.e. userId or all users (if userId=USER_ALL).

Bug: 19063113
Change-Id: I7bd6166b16f4f8da593b4e7e4d9f5189cd02b45b
ackageManagerService.java
e476bf6aeb58ccdf1ae4e44c2e9319b52fe22001 09-Feb-2016 Svetoslav Ganov <svetoslavganov@google.com> Delete only the target user

bug:27094971

Change-Id: I5b43d59ff6edeefc0e05a6ec90d04d388e707c29
ackageManagerService.java
2d291d89f957495917071282ac0afce9b65c5e26 06-Feb-2016 Selim Gurun <sgurun@google.com> Introduce a use32bitAbi flag

Bug: 26874366

On Multiarch apps, it might be necessary to prioritize 32bit Abi ahead
of 64bit ones. The use32bitAbi flag enables this.

This CL also reverts the public api changes in I2c1fd1d036efe72b28b5fe996416df69a583959f and Ie3ecea6d84e2cb1522e736a21c3a3a24ac62eb27. Previously
the same functionality was provided using a raw abi string that
utilized cpuabioverride flag.

Change-Id: Idce3cbfedd11ef9079ce8a2901e69d30b1cf9ef4
ackageManagerService.java
f854174ee6bff124a2238d802137a376c8f328ca 09-Feb-2016 Steven Ng <stevenckng@google.com> Merge "Whitelist camera permission for SetupWizard" into nyc-dev
354cd3ce2213a1032d9138ea6fa1420f055ab08c 17-Dec-2015 Svet Ganov <svetoslavganov@google.com> Multi packages per APK

This change introduces the ability to have multiple packages per
APK. The feature is currently restricted to privileged apps and
updates to such apps.

In essence the manifest can have multiple child package declarations.
A child package can declare everything an Android package can except
some tags or attributes that are not applicable and instead inherited
from the parent when needed. For example, the target SDK of the parent
applies to all children.

A child package can be updated only through the parent package.
A package with multiple child packages is installed, uninstalled
atomically - no partial installs where some child packages are not
installed.

The remaining work is to ensure broadcasts are also sent for child
packages. This will come in a subsequent change.

Sample app:ag/848432

Design doc: https://docs.google.com/document/d/18nFWtJuZchLxrHf5SBbJW03-Ky9Rh_G0-OVB14b6u78

Change-Id: I6fd021d981bf5786290e0c53502724a14c97358c
ackageManagerService.java
ackageSetting.java
ackageSettingBase.java
ackageSignatures.java
endingPackage.java
ettings.java
76bcfb2e6688f1726f12c1ed3043665fc4409144 03-Feb-2016 Steven Ng <stevenckng@google.com> Whitelist camera permission for SetupWizard

+ Camera permission is required for QR provisioning in SetupWizard.

Bug: 26932941
Change-Id: I1573cdd3b8ac708f457a9c7efbbf02c3c8ce6d8d
(cherry picked from commit 950b2dee6648a90bd2e9fedecde137f41f7c4513)
efaultPermissionGrantPolicy.java
e84bdd38addecc80878d811ab279646acfe6ab19 08-Feb-2016 Jeff Sharkey <jsharkey@android.com> Move graphics and JIT caches to DE storage.

We confirmed with the graphics and JIT teams that no sensitive
user data is written to these caches, so they're safe to point at DE
storage.

Since we don't have control over what is written by the app, we need
to keep the cache environment variable pointing at CE storage.

Fix ensurePrivateDirExists() to always return a path, instead of
returning null which can cause scary bugs.

Change packages.list to no longer canonicalize data paths, since
these fail when CE storage is still locked.

Bug: 27069522
Change-Id: Ifff64a036fa4aa1e61aa0dd98486bc711fbf8f4a
ettings.java
e4697136ed8d3e2486738b5798b22f2226b7de75 07-Feb-2016 Jeff Sharkey <jsharkey@android.com> Migrate default app data on non-FBE devices.

When a system app requests "forceDeviceEncrypted" they expect their
default app storage to point at a consistent location regardless of
device FBE support. So when booting upgraded non-FBE devices, we
may need to migrate any data from CE to DE. Note that on non-FBE
devices these are just semantic locations with identical protection.

This migration *only* works for non-FBE devices; changing
forceDeviceEncrypted flags on an FBE device always requires a full
data wipe.

Bug: 26668510
Change-Id: Ic5dfeaaf2db26c385901a638ca8ec35eb3c52859
nstaller.java
ackageManagerService.java
e5a20ce3973974b797df27d76b0092df30b6e938 05-Feb-2016 Jeff Sharkey <jsharkey@google.com> Merge "Prepare user storage just before using it."
47f7108c1270a9e81d9560b6b0570c659bb93a71 02-Feb-2016 Jeff Sharkey <jsharkey@android.com> Prepare user storage just before using it.

Wire up preparing of user-specific app storage to existing user
lifecycle hooks. This way we're sure the storage is ready to roll
just before we start reconciling app data directories.

This also has the nice property that we only prepare storage when
we know that keys are unlocked.

Bug: 25796509
Change-Id: Ic7df9ddbcfb1e20649d11b6cf68d424e3c365ee1
nstaller.java
ackageManagerService.java
ettings.java
serManagerService.java
0cf8cc66ecca83c7e24d3e55268283de71272f50 03-Feb-2016 Calin Juravle <calin@google.com> Fix useProfiles usage in PackageDexOptimizer

When useProfiles is set we should always try to recompile.

Change-Id: Ide2aaf1cfbe7ccad28f653e544b5d04457dc14a9
ackageDexOptimizer.java
1f1ceef0f88a8c2758d1ec0ed6c1366bac7c9de4 28-Jan-2016 Makoto Onuki <omakoto@google.com> Ignore unknown user restrictions and WTF instead.

Bug 23902097

Change-Id: I1ac147ecd0286a8eb674d6f9f527edfea6e1198e
serManagerService.java
serRestrictionsUtils.java
fe54b11803e7940d23b6c540b2e6db738299702c 02-Feb-2016 Andreas Gampe <agampe@google.com> Merge "Frameworks/base: Add A/B OTA preopting"
0829fd4b269aafd0d64a93f00870c124bee877eb 02-Feb-2016 Selim Gurun <sgurun@google.com> Merge "Run 32-bit app in multiArch APK."
a89087542f774c585b6a6ec535fc294721710521 10-Nov-2015 Andreas Gampe <agampe@google.com> Frameworks/base: Add A/B OTA preopting

Add an OTA Dexopt service. Refactor package manager service and
package dex optimizer to reuse some code. Add knowledge about
OTA flag to installer.

Bug: 25612095
Change-Id: I7dd6bb468fea44b9d3acf0ac7d7404fb02d0f30a
nstaller.java
taDexoptService.java
taDexoptShellCommand.java
ackageDexOptimizer.java
ackageManagerService.java
c9a0237f5f49f2ffa52affb1bfd3e190b2267f22 13-Jan-2016 Tao Bai <michaelbai@google.com> Run 32-bit app in multiArch APK.

Bug: 26874366

Change-Id: I2c1fd1d036efe72b28b5fe996416df69a583959f
ackageManagerService.java
f2519814cc7136773a115b770d20cf4c92945952 26-Jan-2016 Oleksandr Peletskyi <peletskyi@google.com> Added restriction that disallows ability to set wallpaper.
BUG: 24890474

Change-Id: I424aa80d914e3b6f3f9eba8ccb4802bad6f54907
serRestrictionsUtils.java
84867864932d7b8ed20e2c31f4568cb16bcc020e 01-Feb-2016 David Brazdil <dbrazdil@google.com> Merge "Add 'package compile' shell command"
493411ace40a8b4a90be70576f361c5b7515f29d 01-Feb-2016 David Brazdil <dbrazdil@google.com> Add 'package compile' shell command

Bug: 26707406
Change-Id: I554969c9f3b3153179370d3d23a88fa7e8693885
ackgroundDexOptService.java
ackageDexOptimizer.java
ackageManagerService.java
ackageManagerShellCommand.java
b4ec8aaaba6ee5f564875741217bdfaf53a10d5f 01-Feb-2016 Makoto Onuki <omakoto@google.com> Merge "Revert "Throw for unknown user restrictions.""
2ec157d928b7804367091ee6c146b196ac6841e2 01-Feb-2016 Makoto Onuki <omakoto@google.com> Revert "Throw for unknown user restrictions."

This reverts commit 3861bf7e73fab9e39e8d1f6e5194f3600ed929a0.

Bug 26896902

Change-Id: I26fa0159b5bb832048ccd013054a01f91b54947b
serManagerService.java
serRestrictionsUtils.java
20a0e405aadd4a200834b70283c20ed34ae09336 01-Feb-2016 Nicolas Prévot <nprevot@google.com> Merge "Don't forward an intent if all handlers are suspended."
311cbe1b83acc0c8c31ce1ecbde1902a7103d0d1 29-Jan-2016 Dianne Hackborn <hackbod@google.com> Merge "Some small binder shell command improvements."
1990221c93499f3be64ba119c4c2def884df9cd9 29-Jan-2016 Andreas Gampe <agampe@google.com> Merge "PackageManagerService: Add more ABI adjustment logging"
f3bc593a627b67425b3b103ff148cf1f3da0fd29 29-Jan-2016 Makoto Onuki <omakoto@google.com> Merge "Throw for unknown user restrictions."
3861bf7e73fab9e39e8d1f6e5194f3600ed929a0 28-Jan-2016 Makoto Onuki <omakoto@google.com> Throw for unknown user restrictions.

Bug 23902097

Change-Id: I78a4b09db880134577d690be0c50ee9a64e6a309
serManagerService.java
serRestrictionsUtils.java
1c8e12bc4dd6db47c87f4c0a976a01c6707440e5 29-Jan-2016 Calin Juravle <calin@google.com> Merge "Revert "Revert "Fix optimizable package filter"""
6dfd83dbe88bd461f5aab224ced0830b07db1c03 29-Jan-2016 Calin Juravle <calin@google.com> Revert "Revert "Fix optimizable package filter""

The issue was traced to go/aog/854901. This revert was only temporary.

Bug: 26863668
This reverts commit d9c31db2e9e4da08ed43c88135fa7e220bc26ebf.

Change-Id: I6724059db18263936cc392651c621d27836f1c33
ackageDexOptimizer.java
a9aa24974ee4620b42a0573189b68c9af50926c5 29-Jan-2016 Jeff Sharkey <jsharkey@android.com> Remove "updatecmds" feature.

This feature is very old and hasn't been used in many releases. In
addition, it was never taught about multi-user layouts, and it would
be incredibly hard to maintain in the new FBE world where CE keys
may not appear until several reboots after an OTA.

Bug: 26854442
Change-Id: I3e88d38fde671e41ea9bdd790173d8b93c8a5c12
nstaller.java
ackageManagerService.java
1fffffcf395c8c90aa6204cb69c50bd45f27c2cb 29-Jan-2016 Calin Juravle <calin@google.com> Merge "Revert "Fix optimizable package filter""
d9c31db2e9e4da08ed43c88135fa7e220bc26ebf 29-Jan-2016 Calin Juravle <calin@google.com> Revert "Fix optimizable package filter"

Bug: 26863668

This reverts commit 8aaaf138887355f218b5da3f0efe1c4610a6c31a.

Change-Id: I659e2de56afd729f36aa111772fec8c9c2ddf801
ackageDexOptimizer.java
bc62b218df0bf6b83169cd82420e2701ae13a5ea 29-Jan-2016 longhai <longhai@xiaomi.com> Fixed the issue when some apps were gone and couldn't be installed
successfully after updating from KK to M via OTA.

There is more than one signature for some apps like Cortana. This app
which is installed in KK would be gone when updating from KK to M via OTA.
The reason for this is the unmatching signature, the error code is:
INSTALL_FAILED_UPDATE_INCOMPATIBLE.

Solution:
'databaseVersion' should not be assigned to CURRENT_DATABASE_VERSION
when creating a 'VersionInfo' instance, because it would affect the
process of ‘compareSignaturesCompat’ signature verification. We could
set the right value of 'databaseVersion' at an appropriate timing.

Signed-off-by: longhai <longhai@xiaomi.com>
ettings.java
c35e8c9c31ffc0419e2c3f75aa933368b20a56f2 29-Jan-2016 Andreas Gampe <agampe@google.com> PackageManagerService: Add more ABI adjustment logging

To help with diagnosis of preopt-related ABI-mismatched induced
errors, log more information during ABI adjustment.

Change-Id: I035f229b20588d5f1ec5f91707ef687d39c1a267
ackageManagerService.java
2e931f56c77cf53df9daf99d5afdd7bc4c109a54 28-Jan-2016 Dianne Hackborn <hackbod@google.com> Some small binder shell command improvements.

- Improve documentation.
- Add low-level access to input/output streams.

Change-Id: I3892be222d6fd919b164fa4e4882185940947f70
ackageManagerShellCommand.java
ec498e8ebedbfbb614808ca1cd4455886fa80af1 28-Jan-2016 Jeff Sharkey <jsharkey@google.com> Merge "Report FBE through a feature string."
b92b05bb4bcaa6f7869128e925d0331eee62e4da 28-Jan-2016 Jeff Sharkey <jsharkey@android.com> Report FBE through a feature string.

Since devices can be converted to enable/disable FBE across a
factory reset, we offer to add the features dynamically depending
on device status.

Bug: 26808417
Change-Id: I905140ba500a5e69756b547f2b1d6167b9a37dc6
ackageManagerService.java
e5342ad5fa7c3f8ac443846547eb66ab70d9728e 28-Jan-2016 Calin Juravle <calin@google.com> Merge "Fix optimizable package filter"
8aaaf138887355f218b5da3f0efe1c4610a6c31a 27-Jan-2016 Calin Juravle <calin@google.com> Fix optimizable package filter

System apps don't have an oat dir according to Package.canHaveOatDir but
installd will put their oat files in dalvik-cache.

Bug: 26080105
Bug: 26740458

Change-Id: I3d293e95af42753ebb29f15f341e9ca366fa03cb
ackageDexOptimizer.java
f348e8e22bed4b56fdb0c02702d12b36467dedd7 07-Jan-2016 Lenka Trochtova <ltrochtova@google.com> Add policy for enforcing that all users are ephemeral.

BUG: 24883058

Change-Id: I8e53ca677c935a6c828dd6ece00b345d0eff182a
serManagerService.java
795c458c89418885f146f40b8d4de96fb0d08ffe 25-Jan-2016 Rubin Xu <rubinxu@google.com> Merge "Turn off profile by stopping the user."
f13c9801697ccac3171137df10dd15f491dd15bd 21-Jan-2016 Rubin Xu <rubinxu@google.com> Turn off profile by stopping the user.

Bug: 22541941
Change-Id: I713ab9b87f3dd1b7bd6206af137562d20a44d76d
serManagerService.java
0af6fa7015cd9da08bf52c1efb13641d30fd6bd7 18-Jan-2016 Amith Yamasani <yamasani@google.com> Voice Interaction from within an Activity

This allows an app to show a voice search button
and invoke a voice interaction session for use
within the activity. Once the activity exits, the
session is stopped.

Test application has a new activity that
demonstrates it with the test voice interaction
service.

This initial version is functional enough for
an integration test, with some more tests
and improvements to come later.

Bug: 22791070
Change-Id: Ib1e5bc8cae1fde40570c999b9cf4bb29efe4916d
ackageManagerService.java
81c61eabba101f81b3f1395cd849e7b20d59a0d2 22-Jan-2016 Makoto Onuki <omakoto@google.com> Disable log

Change-Id: I373e3f7e31dc697bd5f62d226e2a0e3e7a4aeffd
serManagerService.java
813d755f7f7247e341a0861aa0de79c0376e0b0f 22-Jan-2016 Calin Juravle <calin@google.com> Merge "Clean up passing volumeUuid to DexOptimizer"
9dff854be4f7b552c5f6fe05331b9dd85de134d1 21-Jan-2016 Calin Juravle <calin@google.com> Clean up passing volumeUuid to DexOptimizer

The argument was redundant.

Also, we should have taken the uuid for shared library from their
package information.

Bug: 26080105
Change-Id: If3d86e00ebecfc13cf63482bce4ac32a119de967
ackageDexOptimizer.java
ackageManagerService.java
b7cc096fd49e99c01a9e963a895f6d26d685e474 21-Jan-2016 Oleksandr Peletskyi <peletskyi@google.com> Merge "Added restriction if a user is allowed to change the icon. BUG: 25305966"
7f1f1dfc8713fbecbab60cfbe14ab4d97d27deee 18-Jan-2016 Oleksandr Peletskyi <peletskyi@google.com> Added restriction if a user is allowed to change the icon.
BUG: 25305966

Change-Id: I3d527224f00087b2bd959879ebb143e2ecb9c914
serManagerService.java
serRestrictionsUtils.java
8c32981f12e599427d919c39c3f66500be26800d 21-Jan-2016 Kenny Guy <kennyguy@google.com> Merge "Update PackageMonitor and LauncherApps for suspended apps."
3bcf800c50238ac2df19c9fc0375c303905524b0 14-Jan-2016 Andrei Stingaceanu <stg@google.com> Suspend apps - block

* kill app when suspending
* block starting ONLY activities for suspended apps
* do not allow suspending the device admin package

Bug: 22776761
Change-Id: I3ee5fcb2d6828f363ce0f024dbc662ab29275192
ackageManagerService.java
772427555f2624b38124ab8e586ac0ccc451eb53 15-Jan-2016 Kenny Guy <kennyguy@google.com> Update PackageMonitor and LauncherApps for suspended apps.

Allow launchers to read ApplicationInfo from LauncherApps
to support suspended flag.
Provide callback to launchers via LauncherApps for suspend
/unsuspend broadcasts.

Change-Id: I772a121c45f60f926e8343bb6f181bef4e8929d3
auncherAppsService.java
a0e10434c49c6fe075e853da2046fd281318c4c4 20-Jan-2016 David Brazdil <dbrazdil@google.com> Extract APKs on install or OTA

ART will unzip APKs in memory during launch if an OAT file is not
present. To save the time and memory, this patch will invoke dex2oat
with '--compiler-filter=verify-at-runtime' to unzip the APK during
install or after an OTA.

Change-Id: I16583f9450ad60356123a29f7a6a649b2ab9999f
ackgroundDexOptService.java
nstaller.java
ackageDexOptimizer.java
ackageManagerService.java
78cea814da1a83d868bdaed596c6a9e304eb4570 21-Jan-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Update flags before querying activities when parsing default apps."
5fd83dcda2d5423014c64cbcb6a880742145dc59 21-Jan-2016 Svetoslav Ganov <svetoslavganov@google.com> Update flags before querying activities when parsing default apps.

Change-Id: I0120f32bfa2a7dd93714e8592496df4a0d74d07e
ackageManagerService.java
ettings.java
69d5ebc59e3cbc9c394906a95dc4b9bdc3355c08 14-Jan-2016 Andrei Stingaceanu <stg@google.com> Suspend apps - broadcast intent and API

Send a protected broadcast to registered receivers only
when packages get suspended.

Bug: 22776761
Change-Id: I043053ed45bdc202ead18518a0c1e39cce47947c
ackageManagerService.java
02fee15d854722955a90a4079a9163a66eee9b36 22-Dec-2015 Lenka Trochtova <ltrochtova@google.com> Add a system config flag for making all guests ephemeral.

BUG: 25737696

Change-Id: I4c915ba97431a6f9f0aee2d93b618a5add51c766
serManagerService.java
7bdf3cff92d26f9a4a8b88f816f5313fe02d6a33 19-Jan-2016 Calin Juravle <calin@google.com> Merge "Enable profile guided compilation on the framework side"
db4a79a5d7d348e9d2286d95d4e5a59dd484456f 23-Dec-2015 Calin Juravle <calin@google.com> Enable profile guided compilation on the framework side

The background compilation service will trigger a profile based
compilation instead of a full one. If no profile information is
available the compilation is skipped (see installd).

Note that the end decision whether or not to compile a package is taken
by dext2oat. We can't make the decision here because this service runs
under system server which cannot read app's profile data.

Bug: 26080105
Change-Id: I457ea8dea0557839c1f7cdc241770055732b0a4a
ackgroundDexOptService.java
nstaller.java
ackageDexOptimizer.java
ackageManagerService.java
f340974e06980e1fcc3a6ef8b5603307b6650187 12-Jan-2016 Janis Danisevskis <jdanis@google.com> Change permissions of apps' home dir to 0700 for SDK > 23

This patchset changes the installd such that apps' home
directory has permissions set to 0700 if build for a
target SDK version. In consequence the commands

create_app_data and move_complete_app

get one more parameter, the target SDK version.
Apps built for a lower SDK version will still have
home directories with permissions set to 0751.

Bug: 7208882
Change-Id: I651da956dd57d882772b23a433421e9130ea4c0b
nstaller.java
ackageManagerService.java
ettings.java
12747879b0204b9dfee997eddc981d09289e8b77 07-Dec-2015 Amith Yamasani <yamasani@google.com> User creation with an intent

New API for an app to request creating a new user with
a given user name and seed account information for the
SetupWizard to use when that user is switched into.

Also adds system APIs to read the seed account data from
UserManager.

Bug: 22776757
Change-Id: I0bc3f11ee19c15e0ee2a908c88d98b13296cc30d
serManagerService.java
12cde00dc03ec802801b8fd7611c1706ab7d4363 16-Jan-2016 Jeff Sharkey <jsharkey@google.com> Merge "Prepare app data only when storage is available."
0e62384ccbd00e9f78851929ca88b919679ee32e 14-Jan-2016 Jeff Sharkey <jsharkey@android.com> Prepare app data only when storage is available.

Before this change, scanning a package aggressively tried checking
to ensure that private app data was prepared. However, in an FBE
world we may not have access to that data at scan time. So this
change shifts the preparing of private app data until later: it
prepares DE storage when a user is started, and CE storage when a
user is unlocked. Wire ourselves into the user lifecycle so we can
prepare storage at both user start and unlock.

When DE/CE storage becomes available, this change reconciles any
found packages against known installed apps, and deletes any orphaned
data directories.

We now need to store the last-restorecon hash in an xattr on a
per-user directory basis, since we can't restorecon CE storage until
it's unlocked, or adopted storage until it's mounted. Remove a
bunch of used logic for loading dynamic SELinux policy at runtime;
our policy always comes from the system image.

Bug: 26466827, 26544104
Change-Id: I8d0a4ef862c35f4e4ef5c7f20d3bb8f12ba3fd4b
nstaller.java
ackageManagerException.java
ackageManagerService.java
ELinuxMMAC.java
ettings.java
serManagerService.java
e9fd1fa31ad6f62d1eb6f32cdcdab50349f246eb 16-Sep-2015 Christopher Tate <ctate@google.com> Back up / restore runtime permission grants

Only user-originated grant actions are backed up/restored. This
includes outright grants, one-time denials, and "never ask again"
type denials.

Bug 19870549

Change-Id: I78b4a8abb713dc5d74b93cb53217b212d57b26e4
ackageManagerService.java
ettings.java
b4c298e39978e189dcc2ad059b4030a12655119c 14-Jan-2016 Jeff Sharkey <jsharkey@android.com> Installing packages always needs to create dirs.

When we're installing an existing app for a user, we still need to
create the private data storage for that app.

Bug: 26554043
Change-Id: Ie18e0952600f860325718f84094aedeac3681403
ackageManagerService.java
a1771110d67fa7361f92d92f2e91019882ce3305 18-Dec-2015 Clara Bayarri <clarabayarri@google.com> Create Work Challenge per-user condition

Change the current static condition to a per-user condition so we
can check and enable/disable the work challenge properly. Also add
an isAllowed API, as the Work Challenge can only be used when the
user's DPC targets N or above to maintain backwards compatibility.

Change-Id: I0cb8b475838816801868ffb24726407aa257b4de
serManagerService.java
fdeeeea6cfdebdb98dd70a7dd48965743af01750 12-Jan-2016 Jeff Sharkey <jsharkey@android.com> Follow installd changes, throw exceptions.

Start by passing down flags to work on both CE and DE storage areas;
a future change will refine this further.

Force consistent argument checking and null handling for all
installd callers. Throw explicit exceptions instead of returning int
values that can accidentally be ignored.

Bug: 26466827
Change-Id: Iddb591f6b3c7786d210d3f132ff7f9886a97b749
nstaller.java
ackageDexOptimizer.java
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerException.java
ackageManagerService.java
ettings.java
9229ee595988c66f1c59409a963fef88b2c30e03 12-Jan-2016 Jeff Sharkey <jsharkey@google.com> Merge "Install non-EA providers once user is unlocked."
12705131b95d5d6bcfae79d7991ff3e6f02457e4 06-Jan-2016 Todd Kennedy <toddke@google.com> Hide ephemerality

Change-Id: Ibf60366b3f00b1920e330cd804bcc1c550f8882a

Bug: 26404647
ackageManagerService.java
f15150be6538374ebcc15172a59fb551a60c0d13 11-Jan-2016 Nicolas Prevot <nprevot@google.com> Don't forward an intent if all handlers are suspended.

If all the activities that can handle an intent in the other
profile are suspended: don't forward the intent to the other
profile.

BUG:26461656
Change-Id: If2838b42224879bfc745554ee4e92dded1748f0d
ackageManagerService.java
2bd31dbd023a11d90061c7b6831dd06454c928af 10-Jan-2016 Jeff Sharkey <jsharkey@android.com> Install non-EA providers once user is unlocked.

When starting encryption-aware apps while the device is locked, we
can only spin up ContentProviders that have been marked as
encryption-aware. Once the user is unlocked, we need to go back and
install non-encryption-aware providers in already running apps.

Fix bugs in getPackageInfo() where only one of the various MATCH_
flags was being consulted (!). Move matching logic to single unified
location in PackageUserState so we have consistent behavior.

Fix another class of bugs where Safe Mode wasn't correctly filtering
package details (!). These bugs are fixed by splicing in the new
MATCH_SYSTEM_ONLY flag as part of state-based flag mutation that was
added for encryption.

Bug: 25944787
Change-Id: I39c8da74b1f9ba944cc817176983f50ba322329c
ackageManagerService.java
ettings.java
cd65448ccd13c4c2d0fe9e9623fec3a898ab9372 09-Jan-2016 Jeff Sharkey <jsharkey@android.com> Even more PackageManager caller triage.

Finish moving all UID/GID callers to single AIDL method that requires
callers to provide flags.

Triage AppWidgets and PrintServices, which currently can only live on
internal storage; we should revisit that later.

Fix two bugs where we'd drop pending install sessions and persisted
Uri grants for apps installed on external storage.

Bug: 26471205
Change-Id: I66fdfc737fda0042050d81ff8839de55c2b4effd
auncherAppsService.java
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
0ab0bdde2b39c77175d9e0d69d6631e130e4b5ac 09-Jan-2016 Jeff Sharkey <jsharkey@google.com> Merge "More progress on triaging PackageManager callers."
c5967e9862489024c932b0c7fcb84ed0af2a7fd7 08-Jan-2016 Jeff Sharkey <jsharkey@android.com> More progress on triaging PackageManager callers.

Catch a bunch of simple cases where the PackageManager flags are
obvious. Add the ability to use the MATCH_SYSTEM_ONLY flag on
PackageInfo and ApplicationInfo queries.

Re-examine recent tasks after a user is unlocked, since some of the
activities may now be available and runnable.

Bug: 26471205, 26253870
Change-Id: I989d9f8409070e5cae13202b47e2c7de85bf4a5b
ackageManagerService.java
ackageSetting.java
f8565afc8ae823fd65978e95da9f9652495bdc53 08-Jan-2016 Jeff Sharkey <jsharkey@google.com> Merge "Verifier is required, except when it's not."
a440d94d0ffe084026b24a16f7684efe1b1baff8 08-Jan-2016 Jeff Sharkey <jsharkey@android.com> Verifier is required, except when it's not.

There are still some devices out there that are missing a verifier,
so relax this until we have time to look closer.

Bug: 26438767
Change-Id: I10e154d736619963c20aaed8199a457f3004011c
ackageManagerService.java
dea471ef548f09e04e178c5ec2d71a4b79bdb8f8 17-Dec-2015 Mahaver Chopra <mahaver@google.com> Added Data roaming user restriction

Added new user restriction DISALLOW_DATA_ROAMING, can only be set
by device owners.

Bug: 24890464
Change-Id: Ic4cb37dd5f9bbffa35f921751488ef7c7ff99452
serRestrictionsUtils.java
819d2745b4e04eb684ab323742b718c66d19c2c1 30-Sep-2015 Todd Kennedy <toddke@google.com> Update PackageInstaller install handing

* Allow forcing permission check. We want to modify the PackageInstaller to
use the PackageInstallerSession for better security / remove deprecated APIs.
In order to do this and continue to prompt for permissions, we need to prevent
the PakcageInstaller from auto-approving the permissions.

* Add originating UID to SessionParams. This is used for package verifier
checks.

Bug: 22282121
Change-Id: I19079749d20ace66f1332f399d52cb0fb8784cd9
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
e46fbfaf2e5759b54091dd62e2e9cf14a8545fcf 07-Jan-2016 Jeff Sharkey <jsharkey@android.com> Don't look for verifier/installer when core only.

When booting the device in core-only mode we're running over a tmpfs
and only a small handful of apps are actually available. Don't
bother looking for verifiers or installers, since we probably won't
find them.

Bug: 26438767
Change-Id: Ia4c4a6e71007b01c4aaa273c2e0197b5cd021262
ackageManagerService.java
ed95093333618e1b33a528d3fcc0ce2a44ef9cd1 07-Jan-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Grant location to SetupWizard by default - framework"
51f3908c6a788f82d8188762c0680594a54b17ae 06-Jan-2016 Jeff Sharkey <jsharkey@google.com> Merge "Consistent naming for PackageManager methods."
e06b4d1d9f718b9fe02980fea794a36831a16db2 06-Jan-2016 Jeff Sharkey <jsharkey@android.com> Consistent naming for PackageManager methods.

When hidden PackageManager methods take a userId argument, they
should be named explicitly with the "AsUser" suffix. This fixes
several lagging examples so that we can pave the way to safely
start passing flags to new methods without scary overloading.

Also fix spacing issues in various logging statements.

Change-Id: I1e42f7f66427410275df713bea04f6e0445fba28
ackageManagerService.java
ettings.java
81cf69a3b4e84c504772173900efbdb606a6eef1 06-Jan-2016 Jeff Sharkey <jsharkey@google.com> Merge "Update logic for resolving verifiers."
c5603cc78292fad17eaf7bd773e8a45dad6fba95 06-Jan-2016 Svetoslav Ganov <svetoslavganov@google.com> Grant location to SetupWizard by default - framework

bug:24914976

Change-Id: I1eaf14fa1e146f0cf1821352eebd2f318d839d5a
efaultPermissionGrantPolicy.java
2a90f673f5819e05ea72f6aba3e75956e0f807dc 06-Jan-2016 Jeff Sharkey <jsharkey@android.com> Update logic for resolving verifiers.

Verifiers or installers may not be encryption-aware, or the user may
have disabled them, so we probe pretty deeply during system boot to
resolve them. Use the new MATCH_SYSTEM_ONLY flag to limit results to
packages on the system image.

When there are multiple matches, pick the one with highest priority
instead of crashing the system.

Switch to updated MATCH_ constants in more places.

Bug: 26250295
Change-Id: Ia7a3b1fb74da6c3b9d2c2edbf1deaa9fb52fc40a
ackageManagerService.java
ettings.java
28b939c5388bb87569df62555346160b5b7280e4 06-Jan-2016 Fyodor Kupolov <fkupolov@google.com> Merge "Collect user creation metrics"
4f6d400b0fa4c94e0f785a7b15ffb30126e6759d 05-Jan-2016 Alex Klyubin <klyubin@google.com> Merge "No need to pass digest of AndroidManifest.xml around."
31ffb442414bd9cf6c0225799d7d0c5409f3769d 21-Dec-2015 Alex Klyubin <klyubin@google.com> No need to pass digest of AndroidManifest.xml around.

When an APK is being installed, the full path to the file is
occasionally passed between processes. To detect changes to the file
during these handovers, the digest of the AndroidManifest.xml entry
could be passed around as well.

This security feature is no longer used and is no longer needed. APKs
should be installed using the modern Package Installer API
(android.content.pm.PackageInstaller).

Bug: 24542768
Change-Id: I2762634c85448e7adcd47ffc9a5294c021e127bd
ackageManagerService.java
2f3e35376ada0327b34a71d7c45ac6e6d955d7dc 21-Dec-2015 Jeff Sharkey <jsharkey@android.com> More work towards triaging missing app behavior.

Many places across the platform query package details without
gracefully handling packages or components that go missing for
various reasons. This can cause annoying user data loss, such as
resetting back to built-in apps or dropping of accounts, etc.

This change verifies that system callers have thought about these
edge cases by logging if they use default matching behaviors without
explicitly marking themselves as being "triaged." (The logging is
currently disabled by default.)

Also creates explicit definitions of supported flags for various
incoming PackageManager calls, and defines a clear distinction
between flag types:

-- GET-style flags are used to request additional data that may have
been elided to save wire space.

-- MATCH-style flags are used to include components or packages that
would have otherwise been omitted from a result set by current system
state.

There are a handful of existing GET flags that better fit under the
MATCH definition, so this change clones them to new constants and
marks the old ones as deprecated.

Fixes bug in JobSchedulerService to consider jobs from apps on
external storage. Revert some dialer behavior back to being
untriaged.

Change-Id: I9b6ab0968241e3479bddbd78de0c51e3b9917318
ackageManagerService.java
ettings.java
8385e4b9d27c5139c643f078a5f94a49f91f2523 30-Dec-2015 Fyodor Kupolov <fkupolov@google.com> Collect user creation metrics

Bug: 26348624
Change-Id: Idb2ac10c6f3fd525ac652e242fa2647cc4cc7249
serManagerService.java
db29e46ae92a5f1b5f427b1d7cdef2e457612f57 29-Dec-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Avoid byte[] allocations in writePackageListLPr"
98963260dc30f1dc3e89dbd0efdfcdc6398d753c 17-Dec-2015 Philip P. Moltmann <moltmann@google.com> Prefer printers that have been used physically close to the current
location of the user.

Commonly the users prints on a printer that this near the user current
location. Hence if possible we want to show the user printers that he
used before and that are close to him.

Hence store the location of the previous uses of a printer and prefer
printer that are close to the user.

Unfortunately getLastLocation might not report a usable location and it
will take at least 5 seconds until the first usable location arrives. At
this time the user might have already opened the destionation spinner.
It would be unexpected for the printers to suddenly change under the
users finger. Hence it might be that we did first show the printer
without any location information and then once the location is known we
cannot update thedestination spinner anymore.

The select printer activity does not have this issue, hence in the worst
case the user has to enter this activity to select a printer and by then
the location is usually determined.

This is not ideal but better than before.

Bug: 24133609
Change-Id: Ie7d20cf3d9dd163e57903f8f6ecc0b3fd4f4374e
efaultPermissionGrantPolicy.java
5217cacbd9f382068bb9e176cd5a0b15388a335c 20-Dec-2015 Jeff Sharkey <jsharkey@android.com> Make JobSchedulerService encryption aware.

When a user is started, but a persisted job component doesn't appear
in the normal resolution list, we avoid enqueuing the job. Later
when the user is unlocked, we take another pass over the pending
jobs to see if they became available.

Load keyboard layouts from XML metadata regardless of crypto status,
since we don't need to spin up any remote code.

Add MATCH_SYSTEM_ONLY to make system logic easier to write when
looking for trusted components.

Sprinkle more annotations on ArrayUtils methods.

Bug: 26279465
Change-Id: Iec28e0bb46862b07d740b12a79f6360de68dab0f
ackageManagerService.java
ettings.java
2a9e3f8e6813716ab88ca54fd04ae047dc9aaaeb 18-Dec-2015 Jeff Sharkey <jsharkey@android.com> Better named encryption flags, start triaging.

Create distinct flags for encryption aware, unaware, and both, and
name them like the other MATCH_ flags.

Start adding logic to help triage all system internal callers to
verify that they've done their homework and thought about how to
handle apps while locked. Call sites in the system should either
ask for explicit matching behavior, or explicitly use the DEFAULT
match flag to indicate that they've been triaged to use the
default state-based matching.

Bug: 26250295
Change-Id: I86214e5c4f71a6dc72f06930800388713aecd107
efaultPermissionGrantPolicy.java
ackageManagerService.java
ettings.java
b69056b6b85b6e0aad48a8142f4116b5da9ae7f2 19-Dec-2015 Fyodor Kupolov <fkupolov@google.com> Avoid byte[] allocations in writePackageListLPr

Previously a new array was created for each package in packages.list. Now
OutputStreamWriter maintains an internal buffer for string to byte conversion.

Bug: 26237300
Change-Id: I649e21833a16e76326f9a909220820c47a27f734
ettings.java
7164cb68dd6bf5efbbb9e3319fe985682685c2af 18-Dec-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Use buffering when reading preferred apps"
50ea35f6695539a03e2c6efe61eca03b598c9c18 17-Dec-2015 Todd Kennedy <toddke@google.com> Print "Success" on success

Change-Id: I274e2aa5d840fee4f57f5a4f2f73af01f0587847
ackageManagerShellCommand.java
b35b34c7612dc5c73502bd286b1f9c9041a0518a 17-Dec-2015 Fyodor Kupolov <fkupolov@google.com> Use buffering when reading preferred apps

On my test, a buffered version takes 10ms in contrast to 80 ms.

Bug: 26237300
Change-Id: I91ae05798672d243873e7447261156d5ebf3b045
ettings.java
af6ec296ec200726ac86ff53efc64e221ed6f2f6 17-Dec-2015 Jeff Sharkey <jsharkey@android.com> Make AppWidgets encryption-aware.

Only parse and load AppWidget configuration details after a user has
been unlocked. Yell loudly if someone accidentally tries loading
data for a locked user.

Tidy up protected broadcast logic a bit more to handle persistent
processes. Add backwards compatible behavior for APPWIDGET_UPDATE
broadcast simliar to APPWIDGET_CONFIGURE, since some apps are sending
it to themselves.

Add hidden USER_HANDLE extra to a handful of broadcasts to make
logic more consistent.

Bug: 26247049, 26219971
Change-Id: I54e4f2e343488571f9baa1a316962f41186c1a2c
serManagerService.java
36a832dd128c18628783cc629b89b2ae399db4f8 17-Dec-2015 Todd Kennedy <toddke@google.com> Merge "revert quick install"
373f0b4313d3a2444aebf6b89a71c4ba64566110 16-Dec-2015 Todd Kennedy <toddke@google.com> revert quick install

bug: 25118622
Change-Id: I61c3a1ea9015599dc45bd9e656f99f6bf8c4ec02
ackageInstallerSession.java
ackageManagerService.java
6142f90b9f99c33c4f75c2057fb1db3bc77425cf 17-Dec-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Introduced PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER"
8d9366cfe9657e6884c00e728bc3b4e8b191bc53 16-Dec-2015 Todd Kennedy <toddke@google.com> Remove 2nd line from failure

In an attempt to provide more detailed information to the end-user, we
caused tests to fail [they parse the output of the 'pm' command]. Remove
the 2nd line of the output that was causing the failure.

Also took the opportunity to merge changes from the Pm command to the
Cmd command.

Bug: 26131598
Change-Id: I459f9ec8978d87dd571136222f780039e426474e
ackageManagerShellCommand.java
1e2839188fb49575b86646d3aadb355c81ef9cc5 26-Nov-2015 Andrei Stingaceanu <stg@google.com> Wire call to suspend a package

Adds APIs in DevicePolicyManager and PackageManager for allowing
a device admin to suspend a package. PackageManagerService sets
or unsets a new PackageUserState 'suspended' setting. Terminal
command to suspend/unsuspend has been added via
PackageManagerShellCommand (as root).

Next steps:
* use the new 'suspended' setting for denying access to start app
(probably in ActivityStackSupervisor)
* broadcast a PACKAGE_(UN)SUSPENDED intent for launchers to pick up
* remove app from recents (go further and kill it if it is running)
* erase existing notifications for this app

Bug: 22776576
Change-Id: I718b3498f6a53cc0c6fdfb6d15031e53ddca4353
ackageManagerService.java
ackageManagerShellCommand.java
ackageSettingBase.java
ettings.java
c063603d9bd2ef03884a70d35ca446942a4fca4f 16-Dec-2015 Esteban Talavera <etalavera@google.com> Merge "Only system can set application restrictions via UserManager"
bdbc9692c7cb365d9d3f239baa2377724a6f7bc8 14-Dec-2015 Fyodor Kupolov <fkupolov@google.com> Introduced PRIVATE_FLAG_REQUIRED_FOR_SYSTEM_USER

When set, signals that the application is required for the system user and
should not be uninstalled.

Bug: 25616324
Change-Id: Idbbd1618e09c40bdb83fa26c0a3d9662dd73bea4
ackageManagerService.java
ettingBase.java
7440f177c3e70da0b883f8abffd6c8fc1d507bb8 09-Dec-2015 Todd Kennedy <toddke@google.com> Fix ephemeral post-install launching

Provide the ephemeral installer with some additional pieces of information:
1) instead of de-referencing the URL a second time, give the installer the
exact package name
2) instead of relying on ephemeral apps to define verified links, give the
installer a pending intent to launch when the ephemeral is installed
3) give the installer a pending intent to launch if the installer fails,
for whatever reason, to install the ephemeral app

Bug: 25119046
Change-Id: I45f50481caee09d5d09451e4b2492e64b0faae82
phemeralResolverConnection.java
ackageManagerService.java
5b9f167a8e7395ca54fc0ef78af4523858de87a7 11-Dec-2015 Esteban Talavera <etalavera@google.com> Only system can set application restrictions via UserManager

Preventing apps with MANAGE_USERS from managing application
restrictions via UserManager. Application restrictions should
only be set via DevicePolicyManager.setApplicationRestrictions,
or via Settings (for restricted profiles).

Bug: 22541936
Change-Id: Ieed51ef54b4c23a73f383465e9af9b3bcf18a514
serManagerService.java
63b0318e4bd1fff25e6d434513488bb3bdca3097 15-Dec-2015 Jeff Sharkey <jsharkey@google.com> Merge "Protect some more broadcasts."
4267eacc3bd6c781423a871e135bac03cd93718a 15-Dec-2015 Jeff Sharkey <jsharkey@android.com> Protect some more broadcasts.

Bug: 26144973
Change-Id: Ic05bca52913ee5545719f0f24bed5b359f31259f
ackageManagerService.java
cbeb114881c2bd3408ce302b0d48cb2449f1dcb0 12-Dec-2015 Andreas Gampe <agampe@google.com> Frameworks/base: Some cleanup in PackageManagerService

Some cleanup of unused/unnecessary code.

Fix two null-pointer checks.

Bug: 19797138
Change-Id: Ib66f60f39f5c6a5902d1687328d78a2148f76155
ackageManagerService.java
055d8396ef6b99f9dcd639e98cce6029fca1c145 11-Dec-2015 Makoto Onuki <omakoto@google.com> Merge "Allow PO to set DO restrictions if it's on user 0"
5485ed46ff337769589c6e06b3469246e60b9e3b 09-Dec-2015 Makoto Onuki <omakoto@google.com> Allow PO to set DO restrictions if it's on user 0

Bug 26091525

Change-Id: Ie6d2cd4ade076d8d2ec47243ff1280b95b7c9044
serRestrictionsUtils.java
6ac42aeed905181b484f97a53db57a17134ef7a8 09-Dec-2015 Dianne Hackborn <hackbod@google.com> Add a mechanism for broadcasts to control background dispatching.

Right now this is just for the BOOT_COMPLETED broadcast to allow
all apps to receive it.

Also clean up the dumpsys of the broadcast queue to not have
every little detail of ResolveInfo+ActivityInfo+ApplicationInfo,
which is just not useful and makes reading the broadcast queue
debug output a lot harder because of so much noise there is.

And rename the package shell query-intent-* commands to a
shorter query-* form.

Change-Id: I0d01565babb87e68b840c9756a2ea730d699efc7
ackageManagerService.java
ackageManagerShellCommand.java
13b80b2303f4cd183e5f1ec4956c6770fea64cfb 08-Dec-2015 Xiaohui Chen <xiaohuic@google.com> Merge "UserManager: get/set user account name"
2acf063da08dfff69f184c9a6a90a7a5fe60d818 25-Nov-2015 Svet Ganov <svetoslavganov@google.com> Ephemeral cookie API

Add APIs for an ephemeral app to set a cookie which is a small
peice of data cached longer than the app itself. This is useful
for avoiding the user to login every time they use the ephemeral
app. The cookie is stored after an ephemeral app is uninstalled.
Normal apps or ephemeral apps upgraded to full apps can also use
these APIs with the difference that once they are uninstalled
the cookie is deleted.

The cookie size defaults to 16KB and is configurable by a global
settings which can be adjusted via gservices. Also eviction policy
is time based with a default of one month and is configurable by
a global setting which can be adjusted via gservices. If the cert
of the app cahnges (when ephemeral is installed, uninstalled and
installed again) the cooke is wiped to prevent data leaks.

This cahange also adds an API for apps to know whether they run in
an ephemeral mode since it this mode some APIs will not be available.
Another API exposed by this change is private for the system and
exposes all ephemeral apps - installed and uninstalled. Only the
system can call this API. When an ephemeral app is uninstalled the
system stores its name, icon, and permissions. When the app is
reinstalled or a full version is installed the permissions are
propagated.

Change-Id: Id4a73a7750bfbabda0bfcb9bf9018d2062e94367
phemeralApplicationRegistry.java
ackageManagerService.java
c4dd021322d38ea32ac49930e904b6d08ce6490c 18-Nov-2015 Lenka Trochtova <ltrochtova@google.com> Introduce ephemeral users.

BUG: 24883058

Change-Id: I2e1d6aa184142c2a3dc0415c0cd407573453cf41
ackageManagerService.java
serManagerService.java
ed6c8cd6ca377ba51243c70844c6dd074abbd0fc 08-Dec-2015 Zoltan Szatmary-Ban <szatmz@google.com> Merge "Make base user restrictions queriable for system apps"
0e57034afda4492b602d450c4ab4240e8e1d26d8 08-Dec-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Fix locking error when a new user is created"
d8327bd864e52bbc6cc57e933488aa7e99654d4f 01-Dec-2015 Fyodor Kupolov <fkupolov@google.com> Fix locking error when a new user is created

Installer should not be called with mPackages lock held.

Bug: 25934378
Change-Id: I619af324d997dd1e4a2ac99171cb0e683c5713d1
ackageManagerService.java
ettings.java
39a275b3980b5ea75e060da540229b95a47333f7 04-Dec-2015 Jeff Sharkey <jsharkey@android.com> Better protection for system broadcast intents.

When the system sends broadcast intents, it's in a very authoritative
position, and many apps blindly trust the sender. This is why we've
historically had the concept of "protected broadcasts" which can only
be sent by the system.

However, it's far too easy to send new broadcasts from the system
without adding them to the protected list. This CL adds logic to help
catch those cases. Currently it just logs the error and continues
sending the broadcast.

Based on boot analysis of a typical device, add 36 new protected
broadcasts.

Bug: 24571095
Change-Id: Ie2cc6b0b2026e67c64730af897e4eb3e0e8404f1
ackageManagerService.java
cc586c5ab12cb713a499766875933947019b73fa 07-Dec-2015 Rubin Xu <rubinxu@google.com> Merge "Introduce quiet mode state to managed profile users"
b3b9258ab6a01af5e0df4b8385b73084cd9ec530 07-Dec-2015 Xiaohui Chen <xiaohuic@google.com> UserManager: get/set user account name

Bug: 25935510
Change-Id: I0b621fb300be74209534e08a11f1d1a7c049cd5a
serManagerService.java
0a29ecd8a53b5ac63b628e870a344650ff34c4b0 04-Nov-2015 Rubin Xu <rubinxu@google.com> Introduce quiet mode state to managed profile users

Quiet mode means the user will be free from visual and audio interruptions
from apps inside the managed profile, including notifications, widgets and
others. This CL adds the underlying state bit to users and exposes various
APIs to control and query the quiet mode state.

Bug: 22541941
Change-Id: If5f8e5a897843050e83b6ec26cb39561098f12b9
serManagerService.java
c72b3101ee368d2a9943e4436ede679acfa38f92 07-Dec-2015 Todd Kennedy <toddke@google.com> Merge "Add ephemeral installs"
3bbceddb94d627495c0022d6e3f92a5cb16aebea 26-Nov-2015 Zoltan Szatmary-Ban <szatmz@google.com> Make base user restrictions queriable for system apps

Needed by e.g. Settings > Location

Bug:22541939
Change-Id: I6cdd5f1c32cde143232eb53f531bbf3a737d8a9a
serManagerService.java
371baee4d3aa2da5af7aa8cc2d7ac82ffe893421 04-Dec-2015 Dianne Hackborn <hackbod@google.com> Merge "Add package command to print resolve activity."
b3523c45dd764ba9926ee70a04cfee78b10e7ab4 04-Dec-2015 Tony Mak <tonymak@google.com> Merge "Introduce ONLY_IF_NO_MATCH_FOUND in CrossProfileIntentFilter"
2699f065558ba78066887210b0c7346105959860 20-Nov-2015 Todd Kennedy <toddke@google.com> Add ephemeral installs

* Add a new --ephemeral argument to 'adb install'
* Add plumbing to internally track ephemeralness
* Create new app directory for ephemeral installs

Bug: 25119046
Change-Id: I1d379f5ccd42e9444c9051eef2d025a37bd824fe
ackageInstallerService.java
ackageManagerService.java
ackageManagerShellCommand.java
5cbbdf2ca610ac7a35b38788d0c92c2e851bbda9 03-Dec-2015 Jeff Sharkey <jsharkey@android.com> Merge "Improved variable naming" am: 4ef9d41066 am: bc57510e9f
am: ec0e46fbc6

* commit 'ec0e46fbc612cb9575ae3e7901664cd34666f438':
Improved variable naming
ec0e46fbc612cb9575ae3e7901664cd34666f438 03-Dec-2015 Jeff Sharkey <jsharkey@android.com> Merge "Improved variable naming" am: 4ef9d41066
am: bc57510e9f

* commit 'bc57510e9f359929a55130d8a35c61a84dad4568':
Improved variable naming
bc57510e9f359929a55130d8a35c61a84dad4568 03-Dec-2015 Jeff Sharkey <jsharkey@android.com> Merge "Improved variable naming"
am: 4ef9d41066

* commit '4ef9d41066d8b4124c2c59752512adf24102634d':
Improved variable naming
10ad84a17d7248488c1653bacc9f20d3a7193999 01-Dec-2015 Clara Bayarri <clarabayarri@google.com> Create a separate Work Challenge check

This allows us to tell lock checks from FBE checks separately,
and will be useful when dealing with password unification.

Change-Id: Ifbea425f749fee4d6d51faddd8b64bf717a1a5f8
serManagerService.java
99878e9b1c599ae4dae0975245b4cead1c47f1a1 03-Dec-2015 Dianne Hackborn <hackbod@google.com> Add package command to print resolve activity.

Change-Id: I020a2b0e27f1430d9c2e9bf64f949e26610db147
ackageManagerShellCommand.java
9cbfc9e212151e84910a22387365644916dde446 08-Oct-2015 Fyodor Kupolov <fkupolov@google.com> Added DISALLOW_RUN_IN_BACKGROUND user restriction

It forces the user to stop instead of going into the background. Also
changed behavior of stopUser method. Now it also attempts to stop related
users along with the specified userId.

Based on ag/807976, with the only difference that it's now a user restriction.

Bug: 24579258
Bug: 24708668
Change-Id: I357298908816fc58feeed83b7e9979fc33d25da6
serManagerService.java
serRestrictionsUtils.java
35fc197caaecf22e8e5642963aa4807f1b43d88f 02-Dec-2015 Todd Kennedy <toddke@google.com> Merge "Copy into ASEC container"
9c165d76010d9f79f5cd71978742a335b6b8d1b4 02-Dec-2015 Svet Ganov <svetoslavganov@google.com> Add optional permission review for legacy apps - framework

For some markets we have to allow the user to review permissions
for legacy apps at runtime despite them not supporting the new
permission model. This is achieved by showing a review UI before
launching any app component. If an update is installed the user
should see a permission review UI for the newly requested
permissions.

To allow distinguishing which permissions need a review we set
a special flag in the permission flags that a review is required.
This flag is set if a runtime permission is granted to a legacy
app and the system does not launch any app components until this
flag is cleared. Since install permissions are shared across all
users the dangerous permissions for legacy apps in review mode
are represented as always granted runtime permissions since the
reivew requirement is on a per user basis.

Whether the build supports permission review for legacy apps is
determined by a build constant allowing us to compile away the
unnecessary code for markets that do not require a permissions
review.

If an app launches an activity in another app that has some
permissions needing review, we launch the permissions review
UI and pass it a pending intent to launch the activity after
the review is completed.

If an app sends a broadcast to another app that has some permissions
needing review, we do not deliver the broadcast and if the sending
app is in the foreground plus the broadcast is explicit (has a
component) we launch the review UI giving it a pending intent to
send the broadcast after the review is completed.

If an app starts a service in another app that has some permissions
needing review, we do not start the service and if the calling app
is in the foreground we launch the review UI and pass it a pending
intent to start the service after the review is completed.

If an app binds to a service in another app that has some permissions
needing review, we schedule the binding but do not spin the target
service's process and we launch the review UI and pass it a callback
to invoke after the review is completed which spins the service
process and completes the binding.

If an app requests a content provider in another app that has some
permissions needing review we do not return the provider and if
the calling app is in the foreground we show the review UI.

Change-Id: I550f5ff6cadc46a98a1d1a7b8415eca551203acf
ackageManagerService.java
ermissionsState.java
191d771a574c16586352b2c0cc0687ed2962f6a1 02-Dec-2015 Todd Kennedy <toddke@google.com> Copy into ASEC container

Even when staged, copy into an ASEC container if the package is
forward locked.

Bug: 25812587
Change-Id: I385f7a441f3c6dc76fb076b4505bc9f43b10bd93
ackageManagerService.java
807e01cb47c2d5442f76e27b70a7206f77ed76d8 01-Dec-2015 Tony Mak <tonymak@google.com> Introduce ONLY_IF_NO_MATCH_FOUND in CrossProfileIntentFilter

With this flag, activities in other profiles can respond to the intent
only if no intent-filter with non-negative priority in current profile can
respond to it.
It is designed like this because activities with negative priority
intentfilter are always used as a fallback in case no one can respond
to the intent. In this case, we expect there is a "real" activity in
other profiles can handle the intentfilter

Here is the example activity that handle the call related intents when
there is no dialer.

NonPhoneActivity.java in Contacts app is an example.
https://github.com/android/platform_packages_apps_contacts/blob/master/AndroidManifest.xml#L461

Bug: 25760508

Change-Id: Ife2a7c19e91ddf5d2e81ad09bd4cf712cdcdb986
ackageManagerService.java
8286a6d85fc01a972f6ee0ffab459364e68c5d8a 01-Dec-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Correctly set default restrictions when creating guest"
e04462caa46803c64dac5107a8d7b07894e23b9d 01-Dec-2015 Fyodor Kupolov <fkupolov@google.com> Correctly set default restrictions when creating guest

Use restrictions from mGuestRestrictions when creating a guest. Initially
phone calls, SMS and installing from unknown sources is not allowed.

Bug: 25904144
Bug: 25729516
Change-Id: I461c492ad64842d3707f73dfd83b533aa31b63ef
serManagerService.java
8924e8759f9a8cffb5ad538ca40a7826793aac07 30-Nov-2015 Jeff Sharkey <jsharkey@android.com> Wire up lifecycle, send unlocked broadcast.

When the correct lock pattern is presented, ask the system to also
unlock credential-encrypted storage, if enabled. The token passed
along is empty for now, but can be wired up to gatekeeper in the
future.

During each system boot, ask vold to lock all users keys to give us
a known starting state. This also has the effect of chmod'ing away
any CE data when in emulation mode.

Define and send a new foreground broadcast when the CE storage is
unlocked for the first time. Add stronger last-ditch checking for
encryption-awareness before starting an app.

Bug: 22358539
Change-Id: Id1f1bece96a2b4e6f061214d565d51c7396ab521
ackageManagerService.java
e7927da1b6dc4f96714aa9bc4fbb71b3659f8cea 25-Nov-2015 Makoto Onuki <omakoto@google.com> Don't call DPM from UserManager to avoid lock inversion

- Also make sure DPMS.mOwners is always guarded with DPMS.this.
(and remove synchronization from Owners.)

Bug 25796840

Change-Id: I83f7b78e7b437d9c2a2b1d6e714346cd15f95330
serManagerService.java
4fab7fbeb01026e5dc81f9d0dc445042e91c8f80 25-Nov-2015 Yury Zhauniarovich <y.zhalnerovich@gmail.com> Improved variable naming

Variable name "appOpPerms" is substituted to "appOpPkgs", which is better
suited.

Change-Id: I038b93fdf5e539551c4aab12d9918c9937602e2d
Signed-off-by: Yury Zhauniarovich <y.zhalnerovich@gmail.com>
ackageManagerService.java
c8a5a555f1482d0f45b538eb898d6ee7e26552a6 19-Nov-2015 Makoto Onuki <omakoto@google.com> DPM.isDeviceOwnerApp() and getDeviceOwner() now check calling user

- Previously on MNC, they would return the same result regardless who
the calling user is.

- Now they properly take DO user-id into account. Meaning, they'll
always return false and null respectively, if the calling user doesn't
run device owner.

- Note isDeviceOwnerApp() is a public API and getDeviceOwner() is
a system API. Meaning we're changing the behavior or non-private
APIs.

- Also cleaned up hidden APIs, and gave them explicit suffixes
to avoid confusion. Bundled code should prefer them for clarity.

Now we have:

* APIs that work cross-users: They all require MANAGE_USERS.
boolean isDeviceOwnerAppOnAnyUser(String packageName)
ComponentName getDeviceOwnerComponentOnAnyUser()

int getDeviceOwnerUserId()
boolean isDeviceOwnedByDeviceOwner()

String getDeviceOwnerNameOnAnyUser()

* APIs that work within user. No permissions are required.

boolean isDeviceOwnerAppOnCallingUser(String packageName)
ComponentName getDeviceOwnerComponentOnCallingUser()

Bug 24676413

Change-Id: I751a907c7aaf7b019335d67065d183236effaa80
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
serManagerService.java
cc99cced2dad73ab025077477d539ffed2904e32 24-Nov-2015 Makoto Onuki <omakoto@google.com> Merge "Fix "some user restrictions not working" issue"
6cbc2fec91c8eae62b0ed578523af4f9765f9c17 24-Nov-2015 Sunny Goyal <sunnygoyal@google.com> Using ParceledListSlice to get the list of activities in LauncherApps

Bug: 25430879
Change-Id: I3a93bb1abcbcc54bc467e57c51f592b5946850cf
auncherAppsService.java
28da2e3490cff619157578c85d32a73ff979d554 20-Nov-2015 Makoto Onuki <omakoto@google.com> Fix "some user restrictions not working" issue

SettingsProvider used to prevent any changes to certain settings
when the corresponding user restriction is set, which isn't really what
these restrictions mean.
Even if a user restriction is set, it should still changing in the more
restricting direction.

Also stop setting "" to LOCATION_PROVIDERS_ALLOWED, which will simply
be ignored.

Bug 25614198

Change-Id: Ifa8edc2927e21e6c6174620c8c874c86c1dc0f75
serRestrictionsUtils.java
ac65e1e1dba1cf0ea237a389220ec818ade07a16 21-Nov-2015 Makoto Onuki <omakoto@google.com> Remove UserManager.setSystemControlledUserRestriction()

Now that we don't have UM.setUserRestriction*s*() that could remove
all existing restrictions, there's almost no point handling
DISALLOW_RECORD_AUDIO differently.

Now DISALLOW_RECORD_AUDIO is handled just like other restrictions,
except we don't persist it.

Bug 24954662

Change-Id: I27875b4a74dd95a3ce6bb774081eeaf718eaec15
serManagerService.java
serRestrictionsUtils.java
cb6fd80721253ffa9dcab5cf8c2f4e9b9cd17ccc 05-Nov-2015 Fyodor Kupolov <fkupolov@google.com> Added keep-uninstalled-packages DO policy

This policy allows DO to specify a list of apps to cache even without being
installed on any user.

Bug: 23938464
Change-Id: I2eeab7f148409739fc23a5c44e955ad12b63fd04
ackageManagerService.java
1fae502824dfb77a109fedd80dad61fe094d8284 19-Nov-2015 Makoto Onuki <omakoto@google.com> Merge "More work on layered user restrictions."
1a2cd74526113b45d9108b6997609122c4311fb1 16-Nov-2015 Makoto Onuki <omakoto@google.com> More work on layered user restrictions.

- Now when DO/PO sets a user restriction, DPMS pushes it to UMS and
then UMS persists it, in order for UserManager.hasUserRestriction()
to never have to talk with DPMS, which would cause lock inversion.

- Also apply user restrictions when a user start.

- This is an updated version of the abandoned CL -- the difference
is, ActivityManager no longer has to call DPMS.

- Also removed an unnecessary write to userlist.xml in UMS.
upgradeIfNecessaryLP().

Bug 23902097
Bug 25388912
Bug 25354031
Bug 25641040

Change-Id: I0948aea06ad7d0f45fe612a431d765faddfe3c58
serManagerService.java
serRestrictionsUtils.java
b4fdb933cb7d48fd2b298a84e209cd7288f8a2c5 19-Nov-2015 Todd Kennedy <toddke@google.com> Merge "Allow ephemeral provider/installer"
d90b3c3df8ff68f347109fa63ba4d65cb7948c2f 19-Nov-2015 Felipe Leme <felipeal@google.com> Merge "Fixed typos."
b8a279ee838c309a64211a3caa5e5e204250163d 18-Nov-2015 Todd Kennedy <toddke@google.com> Allow ephemeral provider/installer

The ephemeral provider is a service that simply determines whether or
not an ephemeral application is available. The ephemeral installer
does the heavy lifting of installing the ephemeral application.

Bug: 25119046
Change-Id: I591f4c2c3f2b149d299fa8b4f359f2582d9199cb
phemeralResolverConnection.java
ackageManagerService.java
ba51235ef5c598d845b77fcf14491329493da34f 13-Nov-2015 Jeff Sharkey <jsharkey@android.com> More file-based encryption work.

Add new "am unlock-user" command so we can trigger changes from the
command line.

Move FBE check to static method so it can safely be called early
during boot before the mount service is ready. Move FBE emulation
to persisted system property, and start reading/writing that value.

Change default permission grants to ignore current encryption-aware
flags, since many of the target apps aren't crypto aware.

Always prepare package data directories, which is how we create the
new "user_de" paths during boot.

Bug: 22358539
Change-Id: I6f58ea2d34b3a466d3775d614f8a13de92272621
efaultPermissionGrantPolicy.java
ackageManagerService.java
ettings.java
serManagerService.java
3f24edf0dd57b5a4daa0e106ce66cac7472e2d2b 19-Nov-2015 Felipe Leme <felipeal@google.com> Fixed typos.

Change-Id: I13f2a0cd9b5e41a6af27fbbc6f33ecc0241b3c29
ackageManagerShellCommand.java
228c322c943ea8f5a4bbdcbdd73c5c40a4e093b1 18-Nov-2015 Xiaohui Chen <xiaohuic@google.com> Merge "Skip dead users when getting primary."
d3e9e1835b599a6d1dbe50ca1175b80023c6b5f0 18-Nov-2015 Xiaohui Chen <xiaohuic@google.com> Skip dead users when getting primary.

Bug: 25769085
Change-Id: I220d175839509e4dbf3f2992a90e9625d0caf825
serManagerService.java
488b4b5872f64c2e9df932c84593d5baf9155ee1 18-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Handle renamed packages during default grants" am: 140b101fcd am: 60cb22008c
am: 9bf367030c

* commit '9bf367030c24e93c711d2ba9ca5594e70a652596':
Handle renamed packages during default grants
9bf367030c24e93c711d2ba9ca5594e70a652596 17-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Handle renamed packages during default grants" am: 140b101fcd
am: 60cb22008c

* commit '60cb22008c602c5345504eacb4eb68ea0ac69cf0':
Handle renamed packages during default grants
60cb22008c602c5345504eacb4eb68ea0ac69cf0 17-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Handle renamed packages during default grants"
am: 140b101fcd

* commit '140b101fcdbdf413b914b5625b19577784ad9d88':
Handle renamed packages during default grants
f443384d9e30111aaa61dac75af1f40d19465e96 17-Nov-2015 Svet Ganov <svetoslavganov@google.com> Handle renamed packages during default grants

If an L device has a privileged app on the system image which was
updated and an M OTA renames the app package (supported only for
privileged apps) we end up with a disabled system package setting
with no package information. Since we are not doing a null check
of the package we get from the disabled package settings during
default grants we crash leaving the system in a bad state.

bug:25687380

Change-Id: I4f2ebcaf471e4bd1696298eab4716b50c52ca5c4
efaultPermissionGrantPolicy.java
505184bf459a1f961bb3ae77a4d021ebe55d65b3 17-Nov-2015 Svet Ganov <svetoslavganov@google.com> Don't grant runtime permissions on install to legacy apps

bug:25329324

Change-Id: Ia020b96eaef8895f0c2a13bddacfa7a053c56d32
ackageManagerService.java
1653ac43956f74a3a31d76711f9c07348716a3d5 17-Nov-2015 Dianne Hackborn <hackbod@google.com> Merge "Don't send PACKAGE_CHANGED of components to manifest receivers."
354c3bc3945cd0d676c403039c528c5f45d8a091 17-Nov-2015 Dianne Hackborn <hackbod@google.com> Merge "Some debugging improvements."
11c5b0aff7a742e21bd701ad04572dcf7e0f9332 16-Nov-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Reduce excessive locking in UserManager"
25bfb2b3d82797b78f5f6b5a715dbe5d192a0949 16-Nov-2015 Jeffrey Vander Stoep <jeffv@google.com> Merge "pm: selinux support for AutoPlay apps"
e80085d61ae6d9e496101f29051cfbb69185f96e 07-Nov-2015 Fyodor Kupolov <fkupolov@google.com> Reduce excessive locking in UserManager

Bug: 24979571
Change-Id: I1cfbe48712ae26ec134354d109d2538d566b92d7
ackageManagerService.java
serManagerService.java
9fdc67f90014c5160068c277711c76430eb8f380 13-Nov-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Moved system user apps whitelisting to PM"
70f929eedec10b154170ad66c9d53f18bfc4f613 11-Nov-2015 Makoto Onuki <omakoto@google.com> Disallow DA to reset password, also fix all DO checks

Now pure DA (not PO, not DO) aren't allowed to change the password
if one is already set.

Also update "isDeviceOwner" check and make sure we always take
user-id into account. If one really wishes to check the package name
only, then use getgetDeviceOwner() instead.

Also change the enforceNotManagedProfile() check to what's more
generic in the FBE world.

Bug 25645900
Bug 25547523
Bug 25643916

Change-Id: I588ecf9452fe3acc1fb0b4ca0457ad662382fcd2
ackageManagerService.java
1682dad7ed303fc43a07e70d0bb5cb42103a7624 12-Nov-2015 Fyodor Kupolov <fkupolov@google.com> Moved system user apps whitelisting to PM

Previously applications where uninstalled for the system user at a later stage
in a boot process, when PM has already been initialized and registered as
a service. This was causing a flood of PACKAGE_REMOVED broadcasts.

Applications are now uninstalled at an earlier stage, when PM hasn't been
registered. Packages can simply be marked as not installed and broadcast
can be skipped.

Bug: 25626819
Change-Id: Ib64e7c45619809b0efb99cc566a9a2120ed48cd3
ackageManagerService.java
a4407bfceef1bdb7eb4d83990722a61082d926c9 30-Oct-2015 Jeff Vander Stoep <jeffv@google.com> pm: selinux support for AutoPlay apps

Add AutoPlay flag to ApplicationInfo.

Append autoplay flag to seinfo string - passed to libselinux for
domain labeling decision.

Change-Id: Ieb45ba328140888c0b679bf344df154658f9fbae
ELinuxMMAC.java
f36003f620ba5fcb3a30dcdf77adb262b10866ee 11-Nov-2015 Dianne Hackborn <hackbod@google.com> Don't send PACKAGE_CHANGED of components to manifest receivers.

To reduce broadcast spam, when we send a PACKAGE_CHANGE filter that
to only go to registered receivers if it is reporting a change in
components of a package (not a change in the overall package). There
should be no reason for apps to launch if component states change
(they can always query the next time they run), and since apps can
change their component state as needed and don't think of this as
an especially expensive operation, we don't want that to result in
a lot of other apps launching.

Change-Id: I5fd005c4ff838b6eade767cf87a928e906f4de63
ackageManagerService.java
ettings.java
3cdb56efea044112bfe1b97b3ed78ee05e0dba46 11-Nov-2015 Dianne Hackborn <hackbod@google.com> Some debugging improvements.

- Fix dumping of package manager intent filters so the option
to print the filter detail works again.
- Extend dump resolvers to allow you to specify the specific
types of resolvers you'd like to dump.
- Add new package manager commands for querying activities,
services, receivers.
- Move the code for parsing a command line into an intent to
the framework, so it can be used by the new package manager
commands and later elsewhere.

Change-Id: I56ea2bb8c3dd0e5198ee333be8f41ad9dcdb626f
ackageManagerService.java
ackageManagerShellCommand.java
f9fc6d6cc05595241bc7ced6d4cab97b45f9b901 09-Nov-2015 Jeff Sharkey <jsharkey@android.com> More file-based encryption work.

Add granular StorageManager APIs for key creation/destruction and
unlocking/locking. Start passing through an opaque token as part
of the unlock command, but leave it empty for now. We now have a
separate "prepare" method that sanity checks that user directories
are correctly setup.

Define a handful of system properties used for marking devices that
should be operating in FBE mode, and if they're emulating FBE. Wire
a command to "sm", but persisting will come later.

Start using new "encryptionAware" flag on apps previously marked with
coreApp flag, which were apps running in the legacy CryptKeeper
model. Small tweaks to handle non-encryptionAware voice interaction
services. Switch PackageManager to consult StorageManager about the
unlocked state of a user.

Bug: 22358539
Change-Id: Ic2865f9b81c10ea39369c441422f7427a3c3c3d6
nstaller.java
ackageManagerService.java
serManagerService.java
183501e1aaee9584f8f0c6ea2d983e3fc17429d1 11-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Merge "Remove performBootDexOpt and am's ensurePackageDexOpt."
27c073796978106746e4a51f2100b29068ab37f6 05-Nov-2015 Nicolas Geoffray <ngeoffray@google.com> Remove performBootDexOpt and am's ensurePackageDexOpt.

Except common shared libraries and boot image, all compilations
are now done through BackgroundDexOptService.

Change-Id: Ib736e253c38b0c8085bc94e45f4e61a048f66e26
ackgroundDexOptService.java
ackageDexOptimizer.java
ackageManagerService.java
cab5208adfa352afb7d46bcdf5b9f7c94faa933b 10-Nov-2015 Todd Kennedy <toddke@google.com> Merge "Move 'un/install' to cmd"
90d3c037b04376b19f214528aa3123d28f6ba9b2 10-Nov-2015 Jeff Sharkey <jsharkey@google.com> Merge "Temporarily disable to fix deadlock."
3eef5a5273ed6fb1c2d96d80acea4553057d8d09 10-Nov-2015 Jeff Sharkey <jsharkey@android.com> Temporarily disable to fix deadlock.

Bug: 25584022
Change-Id: Icee579cfebfb75c573e9a54622f219e0f81fbd35
ackageManagerService.java
72cfcd02b89838264b018e9b9417d2829c87b7e2 04-Nov-2015 Todd Kennedy <toddke@google.com> Move 'un/install' to cmd

Move the implementation of the install variants and uninstall to the cmd
command. Additionally, make two other important changes: 1) replace calls
to the legacy PackageManager#installPackageAsUser with the PackageInstaller
2) allow streaming package bits for 'pm install'

Change-Id: I5680f57208d377daadb69b2cc09c233c02fe5016
ackageManagerShellCommand.java
f49bec047a69859190c8331b46eb454d88521420 09-Nov-2015 Guang Zhu <guangzhu@google.com> Merge "Revert "Move 'un/install' to cmd""
18bc3305e43a040018add48c97cfbc7b3d9ecf7c 09-Nov-2015 Todd Kennedy <toddke@google.com> Revert "Move 'un/install' to cmd"

This reverts commit ec059d839de6d061085dcfd85ce6565dcf4d5b69.

Change-Id: Ieaa1373e96fb4cc20aa41c3159518bd9e86c572b
ackageManagerShellCommand.java
d59262667cbcdfedd9b03dccaa26a9a000486350 09-Nov-2015 Nicolas Prévot <nprevot@google.com> Merge "Add method to tell the dpc if provisioning is allowed."
5d7e9516861b8248f728641d7ae7a54b82a1255d 08-Nov-2015 Jeff Sharkey <jsharkey@google.com> Merge "More APIs for encryption-aware apps."
e17ac1569793c333bb4dce86607a342e7c982ae7 07-Nov-2015 Jeff Sharkey <jsharkey@android.com> More APIs for encryption-aware apps.

Apps can mark manifest components as being encryption-aware, which
means they can safely be run before the credential encrypted storage
is available.

Start adding filtering logic so that we only return these components
when a user is running "with amnesia." That is to say, only device
encrypted storage is available, so the user is running but with only
partial knowledge of its data.

To avoid calling into ActivityManager with the PackageManager lock
held, we quickly determine user state and splice the state into the
flags for later per-component evaluation.

Bug: 22358539
Change-Id: Idc56ec29f1ef04da8963e004314d7f5e47400997
ackageManagerService.java
ettings.java
serManagerService.java
94d0b64d4fed8377be2374eb7d31aa270a9c9aff 07-Nov-2015 Jeff Sharkey <jsharkey@google.com> Merge "Initial file-based encryption public APIs."
15447798a38d2b5acb1998731340255f4203f294 06-Nov-2015 Jeff Sharkey <jsharkey@android.com> Initial file-based encryption public APIs.

Define two explicit directories where device-encrypted and
credential-encrypted data will be stored. Third-party apps only
need access to the device-encrypted directory, so that's the only
API exposed for now.

General cleanup in how ApplicationInfo details are derived.

Bug: 22358539
Change-Id: If0a0108721a4aa1c3052b4912e08604bbf24e1ae
ackageManagerService.java
9e935a3bc9d1426a974fbe918d095900c3947ecd 06-Nov-2015 Makoto Onuki <omakoto@google.com> Make sure to persist user restrictions in UMS

Bug 25565111

Change-Id: Ic48ce728a1c2b55d70276a37b9a359407167edf1
serManagerService.java
86cd001e364d0d0a8253cf4ee14acd13915cbd9a 06-Nov-2015 Makoto Onuki <omakoto@google.com> Merge "Have AudioService listen to DISALLOW_UNMUTE_MICROPHONE and"
ec059d839de6d061085dcfd85ce6565dcf4d5b69 04-Nov-2015 Todd Kennedy <toddke@google.com> Move 'un/install' to cmd

Move the implementation of the install variants and uninstall to the cmd
command. Additionally, make two other important changes: 1) replace calls
to the legacy PackageManager#installPackageAsUser with the PackageInstaller
2) allow streaming package bits for 'pm install'

Change-Id: Ia49dac0ccd6470f9d1c1964bdeb3c0b22b856075
ackageManagerShellCommand.java
a2e846013b251e9b2e490bc6491ddbb77b7bb306 06-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Take into account default app for default grants" am: 7abb36599d am: 57fb4bd4f7
am: 66ce9698dc

* commit '66ce9698dc06662b4f3d5aece80f33d52efca53f':
Take into account default app for default grants
66ce9698dc06662b4f3d5aece80f33d52efca53f 06-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Take into account default app for default grants" am: 7abb36599d
am: 57fb4bd4f7

* commit '57fb4bd4f704c93ff73e055e6602ee18f7dbf669':
Take into account default app for default grants
8800ac78e9c7d8b0bba5dc42a7e931d93c1d6c13 06-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Revert "Take into account default app for default grants"" am: 9ae3aeec53 am: 0c4ce4474f
am: 88cdc715c0

* commit '88cdc715c0795969be7f68d7363a0edfecebeea2':
Revert "Take into account default app for default grants"
57fb4bd4f704c93ff73e055e6602ee18f7dbf669 06-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Take into account default app for default grants"
am: 7abb36599d

* commit '7abb36599d9537296d9a51f766152025c6ed0491':
Take into account default app for default grants
88cdc715c0795969be7f68d7363a0edfecebeea2 06-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Revert "Take into account default app for default grants"" am: 9ae3aeec53
am: 0c4ce4474f

* commit '0c4ce4474ff0020b2b041f26fb00efbdc0783285':
Revert "Take into account default app for default grants"
5d05bbea5faad9f9b53f8fe9cb0635429969959a 06-Nov-2015 Svetoslav <svetoslavganov@google.com> Take into account default app for default grants

Change-Id: Ib78c7dbda65d405bbf74544cad18e5e10bfcdeec
efaultPermissionGrantPolicy.java
0c4ce4474ff0020b2b041f26fb00efbdc0783285 06-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Revert "Take into account default app for default grants""
am: 9ae3aeec53

* commit '9ae3aeec532ce5a7908d395049efb61399875360':
Revert "Take into account default app for default grants"
9ae3aeec532ce5a7908d395049efb61399875360 06-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Revert "Take into account default app for default grants""
d2bbf1bf0af14231e89f1ecf443e4f4c847bc301 06-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Revert "Take into account default app for default grants"

Apparently OEMs can set the chooser so this patch is not enough since it assumes the chooser is a platform component.

This reverts commit fce33d58d87fd494686aae4e21332b58ec260b73.

Change-Id: I3b8e499d2f0a731a227d193f6c5d6ed528be2272
efaultPermissionGrantPolicy.java
3b0660412ce46eece710bbf1fc3c0b14ea08deef 05-Nov-2015 Jeff Sharkey <jsharkey@google.com> Merge "Kick movement preconditions onto handler thread." into mnc-dr-dev am: e10faaa410 am: 2de7e39ffa am: 73d60ff36f
am: 8bad938369

* commit '8bad93836922805a93c2385fa79e22de8288f9ab':
Kick movement preconditions onto handler thread.
8bad93836922805a93c2385fa79e22de8288f9ab 05-Nov-2015 Jeff Sharkey <jsharkey@google.com> Merge "Kick movement preconditions onto handler thread." into mnc-dr-dev am: e10faaa410 am: 2de7e39ffa
am: 73d60ff36f

* commit '73d60ff36fbf656d022c2d4f35b8e9f2d25e795f':
Kick movement preconditions onto handler thread.
2de7e39ffa387b370e5997542811fd05a73cb8fc 05-Nov-2015 Jeff Sharkey <jsharkey@google.com> Merge "Kick movement preconditions onto handler thread." into mnc-dr-dev
am: e10faaa410

* commit 'e10faaa41026863b9d0f7dd6b0c239ff79586dc7':
Kick movement preconditions onto handler thread.
f131e1aae9c04d58a6ac0c51555ed90ea4158d6e 05-Nov-2015 Jeff Sharkey <jsharkey@android.com> Kick movement preconditions onto handler thread.

The bulk of package moving already occurs on the handler thread,
but one of the precondition steps requires that we make an installd
call to calculate disk space of the app. If there was already
another long-running installd call going on, we could end up ANR'ing
the caller.

Since movePackage() is already designed to return a moveId and go
async, we can push all the precondition steps onto the handler thread
to prevent the ANR.

Bug: 25490003
Change-Id: I62d555c23bbf81b791f6f4cabc40c3d64c580cf8
ackageManagerService.java
3b2872a87159e6ba1a4212465a395ffbcbfccc74 05-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Take into account default app for default grants" am: 82eeb2f20c am: 0c7e9262a1
am: f7db8e407b

* commit 'f7db8e407b02a3cb2fe1e1e5838b1ebcb67f6dc5':
Take into account default app for default grants
4c515357e5aad1b500ac07ebdbee9d08dc37c927 05-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Enforce weaker grant if app is default handler for miltiple action" am: 035374d7a2 am: a9b62e1330
am: 1809ccc62e

* commit '1809ccc62e6c3649b3024a099dccccb3b773cf49':
Enforce weaker grant if app is default handler for miltiple action
f7db8e407b02a3cb2fe1e1e5838b1ebcb67f6dc5 05-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Take into account default app for default grants" am: 82eeb2f20c
am: 0c7e9262a1

* commit '0c7e9262a1cc89b748e281f330dd1ffecec6df3f':
Take into account default app for default grants
1809ccc62e6c3649b3024a099dccccb3b773cf49 05-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Enforce weaker grant if app is default handler for miltiple action" am: 035374d7a2
am: a9b62e1330

* commit 'a9b62e13305d9cb43f53831f0b92d72bd490c1ae':
Enforce weaker grant if app is default handler for miltiple action
0c7e9262a1cc89b748e281f330dd1ffecec6df3f 05-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Take into account default app for default grants"
am: 82eeb2f20c

* commit '82eeb2f20c934ddc97380032b3c8ecacc21d9a04':
Take into account default app for default grants
a9b62e13305d9cb43f53831f0b92d72bd490c1ae 05-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Enforce weaker grant if app is default handler for miltiple action"
am: 035374d7a2

* commit '035374d7a29b4e0b0bc71bdfb3555b2e547ce1da':
Enforce weaker grant if app is default handler for miltiple action
82eeb2f20c934ddc97380032b3c8ecacc21d9a04 05-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Take into account default app for default grants"
5db602fd196cde39feed21e173b553aae136d040 03-Nov-2015 Svetoslav <svetoslavganov@google.com> Enforce weaker grant if app is default handler for miltiple action

Change-Id: Ibc46e458e277412ebb276eb5ba6f2765b6b6c5e9
efaultPermissionGrantPolicy.java
ackageManagerService.java
d45a4a2ecb18701b4cfadcb4a26663f2eab642fe 03-Nov-2015 Makoto Onuki <omakoto@google.com> Have AudioService listen to DISALLOW_UNMUTE_MICROPHONE and

... DISALLOW_ADJUST_VOLUME, instead of UserManager pushing
new settings to AudioService.

Also:
- Allow PO to set these two restrictions.

- Now AS.setMasterMuteInternal() respects mUseFixedVolume to make
it consistent with readPersistedSettings().

- When a user switches and restores the mute state in
AS.readPersistedSettings(), also check the current user restrictions
in addition to system settings. Because of the delay in AudioService
before persisting the mute settings in setMasterMuteInternal() and
setMicrophoneMute(), there's was an edge case
DISALLOW_UNMUTE_MICROPHONE and DISALLOW_ADJUST_VOLUME would be ignored
when the user switches right after they are set.

Bug 24981972

Change-Id: I4d9b709a0a0e6812319204568c6e44d6664bdeb4
serManagerService.java
serRestrictionsUtils.java
07387fedfafa72bcb68defd801eef82f1f494d7c 30-Oct-2015 Nicolas Prevot <nprevot@google.com> Add method to tell the dpc if provisioning is allowed.

The DPC can use it to tell if provisioning a managed profile or for
device owner would work or not.

BUG:25338478
Change-Id: I09ea6a9f23a8e88e4ed37c048170b2a68213086e
serManagerService.java
965da39942f9a8736f785f7c57a6c351a8c89d6b 28-Oct-2015 Clara Bayarri <clarabayarri@google.com> Create a File Based Encryption check API

Change-Id: Ibf41f98818ea801b9f690200c340be80c3b9bf31
serManagerService.java
8948c01eb726ec79983472e5597ddac8004f9f44 03-Nov-2015 Jeff Sharkey <jsharkey@android.com> Yell when calling installd with PM lock held.

As a matter of policy, we should never be holding the mPackages lock
while calling down into installd. This little bit of logic helps us
catch accidental cases where this happens.

Change-Id: I676c81df43ef936ffd36290d45a79429630c1b4b
nstaller.java
ackageManagerService.java
598ee3f6c2cca9eecc7ad90f2003e36f5fb04114 03-Nov-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Introduced short-term lock for UMS internal state"
82402753815ff4633cc572713ae490a17d9129e5 28-Oct-2015 Fyodor Kupolov <fkupolov@google.com> Introduced short-term lock for UMS internal state

Added mUsersLock - short-term lock for internal state, when interaction and
synchronization with PM is not required. Modifications to mUsers and
mRemovingUserIds must be guarded by 3 locks: mInstallLock, mPackagesLock and
mUsersLock. While reads can use mUsersLock.

Testing revealed that the following methods in UMS often cause contention:
- exists
- getUserInfo
- getProfileParent

They all now use a short-term lock mUsersLock for reads.

Bug: 24979571
Change-Id: Ie3a22ea7cbb450c7969800fe2a4a2b2516165e5b
ackageManagerService.java
serManagerService.java
fce33d58d87fd494686aae4e21332b58ec260b73 03-Nov-2015 Svetoslav <svetoslavganov@google.com> Take into account default app for default grants

Use the correct API to query activities when granting
default permissions to ensure the preferred apps are
taken into account. This allows OEMs to customize which
app should get default permission grants if there is
more than one resolving to the query intent.

Change-Id: I047f22dfff773a2ba9de1a0144442e372607777c
efaultPermissionGrantPolicy.java
671b8721b01d911cabee8467290f363becbe49c7 03-Nov-2015 Todd Kennedy <toddke@google.com> Merge "Implement shell commands for package and user services"
60459abb211a11caf71238a44f543fdc18289772 30-Oct-2015 Todd Kennedy <toddke@google.com> Implement shell commands for package and user services

Only implement the 'list' package service command. More will follow
in future CLs.

Change-Id: Iae225cd4ee63c7d468a4fd882d8cb4b6b76ccc09
ackageManagerService.java
ackageManagerShellCommand.java
serManagerService.java
4f16073556f7978708fb71c87628cfe1692412d5 28-Oct-2015 Makoto Onuki <omakoto@google.com> Make UserManager enforce user restrictions, not DPM.

- Now even if a user restriction is set via UserManager, it'll be correctly
enforced.

- Changed the way AudioService enforces the OP_MUTE_MICROPHONE and
OP_AUDIO_MASTER_VOLUME app ops -- previously, when they're set, even a muting
call would be rejected. This was why DPMS.setUserRestriction() used different
calling orders for DISALLOW_UNMUTE_MICROPHONE/DISALLOW_ADJUST_VOLUME depending
on setting them or clearing them.
Now, even when the app ops are set, we still allow muting calls.

Bug 23902097
Bug 24981972

Change-Id: I865b5de43e15f5955f94006475a5ec6254904d31
serManagerService.java
serRestrictionsUtils.java
5263492de62c4dac099d0aa0f70056dbc729b06b 02-Nov-2015 Makoto Onuki <omakoto@google.com> Merge "Allow DO to disable camera device-wise."
759a763f5f03fda86b96d238faedb870fbee24ec 29-Oct-2015 Makoto Onuki <omakoto@google.com> Allow DO to disable camera device-wise.

Bug 24538855

Change-Id: I421690f14ee57fa818d2b233fe48a90a0a575a9e
serManagerService.java
f2e81e904a57660eabcb4c0c24bf8e6e6b1f6467 02-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Don\'t try overriding system fixed permissions on install" into mnc-dr-dev am: a47f9dad2b am: c4c1866228
am: 023f4d158d

* commit '023f4d158d96bb4237733db0a1e124eae499d7cc':
Don't try overriding system fixed permissions on install
c4c1866228a776758d71cf4d171a17fa01891d89 02-Nov-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Don\'t try overriding system fixed permissions on install" into mnc-dr-dev
am: a47f9dad2b

* commit 'a47f9dad2bd70b594e445a6a448877122f28517a':
Don't try overriding system fixed permissions on install
4f7883ce61aa8781f8781104fbee18d8ba1feb81 02-Nov-2015 Svet Ganov <svetoslavganov@google.com> Don't try overriding system fixed permissions on install

bug:25397466

Change-Id: Ie92ec000a94b757178ddfdd9384407535f4af9db
ackageManagerService.java
be8c7c8d04983f881ed325f426265d7da6397dec 02-Nov-2015 Jeff Sharkey <jsharkey@android.com> PackageSettingBase needs to copy volume UUID. am: 3b1c6e03f6 am: e63509b509 am: 12d2e98fe0
am: ca3b971e7a

* commit 'ca3b971e7a4c3ca8e55eaa505556a02964b4e299':
PackageSettingBase needs to copy volume UUID.
ca3b971e7a4c3ca8e55eaa505556a02964b4e299 02-Nov-2015 Jeff Sharkey <jsharkey@android.com> PackageSettingBase needs to copy volume UUID. am: 3b1c6e03f6 am: e63509b509
am: 12d2e98fe0

* commit '12d2e98fe07764475cae788aa6ff20406d1ee4c9':
PackageSettingBase needs to copy volume UUID.
e63509b5093776e0320876719226cbbb16cc5eab 02-Nov-2015 Jeff Sharkey <jsharkey@android.com> PackageSettingBase needs to copy volume UUID.
am: 3b1c6e03f6

* commit '3b1c6e03f67ba8e4a4f4a98e996c7ceabf36affa':
PackageSettingBase needs to copy volume UUID.
e19dcaa50f1a74d0151891826402b2802b6526ea 02-Nov-2015 Clara Bayarri <clarabayarri@google.com> Merge "Return actual userId when File Based Encryption is present"
3b1c6e03f67ba8e4a4f4a98e996c7ceabf36affa 31-Oct-2015 Jeff Sharkey <jsharkey@android.com> PackageSettingBase needs to copy volume UUID.

When copying all fields from one PackageSettingBase to another, we
also need to copy volumeUuid, which had previously been missed.

Without this, packages using sharedUserId that are installed on
adopted storage devices will be destroyed, since after reboot we
think they actually belong on internal storage (where volumeUuid is
null).

Bug: 25334169
Change-Id: I223361bd1e19e7d5dd78626682ac7c5cbecb9fa1
ackageSettingBase.java
df5f870d989bd1f3c94466adace1e3879d77178e 30-Oct-2015 Jeff Sharkey <jsharkey@android.com> resolve merge conflicts of 07c6628d68 to master.

Change-Id: I29c9b408956c578ce1cfe0eb5d8704b7a5d2f818
07c6628d68da39582d8d682bc9c849be8bfaaa10 30-Oct-2015 Jeff Sharkey <jsharkey@google.com> Merge "Handle "uninstalled" apps when pruning app-ops." into mnc-dr-dev am: a975732a83 am: 637d05eb5c
am: d359137d41

* commit 'd359137d419023f207351251cdbfa23180236963':
Handle "uninstalled" apps when pruning app-ops.
637d05eb5c19825b1f9a7da481037a0c54add08d 30-Oct-2015 Jeff Sharkey <jsharkey@google.com> Merge "Handle "uninstalled" apps when pruning app-ops." into mnc-dr-dev
am: a975732a83

* commit 'a975732a8302893a40cdc444f893bf09b7669173':
Handle "uninstalled" apps when pruning app-ops.
e2ed23e6b221185ce2587fb19a6e904dbf7ec77b 30-Oct-2015 Jeff Sharkey <jsharkey@android.com> Handle "uninstalled" apps when pruning app-ops.

During system boot, we prune app-ops belonging to apps that have
been uninstalled. However, apps installed on adopted storage devices
haven't been scanned at this point, so they appear to be uninstalled.

To avoid pruning app-ops for these apps, we need a getPackageUid()
variant that also considers "uninstalled" apps for which we still
have PackageSetting values.

Bug: 25206071
Change-Id: I1820f674d45c5ddc1c5f10ed7d859e7025005e28
ackageManagerService.java
0529672a8cffd2abb749265ddeb703a179c34662 29-Oct-2015 John Reck <jreck@google.com> resolve merge conflicts of a1b8d77ca3 to master.

Change-Id: Ia78c6d31687542dfaba20b177e774333cfb1edb5
a1b8d77ca3ea6cc5e851dce8701785524e3049eb 29-Oct-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Make SYSTEM_ALERT_WINDOW development permission" into mnc-dr-dev am: 2658cb002a am: 35151fbc8b
am: 08d013d3a1

* commit '08d013d3a1e6306533c2fae1a4581986ffc9a642':
Make SYSTEM_ALERT_WINDOW development permission
35151fbc8b028f6633f477fd36044032a03b2bff 29-Oct-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Make SYSTEM_ALERT_WINDOW development permission" into mnc-dr-dev
am: 2658cb002a

* commit '2658cb002abae9341c9a82bfeaed764ba5bf97c8':
Make SYSTEM_ALERT_WINDOW development permission
2658cb002abae9341c9a82bfeaed764ba5bf97c8 29-Oct-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Make SYSTEM_ALERT_WINDOW development permission" into mnc-dr-dev
01af6a42a6a008d4b208a92510537791b261168c 27-Oct-2015 Svetoslav <svetoslavganov@google.com> Make SYSTEM_ALERT_WINDOW development permission

bug:25329324

Change-Id: I0086464846bab9424764dd0d726692d96a0f1207
ackageManagerService.java
a7473a671c717d77fd32e6155e16635dbe7c173e 27-Oct-2015 Svetoslav <svetoslavganov@google.com> Installer can override system or policy

The installer can grant permissions at install/update. It
can wrongly override system and policy and grant permissions
explicitly revoked by the system or device/profile owner.

bug:25323455

Change-Id: Ica4241bfdef753e1d6cb80692c6b375300a05459
ackageManagerService.java
068c54a5be697c3df4657dcda33cd17c4b547710 13-Oct-2015 Makoto Onuki <omakoto@google.com> Layer user restrictions

- Now DPMS remembers user restrictions set by DO / PO in their ActiveAdmin.

- User restrictions set by DO/PO will no longer be saved by UserManger. Instead,
when needed, UMS will consult DPMS to build "effective" user restrictions.

- UM.getUserRestrictions() will now always return "effective" user restrictions.

- DPMS migrates existing user restrictions per the eng spec.

- Also now UM.setUserRestrictions() will crash. UMS.setUserRestrictions() has
been removed.
This was needed because UM.setUserRestrctions(UM.getUserRestrictions()) will no
longer be a valid use like it used to be.

- Also introduced a fined-grained lock for user restrictions in UM to avoid
deadlock between DPMS and also for better performance.

Bug 23902097

Change-Id: If0e1e49344e2f3e9226532d00777976d1eaa7df3
serManagerService.java
serRestrictionsUtils.java
8e46e7db5d47818b469366c044ed6f29696fdc32 26-Oct-2015 Xiaohui Chen <xiaohuic@google.com> Scan package with null user context.

Bug: 25185277
Change-Id: Ib15c04b55b10e315f186dd58a9489bbfcd527061
ackageManagerService.java
f05b9d0830ab7fd1ba4da8801194353889919ffc 23-Oct-2015 Clara Bayarri <clarabayarri@google.com> Return actual userId when File Based Encryption is present

The existing UserManagerService#getCredentialOwnerProfile always
returned the parent profile for the given userId. With File
Based Encryption, we want to enable per-user credentials.

This is part of the Separate Work Challenge feature.

Change-Id: If5b32d22a5da63103b773acbe4a6d1396d34412b
serManagerService.java
4c6b40ec81c6394cb10e5ecb6c00d1412cba8272 23-Oct-2015 Daniel Cashman <dcashman@google.com> Merge "libs: add libpackagelistparser" am: cc7373eafd am: 188e8875db
am: a2dbc1cea3

* commit 'a2dbc1cea3c60510f27bfeb39012ae2c2796503c':
libs: add libpackagelistparser
a2dbc1cea3c60510f27bfeb39012ae2c2796503c 23-Oct-2015 Daniel Cashman <dcashman@google.com> Merge "libs: add libpackagelistparser" am: cc7373eafd
am: 188e8875db

* commit '188e8875db1a55a6bafc8e8ef741400baab6e6fb':
libs: add libpackagelistparser
188e8875db1a55a6bafc8e8ef741400baab6e6fb 23-Oct-2015 Daniel Cashman <dcashman@google.com> Merge "libs: add libpackagelistparser"
am: cc7373eafd

* commit 'cc7373eafd0d5be7df8898748a700b47298ebf10':
libs: add libpackagelistparser
c982b407b9ff83465a12ec9225409edf45828ef0 22-Oct-2015 Nicolas Prévot <nprevot@google.com> Merge "Don\'t resolve cross-profile app links without intent picker." into mnc-dr-dev am: 6666b29cf7 am: f31628f58b am: d7688f5933
am: e1be56cdff

* commit 'e1be56cdfff431985ffd931bdd7c001e4c87478d':
Don't resolve cross-profile app links without intent picker.
e1be56cdfff431985ffd931bdd7c001e4c87478d 22-Oct-2015 Nicolas Prévot <nprevot@google.com> Merge "Don\'t resolve cross-profile app links without intent picker." into mnc-dr-dev am: 6666b29cf7 am: f31628f58b
am: d7688f5933

* commit 'd7688f593327929e2bc42989236b62ddecf5e8b5':
Don't resolve cross-profile app links without intent picker.
f31628f58b97f99133b760b4c34d2ff6f4e456d0 22-Oct-2015 Nicolas Prévot <nprevot@google.com> Merge "Don\'t resolve cross-profile app links without intent picker." into mnc-dr-dev
am: 6666b29cf7

* commit '6666b29cf7c5ddaeae3d66606a9982f7c5cc8686':
Don't resolve cross-profile app links without intent picker.
73e82d78576ee961dd3b54143bbe5edefca71e73 22-Oct-2015 Anthony Hugh <ahugh@google.com> Merge "Give watch Home app location permissions by default" into cw-e-dev am: 0a3270e00a am: 5f8ac21cac
am: a7882195a9

* commit 'a7882195a9888b2003c95d34a2d0aa5c53f61b62':
Give watch Home app location permissions by default
a7882195a9888b2003c95d34a2d0aa5c53f61b62 22-Oct-2015 Anthony Hugh <ahugh@google.com> Merge "Give watch Home app location permissions by default" into cw-e-dev am: 0a3270e00a
am: 5f8ac21cac

* commit '5f8ac21cac89077edd50d547b43550296a506d4b':
Give watch Home app location permissions by default
0a3270e00ab6bbba5669288f958cc88c8484a587 22-Oct-2015 Anthony Hugh <ahugh@google.com> Merge "Give watch Home app location permissions by default" into cw-e-dev
ff91ef8ed1156e29af212417c290c295eb7e0320 22-Oct-2015 Nicolas Prevot <nprevot@google.com> Don't resolve cross-profile app links without intent picker.

If ALLOW_CROSS_PROFILE_APP_LINKING has been set:
If there is an app with status always across profiles, and some
apps without status always in the current profile: show an intent
picker instead of directly resolving across profiles.

BUG:25109215

Change-Id: I74a67d231284ce912121ea0818109fbf904183e8
ackageManagerService.java
b32f8a2b53655fe5380ec8ed3880c5bed3209dca 22-Oct-2015 Esteban Talavera <etalavera@google.com> Merge "Only system can set app restrictions"
f81de0e4a5f33e8d044e18d7f65dbc40ad819e3c 21-Oct-2015 Todd Kennedy <toddke@google.com> Merge "Maintain shared user list on OTA" into mnc-dr-dev am: 0cd10ec8cf am: d12f298da4 am: c9f3b2f54b
am: 68457b9cd4

* commit '68457b9cd49a695ed50c51eb9c0d0b63fcead737':
Maintain shared user list on OTA
68457b9cd49a695ed50c51eb9c0d0b63fcead737 21-Oct-2015 Todd Kennedy <toddke@google.com> Merge "Maintain shared user list on OTA" into mnc-dr-dev am: 0cd10ec8cf am: d12f298da4
am: c9f3b2f54b

* commit 'c9f3b2f54b042df97a806ad114f21cca26a8341a':
Maintain shared user list on OTA
a15f791cd8f33565a7b03c86c9da186e5a1e235f 21-Oct-2015 Jeff Sharkey <jsharkey@android.com> Narrow permission re-granting to specific volume. am: 052366ca4e am: 0b639c78f1 am: 7a6a7ae64d
am: 949ea14429

* commit '949ea1442925cbbce72ccff1b0ffc7c7f876e97b':
Narrow permission re-granting to specific volume.
949ea1442925cbbce72ccff1b0ffc7c7f876e97b 21-Oct-2015 Jeff Sharkey <jsharkey@android.com> Narrow permission re-granting to specific volume. am: 052366ca4e am: 0b639c78f1
am: 7a6a7ae64d

* commit '7a6a7ae64dea59c0ee3e617c333ec389fcfe911c':
Narrow permission re-granting to specific volume.
d12f298da4748321d9023185a4ee09c3324c4673 21-Oct-2015 Todd Kennedy <toddke@google.com> Merge "Maintain shared user list on OTA" into mnc-dr-dev
am: 0cd10ec8cf

* commit '0cd10ec8cf7a896bbdfc0639bf5f9c663c46edbb':
Maintain shared user list on OTA
0cd10ec8cf7a896bbdfc0639bf5f9c663c46edbb 21-Oct-2015 Todd Kennedy <toddke@google.com> Merge "Maintain shared user list on OTA" into mnc-dr-dev
0b639c78f112252b93314f016b0e1ed1abafc4e3 21-Oct-2015 Jeff Sharkey <jsharkey@android.com> Narrow permission re-granting to specific volume.
am: 052366ca4e

* commit '052366ca4e6138b583d08535bd1837deb7cd58d0':
Narrow permission re-granting to specific volume.
68f6715bb283de2aa1678ffa16f69fd897300d8d 21-Oct-2015 Todd Kennedy <toddke@google.com> Maintain shared user list on OTA

When a package is removed during an OTA, we weren't removing it from the
shared user list. This means anyone asking for the packages for a shared
UID would continue to see the old package.

Bug: 24906701
Change-Id: Ifb6d64195e6b8af7454e19591611af66a40cbd10
ettings.java
3a36f0a3ab7af0fde7267c70c4866c145b23aeb3 21-Oct-2015 Anthony Hugh <ahugh@google.com> Merge "Watch dialer should have phone permission fixed" into cw-e-dev am: 52c6f9ecb3 am: 2cd707ef13
am: 2b76beebac

* commit '2b76beebacacc438478b617020ed7e3a71c5f6fc':
Watch dialer should have phone permission fixed
2b76beebacacc438478b617020ed7e3a71c5f6fc 21-Oct-2015 Anthony Hugh <ahugh@google.com> Merge "Watch dialer should have phone permission fixed" into cw-e-dev am: 52c6f9ecb3
am: 2cd707ef13

* commit '2cd707ef137aedfc3d0bc048a21e122842cce8f6':
Watch dialer should have phone permission fixed
52c6f9ecb3b5c49a16f493f9e1111d1c10a48bd7 21-Oct-2015 Anthony Hugh <ahugh@google.com> Merge "Watch dialer should have phone permission fixed" into cw-e-dev
90814f0006a8d4102870891b001183ef84b314e5 21-Oct-2015 Anthony Hugh <ahugh@google.com> Give watch Home app location permissions by default

BUG: 24973857
Change-Id: Ia2758a1822791fb89e6e1f6f20daba9e93cf1794
efaultPermissionGrantPolicy.java
d4539926a343f61084e67de35ef8287e2a706b04 19-Oct-2015 Anthony Hugh <ahugh@google.com> Watch dialer should have phone permission fixed

Watch dialer should have phone permission as fixed.

BUG: 24976862
Change-Id: I8bbc63ab0d7dfb2e38eec641681ac9aacae330a0
efaultPermissionGrantPolicy.java
052366ca4e6138b583d08535bd1837deb7cd58d0 21-Oct-2015 Jeff Sharkey <jsharkey@android.com> Narrow permission re-granting to specific volume.

When mounting a storage volume after an SDK upgrade, the platform
grants install permissions requested by apps. This patch fixes a
bug that was causing us to re-grant permissions for all installed
apps; we now narrow the granting to just the storage volume of
interest.

Also fixes a bug where scanning of internal ASECs would bump the
VersionInfo of the legacy apps-on-SD volume.

There is still a bug here around internal ASECs not being considered
for re-grants, but that needs to be fixed in a more invasive CL that
creates a separate VersionInfo. In addition, internal ASECs (also
known as forward locked apps) have been deprecated for some time.

Bug: 24583803
Change-Id: I9115fd484ec083bc10a970f5f612860d5a53e520
ackageManagerService.java
2a5d6c6cbd0286ebca844d4fb8f4d3437ad1ecdd 21-Oct-2015 Esteban Talavera <etalavera@google.com> Only system can set app restrictions

Only system/root UIDs or components with MANAGE_USERS permission
can set app restrictions. Apps should only be able to retrieve their
own restrictions, but not set them.

Change-Id: I1ebf30dc6ef5af12fa79230618f89b43aa7b1fb6
serManagerService.java
008672f62d15bac2b26502f20688da92d5ad3292 21-Oct-2015 Jeff Sharkey <jsharkey@google.com> Merge "Correctly derive ABI for apps on adopted media." into mnc-dr-dev am: 55d2b6e8e6 am: 257d2ca7fd am: e01b99faa5
am: 6dee8faff3

* commit '6dee8faff3b25c6dd6c8fa308ceb0fb8b31f6a05':
Correctly derive ABI for apps on adopted media.
6dee8faff3b25c6dd6c8fa308ceb0fb8b31f6a05 21-Oct-2015 Jeff Sharkey <jsharkey@google.com> Merge "Correctly derive ABI for apps on adopted media." into mnc-dr-dev am: 55d2b6e8e6 am: 257d2ca7fd
am: e01b99faa5

* commit 'e01b99faa54a083ae7b10db902a03f4aa6c9bd63':
Correctly derive ABI for apps on adopted media.
257d2ca7fd75926bd1cfd13d3a07809e2d51a097 21-Oct-2015 Jeff Sharkey <jsharkey@google.com> Merge "Correctly derive ABI for apps on adopted media." into mnc-dr-dev
am: 55d2b6e8e6

* commit '55d2b6e8e6f364e2fd52c45b5fa3eb6a56082456':
Correctly derive ABI for apps on adopted media.
bbcb3312050dc89385e70e96fee7d88fbcb4e794 21-Oct-2015 Jeff Sharkey <jsharkey@android.com> Correctly derive ABI for apps on adopted media.

There was a bug causing PackageManager to think apps on adopted media
were actually in an ASEC, causing it to skip ABI derivation. This
change fixes the issue by copying the volume UUID into place early
in the scanning process.

Also fixes two places where we had incorrectly been including apps
on adopted media; switched them to check only for ASECs.

Bug: 24583803
Change-Id: If66d1bce02824a4d8e22f741b04a2abda0378cfb
ackageManagerService.java
2fbd20fd7b213daef99598a836c285fdf7794c57 20-Oct-2015 Todd Kennedy <toddke@google.com> Merge "Enable "quick install""
27c24fb8b85c36298de053699b1967a808c6d308 18-Sep-2015 Todd Kennedy <toddke@google.com> Enable "quick install"

Quick install skips a lot of the normal install steps in order to
dramatically reduce the installation time [eg Twitter normally takes
20s to install. But, installs in under 2.5s with quick install]

The specific optimizations [with caveats]:
1. Use the JIT. Although the oat file is technically created, it
only contains the exploded contents of the APK and does not contain
pre-compiled native binary code. While this improves install time,
it impacts app execution. [saves 17s]
2. Bypass Play verification. Play normally verifies all installs
to ensure we're not installing malware. But, it can take multiple
seconds for Play to collect and send package information to our
backend servers. [saves 2.7s]
3. Reduce JAR file verification. Due to the structure of the JAR
certs, we cannot completely bypass JAR processing. However we skip
the step of verifying every manifest entry. [saves 1.3s]

NOTE: #2 and #3 will only occur on eng/user-debug builds.

Bug: 22848361
Change-Id: I48e77595ad5c13a9534fdb06da67ba8dae2797fb
ackageDexOptimizer.java
ackageInstallerSession.java
ackageManagerService.java
fd5b77444edaec88895344a629d071ecf352cf36 15-Oct-2015 Xiaohui Chen <xiaohuic@google.com> Add UM.isSameProfileGroup()

This optimizes the performance to check if two users are in the same
profile group.

Change-Id: I493a3475b848487836f4dbe01529c63165ace483
serManagerService.java
dc06bb0752c1bc3e87b04a097b308bca1bc86181 24-Jul-2015 William Roberts <william.c.roberts@intel.com> libs: add libpackagelistparser

There are 4 components that all implement package parsing, they are:
1. sdcardd
2. libselinux
3. logd
4. runas

Create a library that can be used by all of them, and new ones as needed.

Change-Id: I87a406802f95d8e7bfd8ee85f723f80e9e6b6c0c
Signed-off-by: William Roberts <william.c.roberts@intel.com>
ettings.java
b08949151f8dfc7a72ea6696f2e6067c2b1643bb 14-Oct-2015 Jeffrey Vander Stoep <jeffv@google.com> am 6b6d1a30: am a2e511d6: am 8b626548: Merge "Pass privapp specifier for selinux labeling"

* commit '6b6d1a3076ad150365c31936b49a8277d476e4d8':
Pass privapp specifier for selinux labeling
6b6d1a3076ad150365c31936b49a8277d476e4d8 14-Oct-2015 Jeffrey Vander Stoep <jeffv@google.com> am a2e511d6: am 8b626548: Merge "Pass privapp specifier for selinux labeling"

* commit 'a2e511d6ca6c3b3d465bbf2fe98f17e210c676d0':
Pass privapp specifier for selinux labeling
a2e511d6ca6c3b3d465bbf2fe98f17e210c676d0 14-Oct-2015 Jeffrey Vander Stoep <jeffv@google.com> am 8b626548: Merge "Pass privapp specifier for selinux labeling"

* commit '8b62654855b105e5ff7628107691309a63effe0c':
Pass privapp specifier for selinux labeling
59e52b9f000ea7be9f18e25f0f741ff442710ca2 13-Oct-2015 Jeff Hao <jeffhao@google.com> am 1c33939b: Merge "Shorten first boot time by filtering dexopted apps by LRU." into mnc-dr-dev

* commit '1c33939be52a9b1d1c9881829236c014e9fb61b9':
Shorten first boot time by filtering dexopted apps by LRU.
71d3260ffa99bf7e580d9ebd979a1e7863b50223 13-Oct-2015 Jeff Hao <jeffhao@google.com> Shorten first boot time by filtering dexopted apps by LRU.

No longer dexopt all system apps and boot listener user apps.

Bug: 23628238
Bug: https://code.google.com/p/android/issues/detail?id=186589

(cherry-picked from commit b84cb9e9719855d56ea74c2eb7afc49034c0e66f)

Change-Id: Id1a1ca9f46777f9e62df3d4f25e98a2837fabf37
ackageManagerService.java
3a2d034062aebb4165ef79bd4482956b747407b1 13-Oct-2015 Svetoslav Ganov <svetoslavganov@google.com> am 5d6d2988: am d93e404e: am 1b872618: am 7a097ff1: Merge "Shared user retains permissions no longer used by any app on an app update" into mnc-dr-dev

* commit '5d6d29882354804050baacb156ac5e59f3fd2b7b':
Shared user retains permissions no longer used by any app on an app update
5d6d29882354804050baacb156ac5e59f3fd2b7b 13-Oct-2015 Svetoslav Ganov <svetoslavganov@google.com> am d93e404e: am 1b872618: am 7a097ff1: Merge "Shared user retains permissions no longer used by any app on an app update" into mnc-dr-dev

* commit 'd93e404ef27f5589248630a13f4bbac6ead9ff52':
Shared user retains permissions no longer used by any app on an app update
1b8726182288900a0248c7a720a05f3d9c0e139e 13-Oct-2015 Svetoslav Ganov <svetoslavganov@google.com> am 7a097ff1: Merge "Shared user retains permissions no longer used by any app on an app update" into mnc-dr-dev

* commit '7a097ff159466c4e887f1c821aeaa545f80e54b6':
Shared user retains permissions no longer used by any app on an app update
ff7b92fc02e3bf3a799716b396860d59e81886cb 13-Oct-2015 Svetoslav <svetoslavganov@google.com> Shared user retains permissions no longer used by any app on an app update

If an app in a shared user uses permission A and B and these are granted
to the shared user and now an app update is installed that only uses A,
the shared user still ratains the B grant. A shared user should have only
permissions declared as used by its currenlty installed apps.

bug:24736912

Change-Id: Idea6c06bdc236fd481a860cddb379e6ce660ee87
ackageManagerService.java
098593733170244d615e8868355c7cb85e834cf6 12-Oct-2015 Jeff Vander Stoep <jeffv@google.com> Pass privapp specifier for selinux labeling

Allow privileged apps to run in their own priv_app domain.

Motivation:
Untrusted_app is overprivileged due to the inclusion of privileged
apps like gmscore, play store and finsky. Moving these and other
privileged apps to their own domain reduces the permissions required
by untrusted_app.

A separate priv_app domain also protects priv-apps by further
isolating them from third party apps.

Bug: 22033466
Change-Id: I8e6ae5677c5a978301c453d0aa51ebed4459f5a0
ELinuxMMAC.java
9b907ce5d87e26c5aed6400160b2911073013ec7 09-Oct-2015 Anthony Hugh <ahugh@google.com> am 66940eaa: am 073a1624: am 6b566ec5: Merge "Give Android Wear system apps default permission" into cw-e-dev

* commit '66940eaaabc007d839d17c71b21c914a1bbba2e0':
Give Android Wear system apps default permission
66940eaaabc007d839d17c71b21c914a1bbba2e0 09-Oct-2015 Anthony Hugh <ahugh@google.com> am 073a1624: am 6b566ec5: Merge "Give Android Wear system apps default permission" into cw-e-dev

* commit '073a1624912a93da65b5e40b6ff434c4fd3ab0f2':
Give Android Wear system apps default permission
979b81ac33c2ba678414c5350c19fc78dbac724a 30-Sep-2015 Anthony Hugh <ahugh@google.com> Give Android Wear system apps default permission

This change grants Android Wear system components default
permission.

I have also added a new Intent category to help identify
the main Home handler on Wear.

BUG: 23419042
Change-Id: Ie669a9908bd3b03498f75c5ca22c0fddf52a5203
efaultPermissionGrantPolicy.java
a52562ca9a4144cf30e6d5c6ffe856cc8e284464 02-Oct-2015 Makoto Onuki <omakoto@google.com> setDeviceOwner() now requires a full component name.

Bug 20149907

Change-Id: I24e66159d1d966925aa3a494b1e2839b07cdafa2
ackageManagerService.java
a4f119790e32fcce56586e7324d508e35cb30a2a 01-Oct-2015 Makoto Onuki <omakoto@google.com> First cut of user restriction layering.

- Start persisting restrictions set by DO/PO.

- Also dump user restrictions on dumpsys

- More changes will follow, including migration.

- Now System settings are mockable.

Bug 23902097
Bug 23902477

Change-Id: I0bda22f484e1a8e259a1feb2df83c5f4a29116da
serManagerService.java
serRestrictionsUtils.java
4a305c95e1669222f2b835a3b85fee77d72fab57 03-Oct-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Do now allow current user to be removed"
369d3dcda03090c314ad2a350335b060eeb1bbd6 02-Oct-2015 Xiaohui Chen <xiaohuic@google.com> Merge "Cleanup USER_OWNER in pm"
bb7e5ac58e74667799662cfa0f780ce8eaad053f 02-Oct-2015 Xiaohui Chen <xiaohuic@google.com> Merge "Cleanup USER_OWNER in mount service"
47f0795d171a25d30ee5b48a6ff1828fb5c92c19 02-Oct-2015 Xiaohui Chen <xiaohuic@google.com> Cleanup USER_OWNER in pm

Bug: 19913735
Change-Id: I27947f539ca8346e3abd96fc1f800a65945be128
ackageInstallerSession.java
ackageManagerService.java
serManagerService.java
621b3fc7a94a9b1bbbb230f264899299a806237b 02-Oct-2015 Xiaohui Chen <xiaohuic@google.com> Cleanup USER_OWNER in mount service

Also removed a failing unit test and the related code which is
now deprecated.

Bug: 19913735
Bug: 24064753
Change-Id: I9b11130b52caeb0ad890cc6adaaf7fb2fc7b5db6
serManagerService.java
0df68cd13b8121aa4e582d8fb59c7589079d6ff9 01-Oct-2015 Fyodor Kupolov <fkupolov@google.com> Do now allow current user to be removed

It was possible to remove a foreground user using pm remove-user command.
The system ends up in the inconsistent state, because switch does not happen
and the removed user stays in the foreground, but its state is removed.

Also added am get-current-user command.

Change-Id: Ida2dce8f99bac55e106cdd44c93e96cc9142d7fb
serManagerService.java
11f15a3727854c45a0228fc70d08a3a02b9c9f39 01-Oct-2015 Amith Yamasani <yamasani@google.com> Merge "Delay cleaning user tasks until user is removed"
3da3ca609ec48e1ff23bcfda0b208632fab88d80 01-Oct-2015 Todd Kennedy <toddke@google.com> Merge "Update PackageInstaller install handing"
515d40600e1f11c7cea3a2bfbbb49e7d86ff801f 28-Sep-2015 Amith Yamasani <yamasani@google.com> Delay cleaning user tasks until user is removed

Fixes #24301208 No recent apps shows when switching
between users.

Instead of cleaning up when stopping a user, we
should remove tasks when removing a user, since
recents tasks should be persisted across reboots.
Reboots are similar to stopping and starting users.

Change-Id: I9a250792077cca5f18ae1a10bc36f7b97e8ea867
serManagerService.java
a1d12cfdb072acb14fa95d5e771e23396e6bd8e1 30-Sep-2015 Todd Kennedy <toddke@google.com> Update PackageInstaller install handing

* Allow forcing permission check. We want to modify the PackageInstaller to
use the PackageInstallerSession for better security / remove deprecated APIs.
In order to do this and continue to prompt for permissions, we need to prevent
the PakcageInstaller from auto-approving the permissions.

* Add originating UID to SessionParams. This is used for package verifier
checks.

Bug: 22282121
Change-Id: I19079749d20ace66f1332f399d52cb0fb8784cd9
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
76ce8473ca99f72eb3fc879eb0b0374f3ab313f0 29-Sep-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Fixed VPN support for restricted profiles in split system user model"
1c36315a36962321dfe870b07e28b04a1d6777e9 02-Sep-2015 Fyodor Kupolov <fkupolov@google.com> Fixed VPN support for restricted profiles in split system user model

In a new split system user model, owner of a restricted profile is not limited
to just user0. restrictedProfileParentId field should be used to get an owner.

Bug: 22950929
Change-Id: I928319a9450e543972237a42267eb2404e117c83
serManagerService.java
6b78340f6cfa49341bfdcc6e0b80a697d76f5b0f 28-Sep-2015 Todd Kennedy <toddke@google.com> resolved conflicts for b4d41021 to master

Change-Id: Ib413c588ffb7a2b4385d2088e6de782417625037
b4d41021b41b60ce0b053035105d51f453816b1d 28-Sep-2015 Todd Kennedy <toddke@google.com> am 92b28f37: resolved conflicts for 4ed21bf0 to stage-aosp-master

* commit '92b28f37de9956c172f779df4cf540abc5b94deb':
Allow using the JIT
92b28f37de9956c172f779df4cf540abc5b94deb 28-Sep-2015 Todd Kennedy <toddke@google.com> resolved conflicts for 4ed21bf0 to stage-aosp-master

Change-Id: I9c8ab83589ee3786c884f34066c1f3d709dc5136
02cb6e773b323a0d54b21f43460a23f668b7727c 19-Sep-2015 Fyodor Kupolov <fkupolov@google.com> Added --restricted option for create-user command

Also moved restricted profile create/setup logic from Settings to
UMS.createRestrictedProfile.

Bug: 24212155
Bug: 24303609
Change-Id: I0346a3368de53f4bb4b6e054349f19adac959d7f
serManagerService.java
b1755d8b4961a2cf5dc0ffd543f3c2901fb42306 26-Sep-2015 Bart Sears <bsears@google.com> Merge "Revert "Added --restricted option for create-user command""
9249a9097707bb57ae0a7d114eff54bc82ad462d 26-Sep-2015 Bart Sears <bsears@google.com> Revert "Added --restricted option for create-user command"

This reverts commit 737b216b5c28f7d7162f219136d4e8a9eb1a486b.

Change-Id: I4c43967933bb2e46cdb8ad6e643d7037d722cab2
serManagerService.java
8c6e5372257b1fa5135811fbafeb234f173091a9 25-Sep-2015 Todd Kennedy <toddke@google.com> Allow using the JIT

Instead of the JIT only being available for eng builds [or configurable
via environment variable], allow the JIT to be enabled programatically.

Change-Id: Ifcbc8445fb8bd45ce2bfed3f80fbaf48496f8e3a
nstaller.java
ackageDexOptimizer.java
ackageManagerService.java
f36f4f584555e0a4edac5489f758a488218f9b8b 26-Sep-2015 Todd Kennedy <toddke@google.com> Merge "resolved conflicts for 389bb7f5 to master"
56ebb257085ffed21c98ba98ced959ffe6afaca3 26-Sep-2015 Todd Kennedy <toddke@google.com> resolved conflicts for 389bb7f5 to master

Change-Id: I9c3474577166cc91c50d32d225957fbd13c205bf
389bb7f509fc74de3656492a9c474c11bcc96e5b 26-Sep-2015 Todd Kennedy <toddke@google.com> am 9f860264: resolved conflicts for 7de7e0b0 to stage-aosp-master

* commit '9f8602644418ecfb1a5c9555792ceed285fa72bd':
Pass dexopt flags as integer
9f8602644418ecfb1a5c9555792ceed285fa72bd 26-Sep-2015 Todd Kennedy <toddke@google.com> resolved conflicts for 7de7e0b0 to stage-aosp-master

Change-Id: I4e45e5bbaebb98b0e740167eaf7517f99d917f30
fa54ab7950b7ad7605cb842b47826b71a685bc28 25-Sep-2015 Todd Kennedy <toddke@google.com> Pass dexopt flags as integer

Instead of using a series of booleans, create a single flags integer
that contains all of the dexopt options.

Change-Id: Ia8fa968f64b164267f43dd29cea9dc0413058125
nstaller.java
ackageDexOptimizer.java
ackageManagerService.java
737b216b5c28f7d7162f219136d4e8a9eb1a486b 19-Sep-2015 Fyodor Kupolov <fkupolov@google.com> Added --restricted option for create-user command

Also moved restricted profile create/setup logic from Settings to
UMS.createRestrictedProfile.

Bug: 24212155
Bug: 24303609
Change-Id: I5f0d48bcbd3c0b51927926b874fd057c15ac5219
serManagerService.java
4e321745173de1eb89343238fadfbcc7ba1a88f9 24-Sep-2015 Todd Kennedy <toddke@google.com> resolved conflicts for cafacef6 to stage-aosp-master

Change-Id: Id02e098a02aede327c5bc1a98aa177d8bf9ec5a9
cafacef60e49bbb8f6d829d261b46c5e7d119577 24-Sep-2015 Todd Kennedy <toddke@google.com> Merge "Frameworks/base: Propagate boot status to installd"
55fe944f987bcbdea8bbec7ea411684f69623da4 21-Sep-2015 Andreas Gampe <agampe@google.com> Frameworks/base: Propagate boot status to installd

Propagate the boot status explicitly to installd so that we do not
have to rely on dev.bootcomplete, which isn't meaningfully set
when the device needs the decryption screen on boot.

Bug: 23898216
(cherry picked from commit 06bb908b78e3c790d3db52fef9f2ab0a129e53cd)
Change-Id: I9b34298caf70b1e5d40970cc0d04c469016a80a7
nstaller.java
ackageDexOptimizer.java
ackageManagerService.java
b18d084f4bb8e2f69732a014b78f6378481d9906 24-Sep-2015 Jeff Hao <jeffhao@google.com> resolved conflicts for f005d55f to master

Change-Id: I82027116a2b0bfc8b1ff1e20c3a115a1ba8a19db
f005d55fb76902a09bede226887313c14b806753 24-Sep-2015 Jeff Hao <jeffhao@google.com> am 75ab8c77: am 384d84f4: Merge "Shorten first boot time by filtering dexopted apps by LRU."

* commit '75ab8c7789b4ec5e26bc7d2f773a6c39d39a821b':
Shorten first boot time by filtering dexopted apps by LRU.
75ab8c7789b4ec5e26bc7d2f773a6c39d39a821b 24-Sep-2015 Jeff Hao <jeffhao@google.com> am 384d84f4: Merge "Shorten first boot time by filtering dexopted apps by LRU."

* commit '384d84f4f02643b63335f6d8d884adc1186d6896':
Shorten first boot time by filtering dexopted apps by LRU.
b84cb9e9719855d56ea74c2eb7afc49034c0e66f 23-Sep-2015 Jeff Hao <jeffhao@google.com> Shorten first boot time by filtering dexopted apps by LRU.

No longer dexopt all system apps and boot listener user apps.

Bug: 23628238
Bug: https://code.google.com/p/android/issues/detail?id=186589

Change-Id: Ib4f960686afcfda13838f7783c2d3ccf8e26db72
ackageManagerService.java
bc68463602b6c26cca8988e55df8dbf48ca653e5 22-Sep-2015 Andreas Gampe <agampe@google.com> resolved conflicts for 5d7b68d4 to master

Change-Id: I6f56e8e11c35733f8d84346ca2b9a201784552e1
5d7b68d4914c8ddb0171abd1f668716ff682fd84 22-Sep-2015 Andreas Gampe <agampe@google.com> am 53ed452e: am 9ce68b24: am b49245f9: Merge "Frameworks/base: Propagate boot status to installd" into mnc-dr-dev

* commit '53ed452e86aa186b5903b65057b4473629292f0d':
Frameworks/base: Propagate boot status to installd
b49245f96233b7f89fb5d4ba52576131ca6fb47a 22-Sep-2015 Andreas Gampe <agampe@google.com> Merge "Frameworks/base: Propagate boot status to installd" into mnc-dr-dev
06bb908b78e3c790d3db52fef9f2ab0a129e53cd 21-Sep-2015 Andreas Gampe <agampe@google.com> Frameworks/base: Propagate boot status to installd

Propagate the boot status explicitly to installd so that we do not
have to rely on dev.bootcomplete, which isn't meaningfully set
when the device needs the decryption screen on boot.

Bug: 23898216
Change-Id: I9b34298caf70b1e5d40970cc0d04c469016a80a7
nstaller.java
ackageDexOptimizer.java
ackageManagerService.java
fd83681aeafce94c6ea10e202ce1e8e104a639d3 21-Sep-2015 Jeff Sharkey <jsharkey@android.com> am e1964182: am 9314f94b: am b7b17fa6: am 281a868c: am e1a6299b: Relax locking when scanning private volumes.

* commit 'e1964182de52d00950219810798ea4e7900fb57b':
Relax locking when scanning private volumes.
e1964182de52d00950219810798ea4e7900fb57b 21-Sep-2015 Jeff Sharkey <jsharkey@android.com> am 9314f94b: am b7b17fa6: am 281a868c: am e1a6299b: Relax locking when scanning private volumes.

* commit '9314f94b687deb21acd7f05810d3edf1a4e8fcbc':
Relax locking when scanning private volumes.
281a868c69e0915efc16eb3c65f669bbf0df69df 21-Sep-2015 Jeff Sharkey <jsharkey@android.com> am e1a6299b: Relax locking when scanning private volumes.

* commit 'e1a6299b994bbdb304550e00d5b3b26a064bdf0c':
Relax locking when scanning private volumes.
f3d939cc73a7c9846b649e4856378b1e04ad14a9 17-Sep-2015 Christopher Tate <ctate@google.com> At install, require the presence of code if hasCode=true

Bug 23875788

Change-Id: I125ea4caf9e558e875e36dc8534f0d0877ff1e89
ackageManagerService.java
e1a6299b994bbdb304550e00d5b3b26a064bdf0c 18-Sep-2015 Jeff Sharkey <jsharkey@android.com> Relax locking when scanning private volumes.

Private volumes with many large apps can take a long time to scan,
which currently happens on the main thread with several large locks
held, making it likely to trigger the system-wide watchdog.

This change relaxes this locking by scanning on the PackageManager
worker thread, and by only holding locks when required. In
particular, we release the installer lock between each scan to give
other apps waiting to dexopt a chance to breathe.

Bug: 24172036
Change-Id: Ie28d3ff72d6be28fa2f72c57d5e4146c768df89d
ackageManagerService.java
cf9f751206e027a1654572585d045a325dec4ecc 16-Sep-2015 Fyodor Kupolov <fkupolov@google.com> am fd464a30: am 71b4b738: am d20f2106: am bfc584df: Merge "Use app directory as apkPath for cluster installs" into mnc-dr-dev

* commit 'fd464a301fea9395ad2b882dc90b0fee6515e9d1':
Use app directory as apkPath for cluster installs
fd464a301fea9395ad2b882dc90b0fee6515e9d1 16-Sep-2015 Fyodor Kupolov <fkupolov@google.com> am 71b4b738: am d20f2106: am bfc584df: Merge "Use app directory as apkPath for cluster installs" into mnc-dr-dev

* commit '71b4b738a611565659df33fe56635d75a25e6f19':
Use app directory as apkPath for cluster installs
bfc584df683a84dffd8e04b7b13f619606a0a42a 16-Sep-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Use app directory as apkPath for cluster installs" into mnc-dr-dev
704460331e87ab49bf54d28ade39add99e4a3c27 16-Sep-2015 Svet Ganov <svetoslavganov@google.com> am 694d28c4: am 4f5b020e: am 51491627: am 276da47a: am cd946024: Default grant SMS and Phone to the verifier

* commit '694d28c4e48eab457417743134b83058f1a0d4cd':
Default grant SMS and Phone to the verifier
694d28c4e48eab457417743134b83058f1a0d4cd 15-Sep-2015 Svet Ganov <svetoslavganov@google.com> am 4f5b020e: am 51491627: am 276da47a: am cd946024: Default grant SMS and Phone to the verifier

* commit '4f5b020e87df63c72562c50131ad2829b911f904':
Default grant SMS and Phone to the verifier
276da47adf23b5512985268f36fab0b7d2d11363 15-Sep-2015 Svet Ganov <svetoslavganov@google.com> am cd946024: Default grant SMS and Phone to the verifier

* commit 'cd946024e94a8fe2f4009dbd2e5463817a17b3a9':
Default grant SMS and Phone to the verifier
a5bf0dea33be6470e2431abde7cc9d8874a9e898 14-Sep-2015 Nicolas Prévot <nprevot@google.com> Merge "Don't consider non-enabled users for cross-profile intents."
cd946024e94a8fe2f4009dbd2e5463817a17b3a9 12-Sep-2015 Svet Ganov <svetoslavganov@google.com> Default grant SMS and Phone to the verifier

bug:24012164

Change-Id: I756644c8044076b2550d7ca104f542f50da0226b
efaultPermissionGrantPolicy.java
ebcac16cb1405bf7d0b570e11a287df078edfc1c 10-Sep-2015 Fyodor Kupolov <fkupolov@google.com> Use app directory as apkPath for cluster installs

Previously, size of of oat directory was not counted by the getsize command,
because base APK location was passed as apkpath argument.

Bug: 23896047
Change-Id: Ic7b6b725785ff2e2a0cf3887ba68c162b23b1212
ackageDexOptimizer.java
ackageManagerService.java
ddb7255838a4e129f2924d39e5b56487e0586ba8 04-Sep-2015 Nicolas Prevot <nprevot@google.com> Don't consider non-enabled users for cross-profile intents.

Previously, if we removed a managed profile and added a new one
immediately:
Until the old managed profile was completely cleaned up,
the presence of the old managed profile prevented cross-profile intents
from working properly with the new managed profile.

BUG:23520975
Change-Id: If46c6c0c0fa000df0982a21272a37fa3da54aa24
ackageManagerService.java
16b43e43f973896baa14961c4805979eeb310654 03-Sep-2015 Svetoslav Ganov <svetoslavganov@google.com> am e4428808: am 8fddbc44: am a5cd5d87: am 0b5162c8: am 6dd856b1: Merge "Don\'t drop runtime permissions on older system app update." into mnc-dev

* commit 'e4428808bf4d26cbfdef1a6f19f2c9a794442a9b':
Don't drop runtime permissions on older system app update.
e4428808bf4d26cbfdef1a6f19f2c9a794442a9b 03-Sep-2015 Svetoslav Ganov <svetoslavganov@google.com> am 8fddbc44: am a5cd5d87: am 0b5162c8: am 6dd856b1: Merge "Don\'t drop runtime permissions on older system app update." into mnc-dev

* commit '8fddbc44b0f97b88839fb438d2b96b348547da96':
Don't drop runtime permissions on older system app update.
0b5162c85f01f8451120e7ad82aa7193850862f7 03-Sep-2015 Svetoslav Ganov <svetoslavganov@google.com> am 6dd856b1: Merge "Don\'t drop runtime permissions on older system app update." into mnc-dev

* commit '6dd856b1ea31bae083b6c2ed40af812c41b3a6cf':
Don't drop runtime permissions on older system app update.
6dd856b1ea31bae083b6c2ed40af812c41b3a6cf 03-Sep-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Don't drop runtime permissions on older system app update." into mnc-dev
c84161847aea15a258ca97c7e7fb90caff421d2e 03-Sep-2015 Christopher Tate <ctate@google.com> am 46ac9a16: am a91d4357: am 623def69: am 7bae31f8: am 60aae166: Apply default link-handling policy at OTA from pre-M

* commit '46ac9a16666ae282d7dde1decb1e45d77eaac652':
Apply default link-handling policy at OTA from pre-M
46ac9a16666ae282d7dde1decb1e45d77eaac652 03-Sep-2015 Christopher Tate <ctate@google.com> am a91d4357: am 623def69: am 7bae31f8: am 60aae166: Apply default link-handling policy at OTA from pre-M

* commit 'a91d4357c5da515b3901eb5f49f9fd5ed1c7ee8f':
Apply default link-handling policy at OTA from pre-M
7bae31f88f8dcaf8114d9d43b29e154bc23374ad 02-Sep-2015 Christopher Tate <ctate@google.com> am 60aae166: Apply default link-handling policy at OTA from pre-M

* commit '60aae166e99dff0dba379e14c0fc43e89fd1a018':
Apply default link-handling policy at OTA from pre-M
6499a85a30e59a33ee643e9fda7d36d794716769 02-Sep-2015 Svetoslav <svetoslavganov@google.com> Don't drop runtime permissions on older system app update.

We have a device with an installed version of an app that is not
preinstalled and has some runtime permissions granted. Now we get
OTA with an older version of the app which does not request these
runtime permissions. We first scan system packages and then installed
apps. During the scan we encounter the newly appeared system package
and determine it is older than the one we have installed and disable
it.

However, before we disable the package we update the permissions
for this package but since the one on the system partition (the one
we found so far) doesn't request some of the runtime permissions
granted to the installed version of the app, they get dropped on the
floor. This grant attempt is not necessary as the permission the
installed package has depends entirely on the permissions it requests.
In this process we may look at the requested permissions on the
disabled system package but in general the updated package cannot
have a permission that it does not request regardless whether the
disabled system app requests it or on.

bug:23718806

Change-Id: I187bc11750eb270c3233c314992186f5d58d9d82
ackageManagerService.java
60aae166e99dff0dba379e14c0fc43e89fd1a018 02-Sep-2015 Christopher Tate <ctate@google.com> Apply default link-handling policy at OTA from pre-M

Not just at first (wiped) boot.

Bug 23744303

Change-Id: I9ab42f7b081e92231d89b3c97935135c3dd901d4
ackageManagerService.java
26637cb3fd56c73d51d7cf53a4e97a51847dfc4f 01-Sep-2015 Nick Kralevich <nnk@google.com> am 1293b953: am 712205ba: am 9d586927: Merge "Automatically assign default seinfo labels using the string "default"."

* commit '1293b953c4c82dfc8738ba1dfc48f7739df78c69':
Automatically assign default seinfo labels using the string "default".
1293b953c4c82dfc8738ba1dfc48f7739df78c69 01-Sep-2015 Nick Kralevich <nnk@google.com> am 712205ba: am 9d586927: Merge "Automatically assign default seinfo labels using the string "default"."

* commit '712205bac075dc59a1ccd79a860d553ba31402f0':
Automatically assign default seinfo labels using the string "default".
712205bac075dc59a1ccd79a860d553ba31402f0 01-Sep-2015 Nick Kralevich <nnk@google.com> am 9d586927: Merge "Automatically assign default seinfo labels using the string "default"."

* commit '9d586927102b597845607ccc82661e350821de82':
Automatically assign default seinfo labels using the string "default".
5e16bc5a143b46bbe9a4873adceed85a6241d1d0 28-Aug-2015 Robert Craig <rpcraig@tycho.ncsc.mil> Automatically assign default seinfo labels using the string "default".

default seinfo values are those for which policy lacks a
matching stanza in the corresponding mac_permissions.xml
file. Prior to this change the null object reference was
used to represent the non-matching state. This is in
contrast to a policy supplied default stanza which will
assign a non null seinfo value. Confused yet?

Basically, two default states were distinguished in the
code to describe the two cases where either a policy stanza
spelled out the base case seinfo label or not. Policy
writers could either supply a default stanza or rely on
the class instantiated value assigned by the ApplicationInfo
object. The hope was that the later assignment could be
used to help distinguish the cases where policy writers
intentionally white listed apps. This change will just use
the hard coded "default" string implicitly to describe all
cases and removes the idea of a policy supplied default stanza.

Change-Id: Ib7b01ee004775f24db9a69340a31784b967ce030
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
ELinuxMMAC.java
ecf9b05812a42a76473e14c41c7c04a25dcfa741 31-Aug-2015 Todd Kennedy <toddke@google.com> Merge "Tweak systrace calls"
c3008a698b32ef91e13fe9559570db1ebbd07439 29-Aug-2015 Ian Pedowitz <ijpedowitz@google.com> am 80bed748: am 2e80aa73: am 6f75cb14: am 8d027e6d: am 3c227bf2: Merge "Show the ResolverActivity in dock mode" into mnc-dev

* commit '80bed748170b24f57d6a2db92b00c6be34e8f36a':
Show the ResolverActivity in dock mode
8d027e6d523d13a9cf2a5cf4ef901cc3e78b901d 29-Aug-2015 Ian Pedowitz <ijpedowitz@google.com> am 3c227bf2: Merge "Show the ResolverActivity in dock mode" into mnc-dev

* commit '3c227bf2418c6d1b6831f0fa7ad0442b0fcbdc07':
Show the ResolverActivity in dock mode
3c227bf2418c6d1b6831f0fa7ad0442b0fcbdc07 29-Aug-2015 Ian Pedowitz <ijpedowitz@google.com> Merge "Show the ResolverActivity in dock mode" into mnc-dev
1a350157198bd8700f1e81b8ce3f7c656f91dba9 29-Aug-2015 Todd Kennedy <toddke@google.com> Tweak systrace calls

Tracing needed a few tweaks.

First, add overall tracing for all of the incoming methods that cause a
package to go through the install flow -- installPackageAsUser, installStage
and movePackage.

Second, add a few more traces for things such as dexopt.

Third, adjust some of the calls; avoid using the async trace methods
when they're not necessary, etc...

Change-Id: Iff47189ddad4478d9fbc6eac2f7031e54cba6271
ackageManagerService.java
3f1099b062fb353850b78c22d7d815c811926557 28-Aug-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Non-system users can now have restricted profiles"
3f4c29824898e359410d288d5f6e936a5a0f09d9 28-Aug-2015 Jeff Sharkey <jsharkey@google.com> am 0551d5d9: am ac4fd070: am 90023609: am 71f15791: am d88152b4: Merge "Give shell permission to move apps." into mnc-dev

* commit '0551d5d9ee2888779e9c37c9a509451ef65ef981':
Give shell permission to move apps.
71f1579190ee3658db15f55a4e5571f03ce431b6 28-Aug-2015 Jeff Sharkey <jsharkey@google.com> am d88152b4: Merge "Give shell permission to move apps." into mnc-dev

* commit 'd88152b4d910fa5e79908dcb6f14cd56ad03b21a':
Give shell permission to move apps.
e515c6495d2ad6317303617ba20509b4e8aa7654 28-Aug-2015 Jeff Sharkey <jsharkey@android.com> Give shell permission to move apps.

Also clear identity when measuring ASEC sizes to relax a second
permission requirement.

Bug: 23600574
Change-Id: Ib3a104426758e0e8f35dff0e504fe874bed7311f
ackageManagerService.java
175c22e2018dabad28ec11b81d03096766a6eb66 28-Aug-2015 Christopher Tate <ctate@google.com> Show the ResolverActivity in dock mode

If there are multiple dock apps present the end result should be
the disambiguation UI, not a fast-forward to the 'normal' home
app.

Bug 23501598

Change-Id: Iebc106b136cb1e446d1e93935738335504f5b812
ackageManagerService.java
06a484adb93c6c969321147b07112684383305f6 22-Aug-2015 Fyodor Kupolov <fkupolov@google.com> Non-system users can now have restricted profiles

In the non split system user, only USER_OWNER is allowed to have restricted
profiles. This is now changed in split user mode, where multiple secondary
users can have restricted profiles.

Added UserInfo.restrictedProfileGroupId field, which defines parent/child
relationship between secondary users and linked restricted profiles. Adjusted
shared accounts handling logic to not assume that USER_OWNER is the only owner.

Bug: 23191995
Change-Id: I5f3fc2aa4f229103d6e75ec2c3dfce866b8007de
serManagerService.java
2170ee43a176cdfa45dd4d9122a183023831d44b 27-Aug-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Limit the number of apps running as system user"
d3a182e5734f460a510d229e27d27ac4cd72d9ff 26-Aug-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Renamed primaryUserOnly to systemUserOnly"
7db5af124e551554f7a2f1abdd2a486c937910fe 01-Aug-2015 Fyodor Kupolov <fkupolov@google.com> Limit the number of apps running as system user

For the system user, enable apps based on the following conditions:
- app has no launcher icons or has INTERACT_ACROSS_USER_FULL permission
- app is whitelisted
- app is not in the blacklist

Bug: 23283899
Change-Id: I90fa266e8cfb28d002e5f792998fdddb6a1e6969
ettings.java
4f5de340c9c7b12d7d67ca53bac863976b36fd32 25-Aug-2015 Fyodor Kupolov <fkupolov@google.com> Renamed primaryUserOnly to systemUserOnly

In the split mode, broadcast receivers and activities marked as
systemUserOnly will be running as system. This is a non-functional change for
non-split system user mode.

Bug: 22958572
Change-Id: I0f7d4f4a81275bc326bf630a776c695e8b5291a6
ackageManagerService.java
95a57ee0a6456f1f5c2a9e9c6b8092f157130507 25-Aug-2015 Nicolas Prevot <nprevot@google.com> am ee02b881: am 6fbf2724: am ae2880a6: am 26b555d4: am d34ecae4: Don\'t set a null filter to a cross-profile ResolveInfo.

* commit 'ee02b88183e700592acd3848af690f318c50a73c':
Don't set a null filter to a cross-profile ResolveInfo.
26b555d42ce2cf78d42ebcc9806447bf83df9318 25-Aug-2015 Nicolas Prevot <nprevot@google.com> am d34ecae4: Don\'t set a null filter to a cross-profile ResolveInfo.

* commit 'd34ecae444867b78be06bb5a6b0fb2a66c2e30aa':
Don't set a null filter to a cross-profile ResolveInfo.
d34ecae444867b78be06bb5a6b0fb2a66c2e30aa 25-Aug-2015 Nicolas Prevot <nprevot@google.com> Don't set a null filter to a cross-profile ResolveInfo.

ResolverActivity expects the filter not to be null.

BUG:23395395
Change-Id: Ie7081daba1ad138b1a3903ef9dd1b649806c8d0e
ackageManagerService.java
225c8387eba89a029ab31f786cb1de23a38a446e 20-Aug-2015 Xiaohui Chen <xiaohuic@google.com> Merge changes I260758f1,Ib6c2ed11

* changes:
Clean up USER_OWNER reference in PMS
Clean up USER_OWNER in notifications
be8b98b939639a579444de64ce2fd86cccf91daf 20-Aug-2015 Nicolas Prévot <nprevot@google.com> Merge "Allow non-owner users to have managed profiles."
b818681dcae157412b897587ff856cd0c531c3f4 06-Aug-2015 Nicolas Prevot <nprevot@google.com> Allow non-owner users to have managed profiles.

In the split system user model:
The only users that are not allowed to have managed profiles are:
- purely system user (user 0)
- guest users
- restricted profiles
- managed profiles

In the non-split system user model, the behavior does not change:
only the primary user can have managed profiles.

BUG:22956426
Change-Id: If908c30f110fd3e740770174f050c9b6cf87ce1b
serManagerService.java
741abfc12074623d24297ebb67d98cb2d9126add 11-Aug-2015 Nicolas Prevot <nprevot@google.com> Fix cross-profile intent filters with system-user split.

Don't assume that the parent is always the user owner.

BUG:23105562
Change-Id: Ia98ed608e2b6d1d82d95a73110134d85274c6abf
ackageManagerService.java
16387b44f5fcdf205f101d8f49ee74515010f00d 18-Aug-2015 Xiaohui Chen <xiaohuic@google.com> Clean up USER_OWNER reference in PMS

Package manager service is tricky to me, so I only have very small
changes.

Bug: 19913735
Change-Id: I260758f19f0ddb073d0c3f675683f8d0efda2dc5
ackageManagerService.java
50b1bd2485ed538310f60b25c7a1213c32b41767 19-Aug-2015 Amith Yamasani <yamasani@google.com> am a79f37c3: am 6e6fbc93: am 7102fb5f: am e1df482c: am e3de6c5d: Merge "Fix crashes when removing work profile" into mnc-dev

* commit 'a79f37c31fb0605465d1d6a1ccfdbf9b821fcd96':
Fix crashes when removing work profile
e1df482c173d975923dba2d3cf644f5a0fadee17 19-Aug-2015 Amith Yamasani <yamasani@google.com> am e3de6c5d: Merge "Fix crashes when removing work profile" into mnc-dev

* commit 'e3de6c5df5a94e627c5ee0f188cbb066233a3dd0':
Fix crashes when removing work profile
594f208d661bc29dafef91e948d36cac652d59db 18-Aug-2015 Xiaohui Chen <xiaohuic@google.com> Clean up USER_OWNER reference in pm/Settings

Bug: 19913735
Change-Id: I538ed443b945e9cbb731520450bf5ef39882ae37
ackageManagerService.java
ettings.java
serManagerService.java
8324a6ee8334668c25e05c669bc04bf9c0c8c583 19-Aug-2015 Yusuke Sato <yusukes@google.com> Trace scanDirLI()

Change-Id: I3761b4991d45684e9b712c5870bcacd08dc806de
ackageManagerService.java
236b2b5d28f430a79d3155115b57ea8d80ad27ea 18-Aug-2015 Amith Yamasani <yamasani@google.com> Fix crashes when removing work profile

This isn't specific to work profile. When multiple user
deletions happen in sequence, a race causes a dying user
to lose permissions prematurely. This fix delays removal of
user state until the user is completely cleaned up and all the
processes have been killed.

Bug: 23178833
Change-Id: I1636bc2022416359a25f19a3f65d113c05289cd3
serManagerService.java
448e082850388a5efafd743fd1d297f4bfbd8ccd 17-Aug-2015 Junda Liu <junda@google.com> am e7194f99: am 9ddc014d: am 88c4e406: am 150123a3: am f2cb6f7e: Merge "Grant SMS carrier provisioning app the permission to receive SMS." into mnc-dev

* commit 'e7194f9954866fafcaeb2089bee62f0e550d02d7':
Grant SMS carrier provisioning app the permission to receive SMS.
150123a37445dc778c30a466b6a69f575007c76d 17-Aug-2015 Junda Liu <junda@google.com> am f2cb6f7e: Merge "Grant SMS carrier provisioning app the permission to receive SMS." into mnc-dev

* commit 'f2cb6f7e3ea143ba4acace0821c9d49e363da7eb':
Grant SMS carrier provisioning app the permission to receive SMS.
f2cb6f7e3ea143ba4acace0821c9d49e363da7eb 17-Aug-2015 Junda Liu <junda@google.com> Merge "Grant SMS carrier provisioning app the permission to receive SMS." into mnc-dev
d878f5327793310d5fda083f800644bc96d6a6e8 13-Aug-2015 Junda Liu <junda@google.com> Grant SMS carrier provisioning app the permission to receive SMS.

Bug: b/22982966
Change-Id: I4af525532e2f97973ba255bf8dbb002e42997eea
efaultPermissionGrantPolicy.java
848dd4bfc9575956187eccfc7c563eb9dd64a2b4 14-Aug-2015 Chris Tate <ctate@android.com> am 14e12258: am 13845aea: am b2d4c550: am b47890c4: am 7e7d79ef: Merge "Make "Ask every time" actually work that way" into mnc-dev

* commit '14e122582c45e236bf2e4c59d10438816f2eed09':
Make "Ask every time" actually work that way
93729fea513f2674da2acc3e0c7324eda827d9df 14-Aug-2015 Dianne Hackborn <hackbod@google.com> am 564e87a3: am 1058bf0f: am e2fd2850: am 9e398eb5: am 81f3a85a: Merge "Fix issue #22940169: "pm grant" can no longer grant permissions..." into mnc-dev

* commit '564e87a36f6cfddee23bf7daf1b54e478411f087':
Fix issue #22940169: "pm grant" can no longer grant permissions...
b47890c4e7a7fc119e74da2b50bf94c2cf172916 14-Aug-2015 Chris Tate <ctate@android.com> am 7e7d79ef: Merge "Make "Ask every time" actually work that way" into mnc-dev

* commit '7e7d79ef2f4aa6a8da86af459d419bd24c47b440':
Make "Ask every time" actually work that way
9e398eb51497dbcd2347cb1315933fa4e7cfcd9e 14-Aug-2015 Dianne Hackborn <hackbod@google.com> am 81f3a85a: Merge "Fix issue #22940169: "pm grant" can no longer grant permissions..." into mnc-dev

* commit '81f3a85aa29d83ed1a5de4de1006587d375a1c77':
Fix issue #22940169: "pm grant" can no longer grant permissions...
7e7d79ef2f4aa6a8da86af459d419bd24c47b440 14-Aug-2015 Chris Tate <ctate@android.com> Merge "Make "Ask every time" actually work that way" into mnc-dev
81f3a85aa29d83ed1a5de4de1006587d375a1c77 14-Aug-2015 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #22940169: "pm grant" can no longer grant permissions..." into mnc-dev
99ba7ad73c18cfe6942281ffbda07185c74e7dc7 14-Aug-2015 Svetoslav Ganov <svetoslavganov@google.com> am f6401419: am 340314fd: am 7c3d595a: am 4b655fd1: am b045331f: Merge "Add GTS test to ensure valid default permission grants - framework" into mnc-dev

* commit 'f64014195b6d7bdc2f4d79f3c4c71de16d2fe338':
Add GTS test to ensure valid default permission grants - framework
4b655fd193992afff948df513c7b9b9a0389972e 14-Aug-2015 Svetoslav Ganov <svetoslavganov@google.com> am b045331f: Merge "Add GTS test to ensure valid default permission grants - framework" into mnc-dev

* commit 'b045331fcb033507072bfd7899a147bb2be7176e':
Add GTS test to ensure valid default permission grants - framework
56f0ff3c48c88b969d9bf5e62eb1ee590e03e461 14-Aug-2015 Christopher Tate <ctate@google.com> Make "Ask every time" actually work that way

..in link-opening behavior. If a candidate is marked as "ask
every time," then the user is guaranteed to get a disambiguation
prompt including that candidate even when some other candidate
app is in the "always prefer this over a browser" state.

Bug 23147746

Change-Id: I904d8697a992b3f16f32b1c1b49c2bf9424c7137
ackageManagerService.java
9f5b0a27350df984fb4a98b9658e89390ed60573 14-Aug-2015 Dianne Hackborn <hackbod@google.com> Fix issue #22940169: "pm grant" can no longer grant permissions...

...with protection flag PROTECTION_FLAG_DEVELOPMENT

Bring back the old grant/revoke code for development permissions.

Also some more dumpsys output to help debugging.

And new dumpsys command for checking a permission.

Change-Id: I6e27e62a9ca5ec1ecc0f102714a448ea02f0f41c
asePermission.java
ackageManagerService.java
ettings.java
52153f4c0540a991b5b7214f4f14b5a891479a3c 11-Aug-2015 Svet Ganov <svetoslavganov@google.com> Add GTS test to ensure valid default permission grants - framework

The platform grants runtime permissions by default to apps on the
system image that provide core device use cases which a user expects
to work out-of-the-box. We are now adding a test to ensure that
OEMs cannot pregrant premissions on non approved components.

bug:23043018

Change-Id: Id76717cce0ee59678956bd0be347d3c045fe4c51
efaultPermissionGrantPolicy.java
ettings.java
2fee91c5683d4f3e89c9bd2485207044ab495f43 12-Aug-2015 Todd Kennedy <toddke@google.com> am f6f11daa: am f5107e38: am d43f4d92: am 8af3406a: am 24e4d48f: Merge "Promote system app permissions" into mnc-dev

* commit 'f6f11daafe9884b93218487d5af29130e97107e9':
Promote system app permissions
8af3406a4558e81394ac18ea0d0dcd728833f483 12-Aug-2015 Todd Kennedy <toddke@google.com> am 24e4d48f: Merge "Promote system app permissions" into mnc-dev

* commit '24e4d48f56a6fca6974c5670b88a7b4da2180331':
Promote system app permissions
8b3e6b0df102901f938cd0687f9994a3ff767fcf 12-Aug-2015 Todd Kennedy <toddke@google.com> Promote system app permissions

When upgrading from a pre-M version of Android, install permissions for
exisiting system are promoted to runtime permissions. This only happens
for apps that existed prior to the OTA. Other system apps targeting M
are not automatically granted any permissions.

Bug: 22970710
Change-Id: I964ee3f93c66ea43fbb1be6b5ac6b09ddea3c385
ackageManagerService.java
64b9b9ad9e5f10d7a4d31c5e393432b87afbd742 08-Aug-2015 Svetoslav Ganov <svetoslavganov@google.com> am 618e065c: am 546a3449: am e12a685c: am 02d6c013: am 90b030ba: Merge "Do not show removed permissions in the UI - framework" into mnc-dev

* commit '618e065cc14b9069954e462fc25cdc934ee3300f':
Do not show removed permissions in the UI - framework
02d6c013e4be4b5e09562c922506c1153347d161 08-Aug-2015 Svetoslav Ganov <svetoslavganov@google.com> am 90b030ba: Merge "Do not show removed permissions in the UI - framework" into mnc-dev

* commit '90b030bae8cc1f13da7948fef4aff1d171a2885a':
Do not show removed permissions in the UI - framework
3e0be7440bf40f5d81581077bc4f5f47e57b88b7 08-Aug-2015 Svet Ganov <svetoslavganov@google.com> Do not show removed permissions in the UI - framework

bug:23043018

Change-Id: Ia5cf49f299eda627d9fde2b34498812afcb3a6d5
ettings.java
157c3fbc52c14cbd7fc7ce6ec5b1b4cc9fe627d5 08-Aug-2015 Nicolas Prévot <nprevot@google.com> am 6d23b141: am 2c661d5a: am ed73021b: am 543fd8be: am 288e82f8: Merge "Keep intent verification status of system apps when uninstalling them." into mnc-dev

* commit '6d23b1419fb3cf26025484d5de142de873e5cd9f':
Keep intent verification status of system apps when uninstalling them.
56088b329b4d0ec96c9d6e8a25f91080db50fe9c 08-Aug-2015 Amith Yamasani <yamasani@google.com> am 8857528d: am d7256292: am 3ad53f76: am 85b3d034: am 1fbc1b3b: Merge "Fix partial user cleanup on restart" into mnc-dev

* commit '8857528dd454f3b1f6ec140c945275bb3690aae7':
Fix partial user cleanup on restart
543fd8be753ac751235adb59f5e8c5cedba3b162 07-Aug-2015 Nicolas Prévot <nprevot@google.com> am 288e82f8: Merge "Keep intent verification status of system apps when uninstalling them." into mnc-dev

* commit '288e82f8f67db894c43bf4ea659ca832f979c65a':
Keep intent verification status of system apps when uninstalling them.
288e82f8f67db894c43bf4ea659ca832f979c65a 07-Aug-2015 Nicolas Prévot <nprevot@google.com> Merge "Keep intent verification status of system apps when uninstalling them." into mnc-dev
85b3d0347955d7244f7d5b89f80482a73e70a0ed 07-Aug-2015 Amith Yamasani <yamasani@google.com> am 1fbc1b3b: Merge "Fix partial user cleanup on restart" into mnc-dev

* commit '1fbc1b3b4b742cdba25d32d65a9813933a37005f':
Fix partial user cleanup on restart
1fbc1b3b4b742cdba25d32d65a9813933a37005f 07-Aug-2015 Amith Yamasani <yamasani@google.com> Merge "Fix partial user cleanup on restart" into mnc-dev
b5ab2ffc213dbc976544ef6e0922d72d4fa241ff 07-Aug-2015 Nicolas Prevot <nprevot@google.com> Keep intent verification status of system apps when uninstalling them.

When creating a work profile, system apps are uninstalled and then
sometimes reinstalled.
In the process, they lose their intent verification status.

BUG:22943461
Change-Id:I5b008c6de2125f190063b08908076a649067c60d
ackageManagerService.java
a7892486c2100d99abef355f2bd2c919e6516a6d 07-Aug-2015 Amith Yamasani <yamasani@google.com> Fix partial user cleanup on restart

Internal volume was not available during PackageManagerService creation,
which resulted in a zombie user's folder not being cleaned after a reboot.

Add the internal volume earlier in the boot cycle so that it can be accessed
for user cleanup.

Bug: 22483086
Change-Id: I8f3ffbb25f3902d00a96d1ee2d7a79373c5e35b7
serManagerService.java
598b03d1008fb416a597ae4b2e037c4492bf696d 07-Aug-2015 Svetoslav Ganov <svetoslavganov@google.com> am 9bf912c1: am 5ed03384: am 1f514608: am 5a624aad: am 38d30dc5: Merge "Immediately kill a shared user process on a permission revocation." into mnc-dev

* commit '9bf912c1cf6941402dc0f8ef449f34787796875e':
Immediately kill a shared user process on a permission revocation.
5a624aad5faa0a71ce6495671caac1ccd90544ba 07-Aug-2015 Svetoslav Ganov <svetoslavganov@google.com> am 38d30dc5: Merge "Immediately kill a shared user process on a permission revocation." into mnc-dev

* commit '38d30dc547825bdde2756f588692063a28749e8d':
Immediately kill a shared user process on a permission revocation.
38d30dc547825bdde2756f588692063a28749e8d 07-Aug-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Immediately kill a shared user process on a permission revocation." into mnc-dev
23d4f7cf6e43d0b6cd6431245cdc06659928236e 07-Aug-2015 Jeff Davidson <jpd@google.com> am 5061b516: am 2fe51373: am 22d20774: am 20de377b: am 1d7c3254: Merge "Correctly propagate permissions when uninstalling updates." into mnc-dev

* commit '5061b51669d476a72b39e4636f7b5a837451337f':
Correctly propagate permissions when uninstalling updates.
aa41add33b8d7d318387cc74c34e3d347d245211 07-Aug-2015 Svetoslav <svetoslavganov@google.com> Immediately kill a shared user process on a permission revocation.

1. When a permission is revoked we kill the app immediately but do
not do an immediate kill for shared uid processes. This fixes it.

2. Remove system APIs that are used only by the package installer.

bug:22984670

Change-Id: I3d4ae52ea8679f894aa7c5972941263903479183
ackageManagerService.java
20de377beb17273a2d2dcd5715c418eec1ac897e 07-Aug-2015 Jeff Davidson <jpd@google.com> am 1d7c3254: Merge "Correctly propagate permissions when uninstalling updates." into mnc-dev

* commit '1d7c32548c30c62a35c54a624f89d5f9db31b9d4':
Correctly propagate permissions when uninstalling updates.
1d7c32548c30c62a35c54a624f89d5f9db31b9d4 07-Aug-2015 Jeff Davidson <jpd@google.com> Merge "Correctly propagate permissions when uninstalling updates." into mnc-dev
768352fdae6fc92805d11dd4e1a1220a25b5f5a5 07-Aug-2015 Andres Morales <anmorales@google.com> am e0a7cfa0: am 981c4561: am 7ab11e45: am 5fd47543: am 85c73c40: Merge "[UserManager] expose method to retrieve credential owner" into mnc-dev

* commit 'e0a7cfa026da56f1197c1feea79f76153c5eddd5':
[UserManager] expose method to retrieve credential owner
5fd4754310a9b19c7b880197e5bd237e2959c040 07-Aug-2015 Andres Morales <anmorales@google.com> am 85c73c40: Merge "[UserManager] expose method to retrieve credential owner" into mnc-dev

* commit '85c73c40d1fd76e8a7bbd90ab80458082764c1c3':
[UserManager] expose method to retrieve credential owner
85c73c40d1fd76e8a7bbd90ab80458082764c1c3 07-Aug-2015 Andres Morales <anmorales@google.com> Merge "[UserManager] expose method to retrieve credential owner" into mnc-dev
2cca431d96475fbc62918188760ba1ad68722a36 06-Aug-2015 Svetoslav Ganov <svetoslavganov@google.com> am 26dbbcc5: am 37a8bf61: am cee66550: am 8695ec34: am 38c0fbda: Merge "Pregrant unrevokable storage permission to the CertInstaller" into mnc-dev

* commit '26dbbcc555bd9d70474b88c4fde4cc5ddf8b8cb9':
Pregrant unrevokable storage permission to the CertInstaller
8695ec34cf0460ec7687b578475d71c4c09cb773 06-Aug-2015 Svetoslav Ganov <svetoslavganov@google.com> am 38c0fbda: Merge "Pregrant unrevokable storage permission to the CertInstaller" into mnc-dev

* commit '38c0fbda53399ac888e112d235e217fea220c2b7':
Pregrant unrevokable storage permission to the CertInstaller
0e62952aad13270bf3577a3381446cfc2dfba9ed 06-Aug-2015 Svetoslav <svetoslavganov@google.com> Pregrant unrevokable storage permission to the CertInstaller

bug:22988119

Change-Id: I310aa7149f67a7918cecfda13c69ab91c7c6e1a8
efaultPermissionGrantPolicy.java
16ed6a45aed0e5d7332647559c3c76b977b705b4 05-Aug-2015 Jeff Davidson <jpd@google.com> Correctly propagate permissions when uninstalling updates.

In ag/733689, which was intended to fix this bug, the following lines
were removed:

// Propagate the permissions state as we do want to drop on the floor
// runtime permissions. The update permissions method below will take
// care of removing obsolete permissions and grant install permissions.
ps.getPermissionsState().copyFrom(disabledPs.getPermissionsState());

The intent with these lines seemed to be that we needed to copy
permissions from the application on /data, which is being uninstalled,
over to the copy on /system, which was disabled but is being
reenabled. However, it wasn't functional, because it incorrectly
copied from the copy on /system, not the copy on /data.

Restore this code, copying from newPs (the copy on /data) rather than
disbledPs (the copy on /system), and clarify the comment because we do
*not* want to drop runtime permissions on the floor.

Bug: 22665508
Change-Id: I6bae37e70b6df1043c9a2b49255b985707ba151a
ackageManagerService.java
c5548c02fe0aa768ebfce88ac09393dabe61ec06 05-Aug-2015 Andres Morales <anmorales@google.com> [UserManager] expose method to retrieve credential owner

Certain operations (like ConfirmCredential) can be invoked
in the context of a profile, in which case the calling code
needs to know under what profile the credential is registered.

Expose a centralized location for this information for Settings
and GateKeeper to consume.

Bug: 22257554
Change-Id: Iffe4f6a254f52d1269b9287edabcf6efa515d9d2
serManagerService.java
e15d6c04cafd5390226358687de39fe1b4cb9c40 05-Aug-2015 Jeff Sharkey <jsharkey@google.com> am 5ea08853: am 294d1eeb: am 026457a4: am 64e26348: am 0d616883: Merge "Fix moving of apps into legacy ASEC." into mnc-dev

* commit '5ea088532f6c44468432ef459b31d30761384030':
Fix moving of apps into legacy ASEC.
64e26348bcb0f6282b71ff3577521d131f765a56 05-Aug-2015 Jeff Sharkey <jsharkey@google.com> am 0d616883: Merge "Fix moving of apps into legacy ASEC." into mnc-dev

* commit '0d6168835a6114a9e346278e4613e9175a907fd3':
Fix moving of apps into legacy ASEC.
0d6168835a6114a9e346278e4613e9175a907fd3 05-Aug-2015 Jeff Sharkey <jsharkey@google.com> Merge "Fix moving of apps into legacy ASEC." into mnc-dev
1c37aa88834e6d656e6cc66f671b36e37d72f459 04-Aug-2015 Svetoslav Ganov <svetoslavganov@google.com> am 9984f0ac: am c3973058: am b381d697: am 073bfb9b: am ce68917c: Merge "Ensure per package and per UID state share same package settings." into mnc-dev

* commit '9984f0acfdc8982946e0e70a08b67828d4d971cf':
Ensure per package and per UID state share same package settings.
073bfb9bec7bc407c50a23a2317852cb0d69599b 04-Aug-2015 Svetoslav Ganov <svetoslavganov@google.com> am ce68917c: Merge "Ensure per package and per UID state share same package settings." into mnc-dev

* commit 'ce68917c849548d80d9aca14f262d22d9c47c3dc':
Ensure per package and per UID state share same package settings.
ce68917c849548d80d9aca14f262d22d9c47c3dc 04-Aug-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Ensure per package and per UID state share same package settings." into mnc-dev
cb8e31d0d06fc80b926b658d38161d7f50c3cfee 04-Aug-2015 Todd Kennedy <toddke@google.com> move code back to original spot

The inital thought was to only create PostInstallData when it was
used later [during the restore]. Unfortunately, it is also used in
normal circumstances for pkg installation.

Bug: 22947287
Change-Id: Iab46183e57250e0f773538dc7156f65f461a3eeb
ackageManagerService.java
e7af1942bac3e674e09019f158de139cba1cbd0b 04-Aug-2015 Svet Ganov <svetoslavganov@google.com> Ensure per package and per UID state share same package settings.

When renaming a package during an OTA we were getting in a state
where the package setting mapped to the package UID was not the
same instance as the one we create for the new package mapped.
This leads to a drift between the permissions state for the package
and that state for the UID, resulting in broken for UID permission
checks as granted permissions were never appearing in the per UID
package setting.

bug:22928831

Change-Id: Ib0372632ec84a917304561fd94032cd09bb4c12f
ettings.java
3fa5609d83339032d456bb51f0419adae756baed 04-Aug-2015 Dianne Hackborn <hackbod@google.com> am aa860fd8: am 35c68de9: am 5dd9ef04: am b0bc8368: am 3011f645: Merge "Fix issue #22912704: "android.process.acore has stopped" dialog keeps popping up" into mnc-dev

* commit 'aa860fd83ab3d3096c4bdf86297b7d8f36f5eec8':
Fix issue #22912704: "android.process.acore has stopped" dialog keeps popping up
94dacb12185c6208d100ada88ed305376d9ab2ee 03-Aug-2015 Jeff Sharkey <jsharkey@android.com> Fix moving of apps into legacy ASEC.

Derive the correct current volume UUID for comparison, and only
check for cluster style installs when moving from internal storage.

Bug: 22616484
Change-Id: Idb6be2aa4aaa9b9f47ebbeeebd65c15a60d5d164
ackageManagerService.java
b0bc8368f53e80236026e54311f2dda7b662c664 04-Aug-2015 Dianne Hackborn <hackbod@google.com> am 3011f645: Merge "Fix issue #22912704: "android.process.acore has stopped" dialog keeps popping up" into mnc-dev

* commit '3011f645abe8f976af6f876579a179d51c09bf30':
Fix issue #22912704: "android.process.acore has stopped" dialog keeps popping up
3011f645abe8f976af6f876579a179d51c09bf30 04-Aug-2015 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #22912704: "android.process.acore has stopped" dialog keeps popping up" into mnc-dev
28ec27cbfa157c242fd9330a10c7c2b8ea838694 04-Aug-2015 Dianne Hackborn <hackbod@google.com> Fix issue #22912704: "android.process.acore has stopped" dialog keeps popping up

Slice 'em up!

Change-Id: Ibba3af7ec5b7f92e6d5e55a57aa838a7f7f936e1
ackageManagerService.java
c8a465c4d3827970f61555e604c43ef3b3f6d4d6 03-Aug-2015 Todd Kennedy <toddke@google.com> Add Package Manager tracing

Change-Id: I6ca2d499bd6a5712f7bf45ba383f1954559a2550
ackageManagerService.java
21d1ff5f38ffdbc906a6457b3769cf6a91e9f8a0 03-Aug-2015 Svetoslav Ganov <svetoslavganov@google.com> am 8622d9ea: am 3d745583: am a459294e: am c2003e1e: am 0855357c: Merge "User correct category for finding headless sync adapters" into mnc-dev

* commit '8622d9ea0551d61cb32c2b18da7c6764c8a9a428':
User correct category for finding headless sync adapters
c2003e1eba4a0bc98452a2b425e7d8dc99337e73 03-Aug-2015 Svetoslav Ganov <svetoslavganov@google.com> am 0855357c: Merge "User correct category for finding headless sync adapters" into mnc-dev

* commit '0855357c4fec1fddb4ebf20d9e7986090962f99d':
User correct category for finding headless sync adapters
0855357c4fec1fddb4ebf20d9e7986090962f99d 03-Aug-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "User correct category for finding headless sync adapters" into mnc-dev
05069b96d0464744e27f0eededcff7bf0ba17e9e 01-Aug-2015 Svet Ganov <svetoslavganov@google.com> User correct category for finding headless sync adapters

bug:22857409

Change-Id: Icc42f1af72c59fba3c60e1bcd558c621df70940a
efaultPermissionGrantPolicy.java
f6f1a7ec9935c32e6c1155333de94ac9cd544442 01-Aug-2015 Dianne Hackborn <hackbod@google.com> am 628b4125: am bc2a8843: am b97c5ddd: am 9b36f526: am c1836bb0: Merge "Change MNC codename to just M." into mnc-dev

* commit '628b4125843b93dc7f3ed0c9bbea76ff470d2eed':
Change MNC codename to just M.
9b36f526dd0378bda8f71c0e51ed37bf97742f8f 31-Jul-2015 Dianne Hackborn <hackbod@google.com> am c1836bb0: Merge "Change MNC codename to just M." into mnc-dev

* commit 'c1836bb0f1bf3e5ef0911719525da0bab3e53507':
Change MNC codename to just M.
c1836bb0f1bf3e5ef0911719525da0bab3e53507 31-Jul-2015 Dianne Hackborn <hackbod@google.com> Merge "Change MNC codename to just M." into mnc-dev
98a70b9d358d04bff2cdf7d6df99abf235d87027 31-Jul-2015 Benjamin Franz <bfranz@google.com> am 33cb97c0: am 54aed521: am 93d45d1c: am 982daf87: am d692fcf1: Merge "Add missing return statement" into mnc-dev

* commit '33cb97c0f0824f8a5f35c09db28565b076bc9994':
Add missing return statement
982daf8769bf78dd6bb240dab9ac7d0a62de21cc 31-Jul-2015 Benjamin Franz <bfranz@google.com> am d692fcf1: Merge "Add missing return statement" into mnc-dev

* commit 'd692fcf115e57fef8a15c214fb2fcde78a48b45c':
Add missing return statement
d692fcf115e57fef8a15c214fb2fcde78a48b45c 31-Jul-2015 Benjamin Franz <bfranz@google.com> Merge "Add missing return statement" into mnc-dev
3aa784e8a32dc1c2b1dcd4d552342fe94b0abe1b 30-Jul-2015 Shishir Agrawal <shishir@google.com> am dfccacca: am 124eb8dc: am 6635ccce: am f9dee583: am 8d1d8fda: Merge "Add SMS permissions for Carrier app." into mnc-dev

* commit 'dfccaccaa1087b1c59eb4a817bce6948fcb8357b':
Add SMS permissions for Carrier app.
f9dee58395fa72dc3764292aef4937dfcca0a14a 30-Jul-2015 Shishir Agrawal <shishir@google.com> am 8d1d8fda: Merge "Add SMS permissions for Carrier app." into mnc-dev

* commit '8d1d8fdaa40cc2149604c9947a7ccf1a6a494e36':
Add SMS permissions for Carrier app.
8d1d8fdaa40cc2149604c9947a7ccf1a6a494e36 30-Jul-2015 Shishir Agrawal <shishir@google.com> Merge "Add SMS permissions for Carrier app." into mnc-dev
9dacbf6fd4b602f3abe9b1a347690d474c54f9a7 30-Jul-2015 Benjamin Franz <bfranz@google.com> Add missing return statement

Bug: 22844272
Change-Id: I4b37b28adb1d1b6d0d1235dd68fbfad6c3121c54
ackageManagerService.java
ad63247690a5082a74891cd16278f6c2ba8760c6 30-Jul-2015 Shishir Agrawal <shishir@google.com> Add SMS permissions for Carrier app.

Carrier apps can act as a transport for SMS and MMS. They may proxy SMSes that
user is sending and need to have access to be able to send these SMSes via the
radio.

Bug: 22830087
Change-Id: I98c0ff1b208be1a7227aef7a4a69222050b3ddb4
efaultPermissionGrantPolicy.java
c685e0b2780cc6517863e47affcf7ff0ae02cf23 30-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> am cb623e4d: am 06b29188: am 92cb006c: am a4375293: am 393c7fb2: Merge "Default grants: handle update system packages" into mnc-dev

* commit 'cb623e4d863d020ba465ee02d10be79cfe9ae0a2':
Default grants: handle update system packages
0e3de6cacaffcfeda4d6353be61e2f1f9ed80705 30-Jul-2015 Dianne Hackborn <hackbod@google.com> Change MNC codename to just M.

Change-Id: I4281d200ff6560791c47cf9073ceea1cb509361e
ackageManagerService.java
a43752934f76316b60a839b2526a23e40714bd70 30-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> am 393c7fb2: Merge "Default grants: handle update system packages" into mnc-dev

* commit '393c7fb2c67e7fc9dfab710a52313f9b55aaa57c':
Default grants: handle update system packages
fdf59bf82f35ccc870dbb7eb20b958997ea73b36 30-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> am c875ad14: am 56de6167: am f6c2d8a9: am 6da43a83: am 9352af2a: Merge "Remove dependencies on the package installer\'s package name" into mnc-dev

* commit 'c875ad14ddc09d0d3a3bde58f71845123110f9f2':
Remove dependencies on the package installer's package name
6672c8ba3b9e52a384cddb7fe77bd8d97fbfd128 30-Jul-2015 Sailesh Nepal <sail@google.com> am 33ec1710: am 2830a139: am 2084291d: am 33763760: am 6b96de8d: Merge "Default permissions for sim call manager" into mnc-dev

* commit '33ec1710b0404f36019688ea8e285b687f81109c':
Default permissions for sim call manager
d9af284299d0ef9ba388da7c883b71002f4593f7 30-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> am f8678e33: am 184f3c24: am 0acabb00: am 9e3d8e26: am a7a65ee4: Merge "Allow non system to set perm policy flags - needed by the installer" into mnc-dev

* commit 'f8678e336f4326115c8635f24def9096f8cad1ca':
Allow non system to set perm policy flags - needed by the installer
d2574c07684363f8d7f78135a15272d663b3133c 30-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> am ef87e802: am 2e621fdc: am ff5e7c34: am 7b45b0fb: am 120a86ac: Merge "Do not reset runtime permissions on upgrade" into mnc-dev

* commit 'ef87e802faac3a330681743fb3215dd3978dc268':
Do not reset runtime permissions on upgrade
393c7fb2c67e7fc9dfab710a52313f9b55aaa57c 29-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Default grants: handle update system packages" into mnc-dev
4aa97977863e01af3803afcee97292109bbec97c 29-Jul-2015 Svetoslav <svetoslavganov@google.com> Default grants: handle update system packages

If there is an app on the system image that gets default
grants but it is updated with a version that does not use
all permissions the version on the system image does, we
would wrongly try to grant a permission to the updated app
that it does not request and crash as a result. Now we
default grant permission that are requested by the system
version of the app regardless if it is updated but only if
the system app is not updated or the update also uses these
permissions.

bug:22800767

Change-Id: Ic22b62ba4976367420a56bdadc8e3824b0b9104f
efaultPermissionGrantPolicy.java
6da43a835c0667e7f539ef47870d83f9bc516ef9 29-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> am 9352af2a: Merge "Remove dependencies on the package installer\'s package name" into mnc-dev

* commit '9352af2a9ef95e3f577a04474625249d3da62a04':
Remove dependencies on the package installer's package name
337637607df93491276a1285f57dd41afd219682 29-Jul-2015 Sailesh Nepal <sail@google.com> am 6b96de8d: Merge "Default permissions for sim call manager" into mnc-dev

* commit '6b96de8dae8be99f75c86c795672905e10fca153':
Default permissions for sim call manager
9e3d8e269e1c016af28c29ca8989ba765504331d 29-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> am a7a65ee4: Merge "Allow non system to set perm policy flags - needed by the installer" into mnc-dev

* commit 'a7a65ee4c5fb879fee258c63b92e49ab4571bbdb':
Allow non system to set perm policy flags - needed by the installer
7b45b0fbf14c43521560a7bf115ec5c92cda1788 29-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> am 120a86ac: Merge "Do not reset runtime permissions on upgrade" into mnc-dev

* commit '120a86ac6f4ac6d2dfdef01dd1fbefdcd1cc8735':
Do not reset runtime permissions on upgrade
9352af2a9ef95e3f577a04474625249d3da62a04 29-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Remove dependencies on the package installer's package name" into mnc-dev
6b96de8dae8be99f75c86c795672905e10fca153 29-Jul-2015 Sailesh Nepal <sail@google.com> Merge "Default permissions for sim call manager" into mnc-dev
a7a65ee4c5fb879fee258c63b92e49ab4571bbdb 29-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Allow non system to set perm policy flags - needed by the installer" into mnc-dev
525bc7a5a68cf2bf5159780ebb66ca4a3bf600ee 29-Jul-2015 Svet Ganov <svetoslavganov@google.com> Allow non system to set perm policy flags - needed by the installer

My previous change overtightened which permission flags can be changed
by a non-system caller. This took away the capability of the package
installer to set policy flags which it needs to implement the auto
grant/deny behavior.

bug:22776149

Change-Id: Ic2a82bedc413fc91360c3bcec355fac456f0fccf
ackageManagerService.java
f480f2899cf4667170d93f6d7637e735b82d5bae 29-Jul-2015 Svet Ganov <svetoslavganov@google.com> Do not reset runtime permissions on upgrade

bug:22772831

Change-Id: Ic7113f48bf4fe2fe2f50bf94c4b6dbb2130b6621
ackageManagerService.java
f1b7f20bb839c96e8254ccb65398135f10fd45d9 29-Jul-2015 Svet Ganov <svetoslavganov@google.com> Remove dependencies on the package installer's package name

bug:22700053

Change-Id: I8540eb8577fbec84e1a67e31e1c31ba654c828a4
ackageInstallerSession.java
ackageManagerService.java
cf85562bc9a0f01db51b4088e72f05a8089fc7f1 29-Jul-2015 Sailesh Nepal <sail@google.com> Default permissions for sim call manager

This CL adds the following permissions by default to the
SIM call manager:
- microphone
- phone

BUG: 22790160
Change-Id: Icaf1db6c6943b3ddbd16a946a81d1bfb734d761f
efaultPermissionGrantPolicy.java
ackageManagerService.java
0c6c5c54383121ae5674d287b13f88dc3e149f26 29-Jul-2015 Todd Kennedy <toddke@google.com> am d2f742d5: am 4c423351: am b91bf1f3: am 673fed99: am f2c616ed: Merge "Partially revert package freezing" into mnc-dev

* commit 'd2f742d5a6ee0dd0fdc9b9321f4102dae9f8131e':
Partially revert package freezing
673fed99b931ce0efc17b0e549e7842e4775154c 29-Jul-2015 Todd Kennedy <toddke@google.com> am f2c616ed: Merge "Partially revert package freezing" into mnc-dev

* commit 'f2c616ed02aee3b9a9025caf288aadbf22cfd046':
Partially revert package freezing
6b0c8315e4c0db24522675c05ecd6a0b9bfb6d9e 28-Jul-2015 Todd Kennedy <toddke@google.com> Partially revert package freezing

On the Nexus Player, upgrading the launcher would cause multiple, simultaneous
processes to be running. In order to prevent this regression, revert the portion
of ag/682591 dealing with package upgrades.

Bug: 21123444
Change-Id: I7a4cf98c7e28fc9893b1c0358d3a98702d94c039
ackageManagerService.java
8bcd8411111c7199dd5cbd90748d34765fa35c84 28-Jul-2015 Fyodor Kupolov <fkupolov@google.com> am 4e5a63fe: am 820b1395: am 9b02cff8: am 0bc60661: am 67a32c49: Merge "Added missing check for MANAGE_USERS" into mnc-dev

* commit '4e5a63fe1c6f4f7e95cd8eb0f469f77590a6c4b2':
Added missing check for MANAGE_USERS
0bc606614ab4c7ec20b6696e0a6bba4f46568925 28-Jul-2015 Fyodor Kupolov <fkupolov@google.com> am 67a32c49: Merge "Added missing check for MANAGE_USERS" into mnc-dev

* commit '67a32c499177d41e48c3ac5a803f883fd97acf37':
Added missing check for MANAGE_USERS
67a32c499177d41e48c3ac5a803f883fd97acf37 28-Jul-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Added missing check for MANAGE_USERS" into mnc-dev
d4b2604109c9239e14b5c96678d751bf05ba4657 27-Jul-2015 Fyodor Kupolov <fkupolov@google.com> Added missing check for MANAGE_USERS

setUserRestriction should do the same permission check as setUserRestrictions
method.

Bug: 22767990
Change-Id: I01f0508ebb23deafaa32ad5dd7063b98a78641be
serManagerService.java
aaf148485108604fb50f11b090d3031dfb7f95ef 27-Jul-2015 Fyodor Kupolov <fkupolov@google.com> am d1f1985f: am 4b3f6caf: am d815c04b: am d7d1ea45: am b83b5fa6: Merge "Check for ACCESS_COARSE_LOCATION/ACCESS_FINE_LOCATION" into mnc-dev

* commit 'd1f1985f33df9915dbd1895433c2c74a0493613c':
Check for ACCESS_COARSE_LOCATION/ACCESS_FINE_LOCATION
d7d1ea45984efdb6a514e97312045ac5b67ccb22 27-Jul-2015 Fyodor Kupolov <fkupolov@google.com> am b83b5fa6: Merge "Check for ACCESS_COARSE_LOCATION/ACCESS_FINE_LOCATION" into mnc-dev

* commit 'b83b5fa641847ee1d533253ba5e1a3e13913b9d9':
Check for ACCESS_COARSE_LOCATION/ACCESS_FINE_LOCATION
ce09a024f8478a21b1f4b8e8ddaf247b0fc9f616 24-Jul-2015 Fyodor Kupolov <fkupolov@google.com> Check for ACCESS_COARSE_LOCATION/ACCESS_FINE_LOCATION

Call to checkPermission(ACCESS_COARSE_LOCATION) should return
PERMISSION_GRANTED, when package only has ACCESS_FINE_LOCATION permission

Bug: 21852542
Change-Id: I53fe2945784213693f59e7bfccc524276ea8c189
ackageManagerService.java
12058d065e5940c4a38c22327c6e956f6b5492a3 24-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> am 2dd71cc1: am 74521d3a: am 7bda4b96: am 79355545: am 28762e61: Merge "Keep default permission grants uninstalling a sys package upgrade" into mnc-dev

* commit '2dd71cc16565d0183d940987aad168a4efcf6423':
Keep default permission grants uninstalling a sys package upgrade
5cdca2a812af6b534000c93c0c72c7a0912bd81c 24-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> am cb731204: am ce4668b6: am 3fce45b6: am 54f1db79: am 607bc34f: Merge "Reset permissions and app links when clearing app preferences - framework" into mnc-dev

* commit 'cb731204c47034b6ce3e6a96b127fafc322a3625':
Reset permissions and app links when clearing app preferences - framework
2138736179504b149cf2ae0f60acb45b55ce0f7b 24-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> am 54603af5: am d788f405: am 675ecc43: am 5974a7ea: am 492fc648: Merge "Grant record audio to system reco service by default" into mnc-dev

* commit '54603af5c2c044a3635c77f25fe0eaf6f826a4f7':
Grant record audio to system reco service by default
5b98249e67198f31fe543334067943aa8ef4788d 24-Jul-2015 Jeff Sharkey <jsharkey@google.com> am 5080e90a: am aebcf3b7: am 23fdb635: am e87dc6db: am f6e9a3ed: Merge "More info to support CTS, fix reconcile bug." into mnc-dev

* commit '5080e90a62445f3ddf2dcff4adabe2d251d25932':
More info to support CTS, fix reconcile bug.
793555452ad44c006657b6c511c5c6068c0317ba 24-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> am 28762e61: Merge "Keep default permission grants uninstalling a sys package upgrade" into mnc-dev

* commit '28762e61e2e45a7e30af02c6fa840a065a645b68':
Keep default permission grants uninstalling a sys package upgrade
28762e61e2e45a7e30af02c6fa840a065a645b68 24-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Keep default permission grants uninstalling a sys package upgrade" into mnc-dev
315c4ac1b66922ef96c4c32d3c5344edd94513e1 24-Jul-2015 Svet Ganov <svetoslavganov@google.com> Keep default permission grants uninstalling a sys package upgrade

bug:22665508

Change-Id: I1cb1e53a8643ddad77f0be9e40d5b504501e06de
ackageManagerService.java
bf822d39a24b0de8228f5fc96c9ea4fcf320cbdc 24-Jul-2015 Dianne Hackborn <hackbod@google.com> am c9e454a5: am 26b2453c: am d363399b: am 86350411: am b7394671: Merge "Work on issue #22303510: Additional permissions aren\'t properly..." into mnc-dev

* commit 'c9e454a544233b6d4d7ae96d4442505bbad22fcb':
Work on issue #22303510: Additional permissions aren't properly...
54f1db793264192017c588b618c7d4cb311482c0 24-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> am 607bc34f: Merge "Reset permissions and app links when clearing app preferences - framework" into mnc-dev

* commit '607bc34f93a8c074d1982861273d210291eae34d':
Reset permissions and app links when clearing app preferences - framework
607bc34f93a8c074d1982861273d210291eae34d 23-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Reset permissions and app links when clearing app preferences - framework" into mnc-dev
5974a7ea2fcc11b994599bdd2c9e2b4c8bbdaf56 23-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> am 492fc648: Merge "Grant record audio to system reco service by default" into mnc-dev

* commit '492fc6483184a0e82d5d1a77634a38c10c7577ac':
Grant record audio to system reco service by default
e87dc6dba58e55c60f387a86468a57a5109a97ac 23-Jul-2015 Jeff Sharkey <jsharkey@google.com> am f6e9a3ed: Merge "More info to support CTS, fix reconcile bug." into mnc-dev

* commit 'f6e9a3ede53ae487838c19714ad62f25a4a6ca4c':
More info to support CTS, fix reconcile bug.
9c8b8ab941e3ca7bdf2cccad6836760d7723518e 23-Jul-2015 Svet Ganov <svetoslavganov@google.com> Reset permissions and app links when clearing app preferences - framework

bug:22359132

Change-Id: I198c0b1cd6c3dcb91fe560874a8502eb6b5f65b3
ackageManagerService.java
492fc6483184a0e82d5d1a77634a38c10c7577ac 23-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Grant record audio to system reco service by default" into mnc-dev
c6ab8b9ecbf08fe3b2dda18caaa808ce6280530d 23-Jul-2015 Svetoslav <svetoslavganov@google.com> Grant record audio to system reco service by default

bug:22668415

Change-Id: I0fec7cc671bb1cc3a13b870748fc8e110a11250e
efaultPermissionGrantPolicy.java
863504111546fb46fcb5af356efb267c8582018a 22-Jul-2015 Dianne Hackborn <hackbod@google.com> am b7394671: Merge "Work on issue #22303510: Additional permissions aren\'t properly..." into mnc-dev

* commit 'b73946715cb9e3ca7a2702407e34f885e92a5d9a':
Work on issue #22303510: Additional permissions aren't properly...
f6e9a3ede53ae487838c19714ad62f25a4a6ca4c 22-Jul-2015 Jeff Sharkey <jsharkey@google.com> Merge "More info to support CTS, fix reconcile bug." into mnc-dev
85ced632680642fce680d141ddd10299ff849233 22-Jul-2015 Jeff Sharkey <jsharkey@android.com> More info to support CTS, fix reconcile bug.

Surface more details and commands for storage volumes to support
CTS testing. Fix user reconciliation bug that skipped user setup on
empty volumes.

Bug: 22658804, 22633097
Change-Id: I4221312d1cce24d1f5a2c108095cf3cf471598ed
ackageManagerService.java
b73946715cb9e3ca7a2702407e34f885e92a5d9a 22-Jul-2015 Dianne Hackborn <hackbod@google.com> Merge "Work on issue #22303510: Additional permissions aren't properly..." into mnc-dev
2f7e00554a4f2c3aaf8499015b3fa77179cc19a9 22-Jul-2015 Jeff Sharkey <jsharkey@android.com> am 426020b8: am b109b134: am 934995ed: am b020b0d9: am cf051d18: Merge "Avoid NPE when no staged installs." into mnc-dev

* commit '426020b80d2214e3e993140abbfe4adc7b14de81':
Avoid NPE when no staged installs.
cfbfafe1b9ca2fd135a4fb6b528b3829830803bf 22-Jul-2015 Dianne Hackborn <hackbod@google.com> Work on issue #22303510: Additional permissions aren't properly...

...disabled after toggling them off

Keep track of whether a permission that has been declared by an app
was able to actually be installed in the system, along with an API
to find this information so that system UI can tell whether that
permission is of interest.

Also clean up some of the permission debug output.

Change-Id: If4541bedb857789b255bb18f03cad155dcda0b95
ackageManagerService.java
ettings.java
b020b0d97d80f0ebb550ce58a5b36787cfcf6df8 21-Jul-2015 Jeff Sharkey <jsharkey@android.com> am cf051d18: Merge "Avoid NPE when no staged installs." into mnc-dev

* commit 'cf051d1846c347413d8c907b42f3fce74795a815':
Avoid NPE when no staged installs.
527dfdfa72e319d11013ab9c7bf79af42fa91ad7 21-Jul-2015 Jeff Sharkey <jsharkey@android.com> am d4dc8756: am 4524184c: am f811d7fc: am fe7a311c: am 35ba2cdb: Merge "Inherit ABI when moving existing install." into mnc-dev

* commit 'd4dc87569fcc608f8065395c98ac956a3d11a79a':
Inherit ABI when moving existing install.
54d42be6eb149b3e43115e810e4a1b92e9865d05 21-Jul-2015 Jeff Sharkey <jsharkey@android.com> Avoid NPE when no staged installs.

listFiles() returns null instead of empty list; deal with it.

Bug: 22608671
Change-Id: I60dabec31932af3cded915c6927a4c5e5c71775d
ackageInstallerService.java
fe7a311c421473f1b50dcd2751585f89664a4327 20-Jul-2015 Jeff Sharkey <jsharkey@android.com> am 35ba2cdb: Merge "Inherit ABI when moving existing install." into mnc-dev

* commit '35ba2cdbf8654d708e57d209131dd498705d0e18':
Inherit ABI when moving existing install.
840b11cba0f1731a6ef45c9691850257f2da03b1 20-Jul-2015 Christopher Tate <ctate@google.com> am 745f3803: am eddb6c00: am 9606921b: am 0fc1e88c: am 6afdad7e: Merge "Don\'t fall back to domain verification state when looking up app linkage state" into mnc-dev

* commit '745f380307c8ecf962488447e81745103d5a8682':
Don't fall back to domain verification state when looking up app linkage state
35ba2cdbf8654d708e57d209131dd498705d0e18 20-Jul-2015 Jeff Sharkey <jsharkey@android.com> Merge "Inherit ABI when moving existing install." into mnc-dev
40cda8ef7c2e91fe1557a8cc35e01b91acf1def8 20-Jul-2015 Jeff Sharkey <jsharkey@android.com> Inherit ABI when moving existing install.

Previously installed apps are moved between volumes as an complete
package, including any previously unpacked native libraries. This
means we need to inherit any previously derived ABI when moving.

Bug: 22093837
Change-Id: I7656e338affa44e7f997fe4aa95bb297c0acc165
ackageManagerService.java
0fc1e88c05e805324880a35b3f10126937824a79 20-Jul-2015 Christopher Tate <ctate@google.com> am 6afdad7e: Merge "Don\'t fall back to domain verification state when looking up app linkage state" into mnc-dev

* commit '6afdad7e8863cb1fa3db5909e48269606fa76991':
Don't fall back to domain verification state when looking up app linkage state
6afdad7e8863cb1fa3db5909e48269606fa76991 20-Jul-2015 Christopher Tate <ctate@google.com> Merge "Don't fall back to domain verification state when looking up app linkage state" into mnc-dev
bdc7141f7f7d278922d240f466244e352d758635 18-Jul-2015 Jeff Sharkey <jsharkey@android.com> am 8d6abd0b: am e9896b3d: am 88c3301c: am 2d9d5905: am 25945302: Merge "Persist version data on a per-volume basis." into mnc-dev

* commit '8d6abd0b772740a0d7a5a135d250d371da2f0522':
Persist version data on a per-volume basis.
a90ce1f985f99e39a7857b7393227c17f6e41b7a 18-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> am 9fe97395: am fd050586: am fa24a782: am 41ec3923: am fbc6f2cb: Merge "Revert "Do not auto grant GET_ACCOUNTS as it is temporarily normal"" into mnc-dev

* commit '9fe97395488402714d023f20d488b19a7d477c78':
Revert "Do not auto grant GET_ACCOUNTS as it is temporarily normal"
2d9d59053fcb8504914f358a1417e67a94c0f8f1 18-Jul-2015 Jeff Sharkey <jsharkey@android.com> am 25945302: Merge "Persist version data on a per-volume basis." into mnc-dev

* commit '259453024c015da9d70d1ffadba09604aa1c786e':
Persist version data on a per-volume basis.
16c268ee90b36defa86ad24f030d7b5a73df2933 18-Jul-2015 Dianne Hackborn <hackbod@google.com> am c8457784: am 9b7c2ee7: am 35534fb4: am fb03aa36: am 5c269121: Merge "Work on issue #22556778: Starting under voice control not allowed" into mnc-dev

* commit 'c8457784df15e6c4361bce65628c56b9326977cf':
Work on issue #22556778: Starting under voice control not allowed
259453024c015da9d70d1ffadba09604aa1c786e 18-Jul-2015 Jeff Sharkey <jsharkey@android.com> Merge "Persist version data on a per-volume basis." into mnc-dev
f80b52b08aff0fe4c5a5fdc710aa5976c7b25699 17-Jul-2015 Jeff Sharkey <jsharkey@android.com> Persist version data on a per-volume basis.

Now that we support multiple adopted external storage devices, we
need to keep track of version data for each volume. This means we
now correctly handle certificate upgrade edge cases, permission
regranting, and clearing of code caches on a per-volume basis.

Bug: 22298966
Change-Id: Ifb9940c197f6c058a3ecca728257f853ce0fd7f4
ackageManagerService.java
ettings.java
41ec39230cd9c6b0d911f99854afc33dfc17e03d 18-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> am fbc6f2cb: Merge "Revert "Do not auto grant GET_ACCOUNTS as it is temporarily normal"" into mnc-dev

* commit 'fbc6f2cb6c5313ac246b8554764a719dd06582fc':
Revert "Do not auto grant GET_ACCOUNTS as it is temporarily normal"
fbc6f2cb6c5313ac246b8554764a719dd06582fc 18-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> Merge "Revert "Do not auto grant GET_ACCOUNTS as it is temporarily normal"" into mnc-dev
d85a66420244eea14588cabf8373cd90e0a6ca49 18-Jul-2015 Christopher Tate <ctate@google.com> Don't fall back to domain verification state when looking up app linkage state

This is in support of the always/never/ask UI tweaks in Settings: any
"assume always" fallback at the verification layer should not be
conflated with the user-facing semantic toggle. This was causing the
UI to report apps as being in the 'always open their links' state
inappropriately.

Bug 22532193

Change-Id: Iaa4bc3a2d5db814e1b0d96bc1c4ecfaafb1e3105
ettings.java
fb03aa36a4790ca0ff5e11a56903507089278390 18-Jul-2015 Dianne Hackborn <hackbod@google.com> am 5c269121: Merge "Work on issue #22556778: Starting under voice control not allowed" into mnc-dev

* commit '5c269121d8ea0bf3f530f2314695e189ffdb3165':
Work on issue #22556778: Starting under voice control not allowed
d4b30c82a8f23698a93658995a47dfa1bcd59449 18-Jul-2015 Svet Ganov <svetoslavganov@google.com> am 825cdf83: am b6a8753c: am d28adb48: am 2d92575a: am 5ff4383b: Merge "Grant default permissions to default apps despite user choices." into mnc-dev

* commit '825cdf8305ca950a1f9da774728252ca3b702ef6':
Grant default permissions to default apps despite user choices.
5c269121d8ea0bf3f530f2314695e189ffdb3165 18-Jul-2015 Dianne Hackborn <hackbod@google.com> Merge "Work on issue #22556778: Starting under voice control not allowed" into mnc-dev
9bd7ccd21c5247f74ae57c861bc6ee1aec4f0181 17-Jul-2015 Svet Ganov <svetoslavganov@google.com> am a47df5a0: am e29a61a0: am ae61307d: am fa9a616d: am 4a1421f3: Merge "Do not auto grant GET_ACCOUNTS as it is temporarily normal" into mnc-dev

* commit 'a47df5a0aa6790e8c185dea630a62140de7c346f':
Do not auto grant GET_ACCOUNTS as it is temporarily normal
2d92575ad0dbbf3bfee4f013f4b78fac06c0ab50 17-Jul-2015 Svet Ganov <svetoslavganov@google.com> am 5ff4383b: Merge "Grant default permissions to default apps despite user choices." into mnc-dev

* commit '5ff4383b466fc26e6696a7bbeb6df5eb7a3c8cc5':
Grant default permissions to default apps despite user choices.
2988187d7b51b12d0d669893f8b3967eace833ff 17-Jul-2015 Xiaohui Chen <xiaohuic@google.com> Merge "sys user split: fix primary flag bug."
5ff4383b466fc26e6696a7bbeb6df5eb7a3c8cc5 17-Jul-2015 Svet Ganov <svetoslavganov@google.com> Merge "Grant default permissions to default apps despite user choices." into mnc-dev
4bb5187e63456a500518e698d5646672188cb3c3 17-Jul-2015 Svet Ganov <svetoslavganov@google.com> Grant default permissions to default apps despite user choices.

This implements the policy of granting default permissions to default
apps upon a selection despite past user permission choices. The act of
picking the app as the default one means the user expects it to work in
this capacity as SMS app, Phone app, Browser app.

bug:22062549

Change-Id: I5e427f2b939e85bb8bbfd311cc271b96857a7ce6
efaultPermissionGrantPolicy.java
54a0cf1b95d5dfc40ef26035dfc4f45c0e7e3fe3 17-Jul-2015 Svetoslav Ganov <svetoslavganov@google.com> Revert "Do not auto grant GET_ACCOUNTS as it is temporarily normal"

This reverts commit 33852d8cd21434b4106b8f2c504752ef34abb2da.

Change-Id: I29a212876c93ae0288967ffcff223abafad78827
efaultPermissionGrantPolicy.java
fa9a616de9664c4bd7212683facbd31dcd9c3bdd 17-Jul-2015 Svet Ganov <svetoslavganov@google.com> am 4a1421f3: Merge "Do not auto grant GET_ACCOUNTS as it is temporarily normal" into mnc-dev

* commit '4a1421f3c50d53a7e2230f41854df12215378ef2':
Do not auto grant GET_ACCOUNTS as it is temporarily normal
4a1421f3c50d53a7e2230f41854df12215378ef2 17-Jul-2015 Svet Ganov <svetoslavganov@google.com> Merge "Do not auto grant GET_ACCOUNTS as it is temporarily normal" into mnc-dev
33852d8cd21434b4106b8f2c504752ef34abb2da 17-Jul-2015 Svet Ganov <svetoslavganov@google.com> Do not auto grant GET_ACCOUNTS as it is temporarily normal

bug:22550851

Change-Id: Iea5dd8fde07074220167a937b32208b1c9488d9d
efaultPermissionGrantPolicy.java
f38c4ee9030b68c2f2b00d376c7d4a05a58a818a 17-Jul-2015 Dianne Hackborn <hackbod@google.com> Work on issue #22556778: Starting under voice control not allowed

The ResolverActivity is voice capable. In fact, it is capable
of EVERYTHING.

Change-Id: I37c4476d546f61fee3540b747aff77e88b702d48
ackageManagerService.java
203243aeaeb20027f2292dc0cec715e159ad1213 16-Jul-2015 Xiaohui Chen <xiaohuic@google.com> sys user split: fix primary flag bug.

When the end user first login as Guest, and the device rebooted during
the session (Guest user not removed), then the first user created
afterwards would not be correctly marked as primary. We need to
explicitly looks through all current users to be able to tell for
sure.

Bug: 19913735
Change-Id: Iab1160c17c8dfdc054fd5dd136435fe2711dfa0c
serManagerService.java
d5ec715394c69bc172b87d991c1ce4ba04d51f44 17-Jul-2015 Todd Kennedy <toddke@google.com> am fdc235a4: am a7624f57: am b1f78ba8: am 8c47b335: am 5fe22e4f: Merge "clear calling identity to dexopt" into mnc-dev

* commit 'fdc235a42b330863f9489fc73dd8d718e8a00b77':
clear calling identity to dexopt
8c47b335b0dd06efbcbf17e26df2be67a33a15f1 17-Jul-2015 Todd Kennedy <toddke@google.com> am 5fe22e4f: Merge "clear calling identity to dexopt" into mnc-dev

* commit '5fe22e4fcbc543aa588d739b2453b3fa72d31859':
clear calling identity to dexopt
5fe22e4fcbc543aa588d739b2453b3fa72d31859 17-Jul-2015 Todd Kennedy <toddke@google.com> Merge "clear calling identity to dexopt" into mnc-dev
2a89545739b4efef4bd6535206ad0f5a813df39f 17-Jul-2015 Todd Kennedy <toddke@google.com> clear calling identity to dexopt

Bug: 22067670
Change-Id: I3596f26a079660f6898401ed679463193b00c799
ackageManagerService.java
28e7313992ba6efd94ddc16b45278863f84d7fcb 17-Jul-2015 Svet Ganov <svetoslavganov@google.com> am 71d12704: am 475858c3: am b295963b: am c00e49b6: am d4b566bf: Merge "Add APIs for verifier to grant at install and revoke permissions" into mnc-dev

* commit '71d12704f64eeace695a6b8e0cd8f36007b96270':
Add APIs for verifier to grant at install and revoke permissions
c00e49b6e4e4cc8356529567040d6ee3be8c1dc3 17-Jul-2015 Svet Ganov <svetoslavganov@google.com> am d4b566bf: Merge "Add APIs for verifier to grant at install and revoke permissions" into mnc-dev

* commit 'd4b566bf56333de708908ce4accb5fb067be64f0':
Add APIs for verifier to grant at install and revoke permissions
d4b566bf56333de708908ce4accb5fb067be64f0 17-Jul-2015 Svet Ganov <svetoslavganov@google.com> Merge "Add APIs for verifier to grant at install and revoke permissions" into mnc-dev
2386517b7c3961bea15e7718eb9c450479f6ef71 17-Jul-2015 Makoto Onuki <omakoto@google.com> am b32039ae: am c2bf95b0: am 89bcc24b: am d737ab17: am b09b84ca: Merge "DefaultPermission: GET_ACCOUNTS is now in CONTACTS" into mnc-dev

* commit 'b32039aeba173e87a64e44b5ee47fb6e78fca662':
DefaultPermission: GET_ACCOUNTS is now in CONTACTS
d737ab1776d1bb7a3402137bdbf3afffe9860c5a 16-Jul-2015 Makoto Onuki <omakoto@google.com> am b09b84ca: Merge "DefaultPermission: GET_ACCOUNTS is now in CONTACTS" into mnc-dev

* commit 'b09b84cafde5ac31f5ef5c79f7a78db540824471':
DefaultPermission: GET_ACCOUNTS is now in CONTACTS
b09b84cafde5ac31f5ef5c79f7a78db540824471 16-Jul-2015 Makoto Onuki <omakoto@google.com> Merge "DefaultPermission: GET_ACCOUNTS is now in CONTACTS" into mnc-dev
a57940dd76e4b0d18d6ab944a311276a634be98f 16-Jul-2015 Todd Kennedy <toddke@google.com> am c0036d03: am 48869114: am a6a5ba19: am c84bf849: am a4911ed9: Merge "Verfiy global apps with device owner" into mnc-dev

* commit 'c0036d03a47ebe0eadee68a9db31e86d88153422':
Verfiy global apps with device owner
bc92479a297904856f0815bc14bcb6763bbbf8bf 16-Jul-2015 Makoto Onuki <omakoto@google.com> DefaultPermission: GET_ACCOUNTS is now in CONTACTS

Bug 22532312

Change-Id: If7ad0faa3a196bb28da1ddc13788c0430df1d1ee
efaultPermissionGrantPolicy.java
c84bf8498e51b04f8be5bfea0616a4bc0bc81eee 16-Jul-2015 Todd Kennedy <toddke@google.com> am a4911ed9: Merge "Verfiy global apps with device owner" into mnc-dev

* commit 'a4911ed97102b638a373adcdae7e4c9b3c64cc30':
Verfiy global apps with device owner
a4911ed97102b638a373adcdae7e4c9b3c64cc30 16-Jul-2015 Todd Kennedy <toddke@google.com> Merge "Verfiy global apps with device owner" into mnc-dev
c2c8ac37966db3499f7246ad9dedb0b779d72754 16-Jul-2015 Nicolas Prevot <nprevot@google.com> am 73c489a9: am e31dad2b: am e4036947: am b298ba48: am dbdf7c45: Don\'t send app links to the parent if status = never (part 2)

* commit '73c489a9b3045b044ca6d670762bee64ce8f6044':
Don't send app links to the parent if status = never (part 2)
633f19983182fbcf9479f6d5dd9f5e29e37f4cd0 16-Jul-2015 Todd Kennedy <toddke@google.com> Verfiy global apps with device owner

Applications installed for a specific user must be verfied as that user. However,
apps that are installed globally [i.e. UserHandle.ALL] should not be verified by
every user on the device. Instead, they should be verified by the device owner.

Bug: 21901423
Change-Id: I5fd3f690d08e7e911a3c86f09bbfcd4eb635b418
ackageManagerService.java
bf36f7569a8a06138509032e6698ec9a3ed33096 16-Jul-2015 Xiaohui Chen <xiaohuic@google.com> Merge "sys user split: assign admin/primary flag"
b298ba48275fb36390398afbe196cc1ef7dae762 16-Jul-2015 Nicolas Prevot <nprevot@google.com> am dbdf7c45: Don\'t send app links to the parent if status = never (part 2)

* commit 'dbdf7c45380f7701e029a279932d2c97bf55fdc9':
Don't send app links to the parent if status = never (part 2)
dbdf7c45380f7701e029a279932d2c97bf55fdc9 15-Jul-2015 Nicolas Prevot <nprevot@google.com> Don't send app links to the parent if status = never (part 2)

To qualify for cross-profile app linking, an intent should resolve
with a better status than "NEVER". Moved this check from canForwardTo
into the source method, getCrossProfileDomainPreferredLpr, to stop
bad resolutions leaking out.

BUG:22287521
Change-Id: I195979d78a783864d841a81f358780912bbf168e
ackageManagerService.java
7121e18595d4c559044e26bfe6035406a862f466 14-Jul-2015 Svet Ganov <svetoslavganov@google.com> Add APIs for verifier to grant at install and revoke permissions

bug:22231699

Change-Id: Ie0c758bf73699f50bf99ff5aa0bf98dcc9004e37
ackageInstallerService.java
ackageManagerService.java
dbcba09295a01922de675fcff63b5419427f45d8 16-Jul-2015 Chris Tate <ctate@android.com> am 6baa88d5: am 87c3a63c: am 73c8a19d: am 5a626722: am a36c5580: Merge "Fix a bug disappearing installerPackageName info of packages after reboot." into mnc-dev

* commit '6baa88d5d35756f5141dd3dd684255ea4d0d2a16':
Fix a bug disappearing installerPackageName info of packages after reboot.
a0bfc2063533d4b93435a49c9e19e54989c3459a 16-Jul-2015 Christopher Tate <ctate@google.com> am fdb71b60: am 374600c9: am 49af7ad4: am fbb4e9d2: am 3b1f8607: Merge "Intent filters need CATEGORY_BROWSABLE to be app-linking eligible" into mnc-dev

* commit 'fdb71b6041c7e4eba0410116799b276ab8ab83c5':
Intent filters need CATEGORY_BROWSABLE to be app-linking eligible
5a6267226e0472a2d6ac69741de1f951b11950c6 16-Jul-2015 Chris Tate <ctate@android.com> am a36c5580: Merge "Fix a bug disappearing installerPackageName info of packages after reboot." into mnc-dev

* commit 'a36c5580c503da98c137c5bf9f52a719a131d2a9':
Fix a bug disappearing installerPackageName info of packages after reboot.
a36c5580c503da98c137c5bf9f52a719a131d2a9 16-Jul-2015 Chris Tate <ctate@android.com> Merge "Fix a bug disappearing installerPackageName info of packages after reboot." into mnc-dev
fbb4e9d23f0d3e3a220e0e3e63934409d615f50c 16-Jul-2015 Christopher Tate <ctate@google.com> am 3b1f8607: Merge "Intent filters need CATEGORY_BROWSABLE to be app-linking eligible" into mnc-dev

* commit '3b1f8607fdc416a87e608499698719f3234ecc90':
Intent filters need CATEGORY_BROWSABLE to be app-linking eligible
29c0a823959e972ee134fff6789955aedd908e3e 16-Jul-2015 Christopher Tate <ctate@google.com> am a9fa3c24: am b3ed2b8b: am ec0ed98d: am b6b97e90: am 06476508: Merge "Resolve based on the correct user\'s default browser" into mnc-dev

* commit 'a9fa3c24e0f013a345be935179579706f67d1f6c':
Resolve based on the correct user's default browser
b4faf9810d5b1cb01b4663cd48f13f6487edc64b 09-Jul-2015 hyemin.hwang <hyemin.hwang@lge.com> Fix a bug disappearing installerPackageName info of packages after reboot.

If user install apps from playstore, system has installerPackageName attribute of app.
but, after reboot, some apps(have sharedUserID) installerPackageName attribute disappearing.
because lack of copy routine.
So, I added copy routine(installerPackageName).

Testcase :
1. Install app(has sharedUserId, ex Lync2013) from market.
2. Confirm package info from packages.xml(exist installer info).
3. reboot.
4. Re-confirm package info from packages.xml(not exist installer info).

Cherry-pick from AOSP master.
Bug 22513758

Change-Id: I3fea3e573c056f6c2f574715d2ebef4df8b75a68
ackageSettingBase.java
ac15b1b0c05c79f5939aa6f88e973d4d479946cb 16-Jul-2015 Christopher Tate <ctate@google.com> Intent filters need CATEGORY_BROWSABLE to be app-linking eligible

Bug 22504009

Change-Id: I565b2ba4d1e5deeee8ede3363819deec206dbf58
ackageManagerService.java
5dc71cb2dd99bb2a5dd8bd6a51fec280bb488c38 16-Jul-2015 Svet Ganov <svetoslavganov@google.com> am ffb43184: am 3d8e949a: am 9088c083: am 12b05ec2: am 75f6b94a: Merge "Grant default permissions to the setup app robustly." into mnc-dev

* commit 'ffb4318447f7741b4901dd38e3f6d97c94794b42':
Grant default permissions to the setup app robustly.
b6b97e90cb247560b880ae7269b5bfb1daa7aeef 16-Jul-2015 Christopher Tate <ctate@google.com> am 06476508: Merge "Resolve based on the correct user\'s default browser" into mnc-dev

* commit '06476508c4aae6b9bb5affdc7470abf159ef9eda':
Resolve based on the correct user's default browser
06476508c4aae6b9bb5affdc7470abf159ef9eda 16-Jul-2015 Christopher Tate <ctate@google.com> Merge "Resolve based on the correct user's default browser" into mnc-dev
12b05ec2e7a22fa0cbc1bc55d5a8b6503dbf038c 16-Jul-2015 Svet Ganov <svetoslavganov@google.com> am 75f6b94a: Merge "Grant default permissions to the setup app robustly." into mnc-dev

* commit '75f6b94a5d5cadb218725011729466e8e438b231':
Grant default permissions to the setup app robustly.
7991f7813edb9ab7b79c4f5cf5ea7d51e83d334d 15-Jul-2015 Christopher Tate <ctate@google.com> Resolve based on the correct user's default browser

Bug 22509659

Change-Id: Iac75e7b40609bf2c81d266e0568fbfbeb71bb3aa
ackageManagerService.java
50a8bf4da0fe1685bfe6a0ecd9a9677e363e2ee1 15-Jul-2015 Svet Ganov <svetoslavganov@google.com> Grant default permissions to the setup app robustly.

There is a zoo of components that handle the home intent and
have different priority. There is no reliable way to distinguish
the setup app from the other apps that handle home as some of
them have lower priority than the setup app and some higher.
This change adds a dedicated category to recognize the default
setup app.

Uncommented the code that grants accounts permissions as the
get_accounts permission is now a runtime permission and can be
granted.

bug:22471024
bug:22501463

Change-Id: I41726751fa2567cbcd7d09c7acfa7615b8aba577
efaultPermissionGrantPolicy.java
ackageManagerService.java
4916f2103add285c57f4f503a1e82d719da5bb85 14-Jul-2015 Svet Ganov <svetoslavganov@google.com> am 0d043abe: am 20994ee5: am 5b93f2d9: am 4248250c: am 8017c647: Fix build

* commit '0d043abe7ff959185148cdf1071aa2d6629d7acc':
Fix build
fbb4a38c7cc8ddb313c588f8d29bfcda5c0609c2 14-Jul-2015 Ian Pedowitz <ijpedowitz@google.com> resolved conflicts for merge of 30efac5a to master

Change-Id: I0dad4cf10ed01cbf49e33f0c2ed1d6f8a1c893e0
8bcb80ca90c1d1f2c04d9e3d6e52f8381dad0c26 14-Jul-2015 Christopher Tate <ctate@google.com> am a46e6066: am 91112eae: am d04c91ab: am c5eadf8d: am 4b9b3e47: Merge "Default browser should not supersede intent filter priorities" into mnc-dev

* commit 'a46e60665cad5b55a8ddcb41f0696d225edad8fb':
Default browser should not supersede intent filter priorities
b3ead99aec04a82b2fc3153e3ecc4d75d0f98194 14-Jul-2015 Svet Ganov <svetoslavganov@google.com> am 9b365c5a: am 9777b1fe: am f12fb43c: am 7ca0c42d: am fc2bc7f1: Merge "Check signatures of privileged persistent apps for granting defailt permissions" into mnc-dev

* commit '9b365c5a442ad0a06163bbe7dcd01ab38a05c029':
Check signatures of privileged persistent apps for granting defailt permissions
4fd798768245f07064a1001a594fa2f4558efb9e 14-Jul-2015 Christopher Tate <ctate@google.com> am d5c43b76: am df8db14e: am 0e201048: am b4494b02: am 288ecf98: Merge "Prioritize most-recently-enabled link-handling app" into mnc-dev

* commit 'd5c43b7619d9d42e902a34c8b300f882b8213309':
Prioritize most-recently-enabled link-handling app
abad26c13260ea37271d69956983117c7986a818 14-Jul-2015 Svetoslav <svetoslavganov@google.com> am 3a49414b: am f835ba3c: am d57778ac: am 72172933: am 56c59d15: Merge "Fix two grant default permissions edge cases." into mnc-dev

* commit '3a49414b47407366d6b299c74f9208b4d9de1ffb':
Fix two grant default permissions edge cases.
b31e14a3d939999a2f325c38c79f8664e0b25878 14-Jul-2015 Xiaohui Chen <xiaohuic@google.com> sys user split: assign admin/primary flag

Assigning admin and primary flags to the primary user instead of the
system user.

BUG:19913735
Change-Id: I64c28538fc688cd8ce0fb4878ece5e629d8e0abf
serManagerService.java
5e181938c4de87e9535e8295a8dbf06f99631834 14-Jul-2015 Amith Yamasani <yamasani@google.com> am f3069383: am 4521361a: am 14627a2c: am 7efb0521: am 1578357d: Merge "Check user state after clearing identity." into mnc-dev

* commit 'f30693831665ad68731b996f8b2744c72e4dddd2':
Check user state after clearing identity.
e1f7a9ff7b764e2876eaf87da7f3204bbb0a764e 14-Jul-2015 Esteban Talavera <etalavera@google.com> am ffded0dd: am d943ac7d: am 8dd280c2: am f463ac66: am 0ec43f89: Merge "Use correct user when filtering app link candidates" into mnc-dev

* commit 'ffded0dd94581c8c20701295d66083ac4dfd1e80':
Use correct user when filtering app link candidates
f27decd439bab93668a9a9a1d884af5b0694092b 14-Jul-2015 Esteban Talavera <etalavera@google.com> am d132e1cd: am 3b869cb4: am 220fd3c0: am 4b114575: am 22921603: Merge "Don\'t send app links to parent profile if status == never" into mnc-dev

* commit 'd132e1cd99d389e3074930dd2bc8501cb7386623':
Don't send app links to parent profile if status == never
4c8d3126068334826e2a6f921799e2b86dba8916 14-Jul-2015 Billy Lau <billylau@google.com> am e385d26f: am cb2a7a2c: am 0be2efb2: am f028ba3d: am 96d00ab3: Merge "Bug: 21589105 Rescope WRITE_SETTINGS and SYSTEM_ALERT_WINDOW permission" into mnc-dev

* commit 'e385d26fef2f62988c082ee8066f5d6715aa16c9':
Bug: 21589105 Rescope WRITE_SETTINGS and SYSTEM_ALERT_WINDOW permission
5cc9a7a801f3a1995cbb2a7dae3f9a716d51df0e 14-Jul-2015 Amith Yamasani <yamasani@google.com> am b646cd6d: am f62ca82b: am a5aaf335: am 0fd2d2b1: am 292eb65f: Merge "Fix new user creation regression due to vold remount calls" into mnc-dev

* commit 'b646cd6df50e99464335f3c196e386c8743fd29e':
Fix new user creation regression due to vold remount calls
4248250c936ded1d5c32b47681817c52f0600c7e 14-Jul-2015 Svet Ganov <svetoslavganov@google.com> am 8017c647: Fix build

* commit '8017c647e665a6b6240501dc43628143ebe4e333':
Fix build
d7be214ca469c593d8a59cf7404020f4ad1aaed9 14-Jul-2015 Ian Pedowitz <ijpedowitz@google.com> resolved conflicts for merge of 8cee6587 to mnc-dr-dev

Change-Id: I0b2ed52214bb097d7fd69434afd0c6c890b5afb3
8017c647e665a6b6240501dc43628143ebe4e333 14-Jul-2015 Svet Ganov <svetoslavganov@google.com> Fix build

Change-Id: I2c97e405eaec7ee1569fcddc872ff2a98c829efe
ackageManagerService.java
8cee6587e0efb2d8e63f1505b057a1e328525017 14-Jul-2015 Svet Ganov <svetoslavganov@google.com> Merge "Teach storage appops." into mnc-dev
6ee871e59812fea4525c50231f677c4bd10c74b8 10-Jul-2015 Svet Ganov <svetoslavganov@google.com> Teach storage appops.

For modern apps targeting M SDK and up the external storage state
is deterined by granted permissions. For apps targeting older SDK
the storage access is determined by app ops correspning to the
storage permissions as the latter are always granted.

When app ops change we do not remount as we kill the app process
in both cases enabling and disabling an app op since legacy code
is not prepared for dynamic behavior where an operation that failed
may next succeed. Hence, we remount when we start the app.

For modern apps we don't kill the app process on a permission
grant, therefore we synchronously remount the app storage.

bug:22104923

Change-Id: I601c19c764a74c2d15bea6630d0f5fdc52bf6a5a
ackageManagerService.java
c5eadf8d889b7e8901d647502d22a0d0c108d1da 14-Jul-2015 Christopher Tate <ctate@google.com> am 4b9b3e47: Merge "Default browser should not supersede intent filter priorities" into mnc-dev

* commit '4b9b3e4731ffb962daf0f5029450001a8a6e7c00':
Default browser should not supersede intent filter priorities
7ca0c42db549fee52d61124be5a2c739f5abdd4a 14-Jul-2015 Svet Ganov <svetoslavganov@google.com> am fc2bc7f1: Merge "Check signatures of privileged persistent apps for granting defailt permissions" into mnc-dev

* commit 'fc2bc7f170ba564bc439fd22dd5a779d96670ffd':
Check signatures of privileged persistent apps for granting defailt permissions
4b9b3e4731ffb962daf0f5029450001a8a6e7c00 14-Jul-2015 Christopher Tate <ctate@google.com> Merge "Default browser should not supersede intent filter priorities" into mnc-dev
d13cb798506a1e04d716c6eac41492c5ae95ccc8 14-Jul-2015 Christopher Tate <ctate@google.com> Default browser should not supersede intent filter priorities

Bug 22304850

Change-Id: Ie4deffea2621fdc03a9bfe35690ecd109eed1a04
ackageManagerService.java
b4494b02d5700b4ef4058315d44f17c3d829c0ad 14-Jul-2015 Christopher Tate <ctate@google.com> am 288ecf98: Merge "Prioritize most-recently-enabled link-handling app" into mnc-dev

* commit '288ecf98f14c9eff639b0a3de074d5b4a06eccec':
Prioritize most-recently-enabled link-handling app
72172933d7933ef60dd7b14b33b35e719c0d92f1 14-Jul-2015 Svetoslav <svetoslavganov@google.com> am 56c59d15: Merge "Fix two grant default permissions edge cases." into mnc-dev

* commit '56c59d1550703bc96151dc53bb4b697fda6a6028':
Fix two grant default permissions edge cases.
fc2bc7f170ba564bc439fd22dd5a779d96670ffd 14-Jul-2015 Svet Ganov <svetoslavganov@google.com> Merge "Check signatures of privileged persistent apps for granting defailt permissions" into mnc-dev
288ecf98f14c9eff639b0a3de074d5b4a06eccec 14-Jul-2015 Christopher Tate <ctate@google.com> Merge "Prioritize most-recently-enabled link-handling app" into mnc-dev
8b24a1d30fa5d2b80b2b6a37454dcc1e67d0e79d 14-Jul-2015 Svetoslav <svetoslavganov@google.com> Fix two grant default permissions edge cases.

1. When querying for components to which to grant default
permissions we are now getting disabled components as
well as we want such packages to get default pemrissions
on upgrade as disabled components may get reenabled.

2. When resolving activities to whose packages to grant default
permissions we skip the corss-profile and skip-profile filters
as they are set by device policy which should not affect
implicitly default permission grants. Policy has explicit
APIs for permission management.

bug:22405963

Change-Id: Idf56d35e567a6fd6e097cd45988d1561422ee6fc
efaultPermissionGrantPolicy.java
ackageManagerService.java
f0d6cb38c47ee37583034dc3a68238ed13c91742 11-Jul-2015 Christopher Tate <ctate@google.com> Prioritize most-recently-enabled link-handling app

In the case when multiple apps handle a given web-link action,
all of which have been marked as "launch the app instead of a
browser" and so are otherwise ambiguous, always prefer the app
that was most recently placed into the always-handle-links state.

Bug 22051035

Change-Id: I3f43c19b0d7b74e9843445e41971bb5433affb1c
ackageManagerService.java
ackageSettingBase.java
ettings.java
7efb0521ff4af2eeca5c99011ece066848069ffc 14-Jul-2015 Amith Yamasani <yamasani@google.com> am 1578357d: Merge "Check user state after clearing identity." into mnc-dev

* commit '1578357df737296aa151c6934fe7dd749a43ae15':
Check user state after clearing identity.
f463ac6647bce5e88c6329b730b5965029b9f372 14-Jul-2015 Esteban Talavera <etalavera@google.com> am 0ec43f89: Merge "Use correct user when filtering app link candidates" into mnc-dev

* commit '0ec43f89d2fc7064e7b42b40b318bef15fb040b5':
Use correct user when filtering app link candidates
4b1145759b6792151546ddab9bae38adb8a43769 14-Jul-2015 Esteban Talavera <etalavera@google.com> am 22921603: Merge "Don\'t send app links to parent profile if status == never" into mnc-dev

* commit '2292160320f29144f8f8f38bd6936e9f1efb4ae5':
Don't send app links to parent profile if status == never
f028ba3db3d3b6478154952dbbd8ed7422ad14f6 14-Jul-2015 Billy Lau <billylau@google.com> am 96d00ab3: Merge "Bug: 21589105 Rescope WRITE_SETTINGS and SYSTEM_ALERT_WINDOW permission" into mnc-dev

* commit '96d00ab359d60197321f06b4feb3d01f3fa03a29':
Bug: 21589105 Rescope WRITE_SETTINGS and SYSTEM_ALERT_WINDOW permission
0fd2d2b124d2aa614131c7b9cedde9d18e830724 14-Jul-2015 Amith Yamasani <yamasani@google.com> am 292eb65f: Merge "Fix new user creation regression due to vold remount calls" into mnc-dev

* commit '292eb65f1ee0747e60899c1b1d0b6cb16c9cd37a':
Fix new user creation regression due to vold remount calls
bac3d0936dfdb4d594873fd8690e8017e748ed96 13-Jul-2015 Paul Crowley <paulcrowley@google.com> Merge "Delete the user key when deleting a user." into mnc-dr-dev
9e0e69915a2e45dd5ba158e0436571551a672636 13-Jul-2015 Paul Crowley <paulcrowley@google.com> Merge "Use mount service to create user dirs." into mnc-dr-dev
1578357df737296aa151c6934fe7dd749a43ae15 13-Jul-2015 Amith Yamasani <yamasani@google.com> Merge "Check user state after clearing identity." into mnc-dev
0ec43f89d2fc7064e7b42b40b318bef15fb040b5 13-Jul-2015 Esteban Talavera <etalavera@google.com> Merge "Use correct user when filtering app link candidates" into mnc-dev
2292160320f29144f8f8f38bd6936e9f1efb4ae5 13-Jul-2015 Esteban Talavera <etalavera@google.com> Merge "Don't send app links to parent profile if status == never" into mnc-dev
96d00ab359d60197321f06b4feb3d01f3fa03a29 13-Jul-2015 Billy Lau <billylau@google.com> Merge "Bug: 21589105 Rescope WRITE_SETTINGS and SYSTEM_ALERT_WINDOW permission" into mnc-dev
22b3f4cb15207239e203d5ec8b72ec6bc90fef35 08-Jul-2015 Billy Lau <billylau@google.com> Bug: 21589105 Rescope WRITE_SETTINGS and SYSTEM_ALERT_WINDOW permission

Raised the protection level of WRITE_SETTINGS permission to appop and also
allowed backwards compatibility with pre23 flag. Also made sure that this
permission is not added as RuntimePermission in DefaultPermissionGrantPolicy as
that breaks a lot of gmscore stuff.

Introduced new action to manage write system settings as a new API and
renamed the string that describes the managing of overlay permission.

Change-Id: Ifd25a6ddc06de68ee37015cb9fb23452e4ef10f4
efaultPermissionGrantPolicy.java
2d42d5f41eefc5550b6750cb86a5324c8f28959f 11-Jul-2015 Amith Yamasani <yamasani@google.com> Check user state after clearing identity.

This is to fix the case where the caller has GRANT_REVOKE_PERMISSIONS
but does not have MANAGE_USERS permission.

Related to a recent fix for
Bug: 22356546

Change-Id: Id51157abad14a0bdba3a16d7cd168f61ba25e890
ackageManagerService.java
292eb65f1ee0747e60899c1b1d0b6cb16c9cd37a 11-Jul-2015 Amith Yamasani <yamasani@google.com> Merge "Fix new user creation regression due to vold remount calls" into mnc-dev
824d453246d65db43fd7bc24df6fa3d536d2b54a 11-Jul-2015 Svet Ganov <svetoslavganov@google.com> Check signatures of privileged persistent apps for granting defailt permissions

bug:22391058

Change-Id: I56d060f0435fadf87a8cf255ea887dd5b3903821
efaultPermissionGrantPolicy.java
1af7588da2e1f1621727a0d135cfc85f135ac4f8 10-Jul-2015 Esteban Talavera <etalavera@google.com> Use correct user when filtering app link candidates

Bug: 22288835
Change-Id: I29b3ac04e66b5e93f5cf29fd618b98d1c8106f58
ackageManagerService.java
5a9a85d3d2b13a05ce2cf47511551428843d23b0 10-Jul-2015 Svet Ganov <svetoslavganov@google.com> am 0bdfb97a: am 88c3918d: am 3ceb043f: am b7cf986e: am 171fe6ac: Merge "Add an API for apps to query if a permisison is denied by policy." into mnc-dev

* commit '0bdfb97a0acb8b40c78b1f40151b334d5401a2d1':
Add an API for apps to query if a permisison is denied by policy.
a17b7f8c4be93d3cc60b75bf4977a98b8d3192d0 10-Jul-2015 Todd Kennedy <toddke@google.com> am 959b5502: am 4c1d9480: am 32eaa610: am 948a3ed9: am d80cf910: Merge "Allow codepath changes for new OTA packages" into mnc-dev

* commit '959b55020d4c47ca7e42bece6cd48ef10c1c1c31':
Allow codepath changes for new OTA packages
171fe6ac0aa5b0d2dd64ac1cdda25cdcb5f183f3 10-Jul-2015 Svet Ganov <svetoslavganov@google.com> Merge "Add an API for apps to query if a permisison is denied by policy." into mnc-dev
d80cf9109aa6b560e473f0197034085ed9062eaa 10-Jul-2015 Todd Kennedy <toddke@google.com> Merge "Allow codepath changes for new OTA packages" into mnc-dev
bb054c9dcc68d24e1d2ded709b721948b939018c 09-Jul-2015 Amith Yamasani <yamasani@google.com> Fix new user creation regression due to vold remount calls

When creating a new user, there's no need to call into vold when
setting up default system permissions for storage. This was otherwise
adding 2 seconds to the user creation time, causing a frozen screen
before showing "Switching to user ...".

Fix is to call the permission setup code synchronously and not
call into vold if the user hasn't been initialized yet.

Bug: 22356546
Change-Id: I4c8632813e8c0f2ac90da386691af439521bb25a
ackageManagerService.java
serManagerService.java
b42e3e044085e9e25c3936c60fc5869284fe6357 09-Jul-2015 Christopher Tate <ctate@google.com> am d3b8da4b: am be4898f2: am 5548f983: am e6991a13: am 607a040d: Merge "Add a mechanism for products to specify default active app linkages" into mnc-dev

* commit 'd3b8da4b8fb67606bb67287e5c55174e521fb82b':
Add a mechanism for products to specify default active app linkages
3ec12db0f5155be41d60694f0ac3c9284ff29002 09-Jul-2015 Esteban Talavera <etalavera@google.com> Don't send app links to parent profile if status == never

Bug: 22287521
Change-Id: Ic84e57eab74c0e0b89f1b6a3baa54784157fa96b
ackageManagerService.java
056d6b0069561af5dc16b1c38fc8d18bd876b54b 09-Jul-2015 Todd Kennedy <toddke@google.com> Allow codepath changes for new OTA packages

When an OTA contains a new package, the system performs some gymnastics
to ensure that we use the most up-to-date version of the package in
either the system image or user directory. But, during boot, we enforce
a package's codepath will never change. This prevents a user-installed
package from ever overriding the system provide package [regardless of
version]. In this one, specific instance, we allow a package's codepath
to change.

Bug: 22179337
Change-Id: I2c29a87801fb5960ffbd2268231446895ad1868f
ackageManagerService.java
7ec733fad39ff9e439a67c9cf51b88bc84cdfda0 19-May-2015 Paul Crowley <paulcrowley@google.com> Delete the user key when deleting a user.

Bug: 19706593

(cherry-picked from commit 85e4e818d83dbc65b1e6e3ed9d39c656188acaec)

Change-Id: Icc6d53a99558317b2ec154f931e481ad9fe64aa3
serManagerService.java
bcf48ed2262d655ebf59153dea645ca761b73db5 22-Apr-2015 Paul Crowley <paulcrowley@google.com> Use mount service to create user dirs.

Bug: 19704432

(cherry-picked from commit 9102f5d953fbde03e12f385b2225004edc43d202)

Change-Id: I64a2c85beef115158feed3953deae32f692e750f
ackageManagerService.java
ettings.java
serManagerService.java
7bd71f65417e0fa643d59abd3c3bdebb9cc992f2 09-Jul-2015 Svetoslav <svetoslavganov@google.com> am 122350fc: am 843d7216: am 353835e1: am c88dec32: am 6638c182: Merge "Fix reset permissions on clear data and package uninstall." into mnc-dev

* commit '122350fca781048e0a59260e2bed233b428cf3fd':
Fix reset permissions on clear data and package uninstall.
27a0f27948286ec5422e6cf4598c945caefc8133 09-Jul-2015 Jack Yu <jackyu@google.com> am f99e20d6: am 230629de: am 40f07062: am 379aa438: am 6b7a0784: Merge "Grant SMS permissions to Cell Broadcast receiver which emergency/non-emergency broadcast messages from the network." into mnc-dev

* commit 'f99e20d6c5e58e357228fd97d840256f33f91de5':
Grant SMS permissions to Cell Broadcast receiver which emergency/non-emergency broadcast messages from the network.
7acd33bb3ce840a2588567d6feae71bb8b24b35a 09-Jul-2015 Amith Yamasani <yamasani@google.com> am 2cd92043: am d1087e74: am 5b65be96: am 370c27c7: am 705ba960: Merge "Qualify the uid with the userId when granting permissions" into mnc-dev

* commit '2cd92043c70fefb2534a8e26e5283193e8a7ebd1':
Qualify the uid with the userId when granting permissions
ad3b2975574f916c14382628d50c710a78064746 08-Jul-2015 Svet Ganov <svetoslavganov@google.com> Add an API for apps to query if a permisison is denied by policy.

bug:22177216

Change-Id: I32227f55097fae997f33743fd1eee06cb18f47f1
ackageManagerService.java
01e186437f7c41b5cf8a97becb22d2f369c374da 08-Jul-2015 Christopher Tate <ctate@google.com> Add a mechanism for products to specify default active app linkages

We now have a new tag type in the existing SystemConfig XML files:

<app-link package="..." />

Packages mentioned here are treated as though the user had instructed
the system to always open the app rather than a browser when touching
an HTTP/HTTPs URL that is handled by the app. This default state can
of course still be turned down by the user if they choose.

Bug 21595872

Change-Id: I2824064a891bba3867ee86f81d609d22e83aef7a
ackageManagerService.java
7ee9a4ef141f22b593bcfa6535e5e4c8de46909d 09-Jul-2015 hyemin.hwang <hyemin.hwang@lge.com> Fix a bug disappearing installerPackageName info of packages after reboot.

If user install apps from playstore, system has installerPackageName attribute of app.
but, after reboot, some apps(have sharedUserID) installerPackageName attribute disappearing.
because lack of copy routine.
So, I added copy routine(installerPackageName).

Testcase :
1. Install app(has sharedUserId, ex Lync2013) from market.
2. Confirm package info from packages.xml(exist installer info).
3. reboot.
4. Re-confirm package info from packages.xml(not exist installer info).

Change-Id: I5f9597b0f0f23be21efdfc7c7780ce7cfd2b9672
ackageSettingBase.java
6638c182635c6af036980ebdacc9c88411dcf583 09-Jul-2015 Svetoslav <svetoslavganov@google.com> Merge "Fix reset permissions on clear data and package uninstall." into mnc-dev
4a5f4a2bc7a379a5b4174f78fefeefe745e6cd37 08-Jul-2015 Svetoslav <svetoslavganov@google.com> Fix reset permissions on clear data and package uninstall.

If the user clears data for an app we reset the permission but
only the changes made by the user. We do not modify syste or
policy flags and also ensure the permission that were granted
by default are granted after the data wipe. This is the same
as starting with a clean slate.

If the package whose data is cleared is a part of a shared user
we resent to initial state only the permissions that the cleared
package contributed. Hence, if another package also declared the
permission as used we do not clear the permission state as it is
still in use.

When a package is deleted for a user but still present for another
user we reset its permissions to their inital state follwoing
above described strategy.

Lastly when a preinstalled package wtih an upgrade is diabled
(triggers upgrade uninstall) and this package is a part of a
shared user, we do not drop permission state (grants and flags)
for permissions used by the shadowed system package. This ensures
that we do not drop runtime permission state (such state is
default grants and user changes).i

bug:22248525

Change-Id: I3a3007476d2cb9f4ff824e1e137a6e1a4d04408b
ackageManagerService.java
ettings.java
6b7a07848b21001a41aea1b6426ec2f75ea652ec 09-Jul-2015 Jack Yu <jackyu@google.com> Merge "Grant SMS permissions to Cell Broadcast receiver which emergency/non-emergency broadcast messages from the network." into mnc-dev
6b53c162102e2a4b3d745fcceb1224cc94860b64 09-Jul-2015 Amith Yamasani <yamasani@google.com> Qualify the uid with the userId when granting permissions

Calls to remountUid() for secondary users was not using the
correct uid. This would prevent providing the required
storage permissions to default apps.

Discovered when investigating bug: 22356546

Change-Id: I98c8f6da724e46331c1c90b95969ca0871ef4fe9
ackageManagerService.java
ed79bf5d74009f0589407c0289e3c7f41488a0f3 07-Jul-2015 Jack Yu <jackyu@google.com> Grant SMS permissions to Cell Broadcast receiver which emergency/non-emergency broadcast messages from the network.

bug: 22229152
Change-Id: Ide02f0c3faafd37b8205f92df8a33a0bc95dd3d7
efaultPermissionGrantPolicy.java
ee94484303ebddbb5eb7cc7efa347240ad641bc7 08-Jul-2015 Dianne Hackborn <hackbod@google.com> am 7b3add61: am f368f6b9: am 6ee8a509: am c55c4a28: am b14dc048: Merge "Add new "preinstalled" permission flag." into mnc-dev

* commit '7b3add61c9e47b708725147dffc23d396db37add':
Add new "preinstalled" permission flag.
4e5dac3d6ef6f28aecb116b8dfd92ff31d49c926 08-Jul-2015 Svetoslav <svetoslavganov@google.com> am 3fd5ebfd: am 7cc8de60: am 0ce19f8e: am 240f8e5f: am 3e07ee07: Merge "Grant installer and verifier install permissions robustly" into mnc-dev

* commit '3fd5ebfd778e540276fb5205a8ba3185e620647d':
Grant installer and verifier install permissions robustly
54c70a6e1e17e0d5be60eb0d4fd0bd7637b5c1b6 08-Jul-2015 Christopher Tate <ctate@google.com> am cf0196d2: am 42e511d6: am a1314983: am 7f25ad62: am 15bb16fb: Merge "App linking: permit overlapping link handling" into mnc-dev

* commit 'cf0196d2d01607e68b9bb573984cb57ab22d58a8':
App linking: permit overlapping link handling
5603e8981cf3a4f7b8590902485bb570d192ccf5 08-Jul-2015 Jeff Sharkey <jsharkey@android.com> am 612da87a: am 0a8ef849: am 00bd16d5: am e719d83c: am dafaa45c: Merge "Split app move into separate copy/delete steps." into mnc-dev

* commit '612da87a609ba5f49969a8eb2ec4b519f964ec5f':
Split app move into separate copy/delete steps.
7840a2275e060546499014d5dc9f99be9d06b2f9 08-Jul-2015 Makoto Onuki <omakoto@google.com> am 557ab62b: am 4030c53d: am a844a8c5: am f31f4cdc: am 53d17aee: Merge "Give fixed READ_PHONE_STATE permission to calllog provider" into mnc-dev

* commit '557ab62b275bf77f345e502d72c2f18a5c93b62d':
Give fixed READ_PHONE_STATE permission to calllog provider
a90c8def2c6762bc6e5396b78c43e65e4b05079d 08-Jul-2015 Dianne Hackborn <hackbod@google.com> Add new "preinstalled" permission flag.

This allows you to specify that a permission can be granted to
any pre-installed system app (not just privileged ones).

And as long as I am doing this, clean up the old "system" permission
flag, renaming it to "privileged" which is what it really is today,
deprecating the old names. And switch the platform's permission
declarations to use the new name.

Change-Id: Iabf484746af232144786851ec7fe90e3de9dddb2
ackageManagerService.java
3e07ee078de8e364d6be0b18b2b514e40decdb3c 08-Jul-2015 Svetoslav <svetoslavganov@google.com> Merge "Grant installer and verifier install permissions robustly" into mnc-dev
15bb16fb48f523b6b0d8c03cfe5988096341e29d 08-Jul-2015 Christopher Tate <ctate@google.com> Merge "App linking: permit overlapping link handling" into mnc-dev
050aee236509512f7098941946f12e1fbf2ab8ae 02-Jul-2015 Christopher Tate <ctate@google.com> App linking: permit overlapping link handling

Allow multiple apps to be enabled as link handlers even their set of
accepted domains overlaps. Also, allow app linking to be turned on
even for unverified apps if the user wishes.

Bug 21817604

Change-Id: I8bc7f1764318e5d4bb6ce93c66483fe07e922b1d
ackageManagerService.java
ettings.java
3e7d977ff7c743713f0ad6336a039d7760ba47d1 07-Jul-2015 Svetoslav <svetoslavganov@google.com> Grant installer and verifier install permissions robustly

bug:22248271

Change-Id: I3a47ae9a112ba7d88b421fcb5f9651d1168ba7a5
efaultPermissionGrantPolicy.java
ackageManagerService.java
dafaa45c0ea1802944566f0e71d81beb3eb55296 07-Jul-2015 Jeff Sharkey <jsharkey@android.com> Merge "Split app move into separate copy/delete steps." into mnc-dev
6b7bb60457501ff4110933c3e9b66446eb4f7b19 07-Jul-2015 Jeff Sharkey <jsharkey@android.com> Split app move into separate copy/delete steps.

App movement now has three distinct stages: copying, scanning, and
cleanup. Previously, a battery pull late in the move process would
end up with packages.xml pointing at the old location which had been
torn down. Now, we update packages.xml to point at the new location
as the "source of truth" before we start deleting the old location.

Bug: 21831336
Change-Id: I6f57f37a8cb335127db9ebb7c6b6cfe5755ada99
nstaller.java
ackageManagerService.java
e35360d806d0858229ec8dde4929da0bdb93e7d3 07-Jul-2015 Jeff Sharkey <jsharkey@android.com> am 67804838: am ccde254c: am 0cae3e9e: am 7dfe0f83: am 7fd3c296: Merge "Permission to view shared storage for all users." into mnc-dev

* commit '67804838150fc85efb1bd27cc68422197976fe3f':
Permission to view shared storage for all users.
3bb8c854189591fcee16d2a6854fae862b02d1e8 07-Jul-2015 Jeff Sharkey <jsharkey@android.com> Merge commit '1db64c19' into merge3

Change-Id: I0aea6817876a5820a7d67a4de5bef0f86ce702a2
7a4082edc4fb85fd0c9aa92d799cb2cb9d957a3e 07-Jul-2015 Makoto Onuki <omakoto@google.com> Give fixed READ_PHONE_STATE permission to calllog provider

Calllog provider lives in the same APK as contacts provider.

Bug 22300894
Bug 22297735

Change-Id: I77f3ee18f093b5adb819308c113062c490a3b54b
efaultPermissionGrantPolicy.java
1d0032e6c604cadcff65599f36ce84c0b8a99eda 06-Jul-2015 Dianne Hackborn <hackbod@google.com> am 5f2653ab: am 65b228a0: am d45c7633: am 1a053eaf: am dcd96ead: Merge "Maybe fix issue #22283836 -- package manager NPE." into mnc-dev

* commit '5f2653ab0bad4f4956f419f2b594acc7fdf9ecac':
Maybe fix issue #22283836 -- package manager NPE.
806347f2fc91600eb9cf9e4afdb19a022667911c 06-Jul-2015 Amith Yamasani <yamasani@google.com> am 019e5cda: am f5205d6c: am 013ec4c2: am b41e36ba: am a72eac60: Fix a typo causing NPE in restricted profiles

* commit '019e5cda7e7e1c8623ebdda2cc60943e1b343219':
Fix a typo causing NPE in restricted profiles
7fd3c296f1991e321e4c69a5e7f918cc3d252625 06-Jul-2015 Jeff Sharkey <jsharkey@android.com> Merge "Permission to view shared storage for all users." into mnc-dev
38cae6c8bcb86236b21d69f852473351c0c1d82a 06-Jul-2015 Jeff Sharkey <jsharkey@android.com> Merge "Reconcile private volumes when mounted." into mnc-dev
32e80d7588720bdc9f8a3e961ac4566d7c80b2b9 06-Jul-2015 Jeff Sharkey <jsharkey@android.com> Permission to view shared storage for all users.

Typical apps are restricted so they can only view shared storage
belonging to the user they're running as. However, a handful of
system components need access to shared storage across all users,
such as DefaultContainerService and SystemUI.

Since WRITE_MEDIA_STORAGE already offers this functionality by
bypassing any FUSE emulation, reuse it to grant the "sdcard_rw" GID
which is no longer handed out to third-party apps. Then we change
the FUSE daemon to allow the "sdcard_rw" GID to see shared storage
of all users.

Bug: 19995822
Change-Id: I504c2a179ba74f142ed0d32da5baa69f4212cd82
ackageManagerService.java
dcd96ead8457466fb3dfb5978eb1e7e5b560ba91 06-Jul-2015 Dianne Hackborn <hackbod@google.com> Merge "Maybe fix issue #22283836 -- package manager NPE." into mnc-dev
f127f42fd44cf322ce942f1c42d2abed84621486 06-Jul-2015 Svet Ganov <svetoslavganov@google.com> am b017752a: am 6bc5b226: am c5a759cf: am d8c2bbcf: am 10c111ed: Merge "Show basic feature warning for default granted permissions" into mnc-dev

* commit 'b017752aeb1d6d2ee961580de9edfc3db8722c8a':
Show basic feature warning for default granted permissions
167d588b8b312882262fad4c7a2ae496b270caba 06-Jul-2015 Dianne Hackborn <hackbod@google.com> Maybe fix issue #22283836 -- package manager NPE.

Change-Id: I0383b9a4f1e0b872b3b427e6ad42fd8aa309b7ab
ackageManagerService.java
a72eac60c7a34089c8e288f03ce031172e3b36b4 06-Jul-2015 Amith Yamasani <yamasani@google.com> Fix a typo causing NPE in restricted profiles

Bug: 22287398
Change-Id: Iec19d890c7b0b7ffed3381dc3f5a9b3e761362a7
efaultPermissionGrantPolicy.java
32edae410f7e9fdb96119fba4fa674a046559249 06-Jul-2015 Svet Ganov <svetoslavganov@google.com> am 052385da: am 8018e677: am 27997678: Merge "Grant the default gallery app storage permissions" into mnc-dev

* commit '052385da414e1b18dae9b4532cc9d92d8246bd85':
Grant the default gallery app storage permissions
1915f726833a864e2ca8571d4350614f4bae062c 06-Jul-2015 Svetoslav <svetoslavganov@google.com> am d87fc3e9: am fa656593: am 212bd428: Merge "Make granting default SMS and Phone permissions robust" into mnc-dev

* commit 'd87fc3e9a14384cc107cd2eccc002c26fd987908':
Make granting default SMS and Phone permissions robust
6dce4964b4d1a13d276d95730b8fb09d6a5a8d04 04-Jul-2015 Jeff Sharkey <jsharkey@android.com> Reconcile private volumes when mounted.

Many things can happen while a private volume is ejected, so we need
to reconcile newly mounted volumes against known state.

First, user IDs can be recycled, so we store the serial number in the
extended attributes of the /data/user/[id] directory inode. Since a
serial number is always unique, we can quickly determine if a user
directory "10" really belongs to the current user "10". When we
detect a mismatched serial number, we destroy all data belonging to
that user. Gracefully handles upgrade case and assumes current serial
number is valid when none is defined.

Second, we destroy apps that we find no record of, either due to
uninstallation while the volume was unmounted, or reinstallation on
another volume.

When mounting a volume, ensure that data directories exist for all
current users. Similarly, create data directories on all mounted
volumes when creating a user. When forgetting a volume, gracefully
uninstall any apps that had been installed on that volume.

Bug: 20674082, 20275572
Change-Id: I4e3448837f7c03daf00d71681ebdc96e3d8b9cc9
ackageInstallerService.java
ackageManagerService.java
ettings.java
serManagerService.java
e8ce8368fc65c3f5c54c44384be62cf228ceb10e 04-Jul-2015 Svet Ganov <svetoslavganov@google.com> am 55cd6f44: am 6fe87a56: am 68ffcf88: Merge "Teach receivers, activities, providers, and services app ops." into mnc-dev

* commit '55cd6f44fd1e49164a999e948bb91a03a3b9daf6':
Teach receivers, activities, providers, and services app ops.
7e07288c7720001542182a4a70a5395015bcff1c 04-Jul-2015 Dianne Hackborn <hackbod@google.com> am 0783b9a4: am ee987ce4: am 76664d9d: Merge "Work on issue #21589105: Scope WRITE_SETTINGS and SYSTEM_ALERT_WINDOW..." into mnc-dev

* commit '0783b9a47ae682cc85a14284e79643b5087b8c9f':
Work on issue #21589105: Scope WRITE_SETTINGS and SYSTEM_ALERT_WINDOW...
91f0cf89f57a19e03b1c229983554644f72257dc 04-Jul-2015 Christopher Tate <ctate@google.com> am 31e5695b: am 0756cf70: am 61d7acae: Merge "Clear default browser setting when a new browser app is installed" into mnc-dev

* commit '31e5695b6ed5472e0ecd4c10cccaf81d2e4a9242':
Clear default browser setting when a new browser app is installed
279a9a3131635fe84d33231711f40daaa798ae26 04-Jul-2015 Svetoslav <svetoslavganov@google.com> am 90336427: am 56ef372f: am 29563632: Merge "Grant permissions to headless system calendar/contacts sync adapters." into mnc-dev

* commit '90336427fd1fc85e15a43ce36a26576013061d91':
Grant permissions to headless system calendar/contacts sync adapters.
9484b08f5794cb4da1d4bfbcef76a807e0c679c1 04-Jul-2015 Svet Ganov <svetoslavganov@google.com> am fd07652c: am a8522a65: am abbdc864: Merge "Clear binder identity when grantint permisisons to carrier apps" into mnc-dev

* commit 'fd07652c08a50d67dacd5d6212b2953ca4c03de2':
Clear binder identity when grantint permisisons to carrier apps
77ab6a888afaeb9010c7c3884adcd4819dbcee66 03-Jul-2015 Svet Ganov <svetoslavganov@google.com> Show basic feature warning for default granted permissions

bug:22174223

Change-Id: Ie8209e1f678ac459893151b5125e86eb5025aad8
efaultPermissionGrantPolicy.java
ettings.java
2799767886cc230d554ec7e7e9c7596b3e311e13 02-Jul-2015 Svet Ganov <svetoslavganov@google.com> Merge "Grant the default gallery app storage permissions" into mnc-dev
200d494b93e8920c61f3795c6c8fc8aac99f99b9 02-Jul-2015 Svet Ganov <svetoslavganov@google.com> Grant the default gallery app storage permissions

bug:22127986

Change-Id: I1ecd49d57d410bf10734fea4e0c92e6e5028d648
efaultPermissionGrantPolicy.java
a5a0d94023b2d9b7c9019fc40e7479995b82066c 02-Jul-2015 Svetoslav <svetoslavganov@google.com> Make granting default SMS and Phone permissions robust

The default dialer and sms apps are provided by the telecomm
stak which is brought up asynchronously as a service to which
the system binds. Hence, by the time we grant default permissions
this service is not bound and we do not know the default dialer
(accidentally the default SMS app is available before the service
is up). Now the default permission grant code is robust to handle
both cases of the default sms and phone apps being available
at grant time or asynchronously.

bug:22208642

Change-Id: I6385a0432368731aa9caea046d57eccbfb5abac0
efaultPermissionGrantPolicy.java
68ffcf883c15b97d28e36c684d0db3da084727fc 02-Jul-2015 Svet Ganov <svetoslavganov@google.com> Merge "Teach receivers, activities, providers, and services app ops." into mnc-dev
99b6043dad9d215cf15810b885b6b8c215dd5b5a 27-Jun-2015 Svet Ganov <svetoslavganov@google.com> Teach receivers, activities, providers, and services app ops.

Perform app op check in addition to the permisison check for all four
paltform components - activities, content providers, broadcast receivers,
services - if they are guarded by a permssion that has an associated app
op. This ensures that legacy apps will behave correctly if the permission
of the caller has been revoked, i.e. the app op for that permission was
disabled.

bug:22199666

Change-Id: Ia22d1c38d58b3cd6aabdc655cb7c7bddd85da7a2
ackageManagerService.java
76664d9dcfbbe04c50a00ea1e268e80b9a9f6087 02-Jul-2015 Dianne Hackborn <hackbod@google.com> Merge "Work on issue #21589105: Scope WRITE_SETTINGS and SYSTEM_ALERT_WINDOW..." into mnc-dev
61d7acae0cafc265e94a35ad3ba1677f60346de9 01-Jul-2015 Christopher Tate <ctate@google.com> Merge "Clear default browser setting when a new browser app is installed" into mnc-dev
7841eb899561af3b122a5143cdcfe64c0766a5f5 01-Jul-2015 Christopher Tate <ctate@google.com> Clear default browser setting when a new browser app is installed

Even if you have explicitly named a default browser app, when you
add a new browser app to the system it now assumes that perhaps you
might want that to be the new default, so it puts you into the
explicit ambiguity state.

Also fix a bug in the factory-default-browser handling; it was not
examining the set of available browsers.

Bug 22120412

Change-Id: I183ed87a51be1e4aa65457f05b98e406bb7b495d
ackageManagerService.java
de15edaa9bf486a4050bb067317d313fd807bb10 01-Jul-2015 Dianne Hackborn <hackbod@google.com> Work on issue #21589105: Scope WRITE_SETTINGS and SYSTEM_ALERT_WINDOW...

...to an explicit toggle to enable in Settings

Add a new permission flag, saying the permission can be automatically
granted to pre-api-23 apps. Apply this to SYSTEM_ALERT_WINDOW.

Change-Id: I24a0ceabe7e9f5e458a864d30eda2696ad14a699
ackageManagerService.java
2956363244ecb61f48729d93b510ffadac591cae 01-Jul-2015 Svetoslav <svetoslavganov@google.com> Merge "Grant permissions to headless system calendar/contacts sync adapters." into mnc-dev
ca58d80f413417aa98eb424c76dd8fe97af12763 01-Jul-2015 Svet Ganov <svetoslavganov@google.com> Clear binder identity when grantint permisisons to carrier apps

bug:22204562

Change-Id: I79dc2e102d227c991adc849e1cbda8572ee14905
ackageManagerService.java
029907b6e268715ee4de3b036903e082333f7ca3 01-Jul-2015 Jeff Sharkey <jsharkey@android.com> am d99c67f6: am ab149b37: am fc2740ae: Merge "Hand out storage to more system apps." into mnc-dev

* commit 'd99c67f683304a96975993cabbad164416ddc85b':
Hand out storage to more system apps.
0010b70beae6fafd3faf06e1b02291f59f9f85db 01-Jul-2015 Svetoslav <svetoslavganov@google.com> Grant permissions to headless system calendar/contacts sync adapters.

bug:21861781

Change-Id: I5f9905a23ba1b23e387adf2cea842172d34207b0
efaultPermissionGrantPolicy.java
ackageManagerService.java
fc2740ae571f68f1a83bf3197655970e7e597de4 01-Jul-2015 Jeff Sharkey <jsharkey@android.com> Merge "Hand out storage to more system apps." into mnc-dev
7186dd3a3073320df053145acce8e5d23568f312 01-Jul-2015 Jeff Sharkey <jsharkey@android.com> Hand out storage to more system apps.

Grant storage access to the Storage Access Framework provider that
offers to delegate access to storage devices. Also grant to the
default music app.

Bug: 22104872
Change-Id: I8cf7dceec8b4c1e31f8ddd40b094ccd4ecb1caf8
efaultPermissionGrantPolicy.java
90a6bb5da207577bc24c2d20f518422214e9213c 01-Jul-2015 Svet Ganov <svetoslavganov@google.com> am 87922ed1: am cf8ec275: am 1aaad610: Merge "Do not hold a lock when calling API to grant default permissions" into mnc-dev

* commit '87922ed1d3dc527d1f9a9ec00fe58549c305ac0f':
Do not hold a lock when calling API to grant default permissions
1aaad610dfc7445ec29fd906974677515c3a9f87 30-Jun-2015 Svet Ganov <svetoslavganov@google.com> Merge "Do not hold a lock when calling API to grant default permissions" into mnc-dev
fc72ce8bbd13daaa787ee0e590e62dbf2583ec10 30-Jun-2015 Svet Ganov <svetoslavganov@google.com> am 49316d83: am ab4f6ff0: am 4a23ac45: Merge "Installer is a part of the system with unrevocable permissions" into mnc-dev

* commit '49316d83d518110c64fab92c423ebd263ee3b7cf':
Installer is a part of the system with unrevocable permissions
4a23ac45895ec65e2357b2e52726229dbead9bb1 30-Jun-2015 Svet Ganov <svetoslavganov@google.com> Merge "Installer is a part of the system with unrevocable permissions" into mnc-dev
6a166af8fd25445c1b9a4d7869d87557fcb79cf9 30-Jun-2015 Svet Ganov <svetoslavganov@google.com> Installer is a part of the system with unrevocable permissions

1. Mark the installer permissions as not revocable.

2. Make the permission result dispatch more robust to handle installer death.

bug:22012614

Change-Id: Idee30ca884b87ccf97ba1bb878d4c49912e474b8
efaultPermissionGrantPolicy.java
06324ed4c6017d5343b9e0bba13472e32a2815f5 30-Jun-2015 Svet Ganov <svetoslavganov@google.com> Do not hold a lock when calling API to grant default permissions

bug:22186491

Change-Id: Id0a468423048938a91598629c4921090ec082853
ackageManagerService.java
a1d9cd4bbcf0cf7ec220ccd8af368d138c70cba0 30-Jun-2015 Dianne Hackborn <hackbod@google.com> am bb82feea: am 707cb64d: am 5a6f2136: Merge "Fix issue #22185268: apps crash with missing permissions and NPE on AppOpsManager" into mnc-dev

* commit 'bb82feea4464bd78fe8a6188c4c96a044abc10a0':
Fix issue #22185268: apps crash with missing permissions and NPE on AppOpsManager
82143339d4bec1e67f8f3a8df6d276df0b2f9e03 30-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #22185268: apps crash with missing permissions and NPE on AppOpsManager

Turn off GET_ACCOUNTS permission assigning for now.

Change-Id: I576117b26a43ca2da10db8bb2b1e4e176109ae39
efaultPermissionGrantPolicy.java
d3f61eb22de4050188aad3670d735395ad24a889 30-Jun-2015 Svet Ganov <svetoslavganov@google.com> am 7f152120: am b88758d8: am b6e00137: Fix build

* commit '7f1521206295f394022c72284e6b898924471b15':
Fix build
b6e0013768f11e47b30cd707fd249b4609cc6ca7 30-Jun-2015 Svet Ganov <svetoslavganov@google.com> Fix build

Change-Id: I64fc25c9ddd79c31e5bf34ec7bb4e21541be315b
efaultPermissionGrantPolicy.java
ee4e4e79f59a808c4c13db8281ac895047ea199a 30-Jun-2015 Svetoslav <svetoslavganov@google.com> am 358a8362: am ae45cfa6: am 03b5f128: Merge "Grant default permissons to the default SMS, Phone, Browser app." into mnc-dev

* commit '358a8362781736a8ddaa27713a0727d4eac1cfd0':
Grant default permissons to the default SMS, Phone, Browser app.
8c70606a97763c6d6e9ee45b4d072e76aa74bf0f 30-Jun-2015 Dianne Hackborn <hackbod@google.com> am 01629a47: am e13d4e72: am a03b18c6: Merge "Auto grant GET_ACCOUNTS where appropriate." into mnc-dev

* commit '01629a478401bfd13f840c536959724749b72b6a':
Auto grant GET_ACCOUNTS where appropriate.
03b5f128dbc375c1a28468773f39e85a5f70fc9a 30-Jun-2015 Svetoslav <svetoslavganov@google.com> Merge "Grant default permissons to the default SMS, Phone, Browser app." into mnc-dev
cdfd230a392d0f0557a3a5bada221b7a05113392 26-Jun-2015 Svetoslav <svetoslavganov@google.com> Grant default permissons to the default SMS, Phone, Browser app.

The default SMS, Phone, Browser are selected in the UI and we
grant default permissions to these. We do this regardless if
they are on the system image as the user has made an explicit
choice in the UI and the permission we grant are considered
essential for such type of a core app to operate properly.

bug:22104986

Change-Id: Ide8caeb524b43dde11a20460666cf34c4d35f84b
efaultPermissionGrantPolicy.java
ackageManagerService.java
ettings.java
a03b18c6c2ccf230a58688da7b3df56a548d561b 30-Jun-2015 Dianne Hackborn <hackbod@google.com> Merge "Auto grant GET_ACCOUNTS where appropriate." into mnc-dev
2f37bd39217177fc2d49b07a9d1b2821d3177e80 29-Jun-2015 Nicolas Prevot <nprevot@google.com> am d1d1a700: am 64c0c4da: am 6fd49936: Merge "Rename ALLOW_PARENT_APP_LINKING to ALLOW_PARENT_PROFILE_APP_LINKING" into mnc-dev

* commit 'd1d1a700501242cca06b5729c2bd888d6f2d4d52':
Rename ALLOW_PARENT_APP_LINKING to ALLOW_PARENT_PROFILE_APP_LINKING
d41e55575959199a1c3a3ee56f5688a3ac242038 29-Jun-2015 Nicolas Prevot <nprevot@google.com> am 0bfbd702: am 26b5ec6b: am f1fff797: Merge "Add flag FLAG_ACTIVITY_RESET_TASK_IF_NEEDED in LauncherAppsService." into mnc-dev

* commit '0bfbd7021b1ea8684ce5d75f14ba024a56e38c2c':
Add flag FLAG_ACTIVITY_RESET_TASK_IF_NEEDED in LauncherAppsService.
6fd49936ae6b145cb2a9fe8b9ff75dcd79632daa 29-Jun-2015 Nicolas Prevot <nprevot@google.com> Merge "Rename ALLOW_PARENT_APP_LINKING to ALLOW_PARENT_PROFILE_APP_LINKING" into mnc-dev
f1fff7976937d92bc7e0014d54cb071a509975dc 29-Jun-2015 Nicolas Prevot <nprevot@google.com> Merge "Add flag FLAG_ACTIVITY_RESET_TASK_IF_NEEDED in LauncherAppsService." into mnc-dev
7257462a7323234b453c14406724319e3bd75c7a 27-Jun-2015 Christopher Tate <ctate@google.com> am de3d02e4: am e436e19e: am b035c6d9: Merge "Properly scope the "only http/https schemes" intent filter semantics" into mnc-dev

* commit 'de3d02e4c3057c8ab7e40c0592dc2e94f0b42e64':
Properly scope the "only http/https schemes" intent filter semantics
b035c6d9a6827510e6ee3f855827cf6e428adb22 27-Jun-2015 Christopher Tate <ctate@google.com> Merge "Properly scope the "only http/https schemes" intent filter semantics" into mnc-dev
2134744efd305a875b7baa5073358387c479e3e4 27-Jun-2015 Christopher Tate <ctate@google.com> Properly scope the "only http/https schemes" intent filter semantics

That restriction applies only to default-app linkage verification, and
not to any general questions of "is this app effectively a web browser?"

Bug 21688029

Change-Id: I9f6a7bc6dcac5e12ee07f8da6465ad51c1aeddfb
ackageManagerService.java
388cd2c2ccc10c7ff8b074c9cb22fa03925b8ad2 27-Jun-2015 Dianne Hackborn <hackbod@google.com> Auto grant GET_ACCOUNTS where appropriate.

And add in a few other things.

Change-Id: If86a04a8ec63c252f895dcceb60a0248abb91083
efaultPermissionGrantPolicy.java
8883d72201cd1e64ce94dfad9e60197770b6287e 27-Jun-2015 Svet Ganov <svetoslavganov@google.com> am 0a5fa7e4: am cf14b8ba: am 143e118f: Merge "Make grant default permission more robust." into mnc-dev

* commit '0a5fa7e410055024eeae2d04c8d58b6dfddef295':
Make grant default permission more robust.
143e118fa90bbeb8cf558ec0d303639d15ee7db7 27-Jun-2015 Svet Ganov <svetoslavganov@google.com> Merge "Make grant default permission more robust." into mnc-dev
ba3ba81eb8756641ae0079ae9da2779cc22aeb89 26-Jun-2015 Svet Ganov <svetoslavganov@google.com> Make grant default permission more robust.

Change-Id: If492ee3305774419671bbdb72b438c8e540005e9
efaultPermissionGrantPolicy.java
ackageManagerService.java
ettings.java
b5381a5b3e1f16031a0525a3bb35f93ebd0f4ed2 26-Jun-2015 Christopher Tate <ctate@google.com> am cba354bf: am 5995f059: am 1c3b7a6d: Merge "Use a framework resource to name a factory-default browser app" into mnc-dev

* commit 'cba354bfe46793985d305281735ce91328fd3e13':
Use a framework resource to name a factory-default browser app
b6830197450d5a2befaf0dc4f7e73850f4c55846 26-Jun-2015 Nicolas Prevot <nprevot@google.com> Add flag FLAG_ACTIVITY_RESET_TASK_IF_NEEDED in LauncherAppsService.

Without this fix:
When starting an activity that was an activity-alias, in the work profile:
If this activity was already running, it caused the activity to be
created a second time instead of restarting the first one.

BUG:21411331

Change-Id: Ieb323885c589caed2675765cd5eed8c311535b92
auncherAppsService.java
1c3b7a6de6593c8a1c01ce48e04dda7e11471288 26-Jun-2015 Christopher Tate <ctate@google.com> Merge "Use a framework resource to name a factory-default browser app" into mnc-dev
1b96b1302671b9361cf7c7453a2ed2e5a079f4a0 26-Jun-2015 Dianne Hackborn <hackbod@google.com> am fb46261c: am a5de0eb5: am 7c5b5f71: Merge "Fix issue #22023824: Download folder is not created in internal storage" into mnc-dev

* commit 'fb46261c1eb015896d201a0275b41c3ebae11d02':
Fix issue #22023824: Download folder is not created in internal storage
db3fe819902f2bea08746c3e3ea55a9a55e3bac5 25-Jun-2015 Christopher Tate <ctate@google.com> Use a framework resource to name a factory-default browser app

If there is no resource-named default but there is a single factory-
installed browser app, that app is made the titular default.

This also introduces a permission guard on attempts to set the
default browser or the app-link state. These operations are now
contingent on the existing SET_PREFERRED_APPLICATIONS permission.

Bug 21778406

Change-Id: Id099bb9c4141f28917546492657cd2fba472e6b6
ackageManagerService.java
ettings.java
ca8e6da41c6e63e3ed17eb461171f1ef2e1d29c6 25-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #22023824: Download folder is not created in internal storage

The media provider and some other things need to be given storage access.

Also, seems like we should give storage access to the camera app as well.

And add a dump dump command that will dump data about a particular
permission name.

Change-Id: Idaaa9bba2ff4dc95290cf6d17e5df933df91e909
efaultPermissionGrantPolicy.java
ackageManagerService.java
ermissionsState.java
ettings.java
aedb56fd18487d7a34b8ea9f09e4a717afa75a1e 26-Jun-2015 Jeff Sharkey <jsharkey@android.com> Merge commit 'b02c73d5' into manualmerge

Change-Id: I3ec37c9d45d685c2393087bdefa6ab512cc70062
9527b223a9d4a4d149bb005afc77148dbeeff785 25-Jun-2015 Jeff Sharkey <jsharkey@android.com> Let's reinvent storage, yet again!

Now that we're treating storage as a runtime permission, we need to
grant read/write access without killing the app. This is really
tricky, since we had been using GIDs for access control, and they're
set in stone once Zygote drops privileges.

The only thing left that can change dynamically is the filesystem
itself, so let's do that. This means changing the FUSE daemon to
present itself as three different views:

/mnt/runtime_default/foo - view for apps with no access
/mnt/runtime_read/foo - view for apps with read access
/mnt/runtime_write/foo - view for apps with write access

There is still a single location for all the backing files, and
filesystem permissions are derived the same way for each view, but
the file modes are masked off differently for each mountpoint.

During Zygote fork, it wires up the appropriate storage access into
an isolated mount namespace based on the current app permissions. When
the app is granted permissions dynamically at runtime, the system
asks vold to jump into the existing mount namespace and bind mount
the newly granted access model into place.

Bug: 21858077
Change-Id: I62fb25d126dd815aea699b33d580e3afb90f8fd2
ackageManagerService.java
f0029c1ddb2875583e62c6a3f96d288e21f2efe2 25-Jun-2015 Nicolas Prevot <nprevot@google.com> Rename ALLOW_PARENT_APP_LINKING to ALLOW_PARENT_PROFILE_APP_LINKING

Also improve the javadoc.

BUG:21701782
Change-Id: I88a75ccfa71b0d5df2f4779987cf0fff56001fd3
ackageManagerService.java
serManagerService.java
0b9b7c505a529f7c6fa3eaf19b845104ebf695a0 25-Jun-2015 Yusuke Sato <yusukes@google.com> Merge "Initialize NativeLibraryHelper.Handle with |pkg|"
390a2080abc2bde5332c027638f5457db42df38c 25-Jun-2015 Yusuke Sato <yusukes@google.com> Initialize NativeLibraryHelper.Handle with |pkg|

to not parse the same apk file again in NativeLibraryHelper.
This will make derivePackageAbi() 2.5x faster. Previously,
derivePackageAbi() took ~330ms to process ~100 system packages
on volantis-userdebug. With this CL, it takes about ~130ms.

Bug: 22063656
Change-Id: I56d7af0ece3030247e2552c34a1007e79279988c
ackageManagerService.java
46b9d3cf44cebaa0128f6f6ce8baeb1895af7893 24-Jun-2015 Christopher Tate <ctate@google.com> am 425bd876: am d1741ef9: am 1af5fe23: Merge "Require that verified intent filters only have http/https <data> decls" into mnc-dev

* commit '425bd87661e318d715458fdfa5de440a2474d437':
Require that verified intent filters only have http/https <data> decls
8d3188d303f66f8f5de374fe325b37dfc1d9c433 24-Jun-2015 Christopher Tate <ctate@google.com> am 16ae25ed: am 62e94844: am 80b60bbb: Merge "Fix NPE when walking the set of packages to update app link policy" into mnc-dev

* commit '16ae25ed8d56e086af7fd325a16f207c1fd8a6f7':
Fix NPE when walking the set of packages to update app link policy
413020a6ca6e7d4eb7e61e3fe7d7a4c570a605db 24-Jun-2015 Christopher Tate <ctate@google.com> Require that verified intent filters only have http/https <data> decls

It is malformed to write a single intent filter like this:

<intent-filter android:autoVerify="true">
<data android:host="foo.example"
android:path="/"
android:scheme="http" />
<data android:host="*"
android:path="/custom"
android:scheme="fooexamplecustomscheme" />
</intent-filter>

In practice this app is accidentally defining a filter that will match
"http://*". This is now detected, and will never be auto-verified for
any of the mentioned domains.

Verified intent filters must *only* handle the http & https schemes.

Bug 21920537

Change-Id: I933cddbea23185d242565cac940e1e7a7e4e289b
ackageManagerService.java
2b40e7076dcd898bab87f0817b74a008756e4be5 24-Jun-2015 Makoto Onuki <omakoto@google.com> am 9e2d1ed8: am b96bc804: am 0633ae74: Merge "Actually wait for installd" into mnc-dev

* commit '9e2d1ed898b8e4a4971ddb511e221e3406bf797a':
Actually wait for installd
80b60bbb5efa42acef12843cde0d7a97f800337d 24-Jun-2015 Christopher Tate <ctate@google.com> Merge "Fix NPE when walking the set of packages to update app link policy" into mnc-dev
0633ae7481045b96da09a6c9e1b360d79433a151 24-Jun-2015 Makoto Onuki <omakoto@google.com> Merge "Actually wait for installd" into mnc-dev
af15d9e755c73d1382cc66fedb30ff1d861b85f0 24-Jun-2015 Christopher Tate <ctate@google.com> Fix NPE when walking the set of packages to update app link policy

Bug 21851441

Change-Id: I3616c5a7e40f5ff9ad9bbfee579a4a2fb2b1f7fd
ettings.java
c8a2cfed0192afc6a408f4bdb77e8a0bdd5d752b 24-Jun-2015 Makoto Onuki <omakoto@google.com> Actually wait for installd

Bug 19337445

Change-Id: I70bdaa0ac3695ac9d03ba34fe9d35fe775a5300d
nstaller.java
54b6b3c82bfae75b5562b4ed86441392e3265aaa 24-Jun-2015 Todd Kennedy <toddke@google.com> am 97ea7af9: am 126b5875: am c6040826: Merge "Skip upgrade keys for adopted storage" into mnc-dev

* commit '97ea7af996c5209c9e2ec594b24df71aa1e47415':
Skip upgrade keys for adopted storage
a576d8d4d391643b83067eef9e71ffd263ebb9a7 24-Jun-2015 Bill Yi <byi@google.com> Merge branch 'master' of https://googleplex-android.googlesource.com/_direct/platform/frameworks/base
b1cc316dcebc29ab74fa24bfb3f8f687e5835fb5 24-Jun-2015 Xiaohui Chen <xiaohuic@google.com> Merge "Introduce system user and primary user."
70f6c38644a4a6e28c016c265e6987bf00dd61f1 28-Apr-2015 Xiaohui Chen <xiaohuic@google.com> Introduce system user and primary user.

Bug: 19913735
Change-Id: I2c7855915d778cf80a7154314321ddd90e2eaaac
serManagerService.java
c6486e08fd4041acd04938905485e924dcd18ed1 24-Jun-2015 oleksii stepanian <aste@google.com> am 08502957: am 3285efc0: am e6953913: Merge "Send installerUid for verification when using PackageInstaller." into mnc-dev

* commit '08502957b8bb9743f618a7b65a901c552b44061f':
Send installerUid for verification when using PackageInstaller.
43469fd4a4e0d7b2fd387f74c0c7f23296553b23 24-Jun-2015 Jeff Davidson <jpd@google.com> resolved conflicts for merge of 8685db85 to master

Change-Id: I8fbf397082ac90d6a173785538fd6eeb8e4976f7
c60408264c7fe19d2f1f3550556f7e6bc1ca716d 23-Jun-2015 Todd Kennedy <toddke@google.com> Merge "Skip upgrade keys for adopted storage" into mnc-dev
1d69d48596dae3c3e365182aa13acbd56b106b2e 23-Jun-2015 Amith Yamasani <yamasani@google.com> am ab8d7e31: am af259ee4: am 862ab87b: Merge "Runtime permissions cannot be set on legacy apps by device policy" into mnc-dev

* commit 'ab8d7e31fb1b6526479844111b177be81a54a31c':
Runtime permissions cannot be set on legacy apps by device policy
e6953913536155a5d1f78d184e67a74f9acbe1c1 23-Jun-2015 oleksii stepanian <aste@google.com> Merge "Send installerUid for verification when using PackageInstaller." into mnc-dev
8d9ad19341e19256651ef86274a4382f2c09b279 23-Jun-2015 Jeff Davidson <jpd@google.com> Merge "Default permissions for carrier apps." into mnc-dev
0bf8f7cc3982164a9e11ea4a25ed930e466f1dd8 22-Jun-2015 Amith Yamasani <yamasani@google.com> Runtime permissions cannot be set on legacy apps by device policy

Clarify docs that runtime permissions can be granted or revoked by
a profile owner/device owner only for MNC apps and not legacy apps.

Check the targetSdkVersion and return false if legacy app.

Remove all policy flags from permissions when cleaning up
a device or profile owner.

Bug: 21835304
Bug: 21889278
Change-Id: I4271394737990983449048d112a1830f9d0f2d78
ackageManagerService.java
ermissionsState.java
c293d3ad1a4fbbf616d4dfb041eb9cbf45262b45 22-Jun-2015 Todd Kennedy <toddke@google.com> Skip upgrade keys for adopted storage

Define a new scan flag to control whether or not we're performing
an initial scan for packages. On internal storage, an intial
scan occurs during every boot. For adopted storage, an intial scan
occurs immediately after the adopted volume is mounted or whenever
an application is moved.

Bug: 21815906
Change-Id: Ieda9668230597346bce9ee25ecfa204f931bcef6
ackageManagerService.java
2a880312086147577e1e814bda6985fa97fb343b 23-Jun-2015 Jeff Davidson <jpd@google.com> Default permissions for carrier apps.

Grant permissions in the PHONE and LOCATION buckets to default carrier
apps as defined by the telephony stack. Provide a system API to grant
default permissions for carrier apps, as the set of apps may change
when a new SIM is inserted.

Since the phone process is separate from the system process, we need
to allow for binder calls to these APIs.

Also fix a log tag that is too long (android.util.Log drops messages
silently if the tag is > 23 characters).

Bug: 21696731
Change-Id: I98ca0c49c69f621f835ba57c1fd0505f2cec0d0d
efaultPermissionGrantPolicy.java
ackageManagerService.java
45df067c0bd04aa1254693cae4dea652ac741b99 23-Jun-2015 Svet Ganov <svetoslavganov@google.com> am bbb281ca: am c2993338: am d6693212: Merge "Auto grant read external storage too - it is now dangerous." into mnc-dev

* commit 'bbb281ca2f8bc6bc69bd5895eede2a9bc203c98d':
Auto grant read external storage too - it is now dangerous.
af6052f5464844ba6242a514cdaacc7e259f190b 23-Jun-2015 Christopher Tate <ctate@google.com> am 309499e0: am a116123f: am 6d2268a5: Merge "Back up / restore default app and intent filter verification state" into mnc-dev

* commit '309499e0cd138d30d340460d6c99ecb8292717d1':
Back up / restore default app and intent filter verification state
d66932127600522b7e520cc0286578ec293ed0bf 23-Jun-2015 Svet Ganov <svetoslavganov@google.com> Merge "Auto grant read external storage too - it is now dangerous." into mnc-dev
975fa474a7926d6041a4117bfbe5faa6e6e63057 23-Jun-2015 Svet Ganov <svetoslavganov@google.com> Auto grant read external storage too - it is now dangerous.

We grant external storage permissions to some default handlers by
default. Read external storage was promoted to runtime permission
but was not granted as a part of the external storage group, i.e.
with write external storage.

bug:21980225

Change-Id: I1edd7ae13222f12c9a488efb1919f5cf96e4b69d
efaultPermissionGrantPolicy.java
9a0f9682a91e4000de50c2ced20506516af28342 23-Jun-2015 Nicolas Prevot <nprevot@google.com> am 69042609: am 2e70cf73: am 3ab6f9e6: Merge "Allow cross-profile app linking from work to personal." into mnc-dev

* commit '6904260904176c67f200654d48fd8046c63011f4':
Allow cross-profile app linking from work to personal.
3f4c7e3f7ed4f2a3077993ebf545c2790ace246c 23-Jun-2015 oleksii stepanian <aste@google.com> Send installerUid for verification when using PackageInstaller.

PackageManagerService when used by PackageInstaller
(installStage) does not send calling installer process id.
As a result Play Store application always triggers verification
of packages that are installed.
This causes unnecessary work on the UI thread for each new
install/update.

Bug: 22014920
Change-Id: I8cc9ba7b6fcbe26ee709a5dda284e6cdd11071f1
ackageManagerService.java
6d2268a57603e1c60329b93fb853ac2c134cb932 23-Jun-2015 Christopher Tate <ctate@google.com> Merge "Back up / restore default app and intent filter verification state" into mnc-dev
6038d15cbc7f4648ceaadf5f15d1928c4899f98e 17-Jun-2015 Christopher Tate <ctate@google.com> Back up / restore default app and intent filter verification state

For apps not present on device, the state inherited from the ancestral
device is applied when the app is ultimately installed.

Bug 20144515

Change-Id: Ie05b4f1751357fc62f14e259da174b8cf465e913
ntentFilterVerificationState.java
ackageManagerService.java
ettings.java
3ab6f9e691fac6eeea1af8fb35bd4c41cdd692ca 23-Jun-2015 Nicolas Prevot <nprevot@google.com> Merge "Allow cross-profile app linking from work to personal." into mnc-dev
b7f6342b745b94f29d5add1d41eebfdab5448ce3 22-Jun-2015 oleksii stepanian <aste@google.com> am c80a2322: am 0acee36b: am 2bd8e97f: Merge "Fix race condition in PackageManager." into mnc-dev

* commit 'c80a2322b68d23c62fdc45634029d6e0c7799e12':
Fix race condition in PackageManager.
9edbda18df025527e18614cf0c45d538a27af30f 17-Jun-2015 Nicolas Prevot <nprevot@google.com> Allow cross-profile app linking from work to personal.

If the profile owner sets ALLOW_PARENT_APP_LINKING:

ACTION_VIEW, scheme http/https intents sent from the work profile
can be resolved by personal apps if they specify a host.

BUG:21701782
Change-Id: I372e2405345539eac9d6b4fb08def6bf84da14a6
ackageManagerService.java
serManagerService.java
2bd8e97f996bba0b52ed213f4feb4f367fe019c2 22-Jun-2015 oleksii stepanian <aste@google.com> Merge "Fix race condition in PackageManager." into mnc-dev
f58d7f21c9d53f9867972ef186c5032c1df9e7d8 20-Jun-2015 Svet Ganov <svetoslavganov@google.com> am 30e440ab: am eea83944: am 3ac465a7: Do not thrown on error persisting runtime permissions

* commit '30e440ab4c9d8d89d34d32fb4ea6a79346978a05':
Do not thrown on error persisting runtime permissions
3ac465a7d830a973096b4f69ef4531f09dcdf07c 20-Jun-2015 Svet Ganov <svetoslavganov@google.com> Do not thrown on error persisting runtime permissions

bug:20752986

Change-Id: I49d7e30afd49d3dcb1bcffd2fd48e9460ed5147f
ettings.java
5c361fc3c219b6999f1208fbc9e6414b87ed7a18 20-Jun-2015 Svet Ganov <svetoslavganov@google.com> am 4c07f7b5: am 5121345d: am 0f800f7c: Ensure default permissions not dropped on data wipe

* commit '4c07f7b55b3135f8c0066e48195033be3ef6d75e':
Ensure default permissions not dropped on data wipe
0f800f7c163383ce3a49cc99bc2d8097f8961bde 20-Jun-2015 Svet Ganov <svetoslavganov@google.com> Ensure default permissions not dropped on data wipe

bug:21954760

Change-Id: I15de766012e66e171d2089af574687ad513a5d57
ackageManagerService.java
58498249b68c3bdb1aac7cc99ef55afda94d8a70 20-Jun-2015 Svetoslav <svetoslavganov@google.com> am 635ace07: am 3adcfab7: am 2fbe248c: Merge "Grant default permissions if perms reset on upgrade." into mnc-dev

* commit '635ace07294ea2508fdd3ba4194e8d6b377c2031':
Grant default permissions if perms reset on upgrade.
971e091d523925c42c7f9e670d68c9b55d60ede0 20-Jun-2015 Svet Ganov <svetoslavganov@google.com> am 27479b57: am f5da7202: am 1e575a0f: Merge "Only grant runtime permissions to special components." into mnc-dev

* commit '27479b5752bcb06853ef5ada1813dc139efb7dd0':
Only grant runtime permissions to special components.
f9f75771cc28035525520128e8a74c898c43e12a 20-Jun-2015 Svetoslav <svetoslavganov@google.com> Grant default permissions if perms reset on upgrade.

Change-Id: I371e8eb42dc8e8953a184d29cc2a3bd2c361097e
ackageManagerService.java
161bd9aae46088cb62e78af428ef9f2b1172c0dc 20-Jun-2015 oleksii stepanian <aste@google.com> Fix race condition in PackageManager.

When Google Play installs 2 apps concurrently (e.g.
personal and work profile) PackageManager can hit a
race condition when connection to media container has
not yet been established but the MCS_BOUND event is
triggered from MCS_UNBIND.

Detailed step by step scenario:
1. package1 comes in
2. INIT_COPY (initiate bind, add pending install)
3. onServiceConnected triggers (MSC_BOUND)
4. MSC_BOUND, process pending package and schedule MSC_UNBIND
5. MSC_UNBIND is triggered once the package is verified
6. service is diconnected
7. package2 comes in
8. INIT_COPY (initiate bind, add pending install)
9. MSC_UNBIND scheduled at step 4
10. MSC_UNBIND sees that there is a pending package,
schedules MSC_BIND
11. MSC_BIND arrives before service is connected and we fail.

Solution: do not fail if we wait for connection.

Bug: 21849046
Change-Id: I39928e1efc81ba64e45c622cc08cb786801d6569
ackageManagerService.java
1e575a0f32a00fc6a2f9a71fe1d1eb4426c71787 20-Jun-2015 Svet Ganov <svetoslavganov@google.com> Merge "Only grant runtime permissions to special components." into mnc-dev
adc1cf46045ae756d3a9ccbccf6b0f894e4c1edd 16-Jun-2015 Svet Ganov <svetoslavganov@google.com> Only grant runtime permissions to special components.

Now runtime permissions are granted only to components that are
part of the system or perform special system operations. For
exmple, the shell UID gets its runtime permissions granted by
default and the default phone app gets the phone permissions
granted by default.

bug:21764803

Change-Id: If8b8cadbd1980ffe7a6fc15bbb5f54a425f6e8f9
efaultPermissionGrantPolicy.java
ackageManagerService.java
ackageSettingBase.java
ettingBase.java
ettings.java
71f9ec2708aa5af69ee35e26215a7a13c31e6cfa 19-Jun-2015 Oleksiy Vyalov <ovyalov@google.com> Merge "Resolve canonical package path before writing it to packages.list." into mnc-dev
83cea22436672551a6af972eb3b1ad28f7f0dfda 19-Jun-2015 Tony Mak <tonymak@google.com> am 8ffdc048: am 2cb9edf5: am 92dfab8d: Merge "Clear granted permission when app is uninstalled by one of the multiple users" into mnc-dev

* commit '8ffdc048f8ec3ef683564c77340f5330e5ad6383':
Clear granted permission when app is uninstalled by one of the multiple users
8e33f63040db4f8326c1bf678645a42ab79c32f3 19-Jun-2015 Tony Mak <tonymak@google.com> Clear granted permission when app is uninstalled by one of the multiple users

Bug: 21838358

Change-Id: Iccd46382c9468d0503da0bb49a49040ae712e2cc
ackageManagerService.java
eb6195c7a2b59d11ff934ead59b2ff7201769502 19-Jun-2015 Sudheer Shanka <sudheersai@google.com> am eaa25779: am a0fa30dc: am a408061c: Merge "Use the intent filter icon in ResolveInfo for managed profile." into mnc-dev

* commit 'eaa2577953eeff27754f6707ac0efa11b77ed947':
Use the intent filter icon in ResolveInfo for managed profile.
6e4019be4b167d5c2d486a2855cefdaffb52709a 19-Jun-2015 Christopher Tate <ctate@google.com> am f45835bf: am 92f8cff8: am 3233a0a6: Merge "Don\'t always dump domain/preferred state" into mnc-dev

* commit 'f45835bf149aecaa169d2ff6a713371831aa8bb1':
Don't always dump domain/preferred state
84406c6899420ec98e5a41f502c13172766ecd6b 19-Jun-2015 Fyodor Kupolov <fkupolov@google.com> am d171cabc: am 01caa29a: am e5bce22d: Merge "Defer writes to runtime-permissions.xml" into mnc-dev

* commit 'd171cabc2c5c132547e20b30928df95876e9217f':
Defer writes to runtime-permissions.xml
9b3890b8dcf18fed6705e0c84fd8cc5fbfe1882d 19-Jun-2015 Jeff Sharkey <jsharkey@android.com> am 282bbbc4: am e5ab13b6: am c8a49a2b: Merge "Write packages.list when granting permissions." into mnc-dev

* commit '282bbbc4358f4e18c7da60397a6f939173048d55':
Write packages.list when granting permissions.
a408061cc7b5efaf090ce9efd5fd0ba1d95e9c11 19-Jun-2015 Sudheer Shanka <sudheersai@google.com> Merge "Use the intent filter icon in ResolveInfo for managed profile." into mnc-dev
466ecdbc1e9f7007158c298652085676b8830f14 12-Jun-2015 Oleksiy Vyalov <ovyalov@google.com> Resolve canonical package path before writing it to packages.list.

Bug id - b/21028929

Change-Id: I82a7ba4f27017d3de29790cdbfab656ca9814cfb
(cherry picked from commit 4b42adf697c0ecde7ed18234109eb5430239fe54)
ettings.java
3233a0a65c8bd2acce4b8fdfe6ce8e6c20b9a24d 19-Jun-2015 Christopher Tate <ctate@google.com> Merge "Don't always dump domain/preferred state" into mnc-dev
9c896ab226c53020b8495e9d2d6f520a0eb887cb 19-Jun-2015 Christopher Tate <ctate@google.com> Don't always dump domain/preferred state

Change-Id: Ie0431b6c3cb1a9f372a142637359c42b182d4b1b
ackageManagerService.java
4b42adf697c0ecde7ed18234109eb5430239fe54 12-Jun-2015 Oleksiy Vyalov <ovyalov@google.com> Resolve canonical package path before writing it to packages.list.

Bug id - b/21028929

Change-Id: I82a7ba4f27017d3de29790cdbfab656ca9814cfb
ettings.java
e5bce22dc098d5da9ff573f4aac812272de3c0af 19-Jun-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Defer writes to runtime-permissions.xml" into mnc-dev
c8a49a2b95d6ed182cbc966676d17f98e1ccd816 19-Jun-2015 Jeff Sharkey <jsharkey@android.com> Merge "Write packages.list when granting permissions." into mnc-dev
b43ec54c23cdb1af88812c5221b62b6218a35b09 19-Jun-2015 Jeff Sharkey <jsharkey@android.com> Write packages.list when granting permissions.

Some permissions have the side effect of adding GIDs right now,
so we need to flush out packages.list.

Bug: 21874693
Change-Id: Ia4398c9f84cf7f151248f821b3fa2c12bdf91b80
ackageManagerService.java
22afc5469efb924dea20902e3618735691e14f4a 18-Jun-2015 Dianne Hackborn <hackbod@google.com> am 2133afc7: am d21b695f: am 22433a33: Merge "Fix issue #21814207 and issue #21814212 (alarm manager)" into mnc-dev

* commit '2133afc77aa36f186b9e5c0ff9954d0d26848e3e':
Fix issue #21814207 and issue #21814212 (alarm manager)
a750a63d639f6936af456df904fa6b9ba941885e 17-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #21814207 and issue #21814212 (alarm manager)

Issue #21814207: AlarmManager.setAndAllowWhileIdle should also allow wake locks.

Introduce a whole new infrastructure for providing options when
sending broadcasts, much like ActivityOptions. There is a single
option right now, asking the activity manager to apply a tempory
whitelist to each receiver of the broadcast.

Issue #21814212: Need to allow configuration of alarm manager parameters

The various alarm manager timing configurations are not modifiable
through settings, much like DeviceIdleController. Also did a few
tweaks in the existing DeviceIdleController impl.

Change-Id: Ifd01013185acc4de668617b1e46e78e30ebed041
ackageManagerService.java
13ae6679e1d68263f9196de1bcf7cf16c0f6599f 17-Jun-2015 dcashman <dcashman@google.com> am daccbc0a: am 1208e343: am 2f902959: Merge "Make keysetmgrservice gurantees explicit." into mnc-dev

* commit 'daccbc0a3c34808d5818f2e754b60731c803a14c':
Make keysetmgrservice gurantees explicit.
2f902959245f1cae57827025b8711a059faaf782 16-Jun-2015 dcashman <dcashman@google.com> Merge "Make keysetmgrservice gurantees explicit." into mnc-dev
3c13a2a5bc452777a785c1de74fff56a7cde9cdb 16-Jun-2015 Fyodor Kupolov <fkupolov@google.com> Defer writes to runtime-permissions.xml

In grantPermissionsLPw, use async version of writeRuntimePermissionsForUserLPr
to defer writes to runtime-permissions.xml.

Change-Id: I9dcae74199d26b6a988e35dff97b038d435e1e16
Bug: 21849928
ackageManagerService.java
1142341872befc70d2d37c3b8bac66e2f77f633d 16-Jun-2015 Jeff Sharkey <jsharkey@android.com> am 10d045cd: am 716978e3: am 2cc03e56: Yet another user restriction.

* commit '10d045cd08a60403056f90f03b8f79dc0bf18571':
Yet another user restriction.
2cc03e5606ad7cd473283898400506d5ac2237ba 20-Mar-2015 Jeff Sharkey <jsharkey@android.com> Yet another user restriction.

Change-Id: Ia2952da19cb974a6a9ba0271a298a10df58b8d18
serManagerService.java
00c06628286ad4a86d421ed7c4708b83f595e234 16-Jun-2015 Christopher Tate <ctate@google.com> am 0375282a: am 73f2f66a: am 60177af8: Merge "Clean up app-link verification policy" into mnc-dev

* commit '0375282aa24c9045ce88c24fdda0f8b39d122e0b':
Clean up app-link verification policy
87f794f0bf8b53d6c983968f398c4bde4cb6a014 03-Jun-2015 dcashman <dcashman@google.com> Make keysetmgrservice gurantees explicit.

Add exceptions/checks for keysetmgrservice interractions which *should* never
happen, but would result in NPE or invalid metadata. Also handle mismatches
between package and keyset metadata in packages.xml.

Bug: 20128916
Change-Id: Ia0f63f78d232d9d8d9fbe4cd8e6cc3406e5192a7
eySetManagerService.java
ackageManagerService.java
72c10a25f0b91bac8d50ec512d37d516ece7c9d5 13-Jun-2015 Christopher Tate <ctate@google.com> Clean up app-link verification policy

If an app claims to be the official auto-verified app for any domain
and thus the automatic handler for ACTION_VIEW / {http,https}://...
intents naming that domain, then we require that it verify as the
official app for *all* domains it purports to handle, even if the
other domains are not flagged for verify.

Bug 21335460

Change-Id: I3fdd8620defa31aea36ce738fa63ac94fc53c5f7
ackageManagerService.java
ettings.java
c7abf0fd67bae8b9c564d7b7afdce79886da5e4f 15-Jun-2015 Christopher Tate <ctate@google.com> am 6e416059: am ee5b89ac: am f63655e4: Merge "Use HTTPS when fetching app link verification resources" into mnc-dev

* commit '6e41605982d4d658e1588a3bd4240e039d8f9454':
Use HTTPS when fetching app link verification resources
f63655e49fcccd922e8d5f61c67f58bd4a361211 15-Jun-2015 Christopher Tate <ctate@google.com> Merge "Use HTTPS when fetching app link verification resources" into mnc-dev
7dd20eb501adbfd9a51dccbb195f93aee64e109e 14-Jun-2015 Svet Ganov <svetoslavganov@google.com> am ab47ce05: am d0fe86b5: am a5c852e0: Merge "Clear runtime permissions on package data reset." into mnc-dev

* commit 'ab47ce059f806f282c565059a745f662c943d8e3':
Clear runtime permissions on package data reset.
a5c852e03abb9372a6928271a930d7d79e4ec45e 14-Jun-2015 Svet Ganov <svetoslavganov@google.com> Merge "Clear runtime permissions on package data reset." into mnc-dev
2a30be19006ede27ee524da89b6c4a1b551b1d76 14-Jun-2015 Svet Ganov <svetoslavganov@google.com> Clear runtime permissions on package data reset.

bug:21817488

Change-Id: I7c51fee5206e3bcb79951f237a71862f0752a709
ackageManagerService.java
e152699d90cc309e72383e964cd70b7448e7f366 13-Jun-2015 dcashman <dcashman@google.com> am 2eb24eb1: am 5bcf8d9d: am 1a3048f3: Merge "Don\'t use upgrade-key-sets check when scanning during boot." into mnc-dev

* commit '2eb24eb1fce4ab7c7ae022275d66a3391a57866f':
Don't use upgrade-key-sets check when scanning during boot.
1a3048f3677680823b52d3b0d538917d08da8495 13-Jun-2015 dcashman <dcashman@google.com> Merge "Don't use upgrade-key-sets check when scanning during boot." into mnc-dev
2ff4d9277446e45ad467784c536c4b1353e0292f 12-Jun-2015 Christopher Tate <ctate@google.com> am 485c2f8c: am 4f4d54f3: am 1c24a8cd: Merge "If we\'re out of space, retry background dexopting later" into mnc-dev

* commit '485c2f8c5715c12bd84a20f9746ce40a1ff15e70':
If we're out of space, retry background dexopting later
1c24a8cd312cf86f1a0a59008933e4ec5579e26d 12-Jun-2015 Christopher Tate <ctate@google.com> Merge "If we're out of space, retry background dexopting later" into mnc-dev
2c9655b3d4c1fb0687baa14730c6d97ab5a56789 12-Jun-2015 Christopher Tate <ctate@google.com> If we're out of space, retry background dexopting later

Give it 4 hours to give the user time to do stuff, then retry;
repeat until we have space to work in.

Bug 20468442

Change-Id: Id4b11abcc38a9e2a50a062f0067a13ce0ae831ad
ackgroundDexOptService.java
3c458636494f28685146060e1252f52fe43ed38a 12-Jun-2015 Christopher Tate <ctate@google.com> Use HTTPS when fetching app link verification resources

Bug 20016932

Change-Id: I30b4e052795551f3048b3adf29cd89ec0501fce8
ackageManagerService.java
465ef5c43940e31ff4479175e51793c63a0e05ab 12-Jun-2015 dcashman <dcashman@google.com> Don't use upgrade-key-sets check when scanning during boot.

Apps may specify upgrade-key-sets which are different than their current signing
keys to prevent a future upgrade with the current set of keys. Every package is
re-scanned on boot, however, so the existing application would violate its own
recorded upgrade-key-sets. Change the key verification check to ignore
upgrade-key-sets on boot. Also default to the same-sig checks if the
upgrade-key-set meta-data has been corrupted.

Bug: 21785716
Change-Id: I5c0c1e2017ec780a745a74488620bfe95b052269
eySetManagerService.java
ackageManagerService.java
4c7ce67197d43eb2831707898ef8f0e8d2e4fe51 05-Mar-2015 Alan Treadway <alantreadway@google.com> Fix test execution documentation in PackageManagerService.

Change-Id: Ie38c0a353e0c9d2ada6d39257083b14b60552630
ackageManagerService.java
3c0e6d9ebfb4406f421788ca3c33953f9ff242fe 11-Jun-2015 Svetoslav <svetoslavganov@google.com> am 47db7221: am 0525c07f: am 75a0ee08: Merge "Add system API to watch for permission changes" into mnc-dev

* commit '47db7221685aaa12926abc42198069c733491cfc':
Add system API to watch for permission changes
75a0ee081fa31b75649e164a8bf79a23a3ebd060 11-Jun-2015 Svetoslav <svetoslavganov@google.com> Merge "Add system API to watch for permission changes" into mnc-dev
f7c06eb03ab4479b9d0656a23a4733d17e995183 11-Jun-2015 Svetoslav <svetoslavganov@google.com> Add system API to watch for permission changes

Change-Id: I1ce450a59fb326c14848f46732d877dea33f33c7
ackageManagerService.java
93553ebab1121d1c5b6a49aea431910e4ef7f5ea 11-Jun-2015 Dmitriy Ivanov <dimitry@google.com> am e50f4866: am 866c375e: am 7cbe9f03: Merge "Fix abi-detection for 32-bit system apps" into mnc-dev

* commit 'e50f4866a5717b989c641df52628ceeaf5ad7055':
Fix abi-detection for 32-bit system apps
7cbe9f03a968ef42840d234ea325b69f4b1f1417 10-Jun-2015 Dmitriy Ivanov <dimitry@google.com> Merge "Fix abi-detection for 32-bit system apps" into mnc-dev
0d7e33ec47c3fd61ad7d90773ba533d2f6a4bef7 10-Jun-2015 Jeff Sharkey <jsharkey@android.com> am d6c886f8: am f355a22d: am e687929f: Merge "Flags to select storage volume for app installs." into mnc-dev

* commit 'd6c886f8621dc259a5bc9d64c74e983c6dc35a85':
Flags to select storage volume for app installs.
e687929f33f272fff9585bd0752d85ad519bc66d 10-Jun-2015 Jeff Sharkey <jsharkey@android.com> Merge "Flags to select storage volume for app installs." into mnc-dev
ab2340996a515ea0c437ad5bb1ea1fa88ab9edff 10-Jun-2015 Jeff Sharkey <jsharkey@android.com> Flags to select storage volume for app installs.

Remote callers can now provide the "--install-location" value from
the APK to help select a location, or they can explicitly force a
volume by UUID.

Bug: 21676789
Change-Id: Iefc92d770a851fc33e37edbf259fdb8df2b14ae5
ackageInstallerService.java
44a2d978d13e2370bdb057c08faede145f937c70 10-Jun-2015 Dmitriy Ivanov <dimitry@google.com> Fix abi-detection for 32-bit system apps

Some system apps are still special and use symlinks
to /system/lib. For these apps we try to detect abi
based on directory structure if detecting abi the
regular way was failed.

Bug: 21668152
Bug: 21711506
Change-Id: Ic048e5f4c24d06ca2cb917d7a061a41bde597e9f
ackageManagerService.java
39947d63dd6585312a9f1bab8aac1c8deb9fb3c0 10-Jun-2015 Fyodor Kupolov <fkupolov@google.com> am 7e1c4917: am 1f6cbb5d: am c2ae0090: Merge "Do not create profile if FEATURE_MANAGED_USERS is not available" into mnc-dev

* commit '7e1c4917aba076b2d92e66f6971002996ab63e44':
Do not create profile if FEATURE_MANAGED_USERS is not available
c2ae0090d2f6b9f36b4027e79f0430d29853a193 10-Jun-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Do not create profile if FEATURE_MANAGED_USERS is not available" into mnc-dev
b61579950461fca161e570f079f1f4d09389c49f 06-Jun-2015 Fyodor Kupolov <fkupolov@google.com> Do not create profile if FEATURE_MANAGED_USERS is not available

Bug: 21629701
Change-Id: Ia0f720eee0faa0d565701064a268948f6dea82e4
serManagerService.java
ffa0f10ddda7895bf3898e997bb92e90275f85b3 09-Jun-2015 Dianne Hackborn <hackbod@google.com> am 51bcd672: am 1a18d087: am ea7438e4: Merge "Fix issue #21571700: Need to be smarter about how foreground..." into mnc-dev

* commit '51bcd6728b30bcef6f89e710fec25a9a081bb46b':
Fix issue #21571700: Need to be smarter about how foreground...
ea7438e4a698945b3e3a7786cff726c337291a68 09-Jun-2015 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #21571700: Need to be smarter about how foreground..." into mnc-dev
0cbdb53bc8d4def260898a8cf99107b790d6ae8e 09-Jun-2015 Narayan Kamath <narayan@google.com> am 5ca85562: am fb89df9f: am 3eb63dc3: Merge "Move linking and directory creation logic to installd." into mnc-dev

* commit '5ca85562faf39fd5a544acde7783d4329e45fe60':
Move linking and directory creation logic to installd.
e845a1ef646aff12978da59dcc3b74836be0875b 05-Jun-2015 Narayan Kamath <narayan@google.com> Move linking and directory creation logic to installd.

bug: 20889739

Change-Id: I1763376a2fbb25f3a3d55f60c1940cdbddcded07
nstaller.java
ackageInstallerSession.java
ab4bb9d1fec685dab0fce9232c9a3477fab356b3 06-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #21571700: Need to be smarter about how foreground...

...services get out of app idle

Introduce a new process state to even better distinguish foreground
services from other states. Rework the INTERACTION reporting to
usage stats to do it less when the screen is off -- require that
an app sit in the foreground service or top activity state for
at least 30 minutes before we consider it an interaction.

Also eradicate a bunch of logging in package manager.

Change-Id: I94249e67f9a9c62e9a92ae104710e6747b16327e
ackageManagerService.java
45bf1ff5ea3f43142cdf9852adadbea2911efdb9 08-Jun-2015 dcashman <dcashman@google.com> am 6bd28c08: am 9a501662: am b5766468: Merge "Add SYSTEM_DIR check to upgrade-key-set verification." into mnc-dev

* commit '6bd28c08041787a02eda22a13a4a0f9e9ce04fb9':
Add SYSTEM_DIR check to upgrade-key-set verification.
96d7fe476709238c117f2b5df238cae13adb9a15 08-Jun-2015 Dimitry Ivanov <dimitry@google.com> am c346c393: am eb748a39: am 25bb4553: Merge "Revert "Print exception stacktrace on failed scanPackageLI"" into mnc-dev

* commit 'c346c393ce0f7bfc8186114b300ec7736f34bd3c':
Revert "Print exception stacktrace on failed scanPackageLI"
b5766468538de200d26012d96019db26bccac5d4 08-Jun-2015 dcashman <dcashman@google.com> Merge "Add SYSTEM_DIR check to upgrade-key-set verification." into mnc-dev
f61ae2de25a2dd09024bf5a8462b4408203c928b 08-Jun-2015 dcashman <dcashman@google.com> Add SYSTEM_DIR check to upgrade-key-set verification.

Bug: 21697139
Change-Id: I7e6ce3d7f231e0ca5da1f501c80342a04f6c2a1e
ackageManagerService.java
25bb4553f379c70244f52d4864eab18530aa0a2e 08-Jun-2015 Dimitry Ivanov <dimitry@google.com> Merge "Revert "Print exception stacktrace on failed scanPackageLI"" into mnc-dev
47fc7fe7f6bd5a44c20c4b03d3195f601bcc3735 08-Jun-2015 Dimitry Ivanov <dimitry@google.com> Revert "Print exception stacktrace on failed scanPackageLI"

This reverts commit 95b7d50ce1a1ae879bbb1b8b8262172744c28d0e.

Bug: 8076853
Change-Id: Ia19e6638a97b7b49561932752a204990e3a486d4
ackageManagerService.java
4c8fd9056339fc51d405b25b8f6295e3118b0ed1 04-Jun-2015 Dmitriy Ivanov <dimitry@google.com> am 75ebffbd: am a4ae987a: am f8e5993c: Merge "Fix abi detection for system apks" into mnc-dev

* commit '75ebffbd85a0a56e1c111586688cf3ecd59c9ddc':
Fix abi detection for system apks
a25a3d6187d7c60991212361e6cf28439cfd1a08 01-Jun-2015 Dmitriy Ivanov <dimitry@google.com> Fix abi detection for system apks

Prebuilts open their libraries directly from apk.
Because of that abi detection is no longer as
special as it was before.

Bug: 20810492
Bug: 8076853
Change-Id: Icbd39d6062f3c1fcad2038e712b98fbdd9aa2196
ackageManagerService.java
0b48160290669f11c6dbc9aa9e6eb844f7eea018 04-Jun-2015 Narayan Kamath <narayan@google.com> am 0559bdea: am 750dab2c: am cd1fc146: Don\'t compile all splits when installing one.

* commit '0559bdea1889b7e028c097bfa37167ca0dc4bf9b':
Don't compile all splits when installing one.
326a0acde1fd2e790b9a854d1ac4610b16224a17 04-Jun-2015 Paul Crowley <paulcrowley@google.com> Merge "Delete the user key when deleting a user."
cd1fc1465bb16eca10cc29fe887c63b0cff178e9 11-May-2015 Narayan Kamath <narayan@google.com> Don't compile all splits when installing one.

This patch consists of two broad changes :
- don't "force" dex2oat when installing a new app. this should never
be necessary because we will always compare checksums.

- when staging a new install, we "inherit" (hard link) all compiled
oat files from the previous install. this will ensure that we compile
only those files that have changed, and not all of them

bug: 20889739
Change-Id: I3e14335f3bcfe76d1d24d233f53a728a6d90e8a1
ackageInstallerSession.java
ackageManagerService.java
8692b7e5a12d79d14a6717bb3650a3f8a032d997 03-Jun-2015 Paul Crowley <paulcrowley@google.com> Merge "Use mount service to create user dirs."
20770ddbd4d6f2af0093f36462a8f44a678b084b 30-May-2015 Svetoslav <svetoslavganov@google.com> Add API to hint whether to show on-board UI before a permission request.

bug:21511988

Change-Id: I9d1d7adf34b68074e65510f53b6e642cf784cf6b
ackageManagerService.java
95b7d50ce1a1ae879bbb1b8b8262172744c28d0e 02-Jun-2015 Dmitriy Ivanov <dimitry@google.com> Print exception stacktrace on failed scanPackageLI

The current message does not provide enough
information to figure out what is going on.

Bug: http://b/8076853
Change-Id: I741781ce6829eac44e4edddd0a545f3be743ceeb
ackageManagerService.java
e3e314df4d52881225326d426a76e3e7f1bc40d3 20-Apr-2015 Stuart Scott <stuartscott@google.com> Network Reset should have a lockdown like Factory Reset.

bug:20332322
Change-Id: I7c61a011d11e89513757f112abf320bb2a785edb
(cherry picked from commit 94b038bbb291431a7b39611d72f206b07e839891)
serManagerService.java
815be147a35452d52feb0610ff11d8645351ad9f 29-May-2015 Svetoslav <svetoslavganov@google.com> Merge "Use AtomicFile APIs correctly when reading." into mnc-dev
3dcdd37b66bb996ae332c29e25788a118a9e2691 29-May-2015 Svetoslav <svetoslavganov@google.com> Use AtomicFile APIs correctly when reading.

21280155

Change-Id: I354ebac8fc91d8f28eec6016474a9521ff2a490d
ettings.java
623b58b2cfcb778f52d2393bc4093ee721c3f16c 28-May-2015 Narayan Kamath <narayan@google.com> Avoid inspecting packages twice to deduce ABIs for moves / installs.

In the case of moves, we can use the existing ABIs from settings because
a move will not result in an ABI change. For new installs, we can just
use the ABI we deduced for compiling (dex2oat) the package.

bug: 21144503
Change-Id: I35e2e8abd47f547b6252271fc6b41d30719c4298
ackageManagerService.java
9ded760f6378b79ae5f91fe694744981a4154d0b 19-May-2015 Sudheer Shanka <sudheersai@google.com> Use the intent filter icon in ResolveInfo for managed profile.

Bug: 20753645
Change-Id: Ifed4b498524272517c9f3338ba88fcbcd3b22075
ackageManagerService.java
85e4e818d83dbc65b1e6e3ed9d39c656188acaec 19-May-2015 Paul Crowley <paulcrowley@google.com> Delete the user key when deleting a user.

BUG=19706593

Change-Id: I36ec1b987f5a07450c6a564c74f124ec8d3403ad
serManagerService.java
9102f5d953fbde03e12f385b2225004edc43d202 22-Apr-2015 Paul Crowley <paulcrowley@google.com> Use mount service to create user dirs.

Bug: 19704432
Change-Id: Iee037ca653482b0ee7bf59c7ba193c75411fe42f
ettings.java
4f11754f72ac4c60448b36a1a933cdc2d7bc1870 08-May-2015 Wojciech Staszkiewicz <staszkiewicz@google.com> Pass charset to XmlPullParser.setInput instead of null

Passing null to XmlPullParser.setInput forces it to do additional
work, which can be easily avoided if we know the charset beforehand.

bug: b/20849543

(cherry picked from commit 9e9e2e73c6ec7bece20268196dc89ad0c8bafad4)

Change-Id: Iaff97be9df2d0f99d7af8f19f65934439c9658e2
ackageInstallerService.java
ackageManagerService.java
ettings.java
serManagerService.java
561e13d687bf698b759cd0dbb653f3250a5b6917 21-May-2015 Narayan Kamath <narayan@google.com> Fix application moves.

We don't dex2oat during application moves, so we must scan
the package again scanPackageDirtyLI to deduce its ABI.

This is unnecessary (since a move cannot change ABIs), but we
need some additional refactoring to avoid a second scan.

bug: 21337469

(cherry picked from commit cd251fa382e887f59c278d4d7cd0a858812c6114)

Change-Id: Id1ed3bdfabb41e05e6a2f7efbd05d2103a67c663
ackageManagerService.java
a96ecf78214a56c16051b2a5a71fe20324984714 20-May-2015 Narayan Kamath <narayan@google.com> Throw a checked exception on inconsistent installs.

Allows us to proceed without crashing the system process. Also,
complete an incomplete error message. Follow up comments from
change b904863476991d8540d37d5.

bug: 21144503

(cherry picked from commit c52ae28006605fb2da38b305b60b9bb419aa2f80)

Change-Id: I47b8762449714162fcd5c16eba6fcc146b93120b
ackageManagerService.java
2b6d792ad56795050f01abbd2d732cf717037b1c 18-May-2015 Narayan Kamath <narayan@google.com> Scan package to derive ABIs before optimizing.

This requires a minor refactor to extract the ABI detection logic
out of scanPackageDirtyLI.

Note that there's a minor regression here : we ignore the
cpuAbiOverride from the package settings when calculating the
CPU ABI. This is OK (and possibly better behaviour) because this
is only a debug only option (for adb install) AND because the instructions
require users to specify the abi override on every adb install
invocation. Furthermore, the behaviour when an ADB installed app
(with an override) is auto-updated is more consistent.

bug: 21144503

(cherry picked from commit b904863476991d8540d37d542c0a49b78deab680)

Change-Id: I1eb88b808fd2e90e14c32322131659220aafdb7a
ackageManagerService.java
589f2b53f2ad4639d5a193bc89e903a8b2400975 23-Apr-2015 Fyodor Kupolov <fkupolov@google.com> Do not create oat directory for an app in ASEC container

Currently installation fails, if an app is located on SD card (inside ASEC).
If an app is located inside ASEC, dexopt output should go to
/data/dalvik-cache. dexopt also needs to be performed at a later stage,
because the name of the oat file contains the absolute path to the dex file.

Bug: 20452651
Bug: 21360107

(cherry picked from commit 94056d1cb8183bde3e942336735b289b9654deb1)

Change-Id: Id1ced7159e5af9c05be0b637437b3b260e859c1d
ackageDexOptimizer.java
ackageManagerService.java
cd251fa382e887f59c278d4d7cd0a858812c6114 21-May-2015 Narayan Kamath <narayan@google.com> Fix application moves.

We don't dex2oat during application moves, so we must scan
the package again scanPackageDirtyLI to deduce its ABI.

This is unnecessary (since a move cannot change ABIs), but we
need some additional refactoring to avoid a second scan.

bug: 21337469

Change-Id: I3e9dfd5db1c928847f9d527dc15d29a05ff40e7d
ackageManagerService.java
91edde24ffa5d78df18bf752de88dfe2bc8c4119 20-May-2015 Jeff Sharkey <jsharkey@android.com> Write packages.list when adding/removing users.

FUSE daemons now rely on getting per-user GID information when
packages.list is written. Normal secondary user adding/removing
usually has enough PackageManager traffic to trigger a side-effect
rewrite, but this change writes explicitly to handle guest users.

Also obtain the user list once, and exclude dying users. During
user creation we manually splice in the user ID that we're bringing
online.

Bug: 19924661
Change-Id: Icc5b1b169300c9dc12099be12651acbf89d6bea9
ermissionsState.java
ettings.java
c52ae28006605fb2da38b305b60b9bb419aa2f80 20-May-2015 Narayan Kamath <narayan@google.com> Throw a checked exception on inconsistent installs.

Allows us to proceed without crashing the system process. Also,
complete an incomplete error message. Follow up comments from
change b904863476991d8540d37d5.

bug: 21144503

Change-Id: Idb6a33f93b70b4e5e2bca95d2d3af0e2adaeedf3
ackageManagerService.java
6503e69d1dfe425f292c6e982bb87cf12b1f4397 20-May-2015 Svetoslav <svetoslavganov@google.com> Prevent modification of system fixed permissions

Change-Id: I061b993df305f27e52f08dad54f1bdbf162de4d9
ackageManagerService.java
6d9a53abbc94788dc02f7ebde30744753e0a5a3d 20-May-2015 Svetoslav <svetoslavganov@google.com> Merge "Handle downgrading a runtime permission to an install one" into mnc-dev
a1d0f3031f3aff9c17c0bd6e1bdfd788a2b79ab9 20-May-2015 Svetoslav <svetoslavganov@google.com> Handle downgrading a runtime permission to an install one

bug:21300531

Change-Id: I5c020c0faae3e727bbe898441c58116e2ab892b8
ackageManagerService.java
b3793d7201c2555cc1f6b01dbed47429b7d31be4 20-May-2015 Fabrice Di Meglio <fdimeglio@google.com> Merge "Add IntentFilter auto verification - part 12" into mnc-dev
f2fec45280682b0b2531781d8f9bd34f64fe164d 19-May-2015 Fabrice Di Meglio <fdimeglio@google.com> Add IntentFilter auto verification - part 12

- again tune Intent resolution candidates filtering: first add always list
if not empty, other wise add undefined and browsers. If the list is still
empty at the end, then add all the initial candidates.

See bug #19628271

Change-Id: I21f5313daf7bec1049c1e7c08275c825855d2935
ackageManagerService.java
5f645339e4d0565cbe1bf2f1a3b77370f07b157a 19-May-2015 Nicolas Prevot <nprevot@google.com> Merge "Allow creating a managed profile if there is only one user." into mnc-dev
b904863476991d8540d37d542c0a49b78deab680 18-May-2015 Narayan Kamath <narayan@google.com> Scan package to derive ABIs before optimizing.

This requires a minor refactor to extract the ABI detection logic
out of scanPackageDirtyLI.

Note that there's a minor regression here : we ignore the
cpuAbiOverride from the package settings when calculating the
CPU ABI. This is OK (and possibly better behaviour) because this
is only a debug only option (for adb install) AND because the instructions
require users to specify the abi override on every adb install
invocation. Furthermore, the behaviour when an ADB installed app
(with an override) is auto-updated is more consistent.

bug: 21144503
Change-Id: I74e7c493468ee0088eb615c9a7fe30b4d7cf27de
ackageManagerService.java
12678a99f12ae20fa8518bb8199c35d52be17954 13-May-2015 Nicolas Prevot <nprevot@google.com> Allow creating a managed profile if there is only one user.

BUG:21119929

Change-ID: Ice1cf25f8ae8199228f828d22118c94b9e11b567
serManagerService.java
a91a6f68f4c2564f763d28a3cfcd9d8b7a3f5db9 16-May-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Hold wakelock while dexopting" into mnc-dev
72434b7088591828082dd952496d523ef3622de2 13-May-2015 Nicolas Prevot <nprevot@google.com> Allow creating a managed profile if there is only one user.

BUG:21119929

Change-ID: Ice1cf25f8ae8199228f828d22118c94b9e11b567
serManagerService.java
e650fd95a9d87f74fb420687b7062c9d428ef3f1 15-May-2015 Svet Ganov <svetoslavganov@google.com> Merge "Fix grant/revoke to act on owner by default and log invalid user id." into mnc-dev
4ccca50d7e501154127ac360e0fcbae850b1bbc8 15-May-2015 Svet Ganov <svetoslavganov@google.com> Fix grant/revoke to act on owner by default and log invalid user id.

bug:21163229

Change-Id: I66d0cc130b37b5752ed06afc73259ed41bfb7830
ackageManagerService.java
9e9e2e73c6ec7bece20268196dc89ad0c8bafad4 08-May-2015 Wojciech Staszkiewicz <staszkiewicz@google.com> Pass charset to XmlPullParser.setInput instead of null

Passing null to XmlPullParser.setInput forces it to do additional
work, which can be easily avoided if we know the charset beforehand.

bug: b/20849543

Change-Id: Iaff97be9df2d0f99d7af8f19f65934439c9658e2
ackageInstallerService.java
ackageManagerService.java
ettings.java
serManagerService.java
857c3019bac34bbabaa8d5ebb4ab0047ca07cfc5 14-May-2015 Svetoslav <svetoslavganov@google.com> Merge "Do not allow opting out from the new permission model." into mnc-dev
d9653703987f0ba194df6383d766173f65bf758e 14-May-2015 Svetoslav <svetoslavganov@google.com> Do not allow opting out from the new permission model.

bug:20525775

Change-Id: I84cd4587db5adb96f6f29148adb242905f53f2dc
ackageManagerService.java
aef477a65e9baaf1feb2c60350f1faf0132d8e92 14-May-2015 Fabrice Di Meglio <fdimeglio@google.com> Merge "Add IntentFilter auto verification - part 11" into mnc-dev
b371c7b6e234bda71a0266e67722c859227f643c 14-May-2015 Fabrice Di Meglio <fdimeglio@google.com> Add IntentFilter auto verification - part 11

- tune Intent resolution candidates filtering: add also the undefinedList
into the results at first so that when you install an App which is not
verified (after installing a verified App) you will still have the
Disambiguation Dialog prompted to the User.

See bug #19628271

Change-Id: I611fff4c1c7f60db22312d7948c8d5120719fbd0
ackageManagerService.java
fe112e7b388fe582a4e57c26fdf651511b0bbb5a 14-May-2015 Fabrice Di Meglio <fdimeglio@google.com> Merge "Add IntentFilter auto verification - part 10" into mnc-dev
649efc68cb3cd9648db6801989108c79f99dc1f2 14-May-2015 Fabrice Di Meglio <fdimeglio@google.com> Add IntentFilter auto verification - part 10

- tune Intent resolution candidates filtering: remove the undefinedList
from the results and then add it again it there is no more candidates.

See bug #19628271

Change-Id: I9ab077f6a431367be8bab30c134d34e1e7ac51ed
ackageManagerService.java
b3f22b48bbd4e4816212e596e3cb612457d48fe5 12-May-2015 Svet Ganov <svetoslavganov@google.com> Runtime permissions for system components not revokable - framework

Change-Id: I5b1d7bb1618ffa8d1231618ece47d0905c82f7bf
ackageManagerService.java
ermissionsState.java
bf6fbb0040a9b37158d50102560ab57b98cae9ad 12-May-2015 Jeff Sharkey <jsharkey@android.com> Merge "Ignore abandon after install relinquished." into mnc-dev
497c05218ae3b30fdd01699e06fba4d04e90659d 12-May-2015 Jeff Sharkey <jsharkey@android.com> Ignore abandon after install relinquished.

We recently changed the install flow to fully dexopt before renaming
the staging directory. This exposed the ability for the session owner
to abandon and destroy the stage contents while dexopt was still
happening.

Due to SELinux rules, the abandon would fail to clean up the stage
directory, and PackageManager would "successfully" rename and install
that stage, which now only contained the oat/ directory.

To avoid this case, we now ignore abandon requests once we've passed
the "point of no return" and relinquished our stage over to
PackageManagerService.

Bug: 20175072
Change-Id: I4ad5b1eba0e38f1315b8330bd95be6e3bc6c635a
ackageInstallerSession.java
bb9d9278aa6fe3ba3d4c21b03d3e3da4543a974c 12-May-2015 Amith Yamasani <yamasani@google.com> Merge "Idle timebase" into mnc-dev
e2f43948d1de58e49192b97306e8a4e1c99412f4 12-May-2015 Fabrice Di Meglio <fdimeglio@google.com> Merge "Add user selectable Default Browser feature - part 6" into mnc-dev
3453e081e0a94bbb0b8c1d58ce4ccdbf2e53639e 12-May-2015 Fabrice Di Meglio <fdimeglio@google.com> Add user selectable Default Browser feature - part 6

- if a default Browser is not defined and if a Browser App
is selected into the disambiguation dialog, then make it as
the default Browser
- clear default Browser saved data (package name) when
the default Browser App is removed

See bug #20144393

Change-Id: Ia8621d7a61ec2cb60deded9d70f75f1e1d88d123
ackageManagerService.java
06bf824628c118fbd5ad6756913d7fd63a6f4ce5 09-May-2015 Amith Yamasani <yamasani@google.com> Idle timebase

Use screen on time as timebase for idling out apps
that have been inactive.

Store the time when an app was last active as an additional
package state in UsageStats. Compare it to screenOnTime to decide
if it's inactive.

Exclude device idle whitelist from apps that can go inactive.

Bug: 20066058

Change-Id: I709f9f31a9affa7ca6e1ae3e4c5729c5fb221669
serManagerService.java
8c7f700a59ad26e75c9791335d78f14322cad49a 07-May-2015 Svet Ganov <svetoslavganov@google.com> Add permission meta-state flags to support grant/revoke permission policy.

We now maintain a mata-state with each permission in the form of flags
specyfying the policy for this permission. This enables support of the
following use cases:

1. The user denies a permission with prejudice in which case an app cannot
request the permission at runtime. If an app requests such a permssion
it gets a denial unless the user grants the permission from settings.

2. A legacy app with disabled app-ops being upgraded to support runtime
permissions. The disabled app ops are converted to permission revocations.
The app ops manager is a part of the activity manger which sits on top
of the package manager, hence the latter cannot have a dependency on the
former. To avoid this the package installer which is the global
permission managment authority marks the permission as revoked on
upgrade and the package manager revokes it on upgrade.

3. A device policy fixing a permission in a granted or revoked state. This
additional information is folded in the meta-state flags and neither
apps can request such permissions if revoked not the user can change
the permission state in the UI.

Change-Id: I443e8a7bb94bfcb4ff6003d158e1408c26149811
asePermission.java
ackageManagerService.java
ermissionsState.java
ettingBase.java
ettings.java
d7b2a2e4562a9f5a085257b0da5a95b1b46d3d55 11-May-2015 Narayan Kamath <narayan@google.com> Merge "Be more accepting of dex2oat errors." into mnc-dev
a627c094e67f640dfe3b2ac0b633edcf51270cf4 06-May-2015 Fyodor Kupolov <fkupolov@google.com> Hold wakelock while dexopting

Bug: 19521294
Change-Id: Ieed9b98ecb4a3332ce652d76c2bac8c312917ca1
ackageDexOptimizer.java
ackageManagerService.java
b501330a1b6ef14ff512a5727f7a01bc423d6fbb 18-Apr-2015 Fyodor Kupolov <fkupolov@google.com> Disable multi-user background recording

On user switch, kill existing processes of the background user with
android.permission.RECORD_AUDIO permission. Home activity should not be
killed to avoid an expensive restart of the home launcher, when the
user switches back.

Introduced DISALLOW_RECORD_AUDIO user restriction, which is enabled for the
background user, and removed for the foreground user.

Introduced a concept of system controlled user restriction, which can only
be set by the system, rather than device administrator.

Bug: 20346194
Change-Id: Ic942fd565e80d14424230dae612965a8e229c4ef
serManagerService.java
4f434a04708e7a254afe2e0d362f715229dc15d1 09-May-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Remove restrictions PIN functionality" into mnc-dev
0dc0193307b9bb97aac1cfb79e56444578ba006e 08-May-2015 Xiaohui Chen <xiaohuic@google.com> Merge "multiuser: postpone user cleanup to systemready" into mnc-dev
aef021042e1bc6851a9d66f40f00cea021d357c7 07-May-2015 Fabrice Di Meglio <fdimeglio@google.com> Merge "Add IntentFilter auto verification - part 8" into mnc-dev
01dcb76fec4ee2ff3a3dc4516a37c144d771f18c 07-May-2015 Narayan Kamath <narayan@google.com> Be more accepting of dex2oat errors.

- Narrow down the scope of caught exceptions. StaleDexCacheError has been
removed (nobody was throwing it) and we shouldn't be catching the
general "Exception".
- Make try {} catch blocks for IOExceptions more fine-grained, only
surrounding the code that throws them.

And finally, don't return DEX_OPT_FAILED if installd couldn't run
dex2oat successfully. We return DEX_OPT_SKIPPED instead.

bug: 20888973
Change-Id: I25701e16157f42981ca767e343545cfe1d9cfbb2
ackageDexOptimizer.java
1f09b8c0c2a08fa5169a36031efcb3f34ec5f163 07-May-2015 Fabrice Di Meglio <fdimeglio@google.com> Add IntentFilter auto verification - part 8

- fix clearing of Intent Verification Status: now do it at the correct
time when the PackageSettings info is still there
- reduce writing of Settings

See bug #19628909

Change-Id: I9113333c330964249342108fa1ca7b8ec89c3322
ackageManagerService.java
ettings.java
ef24909d84db9d5aefb825ee1556089fcdcc1678 06-May-2015 Fyodor Kupolov <fkupolov@google.com> Remove restrictions PIN functionality

Bug: 20852231
Change-Id: I5666ee28ff1341ead9b258bc0852d8ba6d313c5e
serManagerService.java
4be96e4e47d249d07d3e7dae5578e87aef90bd07 06-May-2015 Xiaohui Chen <xiaohuic@google.com> multiuser: postpone user cleanup to systemready

User cleanup was too early and causing exceptions during boot.

Bug: 20826665
Change-Id: Idace66d41cefaff1d80f490c161f8868e91d36d9
serManagerService.java
4a64b19f239b6bff82a032329ce5781681843044 05-May-2015 Svet Ganov <svetoslavganov@google.com> Merge "Permission UI - legacy apps support" into mnc-dev
019d2304998f3ed77c0a608df6cf4bea1138f8dc 04-May-2015 Svet Ganov <svetoslavganov@google.com> Permission UI - legacy apps support

Change-Id: Id3f98c138422d33868363d587dd196898b42a0d4
ackageManagerService.java
ettings.java
44b60be189183138437a3faf9a73388af0efcf44 05-May-2015 Fabrice Di Meglio <fdimeglio@google.com> Merge "Add user selectable Default Browser feature - part 5" into mnc-dev
7d1a9d056261fdf304215c9b53b7cc4f4422e1db 05-May-2015 Fabrice Di Meglio <fdimeglio@google.com> Add user selectable Default Browser feature - part 5

- check and clear default Browser if its package is no more available

See bug #20144393

Change-Id: I60a1b8f11058f3a4f9dc80440027ab72fe7cce2e
ackageManagerService.java
8ef631de47d4e52cafe5f9182633892b480dfcdb 04-May-2015 Fabrice Di Meglio <fdimeglio@google.com> Merge "Add user selectable Default Browser feature - part 4" into mnc-dev
4c92949993e77e1727f5d967b070074dd8f67a5c 02-May-2015 Fabrice Di Meglio <fdimeglio@google.com> Add user selectable Default Browser feature - part 4

- when selecting a default Browser App, make the others Browser Apps
not capable to open URLs automatically

See bug #20144393

Change-Id: I6ffaafbfb1a2571c0eba90af5c1648150b020559
ackageManagerService.java
83bb765b046a3c6d90abbd65545d4532f647ae14 01-May-2015 Fabrice Di Meglio <fdimeglio@google.com> Merge "Add IntentFilter auto verification - part 7" into mnc-dev
1de3f0dcafb0c5ceb3d9bec96a5c630bb8d4a515 30-Apr-2015 Fabrice Di Meglio <fdimeglio@google.com> Add IntentFilter auto verification - part 7

- update packages priming so that it effectively save its data
- use ArraySet instead of ArrayList for list of domains (a set
is preferable as we dont want duplicates)

See bug #19628909

Change-Id: I52085f4bc28dcbc7fbc02ba0898abcd4ae9cf1e2
ackageManagerService.java
ettings.java
a320505f3a39e21f29065f0f2a01089363825318 01-May-2015 Jeff Sharkey <jsharkey@android.com> Merge "Move both app code and data together." into mnc-dev
bd0e9e4958acdc6ab5f607bc252fddba877d20f9 01-May-2015 Jeff Sharkey <jsharkey@android.com> Move both app code and data together.

Refactor app movement code into the normal install flow as a new
flavor of InstallArgs. It copies both app code and data during the
copy step, and just updates paths during the rename step.

Measure free space before kicking off a move. Spawn a thread to
derive a hacky progress estimate based on free disk space counting
down.

Remove checkFreeStorage() and getLegacyNativeLibraryPath() which
nobody was calling. Fix deadlocks around package broadcasts, and fix
wrong lock ordering when loading packages.

Bug: 19993667, 20275578, 20370140
Change-Id: I7bbf14c924a724d6ebb8a41a02434750fa3302bc
nstaller.java
ackageManagerService.java
ettings.java
dc4ad271f931eca48ab8ef22ef76db740d179d99 30-Apr-2015 Benjamin Franz <bfranz@google.com> Merge "Add package name extra to PackageInstaller callback" into mnc-dev
e31b820dad4c5f2b19ee10479a675a139ad3c61e 30-Apr-2015 Jeff Sharkey <jsharkey@android.com> New "frozen" state during app move/upgrade.

This replaces mOperationPending, which was in an odd place. It adds
a new PackageSetting.frozen flag that is a last-ditch effort to
prevent ActivityManager from starting an app while it's being moved
or upgraded.

Also provides clearer guarding around all upgrades by freezing,
killing, upgrading, then unfreezing.

Bug: 20275579
Change-Id: I28bb0359a6f4e05080fb336b18dd2a249509d989
ackageManagerService.java
ackageSettingBase.java
ettings.java
50a05454795c93ac483f5cb6819e74cb17be1b5b 29-Apr-2015 Jeff Sharkey <jsharkey@android.com> Returning to wizard, split move events.

Finish wiring up notifications to jump back into in-progress wizard
flow, using moveId as identifier.

Split move events back into separate creation and progress events,
and pass details as bundle to pass extra stuff like UUID. Null
package still means moving primary storage.

Add explicit "volume forgotten" event for PackageManager to clean
up internal state with.

Plumb through internal path reported by vold, and bring back FUSE
bypass rewriting optimization.

Bug: 19993667
Change-Id: I0f43edbba36c58c5cd33550022c54c4eb9f01a48
ackageManagerService.java
2e3e943ccd419dd10d3e4df5ae7640e8b020cc76 17-Apr-2015 Benjamin Franz <bfranz@google.com> Add package name extra to PackageInstaller callback

If an app invokes app install via PackageInstaller APIs without knowing
the package name, the callback contains no information about the name
of the installed package. Add EXTRA_PACKAGE_NAME to this callback.

Also allow PackageInstaller to distinguish between a newly installed and
an updated package.

Bug: 19764848
Bug: 20150135
Change-Id: I062440a08df9a723e9445ea10bc6f6800c5b99a8
ackageInstallerService.java
ackageManagerService.java
1c4a44e577c7b8316172d1bf5357d006776ae75e 23-Apr-2015 Nicolas Prevot <nprevot@google.com> Do not return cross-profile intent results to a non-enabled user.

In PackageManagerService.queryIntentActivities, do not return
ResolveInfos targeting a user which is not enabled.

BUG:19578138
Change-Id: Id4e730ca8671c26f8cf077bc9c66b3dbd37be482
ackageManagerService.java
b36586a7c9b7718f33961406537e27bbd9b16211 27-Apr-2015 Jeff Sharkey <jsharkey@android.com> Split some VolumeInfo state into VolumeRecord.

VolumeRecord is a historical record of a volume that we've seen in
the past. It's now surfaced outside the framework for SystemUI to
drive the notifications that bug users to reinsert missing private
volumes.

Show progress notifications for both storage and package movement
operations. Notify when an empty disk is inserted (no usable volumes)
which launches into the normal format flow.

Add API to forget volumes.

Bug: 20275424, 20275424
Change-Id: I75602c17fdcd4d1f1f62324e1a08c4a33093eefa
ackageManagerService.java
9f7e39fc9d278642a29df48daf44dceff11acd17 11-Apr-2015 Fabrice Di Meglio <fdimeglio@google.com> Use Default Browser App for IntentResolution when needed

- add MATCH_ALL as a new flag for telling that all results need to
be returned (even if there is some sort of filtering done).
- take into account the default Browser App for Intent resolution
- also, dont do any domain verification priming for non system app

See bug #20144393

Change-Id: Iddd1f2029e3bbf3b99ebc5f416dc7f17e5bad10c
ackageManagerService.java
79d37cbcddf4b35dbaa345916fe405d081973866 27-Apr-2015 dcashman <dcashman@google.com> Remove static modifier from KeySetManagerService issuedIds.

There is no notion of shared issuedIds across instances of KeySetManagerService,
of which there should only ever be one on the system. This is particularly
troublesome for unit tests which rely on a clean slate for each
KeySetManagerService invocation.

Bug: 19530120
Change-Id: I41fbd5424650a74426c5aa1128ddfa6a230dcfa3
eySetManagerService.java
275e3e43f2fba72fa99001cafa2a70e5478fc545 25-Apr-2015 Jeff Sharkey <jsharkey@android.com> Migrate primary external storage.

Wire up through MountService to call down into vold. Watch for
unsolicited events that report progress, including special value "82"
that signals that copy has finished. We use this value to persist
the volumeUuid in case of unexpected reboot, since it indicates the
new volume is ready.

Wire progress updates through existing callback pipeline.

Update the volume mounting code to match against the persisted UUID
when selecting the primary external storage.

Bug: 19993667
Change-Id: Id46957610fb43517bbfbc368f29b7d430664590d
ackageManagerService.java
8a33121ad905c78c01ba44d5bf8a314ab2c7348b 24-Apr-2015 dcashman <dcashman@google.com> Remove line wrapping for publickey encoding.

This adds unnecessary whitespace in packages.xml and is contrary to the approach
taken by certs. Remove it.

Change-Id: I217bb94af97c3b38dab1fd806ffe7b7600fa6fdd
eySetManagerService.java
620b32b316fd4f1bab4eef55ec8802d14a55e7dd 24-Apr-2015 Jeff Sharkey <jsharkey@android.com> Package and storage movement callbacks.

Since package and primary storage movement can take quite awhile,
we want to have SystemUI surface progress and allow the Settings
app to be torn down while the movement proceeds in the background.

Movement requests now return a unique ID that identifies an ongoing
operation, and interested parties can observe ongoing progress and
final status. Internally, progress and status are overloaded so
the values 0-100 are progress, and any values outside that range
are terminal status.

Add explicit constants for special-cased volume UUIDs, and change
the APIs to accept VolumeInfo to reduce confusion. Internally the
UUID value "null" means internal storage, and "primary_physical"
means the current primary physical volume. These values are used
for both package and primary storage movement destinations.

Persist the current primary storage location in MountService
metadata, since it can be moved over time.

Surface disk scanned events with separate volume count so we can
determine when it's partitioned successfully. Also send broadcast
to support TvSettings launching into adoption flow.

Bug: 19993667
Change-Id: Ic8a4034033c3cb3262023dba4a642efc6795af10
ackageInstallerService.java
ackageManagerService.java
9bafd3b5e08ea5af27e1aa2d82a56b95f60cb0e8 23-Apr-2015 Svet Ganov <svetoslavganov@google.com> Merge "Revert some unnecessary changes in handling XML read"
e723e54650c5ace8beb47bc4d3c493e276e65d91 23-Apr-2015 Svet Ganov <svetoslavganov@google.com> Revert some unnecessary changes in handling XML read

Change-Id: I3bbbc3159930d80e2e1f28fa9c0035ae5029d4b8
ettings.java
7fadb2f5428e0b8a1a327cd300c0ade8a6fdc348 23-Apr-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Do not create oat directory for an app in ASEC container"
94056d1cb8183bde3e942336735b289b9654deb1 23-Apr-2015 Fyodor Kupolov <fkupolov@google.com> Do not create oat directory for an app in ASEC container

Currently installation fails, if an app is located on SD card (inside ASEC).
If an app is located inside ASEC, dexopt output should go to
/data/dalvik-cache. dexopt also needs to be performed at a later stage,
because the name of the oat file contains the absolute path to the dex file.

Bug: 20452651
Change-Id: I4432ca7a0b0e88b705705acf42e5cae78cadf729
ackageDexOptimizer.java
ackageManagerService.java
ba0821ed3bc2536be02df1ae850619b111cbd6f4 22-Apr-2015 Svet Ganov <svetoslavganov@google.com> Make read/write from/to XML persistent state more robust.

When writing critical state to XML an excpetion can lead to creating
a malformed XML that is later parsed and may put the device in a bad
state. Hence, on any error while writing we should bail out and drop
the partially write state on the floor.

Corollary, any error on parsing can lead to having a partially read
state that is not consistent which may lead to writing this bad state
back to disk. Hence, on any error while parsing we should bail as
our current state may be unrecoverable.

Change-Id: Ia050c16198cb583f8a51263ad2035dbb948052b8
ettings.java
4f2dcfd48010a338dc9a2f5870ed12b382c30cd7 22-Apr-2015 Svet Ganov <svetoslavganov@google.com> Fix permission check imposed by broadcast sender.

Change-Id: Id105b00aad7b369fa0337fa63753ce7ea71b3383
ermissionsState.java
1b7025f264fd811ab27470867f8e65eeebf092e9 22-Apr-2015 Svetoslav <svetoslavganov@google.com> Report all permissions by type correctly

Change-Id: I357ad52d022ffd7703cce7e1551fa10cc7edd72f
ermissionsState.java
7a0fe44d6a4d3ffcc2803694c544b794b4d40342 20-Apr-2015 Svet Ganov <svetoslavganov@google.com> Merge "Report all permissions for user in PermissionsState"
7aa6dfeb011e1886290f64958af9489ee0d25b6b 20-Apr-2015 Svet Ganov <svetoslavganov@google.com> Report all permissions for user in PermissionsState

Change-Id: I08a228018401820ef82cf1f95fe29556d3aeba5e
ermissionsState.java
529f91fc8e7e884ef19bef8eb3e4e3a1d69336f4 19-Apr-2015 Jeff Sharkey <jsharkey@android.com> Always send volume UUID with installd commands.

Since packages can be moved to other volumes, all relevant commands
to installd now require an explicit volume UUID parameter.

Bug: 20275577
Change-Id: Ie84f5bc43c7aada5800b8d71692c7928b42b965e
nstaller.java
ackageInstallerSession.java
ackageManagerService.java
ettings.java
7e92ef3a1146102806fa0543ef12e09231c55639 18-Apr-2015 Jeff Sharkey <jsharkey@android.com> Volumes know parent disks; unsupported disks.

This is cleaner and more direct than the reverse of having the disk
publish child volume membership. Rename state constants to match
public API. Add state representing bad removal. Make it clear that
volume flags are related to mounting.

Send new unsupported disk event when we finish scanning an entire
disk and have no meaningful volumes.

Splice disk labels into description when known. Only adoptable
slots are directly visible to apps.

Bug: 19993667
Change-Id: I12fda95be0d82781f70c3d85c039749052dc936b
ackageManagerService.java
e2d45be4dae116307f8edd85eaa61134221cb8f9 16-Apr-2015 Jeff Sharkey <jsharkey@android.com> Candidate volumes for packages, fix symlink.

Add API to determine the possible candidate volumes that a package
can be moved to. For example, it currently knows that we need to
move ASEC-based apps through internal storage before migrating them
to a private volume.

Comparator for consistent VolumeInfo ordering when displayed in UI.

Fix native library symlink to be volume UUID aware.

Bug: 19993667
Change-Id: I68d5fac5f0f776ac1c7dd15e7a984bfe2704f3f7
ackageManagerService.java
afd1fc3ccc7c5627c0a10d4b61fb4e87b0e18cd9 13-Apr-2015 Svetoslav <svetoslavganov@google.com> Improve permission group handling.

1. Don't ignore permissions in an unknown group.

2. Ignore permission groups for legacy apps as the meaning
of a permission group is redefined.

Change-Id: Ifd0e0928cfd8540f3abc39a8834e84c3f18149be
ackageManagerService.java
98680e969b384e2765a311fe14a070fb39f587ee 13-Apr-2015 Sudheer Shanka <sudheersai@google.com> Merge "Clear defaults of an application installed in multiple users."
d957f80ced65b4151c4fe1fcd9815cc2dcc00c99 04-Mar-2015 Sudheer Shanka <sudheersai@google.com> Clear defaults of an application installed in multiple users.

Bug: 19120156
Change-Id: I6c85b62d121df84e5f86dd359e8555376fea9701
ackageManagerService.java
6036cd51265d31c08eefe0470a9f37e7f757aae8 11-Apr-2015 Jeff Sharkey <jsharkey@android.com> Merge "Support moving apps to expanded storage."
30ca50a3ddf35e6426e7b561b95e0864885de6d5 11-Apr-2015 Fabrice Di Meglio <fdimeglio@google.com> Merge "Add Default Browser App support and relax Hosts validation for AppLinks"
6227172310663e1267b1fabd68be890a1cb7e145 11-Apr-2015 Fabrice Di Meglio <fdimeglio@google.com> Add Default Browser App support and relax Hosts validation for AppLinks

- add private PackageManager APIs for setting/getting the default
Browser App package name
- serialize / deserialize the default Browser App package name per User

Also relax the Hosts name validation for the AppLinls feature. Now we
just care if the IntentFilter is having an HTTP or HTTPS scheme.

Change-Id: I4436f66ac6beff57e14f7f3a2a00b0b582c03be9
ackageManagerService.java
ackageSettingBase.java
ettings.java
2e29aa5ea7fd361e66751578037ce253009c80e4 11-Apr-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Added getUserCreationTime to query user/profile creation time"
b3a6defec84ab1d420b049c575cb37b1151e095a 11-Apr-2015 Svetoslav <svetoslavganov@google.com> Fix accounting of permission gids.

bug:20143490

Change-Id: I718d4db74ebf003616241710a67774b2e2e5384f
asePermission.java
ermissionsState.java
caa41648f4e3cecc1996447396aabc4e394b8fd0 10-Apr-2015 Svetoslav <svetoslavganov@google.com> Merge "Allow only system signed apps to grant permissions at install"
805b63e253c139625f5a86d72ef7b31d6ec9f8e9 10-Apr-2015 Svetoslav <svetoslavganov@google.com> Allow only system signed apps to grant permissions at install

bug:20099946

Change-Id: Ifcc5c6638b4174ffb3ba452ae68a5a53b2d1ff0a
ackageInstallerService.java
ackageManagerService.java
a3e28e69e5c8592b1fec92099a379119a14b4cef 10-Apr-2015 Nick Kralevich <nnk@google.com> am 12a597a2: am a55ec9c2: am 08d76a94: Merge "Impose an ordering on created SELinuxMMAC Policy objects."

* commit '12a597a2bc92eda2f33bc85bb1c525989c261abf':
Impose an ordering on created SELinuxMMAC Policy objects.
a55ec9c2abfd8a8bd216f133ec925e9db1d69ae7 10-Apr-2015 Nick Kralevich <nnk@google.com> am 08d76a94: Merge "Impose an ordering on created SELinuxMMAC Policy objects."

* commit '08d76a946b898af28f3c8125cdf4966195b718fb':
Impose an ordering on created SELinuxMMAC Policy objects.
4caa6b1efbac3a518328b581ac665876fa6aac77 10-Apr-2015 Robert Craig <rpcraig@tycho.ncsc.mil> Impose an ordering on created SELinuxMMAC Policy objects.

Imposing an order on Policy objects allows us to extend the
policy writers ability to union mac_permissions.xml files.
Policy developers can now create new mac_permissions.xml
entries under their device specific directories. This is
in contrast to current methods which only allow differing
stanzas to appear outside the base mac_permissions.xml.

Also, report on stanzas with duplicate input selectors and
treat these as errors. There are some ambiguities that can
arise otherwise.

Lastly, impose an XOR condition on signer stanzas w.r.t seinfo
and package tags. This finer distinction helps the union feature
of policy to become clearer and simpler to code.

Change-Id: Idd86df8ad9a63d1b8ba6e8270670814ca6cee8d2
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
ELinuxMMAC.java
b9f3674c11ed9c89b80a69f728cbc5f540b2ecde 09-Apr-2015 Jeff Sharkey <jsharkey@android.com> Support moving apps to expanded storage.

Start deriving the data path for apps based on the volume UUID where
the app lives. This path is used for all higher-level APIs, giving
us a clean place to switch app storage.

When parsing a package, keep track of the volume UUID where it lives
and update PackageSetting once installed. For now continue treating
moves as installs, but we'll eventually clean this up to avoid the
additional dexopt pass. Wire up move to use the new installd command
to move private data between devices.

Cache LoadedApk only for the current user, since otherwise the data
dir points at the wrong path.

Bug: 19993667
Change-Id: I53336e3b147d5fd3130e6800869af172b628da37
nstaller.java
ackageManagerService.java
ettings.java
5f76360ff99b44d611a40bc1b04bacb2a49b47fa 10-Apr-2015 Fabrice Di Meglio <fdimeglio@google.com> Merge "Add IntentFilter auto verification - part 5"
e48c137acdddd477d671417eb93ec120a1931cbb 10-Apr-2015 Fabrice Di Meglio <fdimeglio@google.com> Add IntentFilter auto verification - part 5

- optimize IntentFilter verification: dont do stuff we dont want
if we dont need to do them.

- improve IntentFilter candidates filtering and also improve
at the same time fix for bug #20128771: we can return the candidates
list rigth the way if the Intent is not related to a Web data URI and
include the "undefined verification state" ones if the first filtering
pass does not leave any.

Change-Id: I19f5c060f58b93530e37b4425d19ed23d2a0f4c0
ackageManagerService.java
95f534143d5a5bdc054142229ea9d7b9bc956719 10-Apr-2015 Jeff Sharkey <jsharkey@android.com> am 84debe27: am e0001185: am 1d3c77a2: Merge "Start passing volume UUID to installd."

* commit '84debe2761433cfaa8203d5a2defa4ba2ed64b61':
Start passing volume UUID to installd.
e000118549c10deaf17c27a14efa866184127b6d 09-Apr-2015 Jeff Sharkey <jsharkey@android.com> am 1d3c77a2: Merge "Start passing volume UUID to installd."

* commit '1d3c77a21e9c8fc59200b42503d9f0effd3f1551':
Start passing volume UUID to installd.
1d3c77a21e9c8fc59200b42503d9f0effd3f1551 09-Apr-2015 Jeff Sharkey <jsharkey@android.com> Merge "Start passing volume UUID to installd."
790a4ecac708883eb3f84165298f4927be59e0fa 09-Apr-2015 Jeff Sharkey <jsharkey@android.com> Start passing volume UUID to installd.

This change adds new method overloads to provide volume UUID. The
older methods remain for now, and pass through the "null" UUID to
reference internal storage.

Follows the existing pattern where null arguments are passed as "!".

Bug: 19993667
Change-Id: Ia1b7c8550cabc13e4f6e1182eabb650f2c33e44f
nstaller.java
7c6a34e64a52b71a6ea00efd2127a4814b5c72a6 09-Apr-2015 Fabrice Di Meglio <fdimeglio@google.com> Merge "Fix bug #20128771 All apps disappeared from app drawer after AAZ08 OTA"
53f35f4a20f69a61b83b88b666e85277d07e9de0 09-Apr-2015 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #20128771 All apps disappeared from app drawer after AAZ08 OTA

- relax a bit Intent resolution. We should still include Apps that
do not support Web domains :-) so in that context add in the result
list the Apps that are with a status INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED

Change-Id: Ibad7b7f577552ac75bba256bb387a75b83524958
ackageManagerService.java
c9d83fc2e0f2e6f24b9f7957cc9650b3e866cf1d 09-Apr-2015 Fabrice Di Meglio <fdimeglio@google.com> Merge "Add IntentFilter auto verification - part 4"
a1b19b7b66b06647501bc80d3002701fd9e59b7a 09-Apr-2015 Richard Uhler <ruhler@google.com> am 00ff42a0: am 7f757130: am f324d245: Merge "Reuse dexopt method for both dex2oat and patchoat."

* commit '00ff42a0ca9d17c4b7ee89d900cf86c9a25c00eb':
Reuse dexopt method for both dex2oat and patchoat.
7f7571308d5dc973e9b1e352d56643a74e99e588 09-Apr-2015 Richard Uhler <ruhler@google.com> am f324d245: Merge "Reuse dexopt method for both dex2oat and patchoat."

* commit 'f324d245fdd07ac14ab312d1a5fa04a4e8dfcceb':
Reuse dexopt method for both dex2oat and patchoat.
f324d245fdd07ac14ab312d1a5fa04a4e8dfcceb 09-Apr-2015 Richard Uhler <ruhler@google.com> Merge "Reuse dexopt method for both dex2oat and patchoat."
7d014cec63939f7aca2a8014f45cd4c9a3e1aa0c 09-Apr-2015 Fabrice Di Meglio <fdimeglio@google.com> Add IntentFilter auto verification - part 4

- add domain verification priming at boot when the PackageManagerService
singleton is created. This will mainly set the domain verification status
to INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS for all Apps that
have an IntentFilter with action VIEW and data scheme HTTP or HTTPS.

- also optimize Intent resolution by taking into account Browser Apps

Change-Id: Id8e66c9759a99e79b07051595ca89a168dc5ae0e
ackageManagerService.java
ettings.java
ff7233e2e3df4965b9ecadabfd78bb991fd1e102 08-Apr-2015 Fyodor Kupolov <fkupolov@google.com> Added getUserCreationTime to query user/profile creation time

Added public api to query creation time of the user or of a managed profile
associated with the calling user.

Bug: 20049349
Change-Id: I7f9263fe434233e6f7d4f165c974cab64ca7107c
serManagerService.java
0788595e0c9bc5e8c1907c63db595010006ef5b4 07-Apr-2015 Fabrice Di Meglio <fdimeglio@google.com> Add IntentFilter auto verification - part 3

- add private API PackageManager.getAllIntentFilters(String)
for getting all IntentFilters from a given package
- update IntentFilterVerificationInfo to use an ArrayList<String>
for domains instead of a String[]
- if you make an App a default domain handler then make the
others as non default
- create an IntentVerificationInfo even if the App IntentFilters
do not need to be verified. This would be done only if the App
has some domain URLs defined and would allow to make it the
default handler for a domain
- a few code optimizations here and there

Change-Id: I4535372a0bb1a2c8e662e1485be8ca700003e9b3
ackageManagerService.java
ettings.java
75bff7cca024d64b090f2104ed9a3be600c27fc5 07-Apr-2015 Fyodor Kupolov <fkupolov@google.com> Unnecessary dexopt in installPackageLI

When a new package is created, installNewPackageLI does not need to call
dexopt, since it has already been made.

Bug: 19550105
Bug: 20087446
Change-Id: If6b05bea590eea5f95efebb22a67ccd8cdf632c2
ackageManagerService.java
8aa61000021ed32480599c7dea875f0b27ba44f0 07-Apr-2015 Svetoslav <svetoslavganov@google.com> Merge "Enable runtime permissions"
77e46d214db035f150e8522fad03edec913939e8 07-Apr-2015 Fyodor Kupolov <fkupolov@google.com> am 6a17f601: Merge "Unnecessary dexopt in installPackageLI"

* commit '6a17f60166082227a5a644f9114db46a0ade73f0':
Unnecessary dexopt in installPackageLI
39fb7fd730dc2113ced7e663d7a35e48a4c6b1ae 18-Feb-2015 Benjamin Franz <bfranz@google.com> Allow silent package install for device owner.

Allow the device owner to silently install and remove packages using the
PackageInstaller APIs. Show notifications to the user after the
installation / deletion was successful.

Bug: 19422461
Change-Id: I0506e18c510efd9d04c4aea9b60a37456e689615
ackageInstallerService.java
ackageInstallerSession.java
b2b9ab8354da1485178cd8d8e9d89ac915b3f269 06-Apr-2015 Jeff Sharkey <jsharkey@android.com> Installing packages to expanded storage.

PackageManager now offers to load/unload packages when expanded
volumes are mounted/unmounted. Expanded storage volumes are still
treated as FLAG_EXTERNAL_STORAGE from a public API point-of-view,
but this change starts treating the INSTALL_EXTERNAL flag as
exclusively meaning ASEC containers.

Start tracking the UUID of the volume where a package is installed,
giving us a quick way to find relevant packages. When resolving an
install location, look across all expanded volumes and pick the one
with the largest free space. When upgrading an existing package,
continue preferring the existing volume. PackageInstaller now knows
how to stage on these volumes.

Add new movePackage() variant that accepts a target volume UUID
as destination, it will eventually move data too. Expose this
move command through "pm" command for testing.

Automount expanded volumes when they appear.

Bug: 19993667
Change-Id: I9ca2aa328b9977d34e8b3e153db4bea8b8d6f8e3
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
ackageSettingBase.java
ettings.java
36b26adde8091bcf8e1d5aff6ae393278fef12c8 07-Apr-2015 Fyodor Kupolov <fkupolov@google.com> Unnecessary dexopt in installPackageLI

When a new package is created, installNewPackageLI does not need to call
dexopt, since it has already been made.

Bug: 19550105
Bug: 20087446
Change-Id: If6b05bea590eea5f95efebb22a67ccd8cdf632c2
ackageManagerService.java
e012a235569fe307d165dfd0784ae847d0b13739 02-Apr-2015 Christopher Tate <ctate@google.com> Back up / restore preferred app configuration

Bug 19848104

Change-Id: I84cdfcc44b48a9732984955d7eedf745b5586bdd
ackageManagerService.java
ettings.java
429270c3ed1da02914efb476be977dc3829d4c30 07-Apr-2015 Svetoslav <svetoslavganov@google.com> Enable runtime permissions

Change-Id: I092a24e472f841ff6094ac4135dfd19381de61ff
ackageManagerService.java
448fd4b8ec29121772994eb701f7944eae948444 06-Apr-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Restored original behavior of getApplicationRestrictions"
f6ee2244a4f4ddb1ddf2ae21a7e3acd6dab1880b 06-Apr-2015 Fyodor Kupolov <fkupolov@google.com> Restored original behavior of getApplicationRestrictions

JavaDoc for getApplicationRestrictions states that null is a valid return
value, but it turns out some apps do not expect that. This fix restores
the original behavior of returning an empty bundle.

Bug: 20081431
Change-Id: I30a4aa6aba14307eba59ba0015f80f14107269af
serManagerService.java
7151a9a887051542c6da9f380376f3b306184e5c 05-Apr-2015 Jeff Sharkey <jsharkey@android.com> Storage methods using IDs, update listeners.

Add StorageManager methods that work with Disk and Volume IDs instead
of paths which can change over time. For example, a freshly formatted
volume has a different UUID and mount point, even though it's the same
volume.

Update StorageEventListener to be all one-way calls to avoid blocking
while dispatching events. Add new listener method for Volume-level
state changes. The existing state method will remain focused on the
per-user state reflected by StorageVolume. Switch listeners over to
using the more robust RemoteCallbackList pattern under the hood.

Change external ASEC scanning logic in PackageManagerService to be
driven by listener events, instead of explicit MountService calls.

Bug: 19993667
Change-Id: I57c505de260ff1762a78d70d15f1892f40229210
ackageManagerService.java
7b08b35bde3df58816b171b88712bcc6d21dcbe8 26-Mar-2015 Richard Uhler <ruhler@google.com> Reuse dexopt method for both dex2oat and patchoat.

Change-Id: Ib9a6373f98474f1242367b5285086251a9d580e5
nstaller.java
ackageDexOptimizer.java
ackageManagerService.java
96bba82ac4295f68ef956ecae7ee169eb3c271d1 03-Apr-2015 Fabrice Di Meglio <fdimeglio@google.com> Merge "Add private flag PRIVATE_FLAG_HAS_DOMAIN_URLS to ApplicationInfo"
d3d8a32217d5a2d895917cfe7e1645935d228494 02-Apr-2015 Fabrice Di Meglio <fdimeglio@google.com> Add private flag PRIVATE_FLAG_HAS_DOMAIN_URLS to ApplicationInfo

This is for supporting Settings UX and Domain URLs

- the new PRIVATE_FLAG_HAS_DOMAIN_URLS flag will be set by
generateApplicationInfo() when the Activity is said to have some
IntentFilter with a VIEW action and a http / https data URI

- code cleaning for args passing
- also add a new constant for the MetricsLogger

Change-Id: I5c9762fc2c4a9b46c0e255b9a23bffd70fae40c7
ackageManagerService.java
25da6b65b0e3be610e1223758b1910f4e7ad1ed2 03-Apr-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Do not log an error when app restriction file does not exist"
6f34d363c32ec3295fd77257648d1291ea31c33f 02-Apr-2015 Fyodor Kupolov <fkupolov@google.com> Do not log an error when app restriction file does not exist

Bug: 20040207
Change-Id: Ibd257388a185020258e36bddf5b451dc24c0b7ee
serManagerService.java
c38a54b1f076b86453041755e15504fd0b4d48af 03-Apr-2015 Fyodor Kupolov <fkupolov@google.com> am 30c688da: am 031898df: am 3d8b7f4d: Merge "Support for storing OAT files in app directory"

* commit '30c688da8bd2b3320446a06424e1cc57b693522a':
Support for storing OAT files in app directory
3425dae8dc63372e8944dce43f7ed2d567512248 03-Apr-2015 dcashman <dcashman@google.com> Merge "Refactor KeySet code."
d2cf3aec6087ba53dcbb55eb38c8e7f385ac4cbd 03-Apr-2015 Svetoslav <svetoslavganov@google.com> Do not clear a shared user's permissions on an app install.

When regranting permissions for an app during an install if
that app is in a shared user we should not clear the permissions
as the permissions for the shared user are additive and go away
when apps requesting them are uninstalled.

bug:20050689

Change-Id: I82aa70669fc25a45e7020a1545b093db5525f5cf
ackageManagerService.java
ackageSetting.java
031898dfd2dd734724d61e447a8ed61cc7f07d5c 03-Apr-2015 Fyodor Kupolov <fkupolov@google.com> am 3d8b7f4d: Merge "Support for storing OAT files in app directory"

* commit '3d8b7f4d50c2f7c64ec4e5874fd95cf837ddc12e':
Support for storing OAT files in app directory
36a9ba67fc5f61d181ff76fe02e4625a208b6946 01-Apr-2015 Svet Ganov <svetoslavganov@google.com> Merge "Fix clobbered shared user install permissions."
37f05184b5641366b59c540ad6bf3e3b2a1ac6ea 01-Apr-2015 Svet Ganov <svetoslavganov@google.com> Fix clobbered shared user install permissions.

The install permissions for a shared user were clobbered when a pending
package for this user was matched to the shared user after reading the
state from XML. The reason was that the copy code in PackageSettingBase was
using the getter to get its settings state to which to copy the permissions
for the pending package but this is the permissions state for the shared
user instead of the package. Since the pending package has no permissions
we ended up clobbering the permissions for the shared user.

bug:19955926

Change-Id: Ia8d090883d50fc987a32ceeed6c7562c49698328
ackageSettingBase.java
ettingBase.java
8c04facdf5e76fb34c55cfe3dc9a0216322b91b8 23-Mar-2015 dcashman <dcashman@google.com> Refactor KeySet code.

Eliminate dependency in packagesetting keyset metadata on other packages by
introducing reference counts for KeySets and public keys. This also allows
keysets to retain their id across reboots by eliminating the need to remove
all keyset data after scanning all packages on boot, which also should
drastically reduce the number of calls to ArraySet.removeAll().

Bug: 19617481

Change-Id: I6cc65f30e431b8e4ebe49047a9219a0d983f2774
eySetHandle.java
eySetManagerService.java
ackageKeySetData.java
ackageManagerService.java
ettings.java
262f9952e6e78e00a6d42bab97d73dccfb9607f4 24-Mar-2015 Fyodor Kupolov <fkupolov@google.com> Support for nested bundles in setApplicationRestrictions

Added new restriction types - bundle and bundle-array.

Modified RestrictionsManager.getManifestRestrictions to support new
hierarchical restrictions.
Added RestrictionsManager.convertRestrictionsToBundle, which enables
programmatic conversion from a list of RestrictionEntries to a Bundle.

Modified read/write methods for application restrictions in UserManagerService.
Added unit tests.

Bug: 19540606
Change-Id: I32b264e04d5d177ea5b4c39a8ace5ee0ce907970
serManagerService.java
b94c1657eb0140f7b91f5372a9f76de5a3d87e36 03-Mar-2015 Fyodor Kupolov <fkupolov@google.com> Support for storing OAT files in app directory

In installPackageLI, dexopt is now performed on a staging directory of the app
(dexopt phase 1). For each codepath:
- /oat/<isa> directory is created
- dexopt output goes to the newly created directory. Optimized files have
.odex extension.

Bug: 19550105
Change-Id: Iec59790d97837b78af82b079fd1970de3388c91d
nstaller.java
nstructionSets.java
ackageDexOptimizer.java
ackageInstallerService.java
ackageManagerService.java
1c1b47125da018b44240739db75f8898e064a948 20-Nov-2014 Fabrice Di Meglio <fdimeglio@google.com> Add IntentFilter auto verification

The purpose of this feature is to prompt the Disambiguation dialog
to Users as less as possible.

- add the new "autoVerify" property to the IntentFilter class
- add new APIs to PackageManager:
verifyIntentFilter(int, int, List<String>),
getIntentVerificationStatus(String, int),
updateIntentVerificationStatus(String, int, int),
getIntentFilterVerifications(String)
for supporting IntentFilter verification
- add support for multi-user
- update PackageManager for IntentFilter verification:
basically when we are installing a new package, ask for verification
of all domains from the IntentFilters that have the "autoVerify" to true.
This means that the PackageManager will send a well defined protected
broadcast (with a new INTENT_FILTER_NEEDS_VERIFICATION action) to
an IntentFilter verifier to do the real job of verification.
We are passing in the broadcast Intent all the necessary data for
doing the verification. The PackageManager will receive as response
the result code of the domain verifications and, if needed, the list
of domains that have failed the verification.
- add a new INTENT_FILTER_VERIFICATION_AGENT permission that needs to
be set by an intent filter verifier to be considered as a trustable
party by the PackageManager.
- add also a new BIND_INTENT_FILTER_VERIFIER permission for securing
the binding between the PackageManager and a service doing the
intent filter verifications.
- add ResolveInfo filterNeedsVerification which is a boolean
to knows if the IntentFilter is of a type that needs a verification
(action VIEW, category BROWABLE, HTTP/HTTPS data URI)
- add new "domain-preferred-apps" / "d" dump command for listing the
prefered Apps for all domains
- add new "intent-filter-verifiers" / "ivf" command for listing the
IntentFilterVerifier used
- introduce the IntentVerificationService which is a basic service
for verifying IntentFilters. This service will send HTTPS requests
to the domain declared in the IntentFilter(s) for doing the
verification. This service has a low priority level so that it
can be replaced by a more sophisticated one if needed. This service
is updating the PackageManager intent verification states thru
the updateIntentVerificationStatus(...) API.
- update MockPackageManager

Change-Id: I0bfed193d0bf1f7c7ac79f6c1b160b7ab93b5fb5
ntentFilterVerificationKey.java
ntentFilterVerificationResponse.java
ntentFilterVerificationState.java
ackageManagerService.java
ackageSettingBase.java
ettings.java
12a692a5e8244cad6ae634cc0821e4e3590cfef6 29-Mar-2015 Svet Ganov <svetoslavganov@google.com> Fix runtime permissinos toggling and relax XML parsing.

1. Fixed the case where runtime permissons can be toggled by a
developer via a system property.

2. Relaxed the runtime permission XML parsing to be more fault
toelrant and consistent wiht the reset of the package manager
parse code.

3. Fixed a deadlock due to calling in to the activity manager
with the package manager lock held to kill an app.

Change-Id: I11dfb57ad4d8119baea79227dc2a3fe5e2208515
ackageManagerService.java
ackageSetting.java
ettings.java
7119be2531c1763749c2b5ed9d427ed506fe9aff 27-Mar-2015 Svetoslav <svetoslavganov@google.com> Merge "Handle dynamic enable/disable of runtime permissions support."
cf959f6e722ddd20033b7c98b3e04c7143f6438e 27-Mar-2015 Svetoslav <svetoslavganov@google.com> Handle dynamic enable/disable of runtime permissions support.

This change adds support for the case where we change the state
of runtime permissions support via the system property. This
was not working properly before because we did not handle system
app permissions properly.:

Change-Id: I66c5e6c823b8521999972b0432b1daaba38c9709
ackageManagerService.java
ackageSettingBase.java
ettings.java
60b3be3ab5fba871311628dec0538214b4965027 27-Mar-2015 Christopher Tate <ctate@google.com> am 9c36cf41: am 9837c51a: am 63862a20: am 7b73a788: am dbe0dd16: When scanning unbundled apps, only install the expected APK tree

* commit '9c36cf4195158b94600a5e1125835627629087e8':
When scanning unbundled apps, only install the expected APK tree
9837c51acc274531a4109b9973a7d7927787da6c 27-Mar-2015 Christopher Tate <ctate@google.com> am 63862a20: am 7b73a788: am dbe0dd16: When scanning unbundled apps, only install the expected APK tree

* commit '63862a2052d41db4543a6a15713f5146b76d65cc':
When scanning unbundled apps, only install the expected APK tree
b4a16b16e75eaf32a8acb7ed2a6d94fbc0c18f98 27-Mar-2015 Svetoslav <svetoslavganov@google.com> Fix a typo

Change-Id: I74da330f7319bd2f571d1c328365e3d5e482dc78
ackageManagerService.java
dbe0dd160e93feef1335830a36e86ae83b19b793 26-Mar-2015 Christopher Tate <ctate@google.com> When scanning unbundled apps, only install the expected APK tree

We now make sure, when scanning post-factory app installs, that we do not
accidentally activate a "leaked" or otherwise superfluous APK tree that the
scan algorithm happens to encounter before the one that we expect a priori
based on the persisted package-installation state. When we find such an
extraneous installation we ignore it in favor of the expected one, similarly
to the policy used when collecting system-bundled packages that have been
updated.

Even if we find an unexpected APK for the package, if the expected one
turns out to be absent we fall back to the existing "we thought this app
was present and now it isn't" logic.

Bug 19602471

Change-Id: I141a93661946176c05d8cf52a123bdf75c8eef74
ackageManagerService.java
d5752bdc8fd39d4f0a508f9088c538e30e73044a 26-Mar-2015 Svet Ganov <svetoslavganov@google.com> Properly handle system app permissions - for real.

System apps targeting SDK greater than Lollipop MR1 get runtime
permissions by default but if the user takes them away we should
not regrant them. To do that we keep track for each package which
user ids were handled in the last permissions update. If a new
user id has appeared we grant runtime permissions for this user
to the sys package. When we start clean (i.e. first boot) the
sys packages were updated for no user so we grant the runtime
perms for the owner. When reading a package from packages.xml
we set the updated user ids to all users ids on the device as
the state in the xml reflects the latest state before a shutdown,
i.e. the last state when permissions were updated.

Change-Id: I93135baa57950405a357b139c59f432cf02f0bc6
ackageManagerService.java
ackageSettingBase.java
ermissionsState.java
ettingBase.java
ettings.java
78027f3b72ad0cad4c39c3947985526ac31a6d3e 25-Mar-2015 Svet Ganov <svetoslavganov@google.com> Properly handle system app permissions.

System apps targeting SDK grater than Lollipop MR1 get runtime
permissions and when a new user is added we update the permissions
for all packages to ensure that the new user gets the runtime
permissions.

Change-Id: Ic7dc5b5a94b034e00d715a60b12f613803524c3b
ackageManagerService.java
serManagerService.java
3695b8a1488a6cc331feba1c2ab359888656bf7c 25-Mar-2015 Svet Ganov <svetoslavganov@google.com> First implementation of the grant/revoke UI

Change-Id: Icdb7c822881552b30850697dba709671bf27baa5
ackageManagerService.java
9041df7f6948f5314b576c437f08247967ac2c2f 24-Mar-2015 Svetoslav <svetoslavganov@google.com> Remove obsolete comments

Change-Id: Ieabe9e8e86cfe226751a0402e4c7d55f2a18c8b1
ackageManagerService.java
00f3904629ef89192e061c1995801ef322fc0bcf 24-Mar-2015 Jeff Sharkey <jsharkey@android.com> Introduce per-user GIDs for storage.

This will eventually allow us to have a single unified filesystem
instead of requiring zygote to use bind mounts.

Change-Id: I29b819ab51498b4bab874e0367b1ab4165f84025
asePermission.java
ackageManagerService.java
ermissionsState.java
ettings.java
95c1adea0c5fe10ceba217a327163757f4589d3d 19-Mar-2015 Svet Ganov <svetoslavganov@google.com> Add install option to grant all runtime permissions.

Change-Id: I72ba67a72025646a3d53611621b0353d3a86677c
ackageManagerService.java
c6d1c345f41cf817bf2c07c97b97107d94296064 26-Feb-2015 Svetoslav <svetoslavganov@google.com> Runtime permissions: per user permission tracking.

Before all permissions were granted at install time at once, so the user
was persented with an all or nothing choice. In the new runtime permissions
model all dangarous permissions (nomal are always granted and signature
one are granted if signatures match) are not granted at install time and
the app can request them as necessary at runtime.

Before, all granted permission to an app were identical for all users as
granting is performed at install time. However, the new runtime model
allows the same app running under two different users to have different
runtime permission grants. This change refactors the permissions book
keeping in the package manager to enable per user permission tracking.

The change also adds the app facing APIs for requesting runtime permissions.

Change-Id: Icbf2fc2ced15c42ca206c335996206bd1a4a4be5
asePermission.java
rantedPermissions.java
ackageManagerService.java
ackageSetting.java
ackageSettingBase.java
ermissionsState.java
ettingBase.java
ettings.java
haredUserSetting.java
bff46bac807ae8a9ebdc22c449a8d4f78711b4d2 05-Mar-2015 Benjamin Franz <bfranz@google.com> Add DO policy to disable safe boot mode.

Bug: 19615843
Change-Id: I14dbe911995ec216c57bd285d6b7b04c9684591a
serManagerService.java
2d5b2c7dc10755a2c329cbef2eefeaa4f6a68611 19-Mar-2015 Mark Salyzyn <salyzyn@google.com> am 6a9cd7b0: am e2c8e504: Merge "logd: optimize statistics"

* commit '6a9cd7b0d4215d9e20ed59e6ab0c328c81cd842b':
logd: optimize statistics
8458e531bfc681ebb0de98476d782ca4d052a145 16-Mar-2015 Nicolas Prevot <nprevot@google.com> Merge "Remove the owner userid of cross-profile intent filters."
2018fd02517449f0c7a13a1d9b7baa7754ade7d3 12-Mar-2015 Mark Salyzyn <salyzyn@google.com> logd: optimize statistics

logd reads /data/system/packages.xml (because it also contains
shared UIDs) and is sensitive to line break and tag name issues.

Bug: 19608965
Change-Id: I2a4a6bcfb10529e4b29c9664cbbf12842e689dd1
ettings.java
7487657ee9f3f91a1fb4e52ce2a03b56496ac1f4 24-Feb-2015 Fyodor Kupolov <fkupolov@google.com> Extracted a separate class to run dexopt on packages

performDexOptLibsLI and related methods were extracted to PackageDexOptimizer
class. Minor refactoring of PackageManagerService.

This is a non-functional change. It should simplify further work to allow
storing OAT files inside package dir.

(cherry picked from commit eeea67b8c3678d882d3774edc41242c63daa60fa)

Change-Id: I3494a2da70605362bb6fb4625ffbee1cbe1cd457
nstructionSets.java
ackageDexOptimizer.java
ackageManagerService.java
ackageSetting.java
38bcb8c9ab2354769723a41ff9bff13a3ddfd031 11-Mar-2015 Alan Treadway <alantreadway@google.com> Merge "Fix for managed-profile users needing to "install" packages twice."
2c1078fbbd550d8adb7ca0d39447bfebc6092012 10-Mar-2015 Andreas Gampe <agampe@google.com> resolved conflicts for merge of b6d6c04a to master

Change-Id: I5286b9fe2d9bde4b219496e593cf028cc4c75bc7
4282924ed33102605d6c295f164ffb3249ced7b4 06-Mar-2015 Alan Treadway <alantreadway@google.com> Fix for managed-profile users needing to "install" packages twice.

Fix ensures that the users requesting package installation have the
package marked as installed and enabled for them. This appears to be
the intent of the existing code, but without this change in certain
cases the user has to effectively request "installation" twice.

Bug: 17445378
Change-Id: Ic17399e493125e631b381b89615336be17c9d1ee
ackageManagerService.java
174a44888ec56f688426c80d50b9e0021f47c16f 10-Mar-2015 Andreas Gampe <agampe@google.com> am 7f383873: Merge "Frameworks/base: Pass APK debugability to installd"

* commit '7f383873566024c7121cadae3bbdd2a7c47150bc':
Frameworks/base: Pass APK debugability to installd
735600c1e654ef3d4fe1201aa31d1f4eb33c18e3 05-Mar-2015 Andreas Gampe <agampe@google.com> Frameworks/base: Pass APK debugability to installd

Change-Id: Id17ec72babe2ee88713a0d274eff86508de30666
nstaller.java
ackageManagerService.java
f3ece36535d4999cf2bfd2175a33da6c3cdf298e 11-Feb-2015 Benjamin Franz <bfranz@google.com> Block setting wallpapers from managed profiles.

Silently fail when a managed profile app tries to change the
wallpaper and return default values for getters in that case.
This is implemented through a new AppOp that is controlled by
a new user restriction that will be set during provisioning.

Bug: 18725052
Change-Id: I1601852617e738be86560f054daf3435dd9f5a9f
serManagerService.java
ddbc48cdee409d882b8bbb2bf626843c378b4925 05-Mar-2015 Andreas Gampe <agampe@google.com> am 0fcfae88: am ecc20aaf: am 63ab6eb2: Merge "Frameworks/base: Use ArraySet more explicitly"

* commit '0fcfae88f2737b004cae83a77d590046e2b08ef3':
Frameworks/base: Use ArraySet more explicitly
ecc20aafa6f3d272292e7b3577c99f2c127e590f 05-Mar-2015 Andreas Gampe <agampe@google.com> am 63ab6eb2: Merge "Frameworks/base: Use ArraySet more explicitly"

* commit '63ab6eb220a2a75837d6e3d18d19cbd5dda175eb':
Frameworks/base: Use ArraySet more explicitly
0888276a1c6cd4077770844615848674de21dab3 05-Mar-2015 Andreas Gampe <agampe@google.com> Frameworks/base: Use ArraySet more explicitly

In KeySetManagerService, use ArraySet more explicitly. Avoid for-each
loops.

Collections API methods on ArraySet are not very efficient. Iterators
incur two object allocations: a helper and the actual iterator object.
During boot, about 4.5K such calls are made. Using the ArraySet more
explicitly like an ArrayList/array avoids the overhead.

Bug: 19617481
Change-Id: I25df334fa1d4be3210667fb1404e3c43f2585049
eySetManagerService.java
4b8d5821512c6a4fdaf442f6d48e1dc412539136 05-Mar-2015 Nicolas Prevot <nprevot@google.com> Remove the owner userid of cross-profile intent filters.

The owner user id was used to identify in which user an app had set
a cross-profile intent filter. But it's not really necessary.

BUG:19505190

Change-Id: Iacc49d31c95e34efee1895e5fbe7224277dbc493
rossProfileIntentFilter.java
ackageManagerService.java
08c7116ab9cd04ad6dd3c04aa1017237e7f409ac 28-Feb-2015 John Spurlock <jspurlock@google.com> Remove unused imports in frameworks/base.

Change-Id: I031443de83f93eb57a98863001826671b18f3b17
rossProfileIntentResolver.java
eySetManagerService.java
ersistentPreferredIntentResolver.java
ELinuxMMAC.java
eeea67b8c3678d882d3774edc41242c63daa60fa 24-Feb-2015 Fyodor Kupolov <fkupolov@google.com> Extracted a separate class to run dexopt on packages

performDexOptLibsLI and related methods were extracted to PackageDexOptimizer
class. Minor refactoring of PackageManagerService.

This is a non-functional change. It should simplify further work to allow
storing OAT files inside package dir.

Change-Id: I3494a2da70605362bb6fb4625ffbee1cbe1cd457
nstructionSets.java
ackageDexOptimizer.java
ackageManagerService.java
ackageSetting.java
7478de1e87b3c1941b43eafc2ff9e9a4bafead7e 18-Feb-2015 Adrian Roos <roosa@google.com> Merge "Decouple package manager lock and bitmap decoding"
c627484653fef1066f442034acf8e127153bec83 18-Feb-2015 Kenny Guy <kennyguy@google.com> Merge "Handle users being deleted in getUserHandle."
1bdff9139fd412b36d5d2d783574b6418fcb198a 17-Feb-2015 Adrian Roos <roosa@google.com> Decouple package manager lock and bitmap decoding

Also moves the actual reading and decoding of the
icon into the client process to avoid unnecessary
copies.

Bug: 18474438
Change-Id: I71623ef48c770d752593aa97d69517f6139cc947
serManagerService.java
05ecfd308d983755bc7cab39ba99a37c321f176b 11-Feb-2015 Alex Klyubin <klyubin@google.com> am 33d3c53d: resolved conflicts for merge of 517e0274 to lmp-mr1-dev-plus-aosp

* commit '33d3c53da021f0d044028860ace0f4ad817273f5':
Move hidden ApplicationInfo flags into a separate field.
33d3c53da021f0d044028860ace0f4ad817273f5 11-Feb-2015 Alex Klyubin <klyubin@google.com> resolved conflicts for merge of 517e0274 to lmp-mr1-dev-plus-aosp

Change-Id: Ic20b6c8851458483dd73a144bd5ae6e8d141e62a
b9f8a5204a1b0b3919fa921e858d04124c582828 03-Feb-2015 Alex Klyubin <klyubin@google.com> Move hidden ApplicationInfo flags into a separate field.

The public API field android.content.pm.ApplicationInfo.flags can
support only 32 flags. This limit has been reached. As a short term
workaround to enable new public flags to be added, this CL moves flags
which are not public API into a separate new field privateFlags and
renames the affected flags constants accordingly (e.g., FLAG_PRIVILEGED
is now PRIVATE_FLAG_PRIVILEGED).

The new privateFlags field is not public API and should not be used
for flags that are public API.

The flags that are moved out of ApplicationInfo.flags are:
* FLAG_HIDDEN,
* FLAG_CANT_SAVE_STATE,
* FLAG_FORWARD_LOCK, and
* FLAG_PRIVILEGED.

NOTE: This changes the format of packages.xml. Prior to this CL flags
were stored in the "flags" attribute. With this CL, the public flags
are stored in a new "publicFlags" attribute and private flags are
stored in a new "privateFlags" attribute. The old "flags" attribute
is interpreted by using the old values of hidden/private flags.

Change-Id: Ie23eb8ddd5129de3c6e008c5261b639e22182ee5
rantedPermissions.java
ackageManagerService.java
ackageSetting.java
ackageSettingBase.java
endingPackage.java
ettings.java
haredUserSetting.java
serManagerService.java
945f8836a68599a633a42dbb11b2f28d0c7beb6d 10-Feb-2015 Kenny Guy <kennyguy@google.com> Handle users being deleted in getUserHandle.

getUserHandle by serial number calls getUserInfoLocked
which may return null for a user that exists when its
being deleted.

Change-Id: I949831f8bc959e5ec1f3cb907d86313f10e12554
serManagerService.java
7d4a9c139c742adc702b6695ac6d7c9ce40b9ca7 09-Feb-2015 Rubin Xu <rubinxu@google.com> am df890b4d: am 082f0bf3: am df608e39: am 3d521c0a: Merge "Perform post installation operations directly if backup manager is disabled" into lmp-mr1-dev

* commit 'df890b4df04f77baaa0051b6cc0d92c82acf3aa9':
Perform post installation operations directly if backup manager is disabled
df890b4df04f77baaa0051b6cc0d92c82acf3aa9 09-Feb-2015 Rubin Xu <rubinxu@google.com> am 082f0bf3: am df608e39: am 3d521c0a: Merge "Perform post installation operations directly if backup manager is disabled" into lmp-mr1-dev

* commit '082f0bf3bd0f266f776f4b28c3fb8dc917cd0d63':
Perform post installation operations directly if backup manager is disabled
99abeed2bb74a15d2336ad3b75dfeb30e64d135d 09-Feb-2015 Rubin Xu <rubinxu@google.com> Perform post installation operations directly if backup manager is disabled

bug: 19312753

Change-Id: I4acdd1e3af6a6be0c51affc42de167993c736b2f
ackageManagerService.java
0e8f037ded946f3aeaa0480c2d1eeb77d6688d0b 28-Jan-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Added primaryUserOnly attribute for activities"
715437763c56a8a23d9ce711b011bdddc90e7b61 28-Jan-2015 Christopher Tate <ctate@google.com> am 0c607b97: am f37b20e1: Merge "Fix \'always\' preferred app assignment" into lmp-mr1-dev
automerge: ff1876d

* commit 'ff1876d1fb8dfcaba61d3fc7de296d663a4e160e':
Fix 'always' preferred app assignment
ff1876d1fb8dfcaba61d3fc7de296d663a4e160e 28-Jan-2015 Christopher Tate <ctate@google.com> am 0c607b97: am f37b20e1: Merge "Fix \'always\' preferred app assignment" into lmp-mr1-dev

* commit '0c607b97f068ca486036a501052572e9207c0926':
Fix 'always' preferred app assignment
57792912ee8f536f90c466db701d71a9e38c54d4 27-Jan-2015 Christopher Tate <ctate@google.com> Fix 'always' preferred app assignment

In the case when some possible resolutions of a given intent are at
different priorities (typically when they're intended as fallbacks when
no "normal" handler for the intent exists) the check for "is this the
same set of possible handlers that we saw last time?" was broken. We
now ignore resolver priority entirely in that check: match set comparison
should be orthogonal to prioritization within the set, and indeed the
priority is dealt with separately in any event.

Bug 19011225

Change-Id: I3c1658442cc88b1f4a5c5f2fe9f64472799e156c
ackageManagerService.java
referredComponent.java
703d1c43a25fe6e80c5fea46cc0ff14f0e1fbc00 27-Jan-2015 Fyodor Kupolov <fkupolov@google.com> Added primaryUserOnly attribute for activities

In addition to receivers, primaryUserOnly is now supported for activities.

In queryIntentActivities method, activities with primaryUserOnly flag set will
be filtered out, when current user is not the owner.

Change-Id: I0b7168b8c96749cd6d23b8c95d5624589f5f2d86
ackageManagerService.java
adf1c93ff77c996be7952f98b9f554befb089543 08-Jan-2015 Dianne Hackborn <hackbod@google.com> am 3968820f: am cb8d8e10: Merge "Fix issue #18827122: system server crashed on broadcasting..." into lmp-mr1-dev automerge: 16e4324

* commit '3968820fc75e1eac03e54cba45b5a0adc28ee87d':
Fix issue #18827122: system server crashed on broadcasting...
3968820fc75e1eac03e54cba45b5a0adc28ee87d 08-Jan-2015 Dianne Hackborn <hackbod@google.com> am cb8d8e10: Merge "Fix issue #18827122: system server crashed on broadcasting..." into lmp-mr1-dev
automerge: 16e4324

* commit '16e4324dd967d180f77fb25dbeea77229eaf0511':
Fix issue #18827122: system server crashed on broadcasting...
56ef86d4d116b037107c4054a0a76c46778e8a3b 08-Jan-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Use scheduled writes to package-restrictions and user xml"
29cd7f19625a2a2a8528469e55f3aa495107b9e7 08-Jan-2015 Dianne Hackborn <hackbod@google.com> Fix issue #18827122: system server crashed on broadcasting...

...an intent with invalid or null package uri

Also tweak battery stats to record in the history when we shut
down, to understand when restarts are due to clean shutdowns or
crashes.

Change-Id: I6443dafc23e356be9f569906f6081152d4f92d2b
serManagerService.java
290e91107c168210fa0583c5e3751821812277d0 30-Dec-2014 Robin Lee <rgl@google.com> Remove deprecated upgrade path for relatedGroupId

As per note this has been unused for upwards of 6 months and its
attribute string is no longer referenced anywhere else in Android.

Change-Id: I5f95ffa6b3d91fca203f2d030d40df3fd55b6a70
serManagerService.java
01d25862efc542815014dc7a03ab90263a6191ba 23-Dec-2014 Nick Kralevich <nnk@google.com> am 8454f2d4: am 5e1e38cc: Merge "Mods to the SELinuxMMAC engine code."

* commit '8454f2d48517d79268688b2262b17ff0cab39622':
Mods to the SELinuxMMAC engine code.
2e1f052f45cd0f3b0b52a7eae2f05da770702cb0 19-Nov-2014 Robert Craig <rpcraig@tycho.ncsc.mil> Mods to the SELinuxMMAC engine code.

* We now require that all certs used to sign the apk and all
certs stored with policy be tested for set equality. Prior
efforts required that the cert included with policy only
needed to match one of the certs included with an apk.

* Allowed a new tag to be included with policy describing the
signatures. <cert signature=""/> is now allowed as a child
element of the <signer> tag describing multiple certs. The
old way of describing signatures attached as attributes to
the root signer tag is still supported. The engine now treats
it the same as if they used the new layout with the outer
signature as the first signature value.

* Moved the class which holds all policy from an inner static
to a builder pattern governed by the Policy.PolicyBuilder
class. This will help provide more clarity and allow for
easier enforcement of certain invariants as the policy
representation is being built.

* Loads of new comments.

Change-Id: I38eb00ed8962fdef71bc9f2e7370cb910cadeff4
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
ELinuxMMAC.java
75d0ea8785163d5b0fddaec339f68bacdf52df82 16-Dec-2014 Fyodor Kupolov <fkupolov@google.com> Use scheduled writes to package-restrictions and user xml

When user is initialized, PackageManager.setEnabledSetting is called
multiple times. Each call triggers a write to user's
package-restrictions.xml file.

Using scheduleWritePackageRestrictionsLocked should help to reduce the
number of writes during initialization time and reduce creation/switching
time for a new user.

Change-Id: I5bd8609e3a79bdc3f198a169ede8005dc0186612
ackageManagerService.java
serManagerService.java
9900dbb9e8296d81100a42c687abf702af6ef1be 16-Dec-2014 Brian Carlstrom <bdc@google.com> am a00be9b4: Remember failed dexopt to avoid retry
automerge: 2350c7c

* commit '2350c7cb1238ad24b5afaa7f6627b3443d33621b':
Remember failed dexopt to avoid retry
a00be9b4d521287fdf4678fb196c3e3a0053c3e4 12-Dec-2014 Brian Carlstrom <bdc@google.com> Remember failed dexopt to avoid retry

Bug: 18643977
Change-Id: Ida8d9b9ce992d97fb75bccb8c3da0d9d73a480a9
ackgroundDexOptService.java
b97633c14da555d89dac7eadbf6e351d82281614 09-Dec-2014 Jeff Sharkey <jsharkey@android.com> am 5d662a82: am 2f4ced30: Merge "Consistent result when signatures don\'t match." into lmp-mr1-dev

* commit '5d662a828935399e11723d0a5e7ff31c433e8b39':
Consistent result when signatures don't match.
10bef1d2f444b8ca23ee317d3bcfb586860af18b 09-Dec-2014 Jeff Sharkey <jsharkey@android.com> Consistent result when signatures don't match.

INSTALL_FAILED_UPDATE_INCOMPATIBLE is a better description of the
real underlying cause when signatures don't match.

Bug: 18413784
Change-Id: Ib81591df7d0d79f6725a4fa7300ae4e20958f004
ackageManagerService.java
11bee890a24b05d099be87b02ea667441e573898 04-Dec-2014 Dianne Hackborn <hackbod@google.com> am 4c4e4686: am 281f36f5: Merge "Fix issue #18607384: Run fstrim after every system update" into lmp-mr1-dev

* commit '4c4e4686d5de3f22cf4d832c63716d9054b9ad54':
Fix issue #18607384: Run fstrim after every system update
281f36f5483ade3800092a42109327347d8aaff6 03-Dec-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #18607384: Run fstrim after every system update" into lmp-mr1-dev
8b22252a6cd4e9c8ea9bccaf55fce1940bb63eaa 03-Dec-2014 Dianne Hackborn <hackbod@google.com> Fix issue #18607384: Run fstrim after every system update

Change-Id: I06f4c0b9e6834a8c8bd85710dfd9fa16471b6ad2
ackageManagerService.java
db6753cf2d8994edcc3e9e488a6be4e2f8ca397a 02-Dec-2014 Jeff Sharkey <jsharkey@android.com> am a8d0a3ae: am 2705387d: Merge "Include splits in dumpsys package output." into lmp-mr1-dev

* commit 'a8d0a3ae602bb455e290ca1ee6f18184c30f8dc7':
Include splits in dumpsys package output.
c4d05fc0db6c41e9d70309aa78219aa202c7cb59 02-Dec-2014 Jeff Sharkey <jsharkey@android.com> Include splits in dumpsys package output.

Describe the currently installed splits, both in normal dumpsys
output and in checkin output. Also include revisionCode of those
splits when defined (non-zero).

Bug: 18576300
Change-Id: Ie8140961fb7b9e0ed23fd6bc267157aab075dd78
ettings.java
e434a94936c8f48bd5158849a09c1e6ce8d6e2d1 01-Dec-2014 Amith Yamasani <yamasani@google.com> am 0c81034c: am 731a5c1a: Merge "Fix parsing bug that affects reading back guest restrictions" into lmp-mr1-dev

* commit '0c81034cac4efe7d538ff303cc9f2badbb22b8d8':
Fix parsing bug that affects reading back guest restrictions
53651b9982f53236b767d766e85ec0ce3acc6f0f 01-Dec-2014 Narayan Kamath <narayan@google.com> am ff45e7df: am 1d184ace: resolved conflicts for merge of 7377998d to lmp-mr1-dev

* commit 'ff45e7df8aae0f55ce719de92102c7d522b62048':
Be increasingly aggressive about fstrim if it isn't being run
e4a5faa61e9084333b241531ddb941684f110566 01-Dec-2014 Jeff Sharkey <jsharkey@google.com> Merge "APK still has privileged flag after being moved from "/system/priv-app"" into lmp-mr1-dev
731a5c1a29e5bdbf6e7e4bade9b80f7abe6ec37e 01-Dec-2014 Amith Yamasani <yamasani@google.com> Merge "Fix parsing bug that affects reading back guest restrictions" into lmp-mr1-dev
48e17629b0b6c89cb77342c0364a1cf3a0b2a0fb 25-Nov-2014 Akira Numata <akira.numata@sonymobile.com> APK still has privileged flag after being moved from "/system/priv-app"

When an app is moved from "/system/priv-app" to another location
during OTA update, the privileged flag should be removed.

(cherry picked from commit 76bf60ead8132b86436ebbba40eaa8f2c8bbe812)

Change-Id: I39feeac7ece89c28045d196ae69fc974b1c6510b
ackageManagerService.java
1446c6c6f67d285bd47b878de6326b8e82fafb2b 27-Nov-2014 Jeff Sharkey <jsharkey@android.com> am d76737a7: am b802cd67: Merge "APK still has privileged flag after being moved from "/system/priv-app""

* commit 'd76737a7325bdcd5010f26fd1626628f07070bb9':
APK still has privileged flag after being moved from "/system/priv-app"
1d184acefa7105592134edebf7de4d77843d5791 27-Nov-2014 Narayan Kamath <narayan@google.com> resolved conflicts for merge of 7377998d to lmp-mr1-dev

Change-Id: I21870e241de7d992e97d7b91e0058f85b5a25fbe
06e8c58e7cf84b87613f4c8114ec75db58e32d72 26-Nov-2014 Jeff Sharkey <jsharkey@android.com> am cd5d46ff: am 293f0f38: Merge "package_info GID shouldn\'t have write." into lmp-mr1-dev

* commit 'cd5d46ff81ab652dc9dc9c28d607f536187f3bab':
package_info GID shouldn't have write.
7377998dac67ce8d486e11b9bd2f159fe0ca501d 26-Nov-2014 Narayan Kamath <narayan@google.com> resolved conflicts for merge of a42f7c1d to lmp-sprout-dev

Change-Id: I8e53c9d7e0014b4ffc621c561b737aa2dae5460c
76bf60ead8132b86436ebbba40eaa8f2c8bbe812 25-Nov-2014 Akira Numata <akira.numata@sonymobile.com> APK still has privileged flag after being moved from "/system/priv-app"

When an app is moved from "/system/priv-app" to another location
during OTA update, the privileged flag should be removed.

Change-Id: I7713382db34697f7b68283dbbbd25a1349cbecdb
ackageManagerService.java
7265abe77a76f848a316640b5da106e882bdbc8a 21-Nov-2014 Christopher Tate <ctate@google.com> Be increasingly aggressive about fstrim if it isn't being run

The current heuristics depend on devices being alive at midnight+ in
order to run periodic background fstrim operations. This unfortunately
means that people who routinely turn their devices off overnight wind
up with their devices *never* running fstrim, and this causes major
performance and disk-life problems.

We now backstop this very-friendly schedule with an increasingly
aggressive one. If the device goes a defined time without a background
fstrim, we then force the fstrim at the next reboot. Once the
device hits the midnight+ idle fstrim request time, then we already
aggressively attempt to fstrim at the first available moment
thereafter, even if it's days/weeks later without a reboot.

'Available' here means charging + device idle. If the device never
becomes idle then we can't do much without rendering an in-use device
inoperable for some number of minutes -- but we have no evidence of
devices ever failing to run fstrim due to this usage pattern.

A new Settings.Global element (type 'long', called
"fstrim_mandatory_interval") is the source of the backstop time. If
this element is zero or negative, no mandatory boot-time fstrim will
ever be performed. If the element is not supplied on a given device,
the default backstop is 3 days.

Adds a new string to display in the upgrading dialog when doing
the fstrim. Note it is too late for this to be localized, but since
this operation can take a long time it is probably better to have
it show *something* even if not localized, rather than just sit there.

Bug 18486922

Change-Id: I5b265ca0a65570fb8931251aa1ac37b530635a2c
ackageManagerService.java
278dfdf73142e72944478e50a3f02d3b5c6fd370 25-Nov-2014 Jeff Sharkey <jsharkey@android.com> am 117c549b: am 0f667f58: Merge "Ignore spammy package logs when dumping." into lmp-mr1-dev

* commit '117c549b86979d891edfe1d810ac087609928386':
Ignore spammy package logs when dumping.
c02f304c3a1dc45a7e44b9f91b38c62353850d30 25-Nov-2014 Jeff Sharkey <jsharkey@android.com> am 58b699c3: am 636baa0d: Merge "Introduce revision codes for split APKs." into lmp-mr1-dev

* commit '58b699c366dea7abc26f34c1e5f1cc6031c04e23':
Introduce revision codes for split APKs.
9fafd0c7111f0d0df431f6c0a4f4f5afcdea7b81 25-Nov-2014 Dianne Hackborn <hackbod@google.com> am 608439df: am 5bbb1af7: Merge "Work on issue #18486438: Reduce size of bugreport output" into lmp-mr1-dev

* commit '608439df383b40dc0f808e4992b369debaff29cd':
Work on issue #18486438: Reduce size of bugreport output
aebb65cb687216b9912cf98d24858ffcb3e6f50b 25-Nov-2014 Jeff Sharkey <jsharkey@android.com> package_info GID shouldn't have write.

Fix permissions on packages.list and package-usage.list to only
allow read access from the package_info GID.

Bug: 18473765
Change-Id: I9b9ef13f4a00a8355619bbcdacc836f9abfa0376
ackageManagerService.java
ettings.java
962bd4a69175077a95bc04bcdcc80ee6cb1034f8 24-Nov-2014 Jeff Sharkey <jsharkey@android.com> Ignore spammy package logs when dumping.

Bug: 18390552
Change-Id: Ie333f57d46d6ab3f4b9daa17f98b1e94a236e959
ackageManagerService.java
88d2a3c0e1b4a8c53a489db5d627beb80b1b9957 23-Nov-2014 Jeff Sharkey <jsharkey@android.com> Introduce revision codes for split APKs.

Apps delivered as multiple split APKs must have identical package
names, version code, and signatures. However, developers may want
to iterate quickly on a subset of splits without having to increment
the version code, which would require delivery of the entire app.

This change introduces "revision codes" which can vary between
split APKs belonging to the same app. An install is valid as long
as the normal version code is identical across all splits. Splits
can be added/removed to an app over time, but if a split is present
across an upgrade the revision code must not decrease.

Since system apps could have been updated with splits, only revert
to the built-in APKs if the version code is strictly greater than the
data version. Also fix bug to enable inheriting from system apps
when adding splits.

Bug: 18481866
Change-Id: I34d8e14c141a8eb95c33ffe24b4e52d6af5c8260
ackageInstallerSession.java
ackageManagerService.java
da0b16825466b9b23c24e1bc2a567afa8e690ec7 21-Nov-2014 Amith Yamasani <yamasani@google.com> Fix parsing bug that affects reading back guest restrictions

Now it remembers guest default restrictions across reboots.

Bug: 18477780
Change-Id: I3a2c0d47825c8fcfc69edf791ddd6329e23ee04b
serManagerService.java
d052a9416ae3f7e42fc1e7de0740021df385ee48 22-Nov-2014 Dianne Hackborn <hackbod@google.com> Work on issue #18486438: Reduce size of bugreport output

Reduce how much stuff ProcessStats spews, and do collapsing of
repeated intent filter targets when dumping IntentResolvers.

Also add to pm's checkout output to include shared user ids,
and fix output formatting in a few places.

Change-Id: Ic9fc6731f0439101ba9343535e66cdbbad47e291
ackageManagerService.java
ettings.java
9f285bd60b219b562bc55c7c2a9fae23eae554e5 20-Nov-2014 Narayan Kamath <narayan@google.com> Merge "Tell installd when boot completes."
e5186c12ec1c95b75d0fef1a38f94483e31aae6f 19-Nov-2014 Jeff Sharkey <jsharkey@android.com> am 40602179: Merge "Default icon is shown after uninstalling updated priv-app"

* commit '4060217905d805897141b028126e0aa51136cf7b':
Default icon is shown after uninstalling updated priv-app
343f478241fab49c909b229d6876ff8405e7b0d5 10-Nov-2014 Narayan Kamath <narayan@google.com> Tell installd when boot completes.

installd can then clear the ".booting" marker from the dalvik-cache
(owned by root). This marker is used to detect boot loops.

bug: 18280671

(cherry picked from commit 76a748e62f354c799342044f724e1f4b80121837)

Change-Id: I2364c05837ac04d428b5a34ab1802964a11d2df4
nstaller.java
e50bc6fd29dd8bb3291517753aadd2ccec94f24b 10-Mar-2014 Akira Numata <akira.numata@sonymobile.com> Default icon is shown after uninstalling updated priv-app

If updated pre-installed app is moved from "/system/app" to
"/system/priv-app" at FOTA, PackageManager does not update its
resource path correctly. This patch fixes it.

Change-Id: Iac793bcb8fd7c5bfbafd1876640b534c6da5dddf
ackageManagerService.java
9f722068483239516d0d31841d1deb189d01b5c1 17-Nov-2014 Jeff Sharkey <jsharkey@android.com> am ecfd372a: am 9c76a7b3: Merge changes Id7f9fb53,I897d7ee8 into lmp-mr1-dev

* commit 'ecfd372ae4fc69c10de83c6499c0c0e4379debc8':
Prevent user ID reuse until after reboot.
Warn user when build fingerprints differ.
6eb093909c5711f2482952e3d85dab66bad234c3 15-Nov-2014 Jeff Sharkey <jsharkey@android.com> Prevent user ID reuse until after reboot.

We're still seeing rare cases where a device struggles to create a
new user, probably because of a subtle bug in the FUSE daemon. To
work around this, only allow user IDs reuse after reboot.

Bug: 8302014
Change-Id: Id7f9fb539c6d6d1ff3d47d941af1d9e6b93eca03
serManagerService.java
643e8ebca31762279597e8bb83b8dd259195c6d4 14-Nov-2014 Jeff Sharkey <jsharkey@android.com> am 84998e28: Merge "Reduce spammy PackageManager critical logs." into lmp-mr1-dev
automerge: adb5def

* commit 'adb5defbd9e27b546c25886046f1977d856509da':
Reduce spammy PackageManager critical logs.
84998e28584e44f69be06fc9fe7e77df182251eb 14-Nov-2014 Jeff Sharkey <jsharkey@android.com> Merge "Reduce spammy PackageManager critical logs." into lmp-mr1-dev
aea5c6e33d120499799474f28b4f1e475d21990b 14-Nov-2014 Jeff Sharkey <jsharkey@android.com> Reduce spammy PackageManager critical logs.

Bug: 18390552
Change-Id: I66e34e6ebf3f644f8585056b9701b7f4582d777e
ackageManagerService.java
688831597953d68b2da3304b61686d9ea6410c00 14-Nov-2014 Craig Mautner <cmautner@google.com> am d21db6b6: am 135ae6dc: am 33d92c56: Use package name as custom resolver process name

* commit 'd21db6b6c4d2d470af2824ad8cd908317a1e71be':
Use package name as custom resolver process name
135ae6dc3b667595b4bf2c681e1db95dc657b88f 14-Nov-2014 Craig Mautner <cmautner@google.com> am 33d92c56: Use package name as custom resolver process name

* commit '33d92c56781f6058c9e682737a06c41f3a2d2f3a':
Use package name as custom resolver process name
33d92c56781f6058c9e682737a06c41f3a2d2f3a 14-Nov-2014 Craig Mautner <cmautner@google.com> Use package name as custom resolver process name

The process name was being assigned null. This meant that after the
process attached we weren't matching the name in
ActivityStackSupervisor.attachApplicationLocked(). That meant missing
the call to realStartActivityLocked() and then the resolver didn't
start until window manager timed out and resumeTopActivity was
called five seconds later.

Fixes bug 18301267.

Change-Id: If3721caeebb309c6054150b2f707e3d6e38a74d2
ackageManagerService.java
1eac0a0105ac2e7468b7f2f58993a94cd3e44bae 13-Nov-2014 Jeff Sharkey <jsharkey@android.com> am 51151dcc: Merge "Make package verifier broadcasts foreground." into lmp-mr1-dev
automerge: 3f8b53c

* commit '3f8b53cc6282ba01bdb2b438ef6ce7a1f78792e2':
Make package verifier broadcasts foreground.
13cf7917af00f66a2fdd0a9dbfebc680a51ced64 13-Nov-2014 Jeff Sharkey <jsharkey@android.com> Make package verifier broadcasts foreground.

We're using ordered broadcasts (sigh!) for package verification, and
we could be stuck behind dozens of other background broadcasts, so
hoist into foreground queue.

Bug: 18356768
Change-Id: Ib4abf771db0147f8fbd7227f32297602816c84ae
ackageManagerService.java
bea6648df5b06240380bc0bf6feefa9af24f7d4f 13-Nov-2014 Jeff Sharkey <jsharkey@android.com> am a2781fda: am 521ca5f8: am 2e700004: am d68b87cd: Recover apps with malformed certificates.

* commit 'a2781fdac332c4f6277a986c88e34daa25a3b5f9':
Recover apps with malformed certificates.
521ca5f8fba355f526e82dc3a8fc6520e4379874 12-Nov-2014 Jeff Sharkey <jsharkey@android.com> am 2e700004: am d68b87cd: Recover apps with malformed certificates.

* commit '2e7000040e3d836bb591e29515974817afc49488':
Recover apps with malformed certificates.
2e7000040e3d836bb591e29515974817afc49488 12-Nov-2014 Jeff Sharkey <jsharkey@android.com> am d68b87cd: Recover apps with malformed certificates.

* commit 'd68b87cdd402d46013170d9316a31c82be4e4816':
Recover apps with malformed certificates.
d68b87cdd402d46013170d9316a31c82be4e4816 12-Nov-2014 Jeff Sharkey <jsharkey@android.com> Recover apps with malformed certificates.

There was a window of time in Lollipop where we persisted certificates
after they had passed through a decode/encode cycle. The well-written
OpenSSL library was liberal when decoding (allowing slightly malformed
certs to be parsed), but then strict when encoding, giving us
different bytes for effectively the same certificate.

A related libcore change (0c990ab4a90b8a5492a67b2b728ac9a4a1ccfa1b)
now returns the original bytes verbatim, fixing both pre-Lollipop
installs and installs after that change.

This change recovers any apps that had been installed during the
window of time described above by doing a one-time check to see if
the certs are effectively equal.

Bug: 18228011
Change-Id: Ib82bd6db718d0490d7a26c9c1014b7c8457a7f2d
ackageManagerService.java
ettings.java
d57eefa4dd2e29d52331e2097b4552907280ad2d 12-Nov-2014 Narayan Kamath <narayan@google.com> am c83443b4: am ccfe6bd4: Merge "Remove unused local field." into lmp-mr1-dev

* commit 'c83443b43ab13b4e9797d4ffa47529a0eb01076f':
Remove unused local field.
ccfe6bd479acc41e018bd38c4021614dc9326fbf 12-Nov-2014 Narayan Kamath <narayan@google.com> Merge "Remove unused local field." into lmp-mr1-dev
3a35bf3f9c109f76ed25ce83afa36b1730c6fd75 12-Nov-2014 Narayan Kamath <narayan@google.com> am 72f9838c: am 222722ee: Merge "Tell installd when boot completes." into lmp-mr1-dev

* commit '72f9838c99a9cb8d84b8ec4af5372f10eeeb4e94':
Tell installd when boot completes.
76a748e62f354c799342044f724e1f4b80121837 10-Nov-2014 Narayan Kamath <narayan@google.com> Tell installd when boot completes.

installd can then clear the ".booting" marker from the dalvik-cache
(owned by root). This marker is used to detect boot loops.

bug: 18280671

Change-Id: I878f1463c7f523892605c17b980a51ac3b6645e2
nstaller.java
fe46f4d90835671c7ddeebb6def1b7198ac41743 10-Nov-2014 Narayan Kamath <narayan@google.com> Remove unused local field.

It's a source of confusion.

bug: 18280671
Change-Id: Ibb387d76e18d71fc9e24afc72d93201a74fc03ae
ackageManagerService.java
bb7388a86e8e9782cf8caf4d176cd2b8d16d752b 07-Nov-2014 Brian Carlstrom <bdc@google.com> am 14531903: am f4d2c8ee: Merge "Restore mLazyDexOpt behavior for eng builds" into lmp-mr1-dev

* commit '1453190388e789e27c775ebb8e96267e3c3c6eca':
Restore mLazyDexOpt behavior for eng builds
f4d2c8eebd8113482b48e0b8f83deb4b2f1f9b22 07-Nov-2014 Brian Carlstrom <bdc@google.com> Merge "Restore mLazyDexOpt behavior for eng builds" into lmp-mr1-dev
aa1185dc44347d1af713ec78b4a294683758b806 06-Nov-2014 Nicolas Prevot <nprevot@google.com> am ea728d75: Merge "Add a cross-profile intent filter only if it wasn\'t previously added." into lmp-mr1-dev automerge: b9744c1

* commit 'ea728d75ebb228822690365d147fc4021fb87ce9':
Add a cross-profile intent filter only if it wasn't previously added.
2e594cfe9848b56ad71a6f7bc4de13df7a36511c 29-Oct-2014 Jeff Hao <jeffhao@google.com> Change boot screen title to "Android is starting" when not upgrading.

Bug: 17565501
Bug: 18247218

(cherry picked from commit 9f60c08a446e38f9e2d5271546ef69ca5941eba9)

Change-Id: I1ec32b318b6221277fc3ffbc19966bf3330c2d93
ackageManagerService.java
939d5c697fdd29ef61a3c02cc60db5da565a31b5 05-Nov-2014 Brian Carlstrom <bdc@google.com> Restore mLazyDexOpt behavior for eng builds

Bug: 17641843
Change-Id: I0869d8718712f22229bb3b9ad95cca2ddd83d3b4
ackageManagerService.java
da0611a759d9b5cc4a5cb5278c1fd0cdd1641812 31-Oct-2014 Nicolas Prevot <nprevot@google.com> am ad93adfb: am 9710b04f: Merge "Schedule to write package restrictions." into lmp-mr1-dev

* commit 'ad93adfb3d4b5470098ec82ea320b9e3669abddb':
Schedule to write package restrictions.
05ea3213fd68204aa7cd9cc4b9b6a0a973f69c17 31-Oct-2014 Jeff Hao <jeffhao@google.com> am 73577862: am b1346d78: Merge "Change boot screen title to "Android is starting" when not upgrading." into lmp-mr1-dev

* commit '73577862ffe6332f326628febfa1fbb9e693bb40':
Change boot screen title to "Android is starting" when not upgrading.
3a1a0bbc3208d8967ed6e462c39d2527028339dc 22-Oct-2014 Nicolas Prevot <nprevot@google.com> Add a cross-profile intent filter only if it wasn't previously added.

BUG: 17996284
Change-Id: I3d087767983928dfb13af9aedb37d29c9940ba36
rossProfileIntentFilter.java
ackageManagerService.java
9710b04f35efae696c9ee6343671eff3568f5678 30-Oct-2014 Nicolas Prevot <nprevot@google.com> Merge "Schedule to write package restrictions." into lmp-mr1-dev
9f60c08a446e38f9e2d5271546ef69ca5941eba9 29-Oct-2014 Jeff Hao <jeffhao@google.com> Change boot screen title to "Android is starting" when not upgrading.

Bug: 17565501
Change-Id: Id5741e6e7a40750feee1cd7306e79f7baeec67de
ackageManagerService.java
a7a3479a85a68175f4d35f8ee977ca6b3b5f618b 28-Oct-2014 Jeff Sharkey <jsharkey@android.com> Merge "Check upgrade certs before permissions." into lmp-mr1-dev automerge: e795533
automerge: 05cff40

* commit '05cff4047d1c1d0552ce52a6af0151c6b1cc8e4f':
Check upgrade certs before permissions.
e79553355b10815be2cd44f7b84ae39c91a12bb1 28-Oct-2014 Jeff Sharkey <jsharkey@android.com> Merge "Check upgrade certs before permissions." into lmp-mr1-dev
c28bd3532b8effccc3577f844bc9be55fbd265f3 27-Oct-2014 Jeff Sharkey <jsharkey@android.com> Check upgrade certs before permissions.

We're now checking for permission redefinition early during the
install process, which can result in a confusing error message when
the real problem is a mis-signed app. So do a quick signature
sanity check before checking permissions.

Bug: 18095637
Change-Id: I9a9b48da9c5dc7fb9bde6f3f338ea08e53b6b705
ackageManagerService.java
1c6659486c7f9a868aaf1c87d08ffd9aa3f750d7 27-Oct-2014 Jeff Sharkey <jsharkey@android.com> am e67b8d28: Merge "Reduce PackageManager RAM usage: ArrayMap/Set." into lmp-mr1-dev
automerge: 301b563

* commit '301b563107c7458a21e4460254e81694b45f0e35':
Reduce PackageManager RAM usage: ArrayMap/Set.
2b8a1b38ecca250a57358675c3a08d7640925fb5 27-Oct-2014 Jeff Hao <jeffhao@google.com> am e8d9810c: Merge "Get UsageStats if no PackageUsage is available for boot dexopt filtering." into lmp-mr1-dev
automerge: ad1a613

* commit 'ad1a613c5291af54df0a26cf5c34434079782692':
Get UsageStats if no PackageUsage is available for boot dexopt filtering.
e67b8d28294d9af440d2ea23f1b2c68dfcba8b1b 27-Oct-2014 Jeff Sharkey <jsharkey@android.com> Merge "Reduce PackageManager RAM usage: ArrayMap/Set." into lmp-mr1-dev
ea72c08c148c602d789d0a85bf56a3eb8cadf149 22-Oct-2014 Nicolas Prevot <nprevot@google.com> Schedule to write package restrictions.

In PackageManagerService, for prefered activities,
persistent preferred activities and cross-profile intent filters:
schedule a write to package restrictions instead of writing the file directly.

Also, do not write all settings when writing package restrictions is enough.

BUG: 17996284

Change-Id: Ic732954f8a66d3aa1f0ca85a10fba290b14e68f4
ackageManagerService.java
9f837a99d48c5bb8ad7fbc133943e5bf622ce065 24-Oct-2014 Jeff Sharkey <jsharkey@android.com> Reduce PackageManager RAM usage: ArrayMap/Set.

Transition PackageManager internals away from heavier HashMap/HashSet
to use drop-in ArrayMap/ArraySet replacements. Saves ~38% RAM and
thousands of objects on a typical device.

Bug: 18115729
Change-Id: Ie107d2fee4b7baa4e3c3923231b4be877d1a5d2f
ackgroundDexOptService.java
rantedPermissions.java
ackageKeySetData.java
ackageManagerService.java
ackageSettingBase.java
ettings.java
haredUserSetting.java
7eb599b267d00cbde891c0a87924f2f5086f4497 23-Oct-2014 Jeff Hao <jeffhao@google.com> Get UsageStats if no PackageUsage is available for boot dexopt filtering.

Bug: 17191977
Change-Id: I33e18459e49afa42b8e8218574a2434e5205a6da
ackageManagerService.java
e6ba73e07b16b413f57a06218e55b4fcd8d98f21 15-Oct-2014 Jeff Sharkey <jsharkey@android.com> am fbfd900a: am 2df76285: am 203ed4db: am 88a6ed54: Merge "Reduce PackageInstaller Binder memory pressure." into lmp-dev

* commit 'fbfd900aa8a4721ce3ef84f5d08b5ecd67f16fd8':
Reduce PackageInstaller Binder memory pressure.
96b46ebaeec6cc3919513599cce79b4134022cf4 15-Oct-2014 Jeff Sharkey <jsharkey@android.com> am 88a6ed54: Merge "Reduce PackageInstaller Binder memory pressure." into lmp-dev

* commit '88a6ed5477eb6fa0453f9f29adef4c11b6eeade0':
Reduce PackageInstaller Binder memory pressure.
97d47ed036ff7bd3d7d2ddc1c6df1104ec237559 15-Oct-2014 Jeff Sharkey <jsharkey@android.com> Reduce PackageInstaller Binder memory pressure.

When restoring hundreds of apps on low-DPI devices, we end up sending
icon Bitmaps inline in the response instead of splitting into ashmem
regions. To avoid triggering TransactionTooLargeException, switch to
using ParceledListSlice under the hood.

Bug: 17926122
Change-Id: Ib4da6775e79d2fcb4aaea15f58ed998df203a5f9
ackageInstallerService.java
133c747e1008069a31cf9b2f25955fff0a650a04 15-Oct-2014 Dianne Hackborn <hackbod@google.com> am 3c5a70e0: am f23b29ad: am a861a9d7: am 35de0e28: Merge "Fix issue #10034864: Define YouTube application as the preferred..." into lmp-dev

* commit '3c5a70e0314cd21d42eda406ed2239303b07e6e1':
Fix issue #10034864: Define YouTube application as the preferred...
de4abc8472fc44fe9465801e6d4bcf760ad6b552 15-Oct-2014 Jeff Hao <jeffhao@google.com> am dbfbb175: Backport of ordering apps for boot dexopt.

* commit 'dbfbb17512fe6a5b3c7198d60b6a149969174a71':
Backport of ordering apps for boot dexopt.
dbfbb17512fe6a5b3c7198d60b6a149969174a71 30-Sep-2014 Jeff Hao <jeffhao@google.com> Backport of ordering apps for boot dexopt.

This is a squashed commit of the following changes:

1. Order apps by priority when performing boot dexopt.
(cherry picked from commit 65cde7d42d741c7d9aa2714a397b7333f688ab55)

2. Improve priority ordering of apps when performing boot dexopt.
Added core apps and updated system apps.
(cherry picked from commit 272bf3a274daff62995caf05da338c1f2a73dae3)

3. Stop boot dexopt when low on memory.
(cherry picked from commit 1d892dcb6b0ff3a50cc63e387667dc29baf1014f)

Bug: 17641843
Change-Id: Ie32f1c21047d3462aaf728f7633fecf647ba2b47
ackageManagerService.java
f23b29ad5a730c7b26d9f96c764dc4e0d96fdd16 14-Oct-2014 Dianne Hackborn <hackbod@google.com> am a861a9d7: am 35de0e28: Merge "Fix issue #10034864: Define YouTube application as the preferred..." into lmp-dev

* commit 'a861a9d713c99b576c0e7284a65d50838c4f953a':
Fix issue #10034864: Define YouTube application as the preferred...
9e6f7e4526b26983a710a89239f4f5d0b3033f2b 14-Oct-2014 Dianne Hackborn <hackbod@google.com> am 35de0e28: Merge "Fix issue #10034864: Define YouTube application as the preferred..." into lmp-dev

* commit '35de0e2872b64f78b596a850d6da2c483ba65bb5':
Fix issue #10034864: Define YouTube application as the preferred...
838018b2536d66455edf65ec263c5b99e7744a46 14-Oct-2014 Jeff Hao <jeffhao@google.com> am b5c5354f: am 63360780: Merge "Stop boot dexopt when low on memory." into lmp-mr1-dev

* commit 'b5c5354fdab213c28d0817169d4ed100cc3e0215':
Stop boot dexopt when low on memory.
f85e7af4d009862fc799c7232ec5cf9e2dc9fa34 14-Oct-2014 Dianne Hackborn <hackbod@google.com> Fix issue #10034864: Define YouTube application as the preferred...

...handler for its Intents

Fix bug when a third party app is installed as an additional but
worse match for the intent.

Also raise up the limit for when we start printing logs about
overly large strict mode data.

And turn off the logs about services being created and destroyed,
since with the way things are using services these days these have
become way too spammy.

Change-Id: I8fe301dfd80fb4b70213cb7783b7c5426245278d
ettings.java
1d892dcb6b0ff3a50cc63e387667dc29baf1014f 10-Oct-2014 Jeff Hao <jeffhao@google.com> Stop boot dexopt when low on memory.

Bug: 17641843
Change-Id: Ie1967fc2cd9bdd258bfee442968f98200edaf62e
ackageManagerService.java
915bd5ca4f8391ac3aaf346e294041719115dd4b 10-Oct-2014 Jeff Hao <jeffhao@google.com> am 4b34b329: am 6b7515dd: Merge "Improve priority ordering of apps when performing boot dexopt." into lmp-mr1-dev

* commit '4b34b329fb242985eedec63418b50357b00f6bd8':
Improve priority ordering of apps when performing boot dexopt.
272bf3a274daff62995caf05da338c1f2a73dae3 08-Oct-2014 Jeff Hao <jeffhao@google.com> Improve priority ordering of apps when performing boot dexopt.

Added core apps and updated system apps.

Bug: 17641843
Change-Id: Ia00ea3399cf1e1acaef45ff8df8f754442de5185
ackageManagerService.java
53d56bea469bd77fffa4a22d86b44017765b92c0 08-Oct-2014 dcashman <dcashman@google.com> am 4b8e7859: am 43934324: am 224a46e9: am 90f46eca: Merge "Add mProperSigningKeySet to PackageKeySetData constructor." into lmp-dev

* commit '4b8e785944e6e9d682bddf724571567f13a141a1':
Add mProperSigningKeySet to PackageKeySetData constructor.
439343246e551749b61e161134f832aef492c383 08-Oct-2014 dcashman <dcashman@google.com> am 224a46e9: am 90f46eca: Merge "Add mProperSigningKeySet to PackageKeySetData constructor." into lmp-dev

* commit '224a46e98ffc8616ec631e12d7b0fef1e83ccd21':
Add mProperSigningKeySet to PackageKeySetData constructor.
c3e45cab20b3de6e02b4d2052a3f5dbb30388b39 08-Oct-2014 dcashman <dcashman@google.com> am 90f46eca: Merge "Add mProperSigningKeySet to PackageKeySetData constructor." into lmp-dev

* commit '90f46eca86df268d8df276fb68dac2e731f35479':
Add mProperSigningKeySet to PackageKeySetData constructor.
d876a1d368c668c17aca2b9c96ff012befb49dcf 07-Oct-2014 dcashman <dcashman@google.com> Add mProperSigningKeySet to PackageKeySetData constructor.

Bug: 17847565
Change-Id: Iafa9650140e82d244d2336a07232bd40bf3c5eb8
ackageKeySetData.java
53322b9f7b2e5d379250251c978a5de885bf2a72 07-Oct-2014 Amith Yamasani <yamasani@google.com> am 41bb3455: Merge "Set the default user restrictions to disallow calling and sms" into lmp-dev

* commit '41bb3455e44dc8fde4569bbfd56fa20c6da8a27d':
Set the default user restrictions to disallow calling and sms
34a2a6ca933c3583fda5a04bf26f9951aa139e79 07-Oct-2014 Amith Yamasani <yamasani@google.com> am 42f611f2: am 4797554a: am b86671f4: am 41bb3455: Merge "Set the default user restrictions to disallow calling and sms" into lmp-dev

* commit '42f611f2f5cbc68a6aaac18ed9e3c62ebc765901':
Set the default user restrictions to disallow calling and sms
4797554ab8522ffc3dbf6f4ede111dcbbb7bb757 07-Oct-2014 Amith Yamasani <yamasani@google.com> am b86671f4: am 41bb3455: Merge "Set the default user restrictions to disallow calling and sms" into lmp-dev

* commit 'b86671f4b8263affaa561796862bd4149235b1d3':
Set the default user restrictions to disallow calling and sms
41bb3455e44dc8fde4569bbfd56fa20c6da8a27d 07-Oct-2014 Amith Yamasani <yamasani@google.com> Merge "Set the default user restrictions to disallow calling and sms" into lmp-dev
aa6634eaca707f7cbf5f5a1d75b90d8d775d254b 06-Oct-2014 Amith Yamasani <yamasani@google.com> Set the default user restrictions to disallow calling and sms

When creating a user via the UI, disallow phone calls and SMS by
default. Primary user must explicitly enable it via Settings.

Bug: 17832802
Change-Id: I18cad4be8493ddc8890b5d90da2df256cb3f1ec9
serManagerService.java
0cfe6f1d2fbef4494779158db9662ee0b4561674 07-Oct-2014 Jeff Sharkey <jsharkey@android.com> am 6d3ea645: am fcc059dc: am 1d5ef81e: am 99586dc0: Merge "Reduce PackageInstaller I/O pressure." into lmp-dev

* commit '6d3ea64599518fcbdceade5ebde7e08cc4613819':
Reduce PackageInstaller I/O pressure.
fcc059dcf0d84a77d9c2b5ef3b01c23afe25f72c 07-Oct-2014 Jeff Sharkey <jsharkey@android.com> am 1d5ef81e: am 99586dc0: Merge "Reduce PackageInstaller I/O pressure." into lmp-dev

* commit '1d5ef81e29279f769d79315f2a38e747ea92e10f':
Reduce PackageInstaller I/O pressure.
5ca7ef1d8e881f69eba26b70c74369c86abef6a8 07-Oct-2014 Jeff Sharkey <jsharkey@android.com> am 99586dc0: Merge "Reduce PackageInstaller I/O pressure." into lmp-dev

* commit '99586dc0108d0f4311c8af4d06ed113bbf40a6ee':
Reduce PackageInstaller I/O pressure.
99586dc0108d0f4311c8af4d06ed113bbf40a6ee 07-Oct-2014 Jeff Sharkey <jsharkey@android.com> Merge "Reduce PackageInstaller I/O pressure." into lmp-dev
02bd78490d8594d225ecc70a74b2058cb968a657 07-Oct-2014 Jeff Sharkey <jsharkey@android.com> Reduce PackageInstaller I/O pressure.

When performing a restore during initial device setup, we could be
installing hundreds of packages. Currently, we're writing all
metadata (including heavy icons) for every session mutation! Because
we're holding the mSessions lock while writing all this heavy data,
we end up causing ANRs when apps call other PackageInstaller APIs.

This patch mitigates by moving the heavy icon data into separate
per-session PNG files, which we only persist when changed.

Bug: 17881962, 17567794
Change-Id: I4dee15d4a65a8eb65c381e6bb7477728b6cc30d2
ackageInstallerService.java
8b718b80e0caf179a174f8417fe4f5b875297de6 06-Oct-2014 Dianne Hackborn <hackbod@google.com> am db75703b: am 2f577e83: am 90d557b7: am 7f7d240b: Merge "Fix issue #17752399: Multiple apps broken by GET_TASKS permission change" into lmp-dev

* commit 'db75703b261e1d1446cca210d7dcafa3279c31bc':
Fix issue #17752399: Multiple apps broken by GET_TASKS permission change
2f577e83cbd5b12e47178a90443390210b446102 06-Oct-2014 Dianne Hackborn <hackbod@google.com> am 90d557b7: am 7f7d240b: Merge "Fix issue #17752399: Multiple apps broken by GET_TASKS permission change" into lmp-dev

* commit '90d557b7a68e64e049a44560b76b959ef87f13d7':
Fix issue #17752399: Multiple apps broken by GET_TASKS permission change
2131b18542cdc9c5a428746eb04d8f403f1f88e9 06-Oct-2014 Dianne Hackborn <hackbod@google.com> am 7f7d240b: Merge "Fix issue #17752399: Multiple apps broken by GET_TASKS permission change" into lmp-dev

* commit '7f7d240b13b96b617e298c6178af0425308f5ef9':
Fix issue #17752399: Multiple apps broken by GET_TASKS permission change
7f7d240b13b96b617e298c6178af0425308f5ef9 06-Oct-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #17752399: Multiple apps broken by GET_TASKS permission change" into lmp-dev
6da9182faec9a8a7cc0d597957d00dd5e8226e34 06-Oct-2014 Jeff Sharkey <jsharkey@android.com> am 97e18d56: am ce85d7f4: am b03b9759: am 4c880877: Merge "Recover from missing upgrade to system package." into lmp-dev

* commit '97e18d563844f7d2a7669e0129edc4bf425bf25b':
Recover from missing upgrade to system package.
ce85d7f44f5c88dcc18a19738bfcd20d9dbb4a78 06-Oct-2014 Jeff Sharkey <jsharkey@android.com> am b03b9759: am 4c880877: Merge "Recover from missing upgrade to system package." into lmp-dev

* commit 'b03b9759d3ec1f3dacde71314795a3451f67fbab':
Recover from missing upgrade to system package.
aee292bda5641d81a637ccdf2ddaa0e935f8405a 06-Oct-2014 Jeff Sharkey <jsharkey@android.com> am 4c880877: Merge "Recover from missing upgrade to system package." into lmp-dev

* commit '4c88087776305f54bec0aae59b8e63bc803c1401':
Recover from missing upgrade to system package.
4c88087776305f54bec0aae59b8e63bc803c1401 06-Oct-2014 Jeff Sharkey <jsharkey@android.com> Merge "Recover from missing upgrade to system package." into lmp-dev
1c133105774835deaa99db78d9668b107246abef 05-Oct-2014 Jeff Sharkey <jsharkey@android.com> Recover from missing upgrade to system package.

When a system app has been upgraded, we mark the built-in version as
disabled, and skip it when parsing built-in apps, since we expect
the userdata version to be scanned a few moments later.

However, in very rare cases we can end up missing the expected
userdata version, and we'd end up dropping the package entirely, even
though we have a built-in version to fall back to. This change
handles that case by rescanning and enabling the built-in version when
the userdata version never materializes.

Also include critical log messages in check-in dumpsys to help track
down how we ended up in this state.

Bug: 17805839
Change-Id: I9971f882f9bb8ab7934c20b04e0b72366c4d04d0
ackageManagerService.java
9813893bfc3ef4de7c10197bab20396d1a85d462 05-Oct-2014 Jeff Sharkey <jsharkey@android.com> am 59d03c6b: am 34f230aa: am c5418198: am 3438bc1b: Merge "Correctly rollback failed system app installs." into lmp-dev

* commit '59d03c6ba435bd78a8571b2df978d0a9e3ad14a4':
Correctly rollback failed system app installs.
34f230aa4ad6043d3b0dd0d3942a51624468e81c 05-Oct-2014 Jeff Sharkey <jsharkey@android.com> am c5418198: am 3438bc1b: Merge "Correctly rollback failed system app installs." into lmp-dev

* commit 'c5418198cc270d7e7cf1ed558c683d2794266e97':
Correctly rollback failed system app installs.
303156809b729e10450eed9c8036596d5de07887 05-Oct-2014 Jeff Sharkey <jsharkey@android.com> am 3438bc1b: Merge "Correctly rollback failed system app installs." into lmp-dev

* commit '3438bc1bfd363e1ee656b33ebc8d0e6744470aec':
Correctly rollback failed system app installs.
3438bc1bfd363e1ee656b33ebc8d0e6744470aec 05-Oct-2014 Jeff Sharkey <jsharkey@android.com> Merge "Correctly rollback failed system app installs." into lmp-dev
3b1cfb1d8fdb7310adfe98cbfb568926eb939358 04-Oct-2014 Jeff Sharkey <jsharkey@android.com> am de6de164: am 9d35c5dc: am 4453d585: am 900e3b5f: Merge "More durable logging around system app upgrades." into lmp-dev

* commit 'de6de164ee10285295ecc25a21b489d2bc761766':
More durable logging around system app upgrades.
9d35c5dc79650c5e3781af15f8df5b0d8d078306 04-Oct-2014 Jeff Sharkey <jsharkey@android.com> am 4453d585: am 900e3b5f: Merge "More durable logging around system app upgrades." into lmp-dev

* commit '4453d5859005d5bd0da1ebc75fb1a9e5ead35021':
More durable logging around system app upgrades.
ab47e4c06ec5f0e46cf89c832846098e506f2e03 04-Oct-2014 Jeff Sharkey <jsharkey@android.com> am 900e3b5f: Merge "More durable logging around system app upgrades." into lmp-dev

* commit '900e3b5fc5bb4bf4947f63c0fed0757dfb7effa6':
More durable logging around system app upgrades.
914bd793b3415a198d0cb4216ff9da0a184ab803 04-Oct-2014 Jeff Sharkey <jsharkey@android.com> Correctly rollback failed system app installs.

Fix bug where we disabled system app, but never turned it back on
when the scanPackageLI() failed.

Bug: 17805839
Change-Id: I73999263aee703af187afd980fa0d0ce8451cf0c
ackageManagerService.java
2d7576b082b84068fb9d68419b710b9bec49139b 04-Oct-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17752399: Multiple apps broken by GET_TASKS permission change

Keep around GET_TASKS as a permission available to apps, so apps still
think they have it and don't get all uppity because they don't.

Add a new REAL_GET_TASKS that is the actual permission now.

Plus some temporary compatibility code until everyone can transition
fromn GET_TASKS to REAL_GET_TASKS.

Change-Id: I12c1102eed24844685dcbd2fa3b612811603958f
ackageManagerService.java
900e3b5fc5bb4bf4947f63c0fed0757dfb7effa6 04-Oct-2014 Jeff Sharkey <jsharkey@android.com> Merge "More durable logging around system app upgrades." into lmp-dev
3933a5dc8c8c04458c5b8c01919d7449c6d00497 04-Oct-2014 Jeff Sharkey <jsharkey@android.com> More durable logging around system app upgrades.

We've been seeing some really funky behavior when upgrading or
downgrading system apps around OTA time. Put more of these one-time
logs into durable storage to help investigate.

Bug: 17805839
Change-Id: If898d7df229c1f71e598b0d965325c272060e5e7
ackageManagerService.java
d6a582d2f3d609f1e320835690b674dec2b69a65 03-Oct-2014 Jeff Hao <jeffhao@google.com> am ea405e68: am d8f5edcb: Merge "Order apps by priority when performing boot dexopt." into lmp-mr1-dev

* commit 'ea405e680f19d81a8fa5a9a076d917d65f5477dd':
Order apps by priority when performing boot dexopt.
d8f5edcb81b5d6708e79c1537e63d59f60de484e 03-Oct-2014 Jeff Hao <jeffhao@google.com> Merge "Order apps by priority when performing boot dexopt." into lmp-mr1-dev
65cde7d42d741c7d9aa2714a397b7333f688ab55 30-Sep-2014 Jeff Hao <jeffhao@google.com> Order apps by priority when performing boot dexopt.

Bug: 17641843
Change-Id: I16997b3b5241521e6bd995f2555864b4605edd17
ackageManagerService.java
5eab0eab1f789364e3d12344f61c0e19af4c5095 02-Oct-2014 Jing Ji <a5705c@motorola.com> am 17fbe404: am 35543f45: am 5468f545: am d5941978: Allow system app to take ownership of built-in permissions

* commit '17fbe404bf28fe1e0d2a01bd5c81c447adbf3715':
Allow system app to take ownership of built-in permissions
4bcef7e339f0d64ad7bcf1cd5b891a21be6322de 02-Oct-2014 Jing Ji <a5705c@motorola.com> am d5941978: Allow system app to take ownership of built-in permissions

* commit 'd594197868c4a51bb8f8bd62479999debc72bf2a':
Allow system app to take ownership of built-in permissions
d594197868c4a51bb8f8bd62479999debc72bf2a 01-Oct-2014 Jing Ji <a5705c@motorola.com> Allow system app to take ownership of built-in permissions

Previous commit bfed9f34c makes the preloaded system app take
precedence over third-party apps when defining permissions, but
it also makes it be able to override android built-in permissions.

Now allow preloaded system app to take the ownership of built-in
permissions instead of overriding it.

Change-Id: I10d588d0284e4316ea4be552fd6191f33e3c725b
ackageManagerService.java
7cf6cac507df68ecb1d6484a5287687e4df61573 02-Oct-2014 Dianne Hackborn <hackbod@google.com> am 03e173ed: am ded96310: am 796d6ece: am c338784b: Merge "More work on issue #17656716: Unhandled exception in Window Manager" into lmp-dev

* commit '03e173edce42a5ae0de8a7718330d83664a84a9e':
More work on issue #17656716: Unhandled exception in Window Manager
594d2a5690a720002eac49c0666323accd8904cd 02-Oct-2014 Winson Chung <winsonc@google.com> am 7f54b3a9: am 6b59887e: am f7d4eb52: am 7f76e505: Merge "Fixing invalid check to get component enabled state. (Bug 17679693)" into lmp-dev

* commit '7f54b3a91430a73241b9ba34bfadf74997c495db':
Fixing invalid check to get component enabled state. (Bug 17679693)
e2aa87b8e239e1582b12c7386bd1405e6ca61b41 02-Oct-2014 Dianne Hackborn <hackbod@google.com> am c338784b: Merge "More work on issue #17656716: Unhandled exception in Window Manager" into lmp-dev

* commit 'c338784bf6bfcce3cd7db40f46b0e6c815e9ed3a':
More work on issue #17656716: Unhandled exception in Window Manager
8d05172112436a81bed6e4a0810f8914509d8a4d 01-Oct-2014 Dianne Hackborn <hackbod@google.com> More work on issue #17656716: Unhandled exception in Window Manager

Fix Slog.wtf to not acquire the activity manager lock in its code
path, so that it can never deadlock. This was the original intention
of it, but part was missed.

Now we can put back in the code to detect when strict mode data is
getting large (a little more targeted now to the actual problem),
and use Slog.wtf to report it. And as a bonus, when this happens
we will now clear all of the collected violations, to avoid getting
in to the bad case where IPCs start failing. So this should be
good enough for L to fix the problem, with wtf reports for us to
see if the underlying issue is still happening.

Finally, switch a butch of stuff in the system process from Log.wtf
to Slog.wtf, since many of those are deadlocks waiting to happen.

Oh and fix a crash in the settings provider I noticed in APR.

Change-Id: I307d51b7a4db238fd1e5fe2f3f9bf1b9c6f1c041
ackageInstallerService.java
ettings.java
010447561a60d943b05e2aa3ef64c6df83b2c0b2 02-Oct-2014 Winson Chung <winsonc@google.com> am 7f76e505: Merge "Fixing invalid check to get component enabled state. (Bug 17679693)" into lmp-dev

* commit '7f76e505624fddbc4ba3350f3e381ccd275a5a75':
Fixing invalid check to get component enabled state. (Bug 17679693)
753f08f740c5cca7b7978277a05ea814405aa523 02-Oct-2014 Brian Carlstrom <bdc@google.com> am 7123bd69: Merge "Use VMRuntime.isBootClassPathOnDisk" into lmp-dev

* commit '7123bd690fa14d0b9e33f5a70c58ea5b5f1b7d32':
Use VMRuntime.isBootClassPathOnDisk
dcf21d15456e5aca28d063aea73139e30842e6d1 01-Oct-2014 Winson Chung <winsonc@google.com> Fixing invalid check to get component enabled state. (Bug 17679693)

Change-Id: I225d59bf766122d667d990d7e5b1971c6e8af2aa
auncherAppsService.java
37fdb6e981d7dabf461458042bf837a6da2f0007 02-Oct-2014 Brian Carlstrom <bdc@google.com> am b3ab7b95: am c9e46543: am ae214fac: am 7123bd69: Merge "Use VMRuntime.isBootClassPathOnDisk" into lmp-dev

* commit 'b3ab7b95a687e4de13d06822fb295ee726b4b42f':
Use VMRuntime.isBootClassPathOnDisk
a39871ef5e9bf6703f18af0725484b06f5c78216 29-Sep-2014 Brian Carlstrom <bdc@google.com> Use VMRuntime.isBootClassPathOnDisk

Bug: 17679443
Change-Id: If53c236058a7237d735c2344a715cf0a36301f9b
ackageManagerService.java
9281a439ca03b1a61078d5d71f9b6a0ca17ede53 26-Sep-2014 Kenny Guy <kennyguy@google.com> am e938f314: am c322e272: am 420050d8: am 25be3cd6: Merge "Uninstall for all users should check device admins." into lmp-dev

* commit 'e938f314c4d96134b0dc6d4cbec4ed1e447662ef':
Uninstall for all users should check device admins.
fb81844bc66c04e671710516791ff67ca919635e 26-Sep-2014 Kenny Guy <kennyguy@google.com> am 25be3cd6: Merge "Uninstall for all users should check device admins." into lmp-dev

* commit '25be3cd6719af42c41a6a99eea1034b00f39a825':
Uninstall for all users should check device admins.
a2b48057e1a15bc9e88a764cad16cda784dc4c04 26-Sep-2014 Kenny Guy <kennyguy@google.com> Merge "Uninstall for all users should check device admins." into lmp-dev
5dde6e334d06e5c2116b2169d7ad67e95238a6f0 25-Sep-2014 Kenny Guy <kennyguy@google.com> Uninstall for all users should check device admins.

Uninstall for all users should check whether package
is admin for any user not just user 0.

Bug: 17657954
Change-Id: Ia116248b5889fc02dd46816a132e03c8e62662c9
ackageManagerService.java
e46582522565fd007acb48b27b6236be170aa43e 24-Sep-2014 Dianne Hackborn <hackbod@google.com> am 2129bb01: am 657bd7ec: am fa3089f8: am 0d18d08d: Merge "Work on issue #17628623: Need to update default preferred activities for YouTube" into lmp-dev

* commit '2129bb0172857aa70e576324fcd6fa1747b7dea1':
Work on issue #17628623: Need to update default preferred activities for YouTube
fbd98105fbb193803ba65b7307c7b71081408f49 24-Sep-2014 Dianne Hackborn <hackbod@google.com> am bee5b25b: am 0d18d08d: Merge "Work on issue #17628623: Need to update default preferred activities for YouTube" into lmp-dev

* commit 'bee5b25b6d95eb8dd586dd2024400593c6039750':
Work on issue #17628623: Need to update default preferred activities for YouTube
58817f502c3c9cfa8a4b3b04cd1cc3ca3644b1aa 24-Sep-2014 Dianne Hackborn <hackbod@google.com> Merge "Work on issue #17628623: Need to update default preferred activities for YouTube" into lmp-dev
eeb2c7e712dbae91de04ab2338c1fbccfbce7ba2 24-Sep-2014 Dianne Hackborn <hackbod@google.com> Work on issue #17628623: Need to update default preferred activities for YouTube

Improve the warning logs when setting up preferred activities
to help identify when there are issues and what they are. Also
improve the algorithm a little to still apply permissions when
resetting them and there are additional third party apps, as long
as the additional app is something like another browser and the
preferred activity being set is more specific (has a better match).

And add an example of using manifest-based preferred activities
in to ActivityTest -- and yes it DOES work! :p

Change-Id: I1ff39e03a5df6526206e0c3882085396b355d814
ettings.java
d96238d02e97ad25cc8e65ea6f1fcc44a28f86ba 23-Sep-2014 Dianne Hackborn <hackbod@google.com> am a85c287d: am 0394c8bc: am c39f4fc2: am 5a9cfe3e: Merge "Maybe fix issue #17614177 APR: system process restarting due to infinite loop" into lmp-dev

* commit 'a85c287d53335cdc2fbdde711216a6f5db5a1a24':
Maybe fix issue #17614177 APR: system process restarting due to infinite loop
c21c6ab3a735b8e524eebff6f7f41e22833803ec 23-Sep-2014 Dianne Hackborn <hackbod@google.com> am 076741d5: am 5a9cfe3e: Merge "Maybe fix issue #17614177 APR: system process restarting due to infinite loop" into lmp-dev

* commit '076741d5776be95a19259827d1e1b2b196eb4ba3':
Maybe fix issue #17614177 APR: system process restarting due to infinite loop
25e1ecaabbde4741663c8e5a777d9df9b939572c 23-Sep-2014 Dianne Hackborn <hackbod@google.com> Maybe fix issue #17614177 APR: system process restarting due to infinite loop

Also try to get rid of a huge wtf we are seeing across a lot of devices
where we incorrectly change real states on a service that is restarting,
and get rid of one of the noisier boot logs in the package manager.

Change-Id: I2510b6fb082eac3f6168cbd57bc3b70ad006114d
ackageManagerService.java
37a52a103a8d446b49222f8b0d95a6eec369f22b 20-Sep-2014 Christopher Tate <ctate@google.com> am 27935970: am 4f3cb005: am 9c236001: am a739f0df: Logspam is spam

* commit '2793597078ee6cbb04eafea48ba0ee89f0b73449':
Logspam is spam
a27e57ea4aa86d03f971d2391d8cbb034d6b2c7b 20-Sep-2014 Christopher Tate <ctate@google.com> am 52b20b5d: am a739f0df: Logspam is spam

* commit '52b20b5dcbd93e715f046bce96145e93bbf6fe5e':
Logspam is spam
eae9216770f96a60dd8642ffd127ed998259cd9f 20-Sep-2014 Christopher Tate <ctate@google.com> Logspam is spam

This turns out to happen a lot in normal usage, but we're logging
copiously about it each time. It's reporting "oh hey we're already
in this state" -- and so the log is not useful anyway.

Logspam is spam.

Bug 15169507

Change-Id: Ie2d01ff1b0b3600dd9c15ccf83d60875558f1dc2
ackageManagerService.java
f05822e21ace54a3a6e937ac37279aa2458c7a53 19-Sep-2014 Jeff Sharkey <jsharkey@android.com> am db6c7541: am 84dc7b17: am 4e6d1f66: am 9e8359ab: Merge "Fix bugs when system apps reclaim permissions." into lmp-dev

* commit 'db6c754149e1c28652a58f3f09327385b936b491':
Fix bugs when system apps reclaim permissions.
a38f9ea49f37f545d0e5e38ae84e9e67f5e8536b 19-Sep-2014 Jeff Sharkey <jsharkey@android.com> am 813142d6: am 9e8359ab: Merge "Fix bugs when system apps reclaim permissions." into lmp-dev

* commit '813142d6f88202835dbc475a1b7c99af265d45f2':
Fix bugs when system apps reclaim permissions.
bfed9f34c0cf7cdf7d25e6a7677e03f5a3d87e0e 19-Sep-2014 Jeff Sharkey <jsharkey@android.com> Fix bugs when system apps reclaim permissions.

Recently we started letting system apps always take precedence over
third-party apps when defining permissions. This change fixes that
logic to claim the permission immediately, instead of delaying until
after the next reboot. (Permissions are always reevaluated after
each install.)

We also tighten the constraints slightly to prevent two system
apps from fighting over a permission definition; the first system
app to claim the permission wins.

Bug: 17526617
Change-Id: I49686407f5e99322bc511795c653c5d702becd9d
ackageManagerService.java
1a50ba057d7dc44dbe0d1a0f3eed575f12989e5f 19-Sep-2014 Dianne Hackborn <hackbod@google.com> am 186b584e: am 80113a79: am 1453241b: am 31ce4c62: Merge "Fix issue #17564607: Apps in the managed profile can send any intent..." into lmp-dev

* commit '186b584e5f9d7dc1d0320e159a4ac51d59fb1eea':
Fix issue #17564607: Apps in the managed profile can send any intent...
0b09f0fcb05bb8fd69471374cc3b52c179ee8b78 19-Sep-2014 Dianne Hackborn <hackbod@google.com> am 63cd1cec: am 31ce4c62: Merge "Fix issue #17564607: Apps in the managed profile can send any intent..." into lmp-dev

* commit '63cd1cec2dd3a59c14d96394eba4891ccf00371d':
Fix issue #17564607: Apps in the managed profile can send any intent...
ace27915d2cc5073bcbe9cc151a5c61683bdcd1a 19-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17564607: Apps in the managed profile can send any intent...

...to the primary user, even if it was not whitelisted to be forwarded.

The path where getActivityInfo is called for the ResolverActivity
would not correctly apply the requested user ID to the result, so
it wouldn't run under the correct user.

Change-Id: I1da47c54bbed26091832a28236d0b06762c92437
ackageManagerService.java
c73c2fd55f0c3adde26dfa3a6f9fd26cd388b124 17-Sep-2014 Dianne Hackborn <hackbod@google.com> am 3ca3e107: am 596d38f8: am 1e4d9476: am 1a7cb969: Merge "Fix issue #16662560: SingleTop activity is getting instantiated multiple time" into lmp-dev

* commit '3ca3e107acec9967c3d8b6ea819835f4f9b14b87':
Fix issue #16662560: SingleTop activity is getting instantiated multiple time
877f2b86cfd72d7fad1e50c4301f6e034ea954f5 17-Sep-2014 Dianne Hackborn <hackbod@google.com> am af9e070e: am 1a7cb969: Merge "Fix issue #16662560: SingleTop activity is getting instantiated multiple time" into lmp-dev

* commit 'af9e070e0b0940de568fe19d65fe19b3a22cfb1e':
Fix issue #16662560: SingleTop activity is getting instantiated multiple time
1a526f582b2c97a93324b68ae11492f2e25ab571 17-Sep-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #16662560: SingleTop activity is getting instantiated multiple time" into lmp-dev
7922882189a5c1cc62de7e91b067f90d9a3e2f2b 16-Sep-2014 Dianne Hackborn <hackbod@google.com> Fix issue #16662560: SingleTop activity is getting instantiated multiple time

Introduce a concept of a "root affinity" to a task -- this is the
affinity of the initial activity in the task. Use this instead of
the current affinity in findTaskLocked(), where we look for an
existing task to use for a NEW_TASK intent.

This changes the semantics of the new "relinquish task identity" mode
so that it doesn't relinquish the root affinity of the task. This
means when we are in the old style application-based recents matching
of findTaskLocked(), we will never count these tasks as the same as
the application's tasks only because they have relinquished their
identity to that application. This is probably okay, it is basically
putting a different line between new document-centric recents and
old application-centric recents when they are mixed together.

Change-Id: I73a22ead9bd08e98bf67ad035a017f828c6a6715
ackageManagerService.java
3469671e4a25c36e5eef2f50e56dab069a618225 16-Sep-2014 Dianne Hackborn <hackbod@google.com> am f2b72117: am 71265274: am 40ce4e60: am 9f568025: Merge "Quick fix issue #17514851: dumpsys package <package-name> includes..." into lmp-dev

* commit 'f2b721171a08502c38e50fe3c151adeaeadf30c3':
Quick fix issue #17514851: dumpsys package <package-name> includes...
7ac65e0498b1eda893b23c956951f9480412e138 16-Sep-2014 Dianne Hackborn <hackbod@google.com> am 02c038e0: am 9f568025: Merge "Quick fix issue #17514851: dumpsys package <package-name> includes..." into lmp-dev

* commit '02c038e0de47ff7184ad1466a14f77da85eb975b':
Quick fix issue #17514851: dumpsys package <package-name> includes...
f1317857cdf815b95822db16621a566fb12baf20 16-Sep-2014 Dianne Hackborn <hackbod@google.com> Quick fix issue #17514851: dumpsys package <package-name> includes...

...irrelevant install state at the end

Quick and dirty impl just doesn't print any of that data when filtering
by package name. In the future that part of the dump should be smarter
to know how to filter by package name. (Probably also moved to a place
earlier in the dump, so the key information -- the overall package
data -- is still at the end.)

Change-Id: I094f7c2f25401438a68a6aa00d10b19c19eb7c7d
ackageManagerService.java
5f49e915f94bc77552ed7ad6262365e59b843bd6 12-Sep-2014 Jeff Sharkey <jsharkey@android.com> am df843862: am 05c1f749: Merge "Fix lock inversion in PackageInstaller." into lmp-dev

* commit 'df8438627733ce2f19f1735df535ed52be60d396':
Fix lock inversion in PackageInstaller.
ce1dd5bee6bf1eb1eece6fa5088fef772141e3aa 12-Sep-2014 Jeff Sharkey <jsharkey@android.com> am dc104ede: am 48058460: Merge "Bring install and install-multiple into parity." into lmp-dev

* commit 'dc104eded26c50c7c01eea5e164a0f95c2cbd0d1':
Bring install and install-multiple into parity.
37ccf18b841afacba5d20e427eb9fec0065f6ecf 12-Sep-2014 Jeff Sharkey <jsharkey@android.com> Merge "Fix lock inversion in PackageInstaller." into lmp-dev
71ac935526d29097891664af40c54c96d6de02e6 12-Sep-2014 Jeff Sharkey <jsharkey@android.com> Merge "Bring install and install-multiple into parity." into lmp-dev
cbf47916b3e7a971c3a61035eb2633f96fc043cb 12-Sep-2014 Jeff Sharkey <jsharkey@android.com> Fix lock inversion in PackageInstaller.

In a small handful of cases individual sessions call up into the
installer while holding their local locks. Defend against this by
treating most InternalCallback events as async. For sealed events,
perform the upcall outside of the session lock.

Bug: 17482676
Change-Id: I265d981c98c8928a0fced09d8b029ca16eb650d9
ackageInstallerService.java
ackageInstallerSession.java
37800dba252628a9c48679c2bd2e4a3729ff9194 12-Sep-2014 Jeff Sharkey <jsharkey@android.com> am f804cd88: am 7ba3d751: Merge "Consistent clean up of failed installs." into lmp-dev

* commit 'f804cd8897161803ca8b85045b67dd7f0348094b':
Consistent clean up of failed installs.
5c0ed94debe51a2954cf9409b5477cfbcc03d7f0 12-Sep-2014 Jeff Sharkey <jsharkey@android.com> Merge "Consistent clean up of failed installs." into lmp-dev
e980804df16c968c14a56b8853886bf5f049f46e 12-Sep-2014 Jeff Sharkey <jsharkey@android.com> Bring install and install-multiple into parity.

This ensures that both are using (almost) identical logic when
deciding what installs to proceed with. Installs from "pm" for all
users now run as OWNER, and rely solely on INSTALL_ALL_USERS to
express intent. This keeps install session notifications simple.

Since installer UID can vary from installer package name, start
persisting the UID. Also parse some missing flags for install
sessions.

Bug: 17469392
Change-Id: I6d89b1a787aa2024cc4bebf6b9c29317c358e147
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
cf4f151df47805f227e679d887fe634b48ef7596 11-Sep-2014 Amith Yamasani <yamasani@google.com> am 0ec5511e: am 4fa40b32: Fix build

* commit '0ec5511e7beba9c326ceb690553018d23305356f':
Fix build
5f0439d7299522f486257c4c829804fed2511695 11-Sep-2014 Amith Yamasani <yamasani@google.com> am 3b18a0c5: am 30a5e35b: Merge "Apply cross-user restrictions to Shell" into lmp-dev

* commit '3b18a0c5f8efdb915fb1304c959236d608eb8b79':
Apply cross-user restrictions to Shell
26f9ea38a5b6030714757834b94dce737aa8d564 11-Sep-2014 Amith Yamasani <yamasani@google.com> Fix build

Import went missing between CLs

Change-Id: I8740b99dbce15b3f3508768ab3e02f551caf673d
ettings.java
f58e532e015ef31d879ee51aeeb251349784717c 11-Sep-2014 Amith Yamasani <yamasani@google.com> Merge "Apply cross-user restrictions to Shell" into lmp-dev
ad8adc1b40970b15a3df2ff4b3b8d1c58a3a1cb6 11-Sep-2014 Alexandra Gherghina <alexgherghina@google.com> am 04d1560c: am b04106ed: Merge "Remove package level intent forwarding." into lmp-dev

* commit '04d1560cac01a35776e84210b1e41038a4d7df84':
Remove package level intent forwarding.
e107c3eb79be40f1071c4370fd9a3f9e4fd6d6de 09-Sep-2014 Adam Connors <adamconnors@google.com> Remove package level intent forwarding.

Clean up unused methods.

Bug: 17389110
Change-Id: I8a80fe3e14219f06572de05c390cdda0efcbf5db
ackageManagerService.java
ettings.java
9b2d26b68347e246e67c588b548e81fca1d29353 11-Sep-2014 Jeff Sharkey <jsharkey@android.com> Consistent clean up of failed installs.

Instead of remembering to add clean-up logic to every install scan
failure case, rely on the fact that we're now throwing for all errors
and use a finally clause to delete data directory when requested.

When clearing data for a package, always try deleting the app data
directories, even if no record of the package exists. This helps
users recover from UID mismatches without resorting to a full data
wipe.

Bug: 17005516
Change-Id: I352863ef4e468c576ecf136549e21cceae2650d5
ackageManagerService.java
8cd28b57ed732656d002d97879e15c5695b54fff 09-Jun-2014 Amith Yamasani <yamasani@google.com> Apply cross-user restrictions to Shell

Even though Shell user is allowed to perform cross-user actions,
lock that path down if the target user has restrictions imposed by
the profile owner device admin that prevents access via adb.

If the profile owner has imposed DISALLOW_DEBUGGING_FEATURES, don't
allow the shell user to make the following types of calls:
start activities, make service calls, access content providers,
send broadcasts, block/unblock packages, clear user data, etc.

Bug: 15086577
Change-Id: I9669fc165953076f786ed51cbc17d20d6fa995c3
ackageInstallerService.java
ackageManagerService.java
ettings.java
serManagerService.java
ceb63ed177444ba042ba13ced5ecad2d451cb57d 10-Sep-2014 Adam Lesinski <adamlesinski@google.com> am 2413aa58: am 38bd55ff: Merge changes I79ba54d7,I224fb4b6 into lmp-dev

* commit '2413aa5838c0d9e653c419c4566ab76a5c7bde2d':
Make UsageStats API default on only for the system
ActivityManager shouldn't return null for getCurrentUser
2dadfeb3069520e82b3c5c6f52f7ebed480a2bbd 10-Sep-2014 Jeff Sharkey <jsharkey@android.com> am 47bf9080: am c5d4ebd6: Merge "Missing manifest error should be NO_CERTIFICATES." into lmp-dev

* commit '47bf90808bd42a3fcfd5434ec216a8ba8859f8f0':
Missing manifest error should be NO_CERTIFICATES.
732edf098fe9728238bf3b69a3b3cfcb221edf35 10-Sep-2014 Adam Lesinski <adamlesinski@google.com> Merge changes I79ba54d7,I224fb4b6 into lmp-dev

* changes:
Make UsageStats API default on only for the system
ActivityManager shouldn't return null for getCurrentUser
ad5f44a68c70f783fb4be85f089f63bfdd63ec0c 10-Sep-2014 Jeff Sharkey <jsharkey@android.com> Merge "Missing manifest error should be NO_CERTIFICATES." into lmp-dev
bc09755e193c2802d2d88871ac3d1f182b260c30 09-Sep-2014 Jeff Sharkey <jsharkey@android.com> Missing manifest error should be NO_CERTIFICATES.

When META-INF/MANIFEST.MF is missing, treat as NO_CERTIFICATES
instead of CERTIFICATE_ENCODING. Also remove redundant layer of
debugging details when wrapping exceptions.

Bug: 15667982
Change-Id: I6e8216d5bf6e42da1feb70c89f991001380305be
ackageInstallerSession.java
ackageManagerException.java
ackageManagerService.java
1f4ea68a070d4e78f29a86d72968fb6580b13af2 09-Sep-2014 Amith Yamasani <yamasani@google.com> am d94df395: am 7a9f541e: Merge "User restriction to disallow outgoing NFC beam" into lmp-dev

* commit 'd94df395a87836b5dba6bd159010046e1d016661':
User restriction to disallow outgoing NFC beam
da6e6c888f81d3bd19ff1f3cf9b081b7f9b2a013 09-Sep-2014 Amith Yamasani <yamasani@google.com> Merge "User restriction to disallow outgoing NFC beam" into lmp-dev
26af829fd70609cf073b56e54e1f78faf83a5e8b 09-Sep-2014 Amith Yamasani <yamasani@google.com> User restriction to disallow outgoing NFC beam

This can be controlled by MDMs via DPM.

Also fixes:
- javadoc for restrictions
- persisting of cross profile copy/paste restriction

Bug: 17387303
Change-Id: Ie148f56189181d2a4c6345c0823d417ab13a94a3
serManagerService.java
eddeb49a734a524347587e7654025c489fb6331e 09-Sep-2014 Adam Lesinski <adamlesinski@google.com> ActivityManager shouldn't return null for getCurrentUser

There was a race where ActivityManager would return null
for getCurrentUser() when switching between guest accounts.
This is because the Guest account was marked for deletion
while it was still active.

Bug:17290209

Change-Id: I224fb4b6836380e5acb7dbeb8f3343d74505f88a
serManagerService.java
ed225682c519700210b8335014f99b367c7fff04 09-Sep-2014 Alexandra Gherghina <alexgherghina@google.com> am f695833a: am c3b392d0: Merge "Removing the NO_CROSS_PROFILE flag for intent forwarding" into lmp-dev

* commit 'f695833ab5764c7b031f43f78a288eec2e162dcc':
Removing the NO_CROSS_PROFILE flag for intent forwarding
76776943204fa5367d13948dba5b1e3de8916cd9 09-Sep-2014 Alexandra Gherghina <alexgherghina@google.com> Merge "Removing the NO_CROSS_PROFILE flag for intent forwarding" into lmp-dev
c788487ae5b28bb6f84410fcdb101f0bdfcd467e 09-Sep-2014 Alexandra Gherghina <alexgherghina@google.com> Removing the NO_CROSS_PROFILE flag for intent forwarding

Bug: 17435289
Change-Id: Iffbecd3cf9338a8633bfcc5bc47247bfc50e7546
auncherAppsService.java
ackageManagerService.java
6098a3acc9b5c2e87dcc6e4802cfd6d0ee4073c0 08-Sep-2014 Jeff Sharkey <jsharkey@android.com> am fa8211c5: am 2f0ed017: Merge "Delayed ASEC allocation, refine progress handling." into lmp-dev

* commit 'fa8211c5f7b8939e230f5643cd94a6e8686571b6':
Delayed ASEC allocation, refine progress handling.
77d218e1869e69c8d436b09cd11dcfe45e50b2cf 06-Sep-2014 Jeff Sharkey <jsharkey@android.com> Delayed ASEC allocation, refine progress handling.

For restore use-case, session creation needs to complete quickly, so
delay ASEC allocation until session is opened. When preflighting
size checks, only consider external when we have a known size for the
container. Also relax size checks when using MODE_INHERIT_EXISTING
on external, since we don't know how much of existing app will be
copied over.

Consider session as "active" while commit is ongoing, until we're
either finished or pending user interaction.

Always publish first client needle movement away from 0. Use 25% of
internal progress to reflect ASEC allocation.

Avoid CloseGuard messages about leaking PFDs.

Bug: 17405741, 17402982
Change-Id: I6247a1d335d26621549c701c4c4575a8d16ef8c2
ackageInstallerService.java
ackageInstallerSession.java
5abb80468e8d41384510acb04b031a46d99fbb34 06-Sep-2014 Jeff Sharkey <jsharkey@android.com> am 01efa7e6: am 89e86555: Merge "Separate active state from open/close." into lmp-dev

* commit '01efa7e6bcbaf781b589dd120d079ebc9e132069':
Separate active state from open/close.
5341f94a191ae57b138f97cd516842bcf04c0609 06-Sep-2014 Jeff Sharkey <jsharkey@android.com> Merge "Separate active state from open/close." into lmp-dev
bc7bce38b2e4733a14f6296c75f983bd50f996d1 06-Sep-2014 Jeff Sharkey <jsharkey@android.com> Separate active state from open/close.

Also change name to setStagingProgress() to make it clearer that
system may adjust the range. Start throwing from openSession() in
preparation for ASEC allocation moving.

Bug: 17405741
Change-Id: Id7da51a32d5d89cb512ddafbd7ceaafbcd41cac6
ackageInstallerService.java
ackageInstallerSession.java
70175ba920d4b99f252a6d23905843e66bddcaf6 06-Sep-2014 Christopher Tate <ctate@google.com> am 7cb42844: am 51a66814: Merge "Don\'t crash in addPackageHoldingPermissions()..." into lmp-dev

* commit '7cb42844afc7f376ddb213011b74497e38f7a883':
Don't crash in addPackageHoldingPermissions()...
3a2822b5ce4ea295084cae34d9a418b7316c1e14 06-Sep-2014 dcashman <dcashman@google.com> am 87b01b0c: am 92f87bbb: Merge "Fix boolean comparison after sig check." into lmp-dev

* commit '87b01b0cb3edf589c9d6d9a70f86e4d3caa8bc2a':
Fix boolean comparison after sig check.
a0c9962388361522257b4ff2f55ac7cea0d559f3 06-Sep-2014 Christopher Tate <ctate@google.com> Merge "Don't crash in addPackageHoldingPermissions()..." into lmp-dev
30f349d2ef3f2220c1d478b0faff4c38eaadf12c 05-Sep-2014 Christopher Tate <ctate@google.com> Don't crash in addPackageHoldingPermissions()...

...in cases involving uninstalled apps, or apps whose install state
varies across different users.

Bug 17398315

Change-Id: I7297d82f8bf5d49c50a7fd53d795a706bf2d2313
ackageManagerService.java
2de4f9f971b0130449ab90305965963f688d1ed3 05-Sep-2014 dcashman <dcashman@google.com> Fix boolean comparison after sig check.

Bug: 17402843
Change-Id: I0cb5ffba1a93f71a250294a41040011234ce1029
ackageManagerService.java
11d44003187c35e47e71d3504dbcb49cd451f5b3 05-Sep-2014 Jeff Sharkey <jsharkey@android.com> am 27264229: am a32e4e6b: Merge "Allow badging updates to install sessions." into lmp-dev

* commit '27264229839c03a5530250b7e93de49694fed235':
Allow badging updates to install sessions.
43a2d06166f9d5aa46371c6496ec99a9fba8df00 05-Sep-2014 Jeff Sharkey <jsharkey@android.com> Merge "Allow badging updates to install sessions." into lmp-dev
ec9bad2015c6d3bc91bab66f0824043c1e24d013 05-Sep-2014 Jeff Sharkey <jsharkey@android.com> Allow badging updates to install sessions.

For the system restore use-case, an installer may need to enqueue
their sessions quickly before badging details, like icons, have been
downloaded. This change relaxes to allow an installer to update
their session badging after the session has been created. Notify
observers when badging changes.

Rename callback registration methods to match style guide. Relax
constraint that observers are home app. Fix bug around internal
progress reporting.

Bug: 17376797, 17389236, 17334199
Change-Id: I5fb88508baea2f08e89a1504fcf5ef972afad4a7
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
f0b044031b9a9e33fab7e1b2cc667ae6f7c3ecd2 05-Sep-2014 Brian Carlstrom <bdc@google.com> am 2a7a7216: am 8a5a6aec: Merge "Fix backwards arguments to performDexOpt" into lmp-dev

* commit '2a7a7216029d5fd7e3fc181d7a8fa412c999b418':
Fix backwards arguments to performDexOpt
839849111c21e4936fec473ab08e21a12cd36736 05-Sep-2014 Brian Carlstrom <bdc@google.com> Merge "Fix backwards arguments to performDexOpt" into lmp-dev
d382be9b220d8f68d095cd5df56c0b900af44f9a 05-Sep-2014 Brian Carlstrom <bdc@google.com> Fix backwards arguments to performDexOpt

Bug: 16696554
Change-Id: I302f8edc8243d3537afd564599cc798708124dbe
ackgroundDexOptService.java
ackageManagerService.java
6de676ca8457e3d0ed4df895489e5d7c8dd171df 05-Sep-2014 Jeff Sharkey <jsharkey@android.com> am daf82380: am 8fcdda89: Merge "Hold package cleaning until system is ready." into lmp-dev

* commit 'daf823800795d25629372cd5068d9340a97ed841':
Hold package cleaning until system is ready.
0b6ce453a21b9a98c5f59bc9074b4a60fc6c128b 05-Sep-2014 Amith Yamasani <yamasani@google.com> am 4a94107f: am 3971e42e: Merge "Fix crash if package setting is not populated yet" into lmp-dev

* commit '4a94107f50d77cc634bb7e931a25ce9ab6b263df':
Fix crash if package setting is not populated yet
fd12f4c9e4985e75b38a8136cf6fdb0a6ce726d6 05-Sep-2014 Jeff Sharkey <jsharkey@android.com> Merge "Hold package cleaning until system is ready." into lmp-dev
7767df3c9c4cffab623f7e9decc99d86d443794e 05-Sep-2014 Amith Yamasani <yamasani@google.com> Merge "Fix crash if package setting is not populated yet" into lmp-dev
43789f56147f7d028a5ca1da3a3332adf7542b28 04-Sep-2014 Amith Yamasani <yamasani@google.com> Fix crash if package setting is not populated yet

Bug: 17388687
Change-Id: I441ec37396a3b725a79b933a182c63fbe52d5646
ackageManagerService.java
c287fb2ffd16848ec59913952ea0816e7bdecd2b 04-Sep-2014 dcashman <dcashman@google.com> am d285ab9a: am 0dd7e085: Merge "Add upgrade KeySets check to permission pruning on install." into lmp-dev

* commit 'd285ab9a7b50bde8f65986139bdc0b30db701395':
Add upgrade KeySets check to permission pruning on install.
977c5bec526b9e763a8d40b416b1d5e4ea92274a 04-Sep-2014 dcashman <dcashman@google.com> Merge "Add upgrade KeySets check to permission pruning on install." into lmp-dev
8fb6a608eaeb67d40130da7f4d83b69dda8c3dbd 04-Sep-2014 Amith Yamasani <yamasani@google.com> am 50ddcc0a: am bd1122e6: Merge "Allow adb install to work even if unknown sources is disallowed" into lmp-dev

* commit '50ddcc0aac6b3156fe0c05b3fd559456e1db4a6f':
Allow adb install to work even if unknown sources is disallowed
dea8e0112286664a8a176cc9d17bee6774bc62d7 04-Sep-2014 Amith Yamasani <yamasani@google.com> Merge "Allow adb install to work even if unknown sources is disallowed" into lmp-dev
ece305d585a3b8888ec962a5daf7a13bb93ab454 04-Sep-2014 Amith Yamasani <yamasani@google.com> Allow adb install to work even if unknown sources is disallowed

adb installs should continue to work for developer usecases,
but PackageInstaller continues to be blocked for sideloading
via the UI - browser, downloads, etc.

Bug: 13760585
Change-Id: I4f8c1445448584c17e5acf77b399579c2643f333
ettings.java
e48b6bbe6f501d9fe0c14838fdecb3e4564e5d5a 04-Sep-2014 Brian Carlstrom <bdc@google.com> am 009a4829: am ffedfd4a: Merge "Ensure that BackgroundDexOptService can still perform dexopt" into lmp-dev

* commit '009a4829b96194301db9ab690f54adcc9f8f3b99':
Ensure that BackgroundDexOptService can still perform dexopt
8f597af542ed9ac5781e84d48642e97b118c23d8 04-Sep-2014 Christopher Tate <ctate@google.com> am 675dc869: am e4f0d1c4: Merge "Fix crash in KeySet dump" into lmp-dev

* commit '675dc869bd73c526cd07e172e0e125e3a5d915f6':
Fix crash in KeySet dump
ebb42e18e8a9c31c92ef4bca0b38d2447afc5558 04-Sep-2014 Brian Carlstrom <bdc@google.com> Ensure that BackgroundDexOptService can still perform dexopt

Bug: 16696554
Change-Id: Id5877618ec9620112fa31dd69016c060bb26b2a7
ackageManagerService.java
965a23423b8a60fd326f2b82fd1ba7692293bc1b 04-Sep-2014 Brian Carlstrom <bdc@google.com> am 719da919: am c74dc4b7: Merge "Restrict lazy dexopt to eng builds only" into lmp-dev

* commit '719da919d21538cc145e372a68955e6b87cf6681':
Restrict lazy dexopt to eng builds only
436e264e87dcbcebfd9c123685505ce547744b7f 20-Aug-2014 dcashman <dcashman@google.com> Add upgrade KeySets check to permission pruning on install.

Bug: 16564805
Change-Id: I80393eec3c6e1e861a9ec2ae27fe37027311948d
ackageManagerService.java
b541f09be309f5f314760ff832bda245e6ec9cdd 04-Sep-2014 Christopher Tate <ctate@google.com> Merge "Fix crash in KeySet dump" into lmp-dev
6441bc7e5366610771b587a8cb6ff04c2861b7a5 04-Sep-2014 Christopher Tate <ctate@google.com> Fix crash in KeySet dump

This was unfortunately DOSing some important parts of the Package
Manager's dumpsys output.

Change-Id: I228f23e8e26820b40a8d8772cd5f5b04ee8317d9
eySetManagerService.java
230561eef41047f04dac1a10949f4bcb43915017 03-Sep-2014 Brian Carlstrom <bdc@google.com> Restrict lazy dexopt to eng builds only

Bug: 16696554
Change-Id: I56bb63ce534842994a70df6b09843b4e3153c845
ackageManagerService.java
ca27d452c14f8a275cf2b7d0e59080690e0dc5c1 02-Sep-2014 Jeff Sharkey <jsharkey@android.com> Hold package cleaning until system is ready.

Package cleaning is going to check things like external storage
state and spin up external services like DCS, so hold it until after
system ready. (There are a handful of cases where we clean packages
during early boot scan.)

Bug: 17152982
Change-Id: I240b1f16679f421d0b416e576ff87713dc01276a
ackageManagerService.java
4fb9a2775c8bfe937a4fca3d409574b04f89cbda 02-Sep-2014 Christopher Tate <ctate@google.com> am f5fe379c: am 44cfdacb: Merge "Don\'t rewrite package restrictions unconditionally in findPreferredActivity()" into lmp-dev

* commit 'f5fe379c4a894426e2174ecca8cf0112971b127e':
Don't rewrite package restrictions unconditionally in findPreferredActivity()
e93e6c81f2ec2588ca3a2878ac2b53776aa4845f 02-Sep-2014 Christopher Tate <ctate@google.com> Merge "Don't rewrite package restrictions unconditionally in findPreferredActivity()" into lmp-dev
4f34c86f3cef9517aec79fb4febf139d49f7241b 02-Sep-2014 Amith Yamasani <yamasani@google.com> am e681727f: am 9bdf3963: Merge "Make it possible to remove current user" into lmp-dev

* commit 'e681727f0106b67824e6315e5473232b42f54120':
Make it possible to remove current user
10170acbc6518c9952ddaa5b248350017be5ab11 02-Sep-2014 Nick Kralevich <nnk@google.com> am 60888dba: am 0988daaa: Merge "Add testing api to SELinuxMMAC code."

* commit '60888dbad1919634a61fc4f1e96126a3c387a228':
Add testing api to SELinuxMMAC code.
1df1473008c24487701c5bc15f39ed9f9697f421 30-Aug-2014 Amith Yamasani <yamasani@google.com> Make it possible to remove current user

Due to the async nature of switching users, it's not possible to
switch and remove immediately. So mark the switch target user as
soon as the user switch is requested, so that a remove will proceed
without failing at stopUserLocked().

Also, fix a similar problem with deleting the current guest and
switching to a new guest. It was attempting to remove the current
user which will result in a failed stopping of the user.
Added a way to mark the current guest
for deletion so that a new one can be created, switched to and the
old one deleted. If runtime fails, old guest is already marked for
deletion and will be cleaned up on restart.

Bug: 17321533
Change-Id: I4be0fb956227e0bb95588b5b1f2867fb1e655c0d
serManagerService.java
d67a78db88d11a58691082ced6ab6bbc48976188 30-Aug-2014 Christopher Tate <ctate@google.com> Don't rewrite package restrictions unconditionally in findPreferredActivity()

We've been forcing a rewrite of package restrictions when doing preferred-
activity lookups in most cases, even when the lookup was not actually making
any changes to the bookkeeping. Now we only do so when something has
actually changed. Flash drives everywhere rejoice.

Bug 17334180

Change-Id: Id8f20723002b7bbcc1d82ccde55df6ef727b64ba
ackageManagerService.java
efb1f36f09cdada7c3b2677e6628492d8f256729 30-Aug-2014 dcashman <dcashman@google.com> Merge "Address KeySet API Review" into lmp-dev
dda003ffa84f986bfaba4344124eafa533f5039d 29-Aug-2014 Amith Yamasani <yamasani@google.com> Clean up apks installed for a removed user

When a user is removed, enumerate through all installed packages
to see if any of them are not installed for any user. Delete the
package if no user has it "installed".

Added a pm option to install an apk for a specific user.

Fixed a crash in UserManagerService when executing the above
cleanup - dying users generate a null UserInfo.

Bug: 15426024
Change-Id: I571decde1ae1c257d0da6db153b896aad6d6bcb4
ackageManagerService.java
serManagerService.java
e545035e0ece992941047d7676a53d090c81448d 29-Aug-2014 Alex Light <allight@google.com> Remove obsolete pruneDexCache

Bug: 16875245

(cherry picked from commit 09107db4916913912e61bfe592643b9c4c50b500)

Change-Id: I06e14c405aa4af295795982c1d236be3cb00e893
nstaller.java
ackageManagerService.java
a9bdc43ec2b8862db579aaced357184b7496468f 27-Aug-2014 Jeff Sharkey <jsharkey@android.com> Merge "Recreate lib symlink after deleting app data." into lmp-dev
d1caf731e400a052bee2a7251bf0b985081227c3 27-Aug-2014 Jeff Sharkey <jsharkey@android.com> Merge "Clear pending operation flag when move failed." into lmp-dev
c5212217403696f81d2db220a1d9b22872600275 27-Aug-2014 Jeff Sharkey <jsharkey@android.com> Recreate lib symlink after deleting app data.

Bug: 16739202
Change-Id: Ie8dccf67feaf6dfa474d52a3cda0862b952e6762
ackageManagerService.java
e084039dd29f63f6e56c91615bc0da6d638c6ea9 27-Aug-2014 Amith Yamasani <yamasani@google.com> Fix incorrect reading of multichoice app restrictions

Clear the list of choices values before putting new ones in.

Bug: 17299310
Change-Id: I01051d1703adcbdd7d0b5fb4ee423404f98489e8
serManagerService.java
1c9edafef8b3841e3b0017b8f6ef5f46277e8646 27-Aug-2014 Jeff Sharkey <jsharkey@android.com> Clear pending operation flag when move failed.

Bug: 17298448
Change-Id: I7a4af0f31d3909a9bfb5a2dd7d168015786024e3
ackageManagerService.java
264a5f5b34d8c1169e81da4136e263344115e02d 26-Aug-2014 Jeff Sharkey <jsharkey@android.com> Merge "Treat moving app as installing in new location." into lmp-dev
d68f83cc478a8ec501d0a5a08a2a737355bee89a 26-Aug-2014 Calin Juravle <calin@google.com> Merge "Pass vmSafeMode (manifest attribute) to installd." into lmp-dev
381d94b712605112b35d7f70064b0d18bd877877 24-Aug-2014 Jeff Sharkey <jsharkey@android.com> Treat moving app as installing in new location.

Moving apps to/from SD cards has historically been neglected, meaning
it can easily break. This happened most recently for split APKs,
64-bit native code, and multiArch support.

To make this easier to maintain, treat move as a no-op upgrade,
following the inheriting code path that split APKs depends on.

Also clean up scary places where different flavors of flags were
being combined, and remove unused flags. Fix media broadcasts to be
sent based on existing app storage location.

New API to abandon install session without opening it.

Bug: 17158495
Change-Id: Ia33bf8f6fdaae099124dfe534f0e320b37bc8e16
ackageInstallerService.java
ackageManagerService.java
941a8ba1a6043cf84a7bf622e44a0b4f7abd0178 21-Aug-2014 Jeff Sharkey <jsharkey@android.com> Installing splits into ASECs!

Sessions can now zero-copy data directly into pre-allocated ASEC
containers. Then at commit time, we compute the total size of the
final app, including any inherited APKs and unpacked libraries, and
resize the container in one step.

This supports both brand new ASEC installs and inheriting from
existing ASEC installs. To keep things simple, it currently requires
copying any inherited ASEC contents, but this could be optimized in
the future.

Expose new vold resize command, and allow read-write mounting of ASEC
containers. Move native library extraction into the installer flow,
since it needs to happen before ASEC is sealed. Move multiArch flag
into NativeLibraryHelper, instead of making everyone pass it
around. Migrate size calculation to shared location.

Separate "other" package name in public API, provide a path to a
storage device when relevant, and add more docs.

Bug: 16514385
Change-Id: I06c6ce588d312ee7e64cce02733895d640b88456
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
feb193085adbdc379ee70dbb7dc6ae4c9f2971dd 21-Aug-2014 Calin Juravle <calin@google.com> Pass vmSafeMode (manifest attribute) to installd.

The flag is used to enforce --interpret-only flag when running dex2oat.

Bug: 12457423
Change-Id: Ifdafcc1afa32996577fa44c5682eeb58c79772ac
nstaller.java
ackageManagerService.java
e812d9096915ad165de125520ed7371009587d1f 21-Aug-2014 Robin Lee <rgl@google.com> Clear identity before calling out to PackageHelper

PackageHelper.resolveInstallLocation expects the binding user to be
equivalent to the calling user. If this is not the case, it may fail
and throw an exception preventing anyone but user 0 from installing
anything.

Bug: 17175251
Change-Id: Id5615738c7b4e1234a548c7b4a410282d14c9ee3
ackageInstallerService.java
bb7b7bea19223c1eba74f525c7fe87ca3911813b 20-Aug-2014 Jeff Sharkey <jsharkey@android.com> More progress towards split APKs in ASECs.

Teach DefaultContainerService to install split APKs, which will be
needed when moving to/from ASECs. Also support forward locking for
testing purposes, even though its deprecated.

Move native library unpacking code to NativeLibraryHelper location
where it can be shared by both DCS and PMS. Also update footprint
calculation logic to mirror the later unpack codepaths.

Immediately persist sealed sessions. When resolving install
locations, prefer location of any existing install of that
package. Lightweight parse requesting certificates now always
verifies that all contents are signed correctly.

Bug: 16514385
Change-Id: Ida1c4eb0f95b065104dd971e19126d4085ebf1f0
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
12450c72ebdc695d72b06ddaa8f199d5afe8d525 19-Aug-2014 Esteban Talavera <etalavera@google.com> Merge "Add cross profile intent in order after intent filter resolution" into lmp-dev
54edd1cdc45773dc5c208d9dc4f26b768d200901 18-Aug-2014 Esteban Talavera <etalavera@google.com> Add cross profile intent in order after intent filter resolution

The elements returned by queryIntentActivities must be in order, as specified in the Javadoc. Otherwise the ResolverActivity will incorrectly filter out intents if they follow another intent with lower priority than the ones that will be shown to the user.

Bug: 15906680
Change-Id: I755e05d3017ee124cbae468f51fa86cfdf42b483
ackageManagerService.java
ccc8c29af113b68a337cf4e38fae5d06531b3cf8 19-Aug-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #17114392: android.com.phone crashes - PackageManager code" into lmp-dev
4a88bf99851a3db3b629df23b919f2660c492f18 19-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17114392: android.com.phone crashes - PackageManager code

Change-Id: Ib02119c6f313384a73fa7cb7b2b62dbd716fa6ca
ackageManagerService.java
f52233df74bb4a3efa1f7b9107353c841eafc933 18-Aug-2014 Nicolas Prevot <nprevot@google.com> Merge "When forwarding intents, ignoring the package set in the intent." into lmp-dev
57137289a2798b8c19f1e9f16bd3f0a71f1b916a 18-Aug-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #17082301: replacePreferredActivity is ignoring userId" into lmp-dev
f2ac2761276e4972f6463d6818c9f5798bdc9a4d 16-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17082301: replacePreferredActivity is ignoring userId

It was being given the argument and just... ignoring it.

But the bulk of this change is to make replacePreferredActivity
better about replacing -- it now detects if the request will not
make a change and, in that case, just do nothing.

The reason for this?

It turns out that each time you install an app, the telephony
system is calling this function over 20 times to set the default
SMS app. This is almost always doing nothing, but before this
change it means we would re-write packages.xml over 20 times...!

There are definitely more improvements that can be made here (delaying
write of packages.xml to allow them to batch together, reducing
the amount of calls being made), but until then this is a big
improvement.

Change-Id: I02c4235b8ecd5c13ef53e65d13c7dc2223719cec
ackageManagerService.java
referredComponent.java
742e790294b3441b79f715fe447069b63c6065db 17-Aug-2014 Jeff Sharkey <jsharkey@android.com> Progress towards staging ASECs.

Move location selection logic into shared PackageHelper location,
and share it between DCS and PackageInstaller. Fix bugs related to
installed footprint calculation; always count unpacked native libs.

Have PMS do its own threshold checking, since it's fine to stat
devices. PMS only ever deleted staging ASECs, so move that logic
into installer and nuke unclaimed staging ASECs. Allocate legacy
ASEC names using PackageInstaller to make sure they don't conflict
with sessions.

Start wiring up session to allocate ASEC and pass through staged
container for installation.

Fix bug to actually delete invalid cluster-style installs.

Bug: 16514385
Change-Id: I325e0c4422fc128398c921ba45fd73ecf05fc2a9
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
3e3b251f46f6ec46a41d42eb7c36a6268096c70d 16-Aug-2014 Jeff Sharkey <jsharkey@android.com> Merge "PackageInstaller API refactoring." into lmp-dev
a0907436c01fd8c545a6b5c7b28bc3bc9db59270 15-Aug-2014 Jeff Sharkey <jsharkey@android.com> PackageInstaller API refactoring.

Switch to using IntentSender for results to give installers easier
lifecycle management. Move param and info objects to inner classes.

Bug: 17008440
Change-Id: I944cfc580325ccc07acf22e0c681a5542d6abc43
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
376e4ba96222163be1f1cf409dc697550be4a285 14-Aug-2014 Nicolas Prevot <nprevot@google.com> When forwarding intents, ignoring the package set in the intent.

Apps should not be allowed to target a specific package in the target user.

BUG: 17025506

Change-Id: I81afa2f8d0a1114d91c001e357366792c63b6577
ackageManagerService.java
c6f22499f3046684d7175e10ca42cce1492cd36f 14-Aug-2014 dcashman <dcashman@google.com> Address KeySet API Review

Hide KeySet API. Change getKeySetByAlias to not require aliases from the calling
package. Make KeySet parcelable. Add hashCode method.

Bug: 16895228
Bug: 17009318
Change-Id: I75951947dfc7a3cca9f8873bda72576d11abaaf0
ackageManagerService.java
29564cd24589867f653cd22cabbaac6493cfc530 07-Aug-2014 Narayan Kamath <narayan@google.com> Remove system_server classes from the boot image.

We set the system_server classpath in the environment
(like we do with BOOTCLASSPATH). After the zygote forks
the system_server, we dexopt the classpath (if needed)
and then launch the system server with the correct
PathClassLoader. This needed several small / medium
refactorings :

- The logic for connecting to installd is now in a separate
class and belongs in the system_server.
- SystemService / SystemServiceManager have now moved to
classes.jar. They are only used from there, and since they
use Class.forName, we want them to be loaded by the
system_server classloader, and not the bootclassloader.
- BootReceiver now moves to frameworks.jar, because it is
used by ActivityThread and friends.

bug: 16555230

Change-Id: Ic84f0b2baf611eeedff6d123cb7191bb0259e600
nstaller.java
ackageManagerService.java
6c4b9de8f1fd594038793c3924b52a44138c319e 08-Aug-2014 Narayan Kamath <narayan@google.com> Validate instruction sets passed to installd.

We don't want folks passing down arbitrary strings.

bug: 16837404
Change-Id: I73ac66b376f1401f9f95f3c6323da6242ac8ed3d
nstaller.java
4903f64ba2478849e6c401f42f5a77c1d4f9f7df 11-Aug-2014 Narayan Kamath <narayan@google.com> Persist the cpuAbiOverride setting.

If an app is installed with an ABI override (adb install -r --abi)
we should remember this so that we don't revert to the scan derived
ABI on the next reboot.

bug: 16476618

Change-Id: I6085bc0099eb613dd9d3b07113c7c13859780697
ackageManagerService.java
ackageSetting.java
ackageSettingBase.java
endingPackage.java
ettings.java
20200849d1dd6ac5e52b3d18ced2d9becb5ff229 11-Aug-2014 Narayan Kamath <narayan@google.com> Fix a couple of PM warnings.

- "Could not delete native binary" : This one is a bit of
a WTF. git history tells us this code has been around for
a very long time (the warning's new though). It's a no-op
because codePath always contains the *current* codePath and
trying to remove native libs from the current codePath will
do nothing for bundled apps. This code sounds like it wants
to delete dangling native binaries for system apps that were
upgraded during an OTA. This sounds like a wrong place to do
that, though.

- "Unrecognized code path" : This one's harmless and removed
by moving this call closer to where it's used.

bug: 16823001

Change-Id: I9b40ae507b2c80ff3fdd45d5699df62bfc86514f
ackageManagerService.java
95ab7849444125387dc88088bb5197ee463d8c17 12-Aug-2014 Amith Yamasani <yamasani@google.com> Decouple user limit from guest creation

Allow Guest to be created even if there are N users.
Allow N users to be created even if there are N-1 users
and a Guest.
Limit number of guests and managed profiles that can
be added.

Added unit tests.

Bug: 15934700
Change-Id: I1a8f0fa38a91d71ef7b2980e05c974244dfc337a
serManagerService.java
7c97bbc39f0b748e413de3cd0b0f0c995a2af0ce 12-Aug-2014 Alexandra Gherghina <alexgherghina@google.com> Bugfix: adds extra null check

Bug: 16976436
Change-Id: Id51fd3125b4e68ff7c0ec37ec031fcb8ff882ed4
ackageManagerService.java
fb2c4d18613efb8197c6b6abcac262b7220b7231 10-Aug-2014 Jeff Sharkey <jsharkey@android.com> GID-based permissions are defined by "android".

This matches all other permissions defined by framework-res.apk,
instead of leaving it null.

Bug: 16907551
Change-Id: I7e2d671443d987906b2f29aa1579bef6380e8a52
ackageManagerService.java
05e8f801b54d43ae43f86a310217ec6f931b5738 08-Aug-2014 Narayan Kamath <narayan@google.com> Reduce the frequency of calls to isDexOptNeededInternal.

The package manager maintains a set of dexopted instruction
sets as a fast path to avoid calling expensive code. We were
correctly adding elements to that list while performing dexopt,
but were *not* adding elements to the list when isDexOptNeededInternal
told us things were up to date. As a result, we'd hit the slow path
100% of the time on userdebug builds in the steady state, i.e, when
the system did not dexopt anything since boot.

With this change, we make sure isDexOptNeededInternal is called
precisely once per boot in such case.

This patch also fixes broken logic for apps that have multiple
code paths. We must mark the paths as dexopted only if we've
processed all paths.

bug: 16828525
bug: 16868741
Change-Id: Icb59121fe915d892e677d9b7e9a4efd11555ae27
ackageManagerService.java
8ad7f2051d722b5a92f0ee0ab46622744b4289ef 04-Aug-2014 Calin Juravle <calin@google.com> Use native ISA for dex code (in case there's a NativeBridge)

In the presence of a native bridge it is more efficient to compile the
dex directly to the native ISA than to use the shared library ISA as a
reference.

This can be achieve by configuring the readonly system properties to map
between the .so ISA and the desired dex code .ISA (e.g.
ro.dalvik.vm.isa.ISA1=ISA2).

Bug: 16185267

(cherry picked from commit I50baa7b37e1465b9adf72d6f6b96f526a08d59c7)
(cherry picked from commit I8fe453a800812e382e8f41b5f7922997aa9c18a9)

Change-Id: I6c9684149691285310c961189b58af8c7f47aff4
ackageManagerService.java
6c0b9da65e36543bb50833d1b54ca532d0bd3aab 08-Aug-2014 Jeff Sharkey <jsharkey@android.com> Handle null IPackageDeleteObserver.

Bug: 16862614
Change-Id: I0c197a994b89d49123027f24fe46827c2b994ab6
ackageManagerService.java
f06009542390472872da986486d385001e91a2a7 08-Aug-2014 Jeff Sharkey <jsharkey@android.com> Logic to confirm uninstalls.

Prompt user for confirmation when caller doesn't have DELETE_PACKAGES
permission. Also extend uninstall events to return failure codes.

Bug: 16515814
Change-Id: I15b52190ff02dbeaaf038b92364264f64c57ba89
ackageInstallerService.java
ackageInstallerSession.java
7328a1b39b3dae1c0cd390c0a3695c6a46b8e9d8 07-Aug-2014 Jeff Sharkey <jsharkey@android.com> Logic to confirm permissions on install sessions.

When an app without INSTALL permission attempts to commit a session,
we involve user to confirm permissions. We currently point at the
base APK, which defines all permissions for an app, handling the case
where a session may only be adding splits.

Add failure codes to represent rejection. Fix bug by ignoring stages
during initial boot scan.

Bug: 16515814
Change-Id: I702bb72445216817bcc62b79c83980c1c2bb0120
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
a25dc2bbe70b7449dc57e9619778ba592c198003 05-Aug-2014 Alex Light <allight@google.com> resolved conflicts for merge of 37651b60 to lmp-dev-plus-aosp

Change-Id: I1fe0e64d2069b7424014bd3ff0bf6f80b439220d
(cherry picked from commit 1faf2d0d25550dc759481fd523456711808e8251)
nstaller.java
ackageManagerService.java
fbd0e9fa37fc17ccd25e4c1f16195bbd27de3c4c 07-Aug-2014 Jeff Sharkey <jsharkey@android.com> Surface user action events when un/installing.

This will be used shortly to connect up with permissions
confirmation UI.

Bug: 16515814
Change-Id: If28cecc28549900d960ac107a1fba0b10ce5bd7b
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
e41ce995a0c2c6b167ed64b51e34865c5d58ea4d 29-Jul-2014 Alexandra Gherghina <alexgherghina@google.com> Add hidden API for removing cross-profile package filters

Bug: 16646591
Change-Id: Iaf6837fe4390ac1018c49df366ea434776ed7244
ackageManagerService.java
f17e498fea935a389d88193dde2d236ea674d10b 06-Aug-2014 Amith Yamasani <yamasani@google.com> Merge "Allow phone UID to export singleton providers" into lmp-dev
41c1ded7f042a4cf303479550b38fa66d7a18906 05-Aug-2014 Amith Yamasani <yamasani@google.com> Allow phone UID to export singleton providers

Also add a user variant of replacePreferredActivity for use
by SmsApplication.

Map user restrictions for SMS/MMS to AppOps perms.

Bug: 16681533
Change-Id: I3dfed5fc754e33bb51c6f571851653a7c2770e46
ackageManagerService.java
f174c6e6de6ba863179401aa7b3d55d91ceed707 05-Aug-2014 Jeff Sharkey <jsharkey@android.com> Stronger constraints around install session IDs.

Generate positive, non-zero session IDs, and don't recycle them
within a given boot. Guard against ID starvation by crazy apps.

Bug: 16792837
Change-Id: I6035afe4d942d358b5ca12b4f818c55885b74aba
ackageInstallerService.java
ceb2adca4905bc1f80545792d82bed5d877ed583 01-Aug-2014 Jeff Sharkey <jsharkey@android.com> Merge "Persist install sessions, more lifecycle." into lmp-dev
1cb2d0d4bba387665128c62c342e59103ea4be26 31-Jul-2014 Jeff Sharkey <jsharkey@android.com> Persist install sessions, more lifecycle.

To resume install sessions across device boots, persist session
details and read at boot. Drop sessions older than 3 days, since
they're probably buggy installers.

Add session callback lifecycle around open/close to give home apps
details about active installs. Also give them a well-known intent
to show session details.

Extend Session to list staged APKs and open them read-only, giving
installers a mechanism to verify delivered bits, for example using
MessageDigest, before committing.

Switch to generating random session IDs instead of sequential.

Defensively resize app icons if too large. Reject runaway
installers when they have too many active sessions.

Bug: 16514389
Change-Id: I66c2266cb82fc72b1eb980a615566773f4290498
ackageInstallerService.java
ackageInstallerSession.java
73140e4df9ed9cfcc897f5cd0742b81d9839d4d4 31-Jul-2014 Christopher Tate <ctate@google.com> Attempt install-time restore even for no-agent apps

Packages without their own backup agents can still have restorable
data to be delivered. Correct the logic for attempting a restore
at install time so that it no longer requires an app-defined backup
agent.

Bug 16688665

Change-Id: I7dcf7ef85ad6b5b393a2c97ce62f1b2eec9d3520
ackageManagerService.java
29762c3dfb7a510c23f021f6797840ebd80663af 29-Jul-2014 Nicolas Prevot <nprevot@google.com> Removing old tag TAG_FORWARDING_INTENT_FILTERS.

By now, all devices should have updated, so we can remove the
old tag name.

Change-Id: Id0bc0e08f3979c5a2652c4eb8da9ff938b5d5bc4
rossProfileIntentFilter.java
ettings.java
43327a61eb57839429fbb064f4166a858788779c 28-Jul-2014 Narayan Kamath <narayan@google.com> Fix regression in renderscript detection.

We must persist the selected (32 bit) ABI for legacy
renderscript apps so that we can launch them correctly.

bug: 16569287

Change-Id: I944acd0cf56ddb1f27337e01bca1b24cd369eb8f
ackageManagerService.java
3f7777fa4f1d392e18bad39edcd4539880c52ff9 24-Jul-2014 Nicolas Prevot <nprevot@google.com> Storing the app who sets a CrossProfileIntentFilter.

When we add a CrossProfileIntentFilter, we store the package and userId of the calling app
inside the CrossProfileIntentFilter.
When an app calls clearCrossProfileIntentFilters, we only remove the filters that the calling app
has set itself.

BUG: 16537557

Change-Id: I6e7bc859383ea66553d9f4230365df8ba27525f3
rossProfileIntentFilter.java
ackageManagerService.java
20e0c50f601e5930a246d4556118423a49c12ca1 25-Jul-2014 Jeff Sharkey <jsharkey@android.com> Offer force-dex-opt when running as root.

Recently we removed the PackageManager inotify triggers, meaning the
only supported ways of installing apps were:

-- adb install -r Foo.apk
-- adb shell stop && adb sync && adb shell start

Iterating on most system apps (like Settings) can use the first
approach, but it doesn't work for "persistent" processes like
SystemUI. (ActivityManager is very particular about how it deals
with persistent apps, and it always sticks with the first
ApplicationInfo found at boot.)

So to enable rapid iteration on persistent apps, we now offer the
one missing piece of forcing a dexopt with a new pm force-dex-opt
command only available to -eng or -userdebug builds. Typical use
for iterating on persistent apps now looks like this:

$ mmm frameworks/base/packages/SystemUI/ && adb sync &&
adb shell pm force-dex-opt com.android.systemui &&
adb shell kill `pid systemui`

Yay!

Change-Id: I0ae2467f1d7cda56c70ba20953cd25fa8ee766ff
ackageManagerService.java
16c8e3f49497b6046972ae650772f65768366be8 25-Jul-2014 Jeff Sharkey <jsharkey@android.com> PackageInstaller changes based on feedback.

Mostly cosmetic changes from API council feedback.

Bug: 16543552
Change-Id: Ic926829b3f77c31f50a899c59b779353daf00d59
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
466d203c4ff032477d9a6bdb077ce3cd9b4fe070 23-Jul-2014 Kenny Guy <kennyguy@google.com> Add method to launch settings app details page.

Add a method to LauncherApps to allow launchers to
show application details for an app in a managed profile.

Bug: 16371359
Change-Id: I23acb4365c09e4a7b9fa742ae6fc7e04434f45aa
auncherAppsService.java
340ca8b7e81afe891b2d76a08e406eafc63c4fc8 23-Jul-2014 Narayan Kamath <narayan@google.com> Handle apps that share a UID with the system_server correctly.

The system process does not explicitly declare any ABI, or
package any native code that it depends on but its ABI is
dictated by the zygote configuration. We need to account for
it correctly to have apps that share a UID with it work
correctly.

bug: 16317188

Change-Id: I84713c64409d7fdcc314114231e87a9263d5c5e7
ackageManagerService.java
045e648980e66a19f7021116020e733814ac8019 23-Jul-2014 Narayan Kamath <narayan@google.com> Handle renderscript apps in the system partition correctly.

Get rid of various pointless calls to setBundledAppAbisAndRoots.
This method should only need to be called during scanPackageLI.

There's no other good reason to call it.

bug: 16484595
Change-Id: I2830b140058f0fffdbedb51d673e514852854626
ackageManagerService.java
84e71d1d61c53cd947becc7879e05947be681103 23-Jul-2014 Jeff Sharkey <jsharkey@android.com> Remove APK observers.

Most app installations have migrated to the new cluster-style layout
where each app is placed in a unique directory. There are now two
general issues with these observers:

We can't know when a push/sync has finished delivering all splits
for an app. Also, inotify isn't recursive, so we'd have to manage
watches for each app directory.

Change-Id: I3770fa9059ddf80f933a3804714f2e52591fce49
ackageManagerService.java
33f5ddd1bea21296938f2cba196f95d223aa247c 22-Jul-2014 Dianne Hackborn <hackbod@google.com> Add permissions associated with app ops.

Change-Id: I575ad7a3ceea59486ca601f69760b14f6269511d
ackageManagerService.java
e5bcff624fb58b6f95be8ddff7f5b6b3bf5d19c7 20-Jul-2014 Amith Yamasani <yamasani@google.com> Rename setApplicationBlocked to setApplicationHidden

This corrects the expected behavior of the app state. Hidden apps
can be installed by the store to be brought out of hidden state.

Bug: 16191518
Change-Id: Id128ce971ceee99ba1dea14ba07ce03bd8d77335
ackageManagerService.java
ackageSettingBase.java
ettings.java
serManagerService.java
603862517569cbebed9a7bd231c3fb80292d4bcd 21-Jul-2014 Jeff Sharkey <jsharkey@android.com> Detect bundled app ABI for cluster-style layout.

Now that build system switched to cluster-style layout for bundled
apps, we need to detect primary/secondary ABI based on that layout.

Bug: 16456263
Change-Id: If6daf60ee1815bb6fde560a0c373b4f2bc8bd3a8
ackageManagerService.java
bb4d6a20bdb14903067e486b33f842fac388e338 17-Jul-2014 Amith Yamasani <yamasani@google.com> Merge "Split telephony restrictions into outgoing calls and sms" into lmp-dev
390989da1967f9d385212cd2e22a50589ce69046 17-Jul-2014 Amith Yamasani <yamasani@google.com> Split telephony restrictions into outgoing calls and sms

DISALLOW_TELEPHONY renamed to DISALLOW_OUTGOING_CALLS and introduced
DISALLOW_SMS.

Outgoing emergency calls should always be permitted.

Change-Id: I0a38ef6e2df9dcf62d16fd93622ad61f4327614f
serManagerService.java
69eef8a0d250ae1b50b510499014e109bd2c6112 17-Jul-2014 Jeff Sharkey <jsharkey@android.com> Merge "Support cluster-style installs for bundled apps." into lmp-dev
1e9189a276e967a7a74ff44a44cf627764396954 17-Jul-2014 Jeff Sharkey <jsharkey@android.com> Support cluster-style installs for bundled apps.

Bug: 16319961
Change-Id: I499b904dfd56f236a1b574c29a44272ed814be0f
ackageManagerService.java
f05b231485fdbf4deedd22aecc51d9b0a9550e47 17-Jul-2014 Kenny Guy <kennyguy@google.com> Merge "Allow app restrictions for uninstalled packages." into lmp-dev
d21b2181390fb96e3a0742be9b985a52d4de2d2c 17-Jul-2014 Kenny Guy <kennyguy@google.com> Allow app restrictions for uninstalled packages.

Stop cleaning up app restrictions for packages
that aren't installed.
Remove app restriction file if restrictions is
set to an empty or null bundle.
All user types may now have restrictions if a
profile or device owner is present.

Bug: 15565914
Change-Id: I55f38ca0ad7794b9fc2967113973dc035a416558
serManagerService.java
78fd9d6b36b78abb57bf2a29e314202bdf26f480 17-Jul-2014 Kenny Guy <kennyguy@google.com> Merge "Check for exported and category before starting activity." into lmp-dev
e702404c5a9d46765acb76f63ea6338d0a42b030 08-Jul-2014 Nicolas Prevot <nprevot@google.com> DO NOT MERGE

Remove cross-profile intent filters when removing a user.

When a user is being removed: removing cross-profile intent filters that have
this user as their source.
This makes sure that if the user id gets reassigned without restarting the phone,
we do not have old information from the preexisting profile.

Change-Id: Ie3a2aa0cbbe6c9eb9e945e650fd907e5cc012409
(cherry picked from commit d44e2d7340c70406d8b5eb8b3d6c6c0daaa8705f)
ettings.java
2df1892f411de6fa93ba487e3c4d23a079b74fcb 17-Jul-2014 Kenny Guy <kennyguy@google.com> Check for exported and category before starting activity.

Make LauncherAppService check that component passed to
startActivityAsUser is exported and has the category
Intent.CATEGORY_LAUNCHER before starting it.

Bug: 15989072
Change-Id: I29d03fae49ff0ca8d7f7524f5e71895d62ff3cae
auncherAppsService.java
9a445771f57dd15b06db0dbefd66c368d84eec2d 16-Jul-2014 Jeff Sharkey <jsharkey@android.com> Install sessions only inherit APK files.

Also track historical install sessions for debugging purposes. Hide
signature verification API for now. Clear code cache only after
killing the app being upgraded.

Bug: 14975160
Change-Id: I52fc7f11d2506f792236d8a365c8cfed21b46c30
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
2053168eb4506e2f8795afdbe9731c6451e1589c 14-Jul-2014 Narayan Kamath <narayan@google.com> Dexopt for Context.createPackageContext when code is included.

The package manager now keeps track of per ISA dex-opt state.

There are two important things to keep in mind here :

- dexopt can potentially be very slow. In cases where the target
package hasn't been dexopted yet, this can take multiple seconds
and may cause an ANR in the caller if the context is being
created from the main thread.
- We will need to remove the constraint that dexopt can only be
requested by the system (or root). Apps will implicitly be
requesting dexopt by asking for package contexts with code included.
It's important to note that unlike dalvik, the dexopt stage in ART
isn't optional. ART cannot load classes directly from dex files.

bug: 15313272
Change-Id: I0bd6c323a9c1f62f1c08f6292b7f0f7f08942726
ackgroundDexOptService.java
ackageManagerService.java
d8723bd3d68fc62134729a767ffead821add128e 16-Jul-2014 Narayan Kamath <narayan@google.com> Merge "Adjust nativeLibraryDir for package contexts of multiArch installs." into lmp-dev
7dba6eb3ac4fd6c8195cb0d0425866de50a9e114 16-Jul-2014 Narayan Kamath <narayan@google.com> Adjust nativeLibraryDir for package contexts of multiArch installs.

When we're creating a package context for a multi-arch app,
adjust the native library directory to match the bitness of
the process creating the context.

This change also removes apkRoot (which wasn't really being used)
and replaces it with a fully constructed secondary library path.
The secondary library path is a transitional measure until we
can reorganize the system image so that we can use nativeLibraryRoot
for system paths as well (nativeLibraryRootRequiresIsa will then
be true for all packages except for legacy installs).

bug: 16013931

Change-Id: I5ae090334b377b9e087aecf40075fab81b20b132
ackageManagerService.java
5fcaa0c6705ae42be8ff507b362fb8e2393a606a 16-Jul-2014 Jeff Sharkey <jsharkey@android.com> Merge "Clearing "cache" shouldn't include "code cache."" into lmp-dev
78f3cf971b33aa5788f59234fbf3b93b0d0197ec 16-Jul-2014 Jeff Sharkey <jsharkey@android.com> Clearing "cache" shouldn't include "code cache."

Bug: 16187224
Change-Id: I075b651d1ff89d4f0232497d28a6b11270cba4d9
ackageManagerService.java
4ed745d359ada6986ac15d8718452e5c55f40170 16-Jul-2014 Jeff Sharkey <jsharkey@android.com> Add code cache directory for apps.

This provides a directory where apps can cache compiled or optimized
code generated at runtime. The platform will delete all files in
this location on both app and platform upgrade.

Bug: 16187224
Change-Id: I641b21d841c436247f35ff235317e3a4ba520441
nstaller.java
ackageManagerService.java
ettings.java
78a130144bdd047665f00782c481d31edb3e5fb7 16-Jul-2014 Jeff Sharkey <jsharkey@android.com> Mark resource-only splits as hasCode=false.

PackageManagerService now skips dexopt for split APKs that don't
declare they have code. Also surface more detailed error messages
in logs.

Bug: 14975160
Change-Id: Ie6078dba724815020cee59b7fc52317e88ca097a
ackageManagerService.java
da96e137bcc8191c584ada7b5de31eaae92f244f 15-Jul-2014 Jeff Sharkey <jsharkey@android.com> Parse more split APK manifest details.

Allow split APKs to define activities, services, receivers,
providers, and metadata. However, support for many manifest items
are explicitly omitted.

Only dexopt split APKs that include code.

Bug: 14975160
Change-Id: I2fbf99e2a62328aa2185e5924755af33060282fc
ackageManagerService.java
d0a2de06a7fb4daaf91a75e9e04a2cb54ebc6fba 16-Jul-2014 Jeff Sharkey <jsharkey@android.com> Merge "Add code cache directory for apps." into lmp-dev
61e9bf246f3eacf1b11305eb86a8cb2a217adc5c 16-Jul-2014 Narayan Kamath <narayan@google.com> Fix install --abi for apps with no native code.

We will need to record the overriden ABI in the package
settings (and applicationInfo) so that we launch the app
with it.

Change-Id: Ib71aae69d006a4b0e85e7101c0e0cebf1a950997
ackageManagerService.java
377ea31c43afe02d452fe462b2b09f23e58d6347 15-Jul-2014 Narayan Kamath <narayan@google.com> Don't throw errors on sharedUid adjustment.

Given that this is "best effort" anyway, stop short of
aborting installs when ABIs can't be adjusted. Otherwise
it will be impossible to test or upgrade an APP that has
a shared UID and changes ABIs. All apps that use a given
sharedUid are expected to use the same instruction set.

Change-Id: Ia9ffd1eb2df7c6ec9a39b23fc40e58794c013749
ackageManagerService.java
f5f1828d968e427b95fe219af022434f1cdfaeb4 15-Jul-2014 Narayan Kamath <narayan@google.com> Fix multiArch installs where only some archs are available.

In this case, NO_MATCHING_ABIS shouldn't result in a failure
when we're trying to match against one of SUPPORTED_32_BIT_ABIS
or SUPPORTED_64_BIT_ABIS.

There shouldn't be a general requirement that packages must
contain both 32 and 64 bit libs because it might legitimately
exclude one or the other for reasons such as compatibility
etc.

bug: 16299358

Change-Id: I5f66b0a54b63b93b36371b584e9cf6bed07c507a
ackageManagerService.java
69ea974f1712c83a9ad194187237edf1169f9064 15-Jul-2014 Jeff Sharkey <jsharkey@android.com> Merge "Public API for PackageInstaller!" into lmp-dev
6c833e07a05c48ca60ee4d72421bf8b1e78dc710 15-Jul-2014 Jeff Sharkey <jsharkey@android.com> Public API for PackageInstaller!

Flesh out documentation and finalize first cut of API. Also surface
installLocation and splitNames through PackageInfo.

Bug: 14975160, 15348430
Change-Id: Ic27696d20ed06e508aa3526218e9cb20835af6a0
ackageInstallerService.java
ackageInstallerSession.java
9f92ffa9278db42655b4d422d887eed0a199886b 14-Jul-2014 dcashman <dcashman@google.com> Merge "Initial KeySet API." into lmp-dev
9d2f441f9bb2c8dcac1150e2cba1d15a86a4efb1 09-Jun-2014 dcashman <dcashman@google.com> Initial KeySet API.

Previously submitted but reverted due to doc-compilation bug.

Bug: 6967056
Change-Id: I9bd7ef299a4c92c4b327f5b5d7e951f0753b4c8a
eySetHandle.java
eySetManagerService.java
ackageManagerService.java
ad11eb52fe62b6696df2194cb9e176f7d799e844 14-Jul-2014 Jeff Sharkey <jsharkey@android.com> Pass install result message; path selection.

Oops, forgot to include message argument to invoke the new-style
callback. Also use more robust way of generating cluster APK
directory names, and add more logging details on rename failure.

Change-Id: Ifa8abdd1db58b73e13b9a8077ec126cf20a0d90e
ackageInstallerSession.java
ackageManagerService.java
a10311434778ea1be1621c2251c0c8c2966f337b 13-Jul-2014 Jeff Sharkey <jsharkey@android.com> Package installation listener events.

Flesh out implementation of install session observers. Carve out 20%
of published install progress for final system operations such as
dexopt, etc.

Add dumpsys output for active install sessions. Create explicit
fsync() instead of overriding meaning of flush(). Hack to throw
IOExceptions over Binder calls.

Bug: 14975160, 15348430
Change-Id: I874457e40c45d2661bc0a526df9285ffea4bb77c
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
e0b0bef75b66f0a87039c8f58c17b1596a2baebe 13-Jul-2014 Jeff Sharkey <jsharkey@android.com> Surface detailed error messages from PMS.

We now both log detailed error messages and relay them back to any
observer. Start refactoring PMS to throw when errors are encountered
internally to make it easier to reason about flow control; already
uncovered a few instances of errors being silently ignored!

Change-Id: Ia335c5e31bd10243d52fd735c513ca828e83dca0
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerException.java
ackageManagerService.java
5de7377feca5242fe7127e2d4dc7792d4886d365 12-Jul-2014 dcashman <dcashman@google.com> Revert "Initial KeySet API."

This reverts commit 9a643fe02bc960e266484547dda5572b094a4c72.
eySetHandle.java
eySetManagerService.java
ackageManagerService.java
405912bce074e9e59a246e2357a108e50dffabf8 09-Jun-2014 dcashman <dcashman@google.com> Initial KeySet API.

Bug: 6967056
Change-Id: I47a01bd5dc25591cc70f58f38920ad0a021094ae
eySetHandle.java
eySetManagerService.java
ackageManagerService.java
d79fdf1c62671abac376c71aca8fa19484a1ecf2 21-Jun-2014 dcashman <dcashman@google.com> Remove KeySetManagerService lock.

The KeySetManagerService is a part of the PackageManagerService, which is
responsible for maintaining the association between packages, keysets and
public keys. This information is a critical component of the
PackageManagerService data, and should require the holding of the
PackageManagerService's lock. Remove the existing KeySetManagerService lock
and require the mPackages lock to be held instead.

Bug: 6967056
Change-Id: I803f8388e42469d30562b40212cf497320851268
eySetManagerService.java
ackageManagerService.java
bb580670350b76fa2fcc5ee873f99b7970759cbf 10-Jul-2014 Jeff Sharkey <jsharkey@android.com> Progress toward installer public API: callbacks.

Instead of surfacing all the existing cryptic error codes, we're
going to classify them into broad categories when surfacing through
public API. This change introduces InstallResultCallback and
UninstallResultCallback, and wires them up to existing AIDL
interfaces.

Also start defining general SessionObserver for apps interested
in general progress details, such as Launcher apps. Details about
active sessions are returned through new InstallSessionInfo objects.

Bug: 14975160
Change-Id: I068e2b0c30135f6340f59ae0fff93c321047f8f9
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
398b6c26c3c46724e4c44b81d9a2541720f8750b 11-Jul-2014 Narayan Kamath <narayan@google.com> Fix an abi <-> instructionSet mixup.

We should be calling is64BitInstructionSet and
not is64BitAbi.

Change-Id: I5b099af19f1d7409f65f63493d3f13a830f4fb5d
ackageManagerService.java
557b26de560a0bed3f04afd035b0a5f97f05f43c 11-Jul-2014 Narayan Kamath <narayan@google.com> Merge "Fix broken dexopt logic."
fd12a35dfc5fa30d8221ed6214f8df1f04e569ef 11-Jul-2014 Narayan Kamath <narayan@google.com> Fix broken dexopt logic.

The logic was incorrect in the presence of multiple paths
(cluster installs) or multiple instruction sets (multi arch)
because of an early return in the case of sucessful dexopt.

- Rewrite this logic to make it (hopefully) clearer.
- Fix a related bug in getAppDexInstructionSets.
- Add instruction set to the dexopt logs.

bug: 16013931
Change-Id: I18c9755583f0a6f8be70469ec2062269564f0f41
ackageManagerService.java
70fcf0c75fee68873a2f1abfe26c8afd669c51ba 11-Jul-2014 Amith Yamasani <yamasani@google.com> Fix apparent delay in removing a managed profile

Bug: 15268575

When returning the list of profiles, don't include dying users.

Change-Id: Ifeaed5c7c2b93922cddea22057dd890a1b3750fc
serManagerService.java
8219a25e31b52c701e45ebae82219c64ea18134b 11-Jul-2014 Kenny Guy <kennyguy@google.com> Merge "Enforce block uninstall in PackageManager"
ad8dff5b1343fa8246674c240d9dd95346f6f802 11-Jul-2014 Narayan Kamath <narayan@google.com> Use the correct ABI list while copying native libs.

copyNativeBinariesIfNeededLI returns an index into the list
it was handed, so using Build.SUPPORTED_ABIS here is incorrect.

bug: 16013931

Change-Id: I35e0dad4b5e0c1dc1199f381d8b99cd228719092
ackageManagerService.java
84f1294a958b42000755dc6570e3eda72ab42140 11-Jul-2014 Jeff Sharkey <jsharkey@android.com> Always derive native library paths at runtime.

Over time, we've unpacked native libraries at various places with
respect to their source APK. Persisting this path in PackageSettings
has caused more pain recently with the switch to supporting multiArch
and cluster installs.

This change switches us to always derive the native library paths at
runtime based on the type of install. This also ensures that
transitioning between a bundled system app and an upgraded system
app will always build the right path.

We still persist the last generated path into PackageSettings to make
cleanup at uninstall time easier.

Bug: 16208505, 16206748, 16212206
Change-Id: Ieb82a424ca4a92b5674983453c50ba4b695abfb0
ackageManagerService.java
ackageSettingBase.java
ettings.java
989eb371bf8f572fed1e65c6d8aeeb2548be89a7 17-Jun-2014 dcashman <dcashman@google.com> Change key-set/public-key manifest relationship.

Separate definition of public keys and keysets in the manifest to better
represent their relationship. The 'key-set' tags should have nested additional
'public-key' tags that indicate which of the defined 'public-key' tags are
associated with them. The first use of a given 'public-key' name should define
its value; subsequent uses may refer to it only by name. 'key-set' and
'public-key' names may not intersect.

Also, change 'keys' tag to 'key-sets' to avoid issues with previous keysets
implementation.

Bug: 6967056
Change-Id: I7534e4a42326e97b67b55509187c0d3c21a2bb32
eySetManagerService.java
ackageManagerService.java
41cd577c12a3525663101ff9217ded509bb869d6 11-Jul-2014 Amith Yamasani <yamasani@google.com> Send USER_FOREGROUND and USER_BACKGROUND to all related profiles

Also do a check for null applicationInfo object during user creation.

Bug: 16211029
Change-Id: Ib49c241cf3698735e273edf5704bef277f1142a5
ettings.java
1b88da54a684cf12f36b74bbc7c9548f35180fbe 10-Jul-2014 Kenny Guy <kennyguy@google.com> Enforce block uninstall in PackageManager

Bug: 14127299
Change-Id: I144233b97e5774f6a5d1d2b49f3f0f8a360557ac
ackageManagerService.java
aef5fcdcb5ff13cbdc64f18b315750b8a9a7fe3e 10-Jul-2014 Narayan Kamath <narayan@google.com> Don't assume all system apps are bundled.

Calling setBundledAppAbisAndRoots will end up
setting a path that points to /system/ if it's called
on a system app that was subsequently updated.

bug: 16208505

Change-Id: I0bf85e0341029b3d4d209a402d30c2ce357daaf2
ackageManagerService.java
ff110bd61a69f7ed8602ae14b27f7befec76b2e7 04-Jul-2014 Narayan Kamath <narayan@google.com> Multi-arch application installs.

Each application now has two ABIs, the primary
and the secondary. The app is always launched with
the primary, but the secondary might be used by other apps
that load the given applications code. This implies we
must:

- dex2oat the app both ways.
- extract shared libraries for both abis.

The former is relatively straightforward but the latter
requires us to change the layout for shared libs that we
unpack from applications. The bulk of this change deals
with the latter.

This change continues to fill in nativeLibraryPath during
scans for backwards compatibility. This will be removed in
a future patch.

Change-Id: Ia943dd11ef815c5cbfc60f17929eaa2a652a385a
nstaller.java
ackageManagerService.java
ackageSetting.java
ackageSettingBase.java
endingPackage.java
ettings.java
ec55ef0934b8e0d1bb705434947de817f7be57f1 08-Jul-2014 Jeff Sharkey <jsharkey@android.com> Extend pm to support sessions and split APKs.

Separate commands to create an install session, stream files into the
staging area, and then commit the install. Streaming can accept data
from stdin across adb, avoiding extra copy from push.

Extend FileBridge to support blocking close(). Always destroy
session regardless of result.

Bug: 14975160
Change-Id: Ic3f462e7d1901079b785e210228950cdfa676466
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
dbbf07a5c7f514f2168f236e1df3b2ca70d4ab2f 09-Jul-2014 Jeff Sharkey <jsharkey@android.com> Upgraded system apps could be mono or cluster.

Derive old-style paths for monolithic installations, otherwise
assume cluster installation.

Bug: 16163776
Change-Id: I03f1a12f9c07f6177a5c09be2bfe967416c07652
ackageManagerService.java
284d0906cde8922983f35edaac79900806026d82 09-Jul-2014 Robin Lee <rgl@google.com> am 06505d23: am 1f0180bf: am 74803e55: Merge "Make misc config directory during user creation"

* commit '06505d234ddf66cb71d1f7defd096bdf68bc222d':
Make misc config directory during user creation
06505d234ddf66cb71d1f7defd096bdf68bc222d 09-Jul-2014 Robin Lee <rgl@google.com> am 1f0180bf: am 74803e55: Merge "Make misc config directory during user creation"

* commit '1f0180bfa877373b239a5675f715288db829fa75':
Make misc config directory during user creation
5e6643c1376130e402d30da647fdfebd86b7f2fc 09-Jul-2014 Jeff Sharkey <jsharkey@android.com> Merge "Clean up IPackageManager install surface area."
513a074de68a4772a9900e90f38e74ff92c15e7c 09-Jul-2014 Jeff Sharkey <jsharkey@android.com> Clean up IPackageManager install surface area.

Also more removal of encryption support.

Change-Id: If525dc5a8422134515f225a8ac4731e968069468
ackageManagerService.java
8d479b0c2ddb150182bcf510876a240cb869661b 08-Jul-2014 Jeff Sharkey <jsharkey@android.com> Derive library path for upgraded system apps.

Bug: 16156270
Change-Id: I368433063ff33d15129c8076ddc6f1e2a0963e54
ackageManagerService.java
65b1a7c0ba4213d625b1cb36d1405cf8767310d4 08-Jul-2014 Jeff Sharkey <jsharkey@android.com> Offer to scan cluster packages at boot.

Bug: 14975160
Change-Id: Ib637f68354b3d4ce4b5b23d875d8e94ccd497fd2
ackageManagerService.java
d746057f2414cba2bdc69257cc5be8cb681bb592 07-Jul-2014 Jeff Sharkey <jsharkey@android.com> Change new file installs to be cluster-based!

Now that all the other pieces are in place, we're ready to start
installing new file-based packages as a cluster (the new unified
directory-based layout). This greatly simplifies the renaming
process.

Also add helper methods to ApplicationInfo to give a much clearer
mapping between it and internal field names, since we can't change
the public API.

Add recursive restorecon().

Bug: 14975160
Change-Id: I72a63c5ddbc594c2fec4a91dd59f73ef253fbfd7
ackageInstallerSession.java
ackageManagerService.java
ettings.java
4ec2023349f19b2fd2461aa3c9b208eb799a662e 09-Jul-2014 Jeff Sharkey <jsharkey@android.com> Merge "Derive library path for upgraded system apps."
9a944532af0f07d8b916556d229c21d3eda91a59 08-Jul-2014 Jason Monk <jmonk@google.com> Fix UserManagerService.setUserIcon throwing expt.

setUserIcon sends a broadcast that requires INTERACT_ACROSS_USERS.
Since the function directly checks MANAGE_USERS permission, added
a clear calling identity.

Alternative solution would be to make function check for one of
INTERACT_ACROSS_USERS permissions before performing any actions.

Change-Id: Ibbf27d4e188d059671024e4bb62f92a2daea3661
serManagerService.java
539a7ef5c93b3a4d6ad7db0d278b1aa5814c0393 07-Jul-2014 Alexandra Gherghina <alexgherghina@google.com> Removes cross profile package information when removing an user

This makes sure that if the user id gets reassigned without restarting the phone,
we do not have old information from the preexisting profile.

Also renames method which needs write locks.

Bug: 15928463
Change-Id: I30b0f85cf90d3e0c289a37bcbaec8da63499a170
ackageManagerService.java
ettings.java
3a0dbfb206dbde546fffa35902cf13101667eb79 07-Jul-2014 dcashman <dcashman@google.com> Record properSigningKeySet values to packages.xml

PackageKeySetData records all of the defined keysets which are a subset of an
apk's signing keyset. It also records the original superset for all of these
in an easy-to-access 'proper' signing-keyset which is consulted as the official
source for a package. This value was not being recorded, causing
PackageManager to re-gather the certificates for a package on each boot after
a fix for a different bug. Record it.

Bug: 16076095
Change-Id: If5a7f6d70dd4784284d7bab466dab0311aa13c28
ettings.java
b5afefbd0770a9af9e1b8a8b9d01a26e2f0338a7 04-Jul-2014 Nicolas Prevot <nprevot@google.com> Fixing bug when checking that the target user can handle the intent.

BUG: 16079965
Change-Id: Iac61d1c20f5b66b3f3016b82bc4e48d7997ea1a0
ackageManagerService.java
be520fba1e45c77ca20eb66005a0cf19e10939a1 05-Jul-2014 Jeff Sharkey <jsharkey@android.com> Teach DCS about cluster packages.

For the time being, DCS is going to still be doing heavy lifting for
some install tasks, so it need to know how to handle both monolithic
and cluster packages. This change is mostly plumbing work to
eventually handle any various splits APKs that we may encounter.

Bug: 14975160
Change-Id: I39848d5666f9083cb4eca493e5cdaa868f3f99fb
ackageManagerService.java
0c54798aac8a86fed24b14a66f09797d58ad0399 06-Jul-2014 Jeff Sharkey <jsharkey@android.com> Start removing ContainerEncryptionParams.

The new PackageInstallerSession APIs will allow installers to deliver
bits directly into system protected storage, so we no longer need
encrypted containers.

Change-Id: I8b598cb149b7dfd1d41e6626c1359610a573edf1
ackageManagerService.java
73767b9d607d99b3a027619b5c6b7f1a09b7673d 05-Jul-2014 Jeff Sharkey <jsharkey@android.com> Extract native code from split APKs.

In the new split APK world, multiple APKs work together to define a
single package. This means that native code may be split among those
APKs. To handle this, extend NativeLibraryHelper to examine all
APKs in a package ordered by splitName.

A package has valid native code as long as one matching ABI is found
inside. The "best" ABI found across all APKs is picked for the
entire package. No attempt is made to ensure that every native
library defined is available for the picked ABI; that's the
responsibility of the installer.

Re-introduce PackageLite to represent a lightweight parsing of an
entire package, which may be a single monolithic APK or a cluster
of one or more APKs.

Remove native code extraction from InstallerSession, since it'll be
handled inside PMS for this release.

Bug: 14975160
Change-Id: I4f4db0f82e88a46101c7777499ebc0a11fd911f9
ackageInstallerSession.java
ackageManagerService.java
c13053bf1c05b980421611487ce67677c08db299 29-May-2014 Kenny Guy <kennyguy@google.com> Add package state to block uninstall.

Add package state to allow profile or device
owners to block uninstall of packages.
Add API to DevicePolicyManager to set/get the
state.

Bug: 14127299
Change-Id: I03528819850b42df7bafa7747bb9e4558d20c4e6
ackageManagerService.java
ackageSettingBase.java
ettings.java
57dcf5b177b56195421535938544f32d8b591b42 19-Jun-2014 Jeff Sharkey <jsharkey@android.com> Slow progress towards APK clusters.

Differentiate between "split APKs" and "cluster packages". A cluster
package is a directory containing zero or more APKs (base+splits),
and a monolithic package is a single APK (base).

PackageSetting will use the directory name as its codePath, so track
the baseCodePath separately. Clarify documentation in several
places.

Require that all installers provide file:// URIs through existing
hidden APIs; PackageInstaller hasn't been able to read content://
URIs for a long time.

Bug: 14975160
Change-Id: I1c6fed1b55205c2474b09871161a98a26669d22e
ackageInstallerSession.java
ackageKeySetData.java
ackageManagerService.java
ackageSettingBase.java
ca76cccb61d4d914abbb5079cb65455505494e2f 02-Jul-2014 dcashman <dcashman@google.com> Merge "Initial work for key rotation."
55b1078e2a1b56daa85edfd5000a5844d3c7914b 09-Apr-2014 dcashman <dcashman@google.com> Initial work for key rotation.

Introduces the upgrade-keyset tag to AndroidManifest.xml. This specifies a
KeySet by which an apk must be signed in order to update the app. Multiple
upgrade KeySets may be specified, in which case one of them must be used to
sign the updating apk. If no upgrade-keyset is specified, the current logic
involving signatures is used.

Current Key Rotation Design Decisions:
-Apps using a shared user id may not rotate keys.
-All acceptable upgrade keysets must be specified, including the key signing
the app. This enables key rotation in one update, but also 'locks' an app if
an incorrect upgrade keyset is specified.
-Minimal changes to existing KeySet code.

Bug: 6967056
Change-Id: Ib9bb693d4e9ea1aec375291ecdc182554890d29c
eySetManager.java
eySetManagerService.java
ackageKeySetData.java
ackageManagerService.java
ettings.java
dbbc070670c1160b15b92a5928e8b9b5bf008b3f 02-Jul-2014 Narayan Kamath <narayan@google.com> am e2840977: am 6e84f8c1: Merge "Fix native crashes when APKs can\'t be opened."

* commit 'e2840977d37e4d19425d448b54895536e43a2989':
Fix native crashes when APKs can't be opened.
db32fb646d90abb5e2281bd145d9d9615c65cbed 01-Jul-2014 Nick Kralevich <nnk@google.com> am d172419e: am 9b1a7d45: Merge "Allow different SELinux policies for third party apps."

* commit 'd172419e9a36f61af8c98d316ec2625e1f1304f6':
Allow different SELinux policies for third party apps.
df0697e392c1789a49966d5091c2ee9e1003a02f 02-Jul-2014 Julia Reynolds <juliacr@google.com> Merge "Apply ENSURE_VERIFY_APPS restriction to PackageManagerService."
6728239cfe8a71d3294b9368a4af73e427a2341c 30-Jun-2014 Julia Reynolds <juliacr@google.com> Apply ENSURE_VERIFY_APPS restriction to PackageManagerService.

Bug: 15986973
Change-Id: I9e8dae15cb866a3bb16e91fc49086fe1633f0bf8
ackageManagerService.java
f29131f7013dc0d6994556b95e74db608c89beb8 02-Jul-2014 Narayan Kamath <narayan@google.com> Merge "Fix native crashes when APKs can't be opened."
cef0b39b9211882f59b6bfe1148e2cd247056693 12-Jun-2014 Narayan Kamath <narayan@google.com> Fix native crashes when APKs can't be opened.

There was lax / incomplete error checking around the
construction of Apk handles. This change changes the ApkHandle
API and makes it throw IOException if the zipfile couldn't
be opened.

Additionally :
- Fix a resource leak in DefaultContainerService
- Report errors correctly during package moves.

bug: 15563874
(cherry picked from commit ec4516470d7ce6e47769591d678c838bd3f6f388)

Change-Id: Ia35b464355467d0d36faf34fae85acbbab3f2896
ackageInstallerSession.java
ackageManagerService.java
7f7b0c759e2970178ef68805b21f06a26e24eb76 23-Jun-2014 Nicolas Prevot <nprevot@google.com> Returning badged icons for components of corporate apps.

So, corporate apps in disambiguation dialogs are badged.
And updating the way we show the icon of the personal space to this new design.

BUG: 14377051

Change-Id: Idc707773a64a8feb2d9d4df88c425d5100542636
ackageManagerService.java
1c7c319bb89b9988bfd12afc3e8d89449fd163fc 26-Jun-2014 Jason Monk <jmonk@google.com> User restriction for disallowing window creation

Block any types of windows that could by used by apps to create
views on top of a locked app. This can be used by device admins
in conjunction with lock task mode.

Added a way for system (and priv apps) to bypass user restrictions
for specified op codes.

Bug: 15279535
Change-Id: I2381530ef6226a5bb32a99bb4030baafb39bf564
serManagerService.java
3edb62a5ade9de69f55df239a55dac990f4bf5c6 01-Jul-2014 Nick Kralevich <nnk@google.com> am db32fb64: am d172419e: am 9b1a7d45: Merge "Allow different SELinux policies for third party apps."

* commit 'db32fb646d90abb5e2281bd145d9d9615c65cbed':
Allow different SELinux policies for third party apps.
be7c50e0a14e91330ce13161bc14a33d34ff6aca 30-Jun-2014 Dianne Hackborn <hackbod@google.com> Add network access blocking when in battery save mode.

The network policy manager now monitors battery save mode and,
when in battery save, uses its facility to block access to metered
networks to block access to all networks. That is, it tells the
network management service that all networks have an (infinite)
quota, and puts various app uids to be restricted under quota
interfaces as appropriate.

This new network blocking needs a new facility to be able to white
list apps, such as GmsCore. To do this, I refactored the package
manager's permission configuration stuff into a separate SystemConfig
class that can be used by others, and it now has a new tag to
specify package names that should be white-listed for power save
mode. These are retrieved by the network policy manager and used
to build a whitelist of uids.

The new general config files can now go in system/etc/config,
though currently everything still remains in the permissions dir.

Still left to be done is changing the semantics of what uids are
allowed in this mode, to include all perceptable uids. (So that we
can still do things like background music playback.) This will be
done in a follow-on CL.

Change-Id: I9bb7029f61dae62e6236da5ca60765439f8d76d2
ackageManagerService.java
e4afaa3a3d7c2885b82fe43f51bcf04e036f7462 30-Jun-2014 Amith Yamasani <yamasani@google.com> Store and retrieve default Guest settings

Save the default guest restrictions for use when a guest is created.

Bug: 15761405
Change-Id: I28db7d823944b0b47527a4909c10cc856c842a62
serManagerService.java
37271629b5bcf54858d6b4c4f5dbde6e85614d79 30-Jun-2014 Julia Reynolds <juliacr@google.com> Merge "If DISALLOW_REMOVE_USER is enabled, UserManager.removeUser should not remove users."
75175025f8d727d9841308fa0afcb9a7a1a118cd 26-Jun-2014 Julia Reynolds <juliacr@google.com> If DISALLOW_ADD_USER is enabled, do not allow users to be created.

Bug: 15910634
Change-Id: I7e14bf7d71001f218402a5d90e2aadc54fcfd875
serManagerService.java
152d5cd30bdfd88b0903b205d38c6966cbded5a8 24-Jun-2014 Narayan Kamath <narayan@google.com> am 22a32d88: am 2a0f9e6a: Merge "Explicitly list out the list of cache subdirs to prune."

* commit '22a32d883794a7a96ff5ffb4830ea59065b3ebda':
Explicitly list out the list of cache subdirs to prune.
828d11df52680ad75e045f5e4251311605d37af2 25-Jun-2014 Alexandra Gherghina <alexgherghina@google.com> Fix uninitialized variable warning

Change-Id: Ib1d4a4e1431388a839f9ef8027b439f57922b025
ackageManagerService.java
fa4533f3a07ebed479d2a0e7af7d6e03d4417d41 24-Jun-2014 Alexandra Gherghina <alexgherghina@google.com> Skip forwarding launcher intents

If we forward intents when looking up launcher icons, we end up
having an icon for a disambig activity instead of the apps for that user.

Bug: 15769854
Change-Id: Ia57525466dba57b6669b2b5cedf98f202d08f586
auncherAppsService.java
ackageManagerService.java
4ac5f85482de4f1845b21567ec510d79878552cd 23-Jun-2014 Julia Reynolds <juliacr@google.com> If DISALLOW_REMOVE_USER is enabled, UserManager.removeUser should not remove users.

Bug: 15834711
Change-Id: I8048c971401fe3216a6e92aae1c961a3aee02dde
serManagerService.java
67565a09f59db91ee0ebcdcf29b9bae0fb17ec32 24-Jun-2014 Narayan Kamath <narayan@google.com> am 152d5cd3: am 22a32d88: am 2a0f9e6a: Merge "Explicitly list out the list of cache subdirs to prune."

* commit '152d5cd30bdfd88b0903b205d38c6966cbded5a8':
Explicitly list out the list of cache subdirs to prune.
3cd9b0d5ef0b171a79b49f76794e8325198876cf 24-Jun-2014 Nicolas Prevot <nprevot@google.com> Merge "Small fix related to cross-profile intents."
9e36a8cd3e106e5a2bb0d5cce805842b61e05426 23-Jun-2014 Brian Carlstrom <bdc@google.com> am 1b98ccf2: am 0924ef65: Merge "Treat missing package usage data as a separate case"

* commit '1b98ccf275d93197c1aa746d5c492a57cd62be7f':
Treat missing package usage data as a separate case
a29e43a364dc8dbe7e97184b535fe3f5d587d7ed 23-Jun-2014 Nicolas Prevot <nprevot@google.com> Small fix related to cross-profile intents.

Change-Id: Ie489d1f83fd23190ffdc1e1abb4f0cfffebeac8d
ackageManagerService.java
aeb0ed74670e0502a04b689fe1b4fe0f537f4a91 23-Jun-2014 Alexandra Gherghina <alexgherghina@google.com> Merge "Adds cross-profile intent filters for the Settings app"
78e51f360d9d89f1fe8acf4baa76ef7854d88130 23-Jun-2014 Brian Carlstrom <bdc@google.com> am 9e36a8cd: am 1b98ccf2: am 0924ef65: Merge "Treat missing package usage data as a separate case"

* commit '9e36a8cd3e106e5a2bb0d5cce805842b61e05426':
Treat missing package usage data as a separate case
88cc346d0602e0b173b5076cd0051120682da601 14-May-2014 Nicolas Prevot <nprevot@google.com> Show the icon of the personal space.

In an intent disambiguation dialog from a managed profile,
when the intent can be forwarded to the personal space:
show the icon of the parent next to "Personal apps".
And put it at the bottom of the dialog.

Change-Id: I523222aac5dde9653e784eb26cf23cdaf018b86c
ackageManagerService.java
serManagerService.java
1b8b3aa265190e84467f740e99a0ade3a0e3cd67 20-Jun-2014 Christopher Tate <ctate@google.com> Fix BackgroundDexOptService scheduled job

1) use the right package name in the ComponentName
2) use a unique-within-package job ID

Also put the full component name in dumpsys, not just the package name

Change-Id: Icf6edabf45573ba72a1adf86b6f83baba57fc593
ackgroundDexOptService.java
6e2ae2590ded39f04f76d5ddca0f06fe01586e26 12-Jun-2014 Alexandra Gherghina <alexgherghina@google.com> Adds cross-profile intent filters for the Settings app

Bug: 15466742
Change-Id: Id9af588f2f3d51a562ef2a06fe7404c96123cc2e
ackageManagerService.java
ettings.java
e7cd37e6138c5e769cc6cb398e632bca24d2d1ab 19-Jun-2014 Nicolas Prevot <nprevot@google.com> Merge "Introducing crossProfileIntentFilters that skip the current profile."
63798c596dc757135950313eb4bb44ca58696c68 27-May-2014 Nicolas Prevot <nprevot@google.com> Introducing crossProfileIntentFilters that skip the current profile.

For these crossProfileIntentFilters, the activities in the current profile cannot
respond to the intent.
Only activities in the target profile can respond to the intent.

BUG: 14936725

Change-Id: I5e2704c2b56ff50a8339dd49284956391d7fad7e
rossProfileIntentFilter.java
ackageManagerService.java
275e085d5a42ced54bb79e40ff76c77539e7d82d 18-Jun-2014 Jeff Sharkey <jsharkey@android.com> Stronger PackageParser contract, more split work.

Require that method callers always provide relevant paths, instead of
relying on constructor. Move DisplayMetrics to be an overall parser
parameter, and move PARSE_TRUSTED_OVERLAY to flags.

Parse split APKs and apply deterministic ordering based on split
names. Assert consistent package name and version code across all
split APKs in a package, and enforce unique split names and required
base APK.

Collect certificates for split APKs, enforcing they're all signed
consistently. Better flow control and resource cleanup when
collecting certs. Refactor validation code so it's easier to reason
about. Cleaner maintenance of read buffer when draining stream
contents.

Change-Id: I8bc8c62095fbb933227b9e76ad8771f4b1246fe8
ackageInstallerSession.java
ackageManagerService.java
0270cfb71df55c1d213340bf9b678a48cc7b8e6e 20-Jun-2014 Jeff Sharkey <jsharkey@android.com> Merge "Explicitly collect manifest digests."
032f2b246bd01653c592f2b148d6a0debfe164b2 20-Jun-2014 Jeff Sharkey <jsharkey@android.com> Explicitly collect manifest digests.

Previously it was a side effect of collectCertificates().

Bug: 15740334
Change-Id: I2e044fdcc1c86ce730b9570bfbecf873366325e1
ackageManagerService.java
36fbc8d6453da438a8ab83352ff1bcfcba5f25b5 18-Jun-2014 Julia Reynolds <juliacr@google.com> Rename apps User Restriction.

Change-Id: I9f81a6b94ba06b593e7213967df51c7cb30a7b31
serManagerService.java
2c43c339de5aaf4fef58aa9b5ac3af48609263a8 13-Jun-2014 Jeff Brown <jeffbrown@google.com> Resolve boot time dependencies related to the power manager.

This change fixes a bug where native daemons may try to communicate
with the power manager before it was fully initialized due to a race
between publishing the binder service and completing init().

The solution was to simplify the dependencies related to the power
manager. It turns out that most services that were passed in
init are not actually needed until systemReady. What remained
was a dependency on the activity manager to check permissions for
incoming calls. So now we start activity manager first.
However, the activity manager also depends on power manager for
wakelocks. To break the cycle, we now defer initializing the activity
manager's wakelocks until after the power manager has been started.

Cleaned up a bunch of boot-time service dependencies so that we
can have better confidence that they are correctly maintained.

Bug: 13884219
Change-Id: If08e2d7ccd44e7026a72441bb6bd5afd7bb9fffe
ackageManagerService.java
8fb63d5a5a61ff6974f792a3ea815af193d1a7a0 18-Jun-2014 Jeff Sharkey <jsharkey@android.com> Merge "Plumb split APKs into public API."
8a4c9721a9e09d20c63381c13fa29bd9f7cbc3e3 16-Jun-2014 Jeff Sharkey <jsharkey@android.com> Plumb split APKs into public API.

Introduces new ApplicationInfo fields to surface zero or more split
APKs for an application. Splice these APKs into both the class
loader and resource system. Cleaner building of these paths.

Run dexopt() on all split APKs found after a parse, and populate
into ApplicationInfo.

Change-Id: I4a376bf4492d84ea95aafa866e106ea43a43e492
ackageManagerService.java
5b2034e2cc1cd8cb934160465364cb1eda99c208 17-Jun-2014 Christopher Tate <ctate@google.com> Merge "Switch everything to scheduled jobs"
cf1a2f73fc102be2ac7060ac97d4682bb2565ca5 17-Jun-2014 Christopher Tate <ctate@google.com> Switch everything to scheduled jobs

Everything that used the IdleMaintenance APIs/broadcasts gets to use the
spiffy new JobScheduler instead. Hooray!

On top of that, the now-obsolete "idle maintenance" APIs are now gone
entirely. Double hooray!

Bug 14993295

Change-Id: I5fb67c296ca8cd0ba8a2c8760a0f0d9d962d813b
ackgroundDexOptService.java
96f4e595ba09bf9a5a5b58882d6e4cebdcf06503 17-Jun-2014 Jeff Sharkey <jsharkey@android.com> Only movedex() when working with apps-on-SD.

Partial revert of earlier change that tried doing movedex() during
a package upgrade. Verified that the normal package upgrade path
already wipes old code as part of InstallArgs.cleanUpResourcesLI().

Change-Id: Icc5ae0d2718a0c494bfe7becf72df50c641efe1b
ackageManagerService.java
5406f59abd0cde826e8254fe628bea6d80769c8c 16-Jun-2014 Narayan Kamath <narayan@google.com> am 6a6411e3: am 076dc013: Merge "Move dex file pruning to installd."

* commit '6a6411e3d8c533a40bfe1897e2c26e3d6f3b52e0':
Move dex file pruning to installd.
c4858a2ba972e86436d629c4d3f18eb49116de14 16-Jun-2014 Jeff Sharkey <jsharkey@android.com> Switch PackageParser to reference single path.

It previously kept mPath separate from mScanPath for some very odd
edge cases around moving apps-on-SD. This changes it to always use
a single path, refactors moving to keep separate paths.

Refactors method names in PackageParser to be clearer about their
APK-versus-package relationship.

Beginnings of a split package parser. Instead of requiring that
callers check error codes when null, switch to always throwing on
parse errors, to require that callers deal with the error. Longer
term the entire parser should switch to this style, but its too
pervasive for a simple refactoring.

Change-Id: If071d8e55e46e56cc201fadfb51cb471713ae973
ackageInstallerSession.java
ackageManagerService.java
b87de28f50e9f02a365f35348f8da6cc2629bc1c 13-Jun-2014 Jeff Sharkey <jsharkey@android.com> Build usesLibraryFiles with ArraySet.

Use ArraySet instead of using odd shared variable.

Change-Id: Ide5095069ae8f2dcb4553f37e877fc1fce33ebde
ackageManagerService.java
5d140e4b1b1d43c742a7d67dd5f9d394c846945f 16-Jun-2014 Narayan Kamath <narayan@google.com> am 5406f59a: am 6a6411e3: am 076dc013: Merge "Move dex file pruning to installd."

* commit '5406f59abd0cde826e8254fe628bea6d80769c8c':
Move dex file pruning to installd.
17c9d69d7018c62d9d08ceecc6218df6704832dd 13-Jun-2014 Kenny Guy <kennyguy@google.com> Don't remove a user already being removed.

Check if UserManager is already removing
a user before starting to remove it.

Bug: 15583858
Change-Id: If9763e9b47355d9ae35cc621367c74725029aa90
serManagerService.java
db6cf3a7685b6ec3cc27a65f5015c41dc9fe8953 12-Jun-2014 Amith Yamasani <yamasani@google.com> Merge "Guest user first iteration"
1e9c21871e81642669079cd290ef47818a3165bd 12-Jun-2014 Amith Yamasani <yamasani@google.com> Guest user first iteration

Setting for controlling if guest is enabled on the device.
Setting to hint to apps that they should skip showing first use clings.

User switcher handles creation and deletion of the guest user.
Some tweaks to the user switcher to show some feedback and make the icons
circular.

Change-Id: I187dc381d2ee7c372ec6d35e14aa9ea4dfbe5936
serManagerService.java
93e9e7208e0de349a9592ac59153d6b06c202fe6 12-Jun-2014 Christopher Tate <ctate@google.com> am ba6e8ae5: Merge "Relax duplicate-permission-definition constraints slightly" into lmp-preview-dev

* commit 'ba6e8ae5d2a364799fd6bc84179e33b6731e574b':
Relax duplicate-permission-definition constraints slightly
f9fcfaae78afb0bc3e6a0716ad1d5fe3561bb81e 12-Jun-2014 Christopher Tate <ctate@google.com> Merge "Relax duplicate-permission-definition constraints slightly" into lmp-preview-dev
104e14531ca2212117540d8b6abc06ab67564ebc 12-Jun-2014 Dianne Hackborn <hackbod@google.com> am f894cad0: Merge "Some tweaks to improve document task creation." into lmp-preview-dev

* commit 'f894cad093c1a3083f4aca099babc4677977a12f':
Some tweaks to improve document task creation.
d38aed81420d7d992f65ef2efb5f69c1900fc61d 11-Jun-2014 Dianne Hackborn <hackbod@google.com> Some tweaks to improve document task creation.

- Mark the chooser activity as never launching in to a new
task, even if the caller asks for it. These are dialogs
so don't make sense as stand-alone tasks. (Maybe later
the policy should be to not launch into a new task in any
case that the activity is a dialog or even transparent at all.)

- Keep track in the task record of whether any activities in
it have been shown to the user, and use this to automatically
remove the task when all activities finish. This leans up
cases where apps are launching stub activities that get turned
in to tasks but are never seen by the user because they
immediately launch another activity in another task and
then finish.

Change-Id: I00b641c80aa96bd5071479f36ee2e4d8e3a81aeb
ackageManagerService.java
8f70744221b739f749f4e5fecff53083ef1d075a 05-Jun-2014 Adam Connors <adamconnors@google.com> DO NOT MERGE : Allow system process to call getApplicationBlockedAsUser

MDMs in the managed profile needs to be able to call
DPM.isApplicationBlocked without the INTERACT_ACROSS_USERS
permission. DevicePolicyManager checks for appropriate
PROFILE_OWNER permission and then removes callerId, so this
change is needed to prevent a spurious security exception.

Bug: 14400206
Change-Id: Idd1bda6bb234f6cb7cb78a885ae2d7cc5cca4890
(cherry picked from commit c11c67b3e117b4fec3245f87b6d510461c1f8323)
ackageManagerService.java
ac383e52a9c76dcc1a14a82848abb49b81c49f99 09-Jun-2014 Adam Connors <adamconnors@google.com> DO NOT MERGE : Api review: Make ACTION_MANAGED_PROFILE_REMOVED registered only.

And update the javadoc to explain use-case.

Bug: 15025562
Change-Id: I8eb2666c8480f873e042687223b1a1f82e7919c9
serManagerService.java
d4b584ea7f6da5c06b7ba9b1ea75428dcc5fe7b2 09-Jun-2014 Adam Connors <adamconnors@google.com> Api review: Make ACTION_MANAGED_PROFILE_REMOVED registered only.

And update the javadoc to explain use-case.

Bug: 15025562
Change-Id: I8eb2666c8480f873e042687223b1a1f82e7919c9
serManagerService.java
b8c0383b0c00ed372ab92d3d0a5095c352d3e642 06-Jun-2014 Christopher Tate <ctate@google.com> Relax duplicate-permission-definition constraints slightly

If the permission being redefined by the install-candidate package is
supplied by the system itself, ignore the redefinition but allow the
install.

Bug 14618942

Change-Id: I3d320e446587e528ae175dcd4782e607729caff7
ackageManagerService.java
1a910ef2b40de91e834a5a82d9b75d117a45da04 05-Jun-2014 Adam Connors <adamconnors@google.com> Allow system process to call getApplicationBlockedAsUser

MDMs in the managed profile needs to be able to call
DPM.isApplicationBlocked without the INTERACT_ACROSS_USERS
permission. DevicePolicyManager checks for appropriate
PROFILE_OWNER permission and then removes callerId, so this
change is needed to prevent a spurious security exception.

Change-Id: Idd1bda6bb234f6cb7cb78a885ae2d7cc5cca4890
ackageManagerService.java
c32a244e907719e03d0fae42b20401dcd2c595fc 03-Jun-2014 Narayan Kamath <narayan@google.com> am dd2e9d33: am 7cb13f8a: Merge "Scan for renderscript files before deciding ABIs."

* commit 'dd2e9d3386d2d74f99f79bcad951ff5cdefa6fab':
Scan for renderscript files before deciding ABIs.
dd2e9d3386d2d74f99f79bcad951ff5cdefa6fab 03-Jun-2014 Narayan Kamath <narayan@google.com> am 7cb13f8a: Merge "Scan for renderscript files before deciding ABIs."

* commit '7cb13f8a0a40f3d971a953b330f38bfcfb001c5e':
Scan for renderscript files before deciding ABIs.
797b109c60bda8e122075b0c2101d3f2a0b67c07 03-Jun-2014 Narayan Kamath <narayan@google.com> am 7ed98c43: Merge "Add an --abi argument to "pm install""

* commit '7ed98c43f8cbcfbb4862205a72455ab39359a011':
Add an --abi argument to "pm install"
dad8f819a710510be28e9fdeee84f9b5b2ddacbf 03-Jun-2014 Narayan Kamath <narayan@google.com> Merge "Add an --abi argument to "pm install""
116bdbd823b607d860b039ec334a1f985eed7a7f 29-May-2014 Narayan Kamath <narayan@google.com> Add an --abi argument to "pm install"

This allows callers to force an install to a particular
ABI. This is intended only for testing (and CTS) and is
not meant for usage by the installer package.

bug: 14453227

(cherry picked from commit 6431d11cd420536aaa9d93ae510a3151ccc4df1d)

Change-Id: I85d4f8785deea02a6a4d3cb0b05e6ef8bf64826b
ackageManagerService.java
dc31af2d4ffa069fe87f4b748995c2616eae5a5f 02-Jun-2014 Amith Yamasani <yamasani@google.com> Merge "Handle saving and restoring ints in application restrictions"
5b5aa4072fb58aea47f523c724878c579adae294 02-Jun-2014 Amith Yamasani <yamasani@google.com> Handle saving and restoring ints in application restrictions

Unit tests for restrictions types and proper escaping.

Change-Id: Iac35521faf5798398a89fecbad82fcdd256a4146
serManagerService.java
df7db074b5e6a19c8a33c2cc6be88f85eb5ee47c 01-Jun-2014 Amith Yamasani <yamasani@google.com> Derive LauncherAppsService from SystemService

And encapsulate the aidl interface implementation.

Change-Id: Id9a2544b411648e2596de18682079a64e95b0710
auncherAppsService.java
3cccd63e562e764dbfd8b03f383620ee2ade6441 31-May-2014 Nick Kralevich <nnk@google.com> am 532536f1: am daa0ee13: am 4f8785f2: Merge "SELinuxMMAC additions to perform policy versioning checks."

* commit '532536f145c3f295cd3ec790dd79f95c00d9d8f5':
SELinuxMMAC additions to perform policy versioning checks.
532536f145c3f295cd3ec790dd79f95c00d9d8f5 31-May-2014 Nick Kralevich <nnk@google.com> am daa0ee13: am 4f8785f2: Merge "SELinuxMMAC additions to perform policy versioning checks."

* commit 'daa0ee137d43850c834b1ead3f871ceaa49814a7':
SELinuxMMAC additions to perform policy versioning checks.
92b25a0ef8f6cf73d5c4e2209a8eac3288ecafd0 30-May-2014 Nicolas Prevot <nprevot@google.com> Merge "Cleaning CrossProfileIntentFilters on user deletion."
a422a07d29b115a6eed1eda6dba55fb8aa1f55a1 29-May-2014 Nicolas Prevot <nprevot@google.com> Merge "Small fix related to Cross-profile intents."
ad0634c50c5c4a18b5b66f2c8250e6a09bf69f1c 29-May-2014 Nicolas Prevot <nprevot@google.com> Small fix related to Cross-profile intents.

Change-Id: Id4cadd051c337776451ed807a2edac6d869b372a
ettings.java
415f354134254fbc70db48d5798e82fc87751df2 29-May-2014 Christopher Tate <ctate@google.com> am ba922631: Merge "Don\'t crash on boot" into lmp-preview-dev

* commit 'ba9226316df301fb612606f919aa69e109645c82':
Don't crash on boot
f889ed11d21bfd3010f8e4e192a0532b7f6f7994 29-May-2014 Christopher Tate <ctate@google.com> Don't crash on boot

...when removing dangling preferred-activity entries.

Bug 15310848

Change-Id: Ibe9d82a06f8c608b866a2c3c6b286da2ededacca
ackageManagerService.java
a0f48855493b7b9c3cdc93a1c8f7d18f9578ed66 27-May-2014 Nicolas Prevot <nprevot@google.com> Cleaning CrossProfileIntentFilters on user deletion.

When a user is deleted, remove all CrossProfileIntentFilters that have this user as their target.

Change-Id: I1cac3ecc0c053ee129d7f0ad13648f44737a378d
ettings.java
e282c97e21197d0fdf2c814fbe5716cb9630152e 27-May-2014 Nicolas Prevot <nprevot@google.com> Merge "Rename code related to cross-profile intents."
ee58b4f44d1c2ecd94e9b39fe74b70b28c859c1a 23-May-2014 Kenny Guy <kennyguy@google.com> Fix bug with removeUser assuming it is called from system uid.

This causes adb shell pm remove-user to fail.

Bug: 15160176
Change-Id: If1ff61dbde90f930d32affd87f935b318df813df
serManagerService.java
8194899071e0a84c95ef10614bd1b9485b48f589 16-May-2014 Nicolas Prevot <nprevot@google.com> Rename code related to cross-profile intents.

For example, replace ForwardingIntentFilter by CrossProfileIntentFilter

Bug: 15023443

Change-Id: Iee8cdf578817ef9956bcdece803a49b0d07b67f7
rossProfileIntentFilter.java
rossProfileIntentResolver.java
orwardingIntentFilter.java
orwardingIntentResolver.java
ackageManagerService.java
ettings.java
d9a6475c9c4825b2d8fc5ea09b9de54ad4f91ee3 22-May-2014 Christopher Tate <ctate@google.com> DO NOT MERGE - Don't crash uninstalling updates to system apps

Bug 15167960

Cherrypick from master

Change-Id: Ibcb3275adb27b20939a237511aaaa8b0011127e1
ackageManagerService.java
5ec9aed64cd03545eded622cca214c83c170ab22 23-May-2014 Jeff Sharkey <jsharkey@android.com> Merge "Offer to stream and fsync() install sessions."
78cc340c2de873d6995c283b777476f7237d690f 22-May-2014 Jeff Sharkey <jsharkey@android.com> Offer to stream and fsync() install sessions.

Installers are interested in both streaming APK data and establishing
a happens-after relationship to support resuming downloads after a
process kill or battery pull.

This exposes a generic OutputStream for writing, and hooks up flush()
to be a blocking call which returns only when all outstanding write()
data has been fsync()'ed to disk.

Tests to verify behavior.

Bug: 14975160
Change-Id: I38289867c80ac659163bb0c2158ef12d99cc570d
ackageInstallerSession.java
f71ece48a14e5c7da97024b0ced83da69e648a89 22-May-2014 Christopher Tate <ctate@google.com> Don't crash uninstalling updates to system apps

Bug 15167960

Change-Id: I606638292e524078f2859ba6be0a4861a4e01c00
ackageManagerService.java
a562f5daf6863640afb931db9e9ea66bea94b828 21-May-2014 narayan <narayan@google.com> am 82ec8c58: am ab3d85ab: am 838b1e22: Merge "Fix NPE in PackageManagerService."

* commit '82ec8c58b1f1cd0cce56d11b7679440f6ba54f4a':
Fix NPE in PackageManagerService.
82ec8c58b1f1cd0cce56d11b7679440f6ba54f4a 21-May-2014 narayan <narayan@google.com> am ab3d85ab: am 838b1e22: Merge "Fix NPE in PackageManagerService."

* commit 'ab3d85ab1a0ae58add5df6efc30607624475405b':
Fix NPE in PackageManagerService.
3856204c0ef3bf35e3c991fb401f30e54aefb4f0 21-May-2014 Sander Alewijnse <salewijnse@google.com> Merge "Disallow adb sideloading if UserManager flag is set for user."
1c91077bf7e13f8fe4e58cef8389d9b7a3ddb230 14-May-2014 Sander Alewijnse <salewijnse@google.com> Disallow adb sideloading if UserManager flag is set for user.

Solution is based on "redefining" the User_all.

Change-Id: Ie1ce5d6391e807f8caa05fe2a92009923d1032a8
ettings.java
1d265716954122f79d5fdd9d953a98e303d298c9 21-May-2014 Brian Carlstrom <bdc@google.com> am e77a77d0: am ec71fed0: Merge "Improve ABI handling for shared user ids."

* commit 'e77a77d081ff9d05100702f5880f356da27fd087':
Improve ABI handling for shared user ids.
96db91e0ff30c872dacc7f9a5d5a67e950e4ba26 20-May-2014 Narayan Kamath <narayan@google.com> Improve ABI handling for shared user ids.

The key improvement is that we need to keep track of
the package that's currently being scanned (this includes
new installs and upgrades of existing packages) and treat
it specially. If we didn't do that, In the case of upgrades
we would perform the shared UID calculation based on the ABI
of the old package, and not the current package.

This change also allows us to perform the CPU ABI calculation
before dexopt, which saves us from having to do it twice and
fixes a bug where we were using the wrong package path to
dexopt a package.

This also has the side effect of fixing 15081286.

bug: 15081286

(cherry-picked from commit b851c89d2252cf3d1dc504558ce1553527885316)

Change-Id: I20f8ad36941fc3df29007f0e83ce82f38f3585c8
ackageManagerService.java
9f6c25f57e26f3e2f9c744547a139d14b7d3db5c 16-May-2014 Amith Yamasani <yamasani@google.com> Per-user telephony restrictions

Allow profile owners or administrators of restricted profiles
to restrict access to telephony features such as calling and
texting for a user.

Change-Id: I89f97608c07c647ad8a7b43fef9d1e6bc4a84e95
serManagerService.java
d4e6d467cd61d6bec1ae25744a415a96f0a0f760 17-May-2014 Dianne Hackborn <hackbod@google.com> Delay the dispatching of non-wakeup alarms.

When the screen is off, there are no guarantees about when
non-wakeup alarms will be dispatched. Historically they are
dispatched any time the device wakes up. With this change,
we will delay the dispatch until sometime later.

The amount of delay is determined by how long the screen has
been off. Currently there are three possible delays: up to
2 minutes if the screen has been off for less than 5 minutes;
up to 15 minutes if it has been off for less than 30 minutes;
and otherwise up to an hour.

When the screen is turned on or a wakeup alarm is dispatched,
all delayed alarms will also be dispatched.

Note that one of the things this delays is TIME_TICK, which
means the in many cases we won't deliver TIME_TICK until the
screen is in the process of waking up. The current
implementation causes this to be delayed until the SCREEN_ON
broadcast is sent; we probably want to improve this to have
the power manager tell the alarm manager about the screen
turning on before it sends that broadcast, to help make sure
things like the lock screen can update their current time
before the screen is actually turned on.

In addition, switch all of the alarm stats to use the new
PendingIntent "tag" identifier for its operations, instead
of the old code to try to construct a pseudo-identifier
by retrieving the raw Intent.

Also add a new package manager command to immediately write
packages.xml.

Change-Id: Id4b14757cccff9cb2c6b36de994de38163abf615
ackageManagerService.java
f584f014dbb281727fccfea10bc9c2539a752f17 20-May-2014 Amith Yamasani <yamasani@google.com> Allow adding a user while still removing other users

When at the user limit, removing and adding a user causes a race
condition where the deleted user is still being removed and adding
another one fails.

This change excludes deleted users from the counting to compare
against the limit.

Also fix an ArrayIndexOutOfBounds recently introduced in AppOpsService.

Bug: 13282768
Change-Id: Ib79659e7604396583a280dbbc560b288a6d9051c
serManagerService.java
f6edb97b62a89789f7eea5ca4b31f697333c88cc 19-May-2014 Narayan Kamath <narayan@google.com> am 9672ee12: am deda5467: am a4fd1baa: Merge "Fail if we\'re unable to agree on an ISA for shared UIDs."

* commit '9672ee125d6aee73bf1e5425c4089285714f25bf':
Fail if we're unable to agree on an ISA for shared UIDs.
9672ee125d6aee73bf1e5425c4089285714f25bf 19-May-2014 Narayan Kamath <narayan@google.com> am deda5467: am a4fd1baa: Merge "Fail if we\'re unable to agree on an ISA for shared UIDs."

* commit 'deda5467f44fc4a03c3435f0c6d7bda4ea298b99':
Fail if we're unable to agree on an ISA for shared UIDs.
8974f2490992b2921b636c0b65ebeb5b19dda89b 16-May-2014 Jason Monk <jmonk@google.com> Merge "Notify AppOpsService of UserRestrictions and Owners"
62062996dd256df8b575b2ba1f0bf97109c4e0ba 06-May-2014 Jason Monk <jmonk@google.com> Notify AppOpsService of UserRestrictions and Owners

This makes the DevicePolicyManagerService and UserManagerService
push the DeviceOwner/ProfileOwners and user restrictions on boot
as well as on any change.

This also adds a list of restrictions that allow any op to connected with
a user restriction such that it will return MODE_IGNORED when the user
restriction is present (except for the device/profile owner).

Change-Id: Id8a9591d8f04fe5ecebd95750d9010afc0cd786c
serManagerService.java
6f16aec6de6e9c49304e3589abc75eeff6d6f6af 16-May-2014 Kenny Guy <kennyguy@google.com> Merge "Send profile removed intent earlier so launchers updates."
f8d3a232e8df65aa75545963ee0ccf753b2d8fb9 15-May-2014 Kenny Guy <kennyguy@google.com> Send profile removed intent earlier so launchers updates.

This sends the profile removed intent when the user has
been disabled.

Bug: 14981942
Change-Id: I32ab9c68ca53ec3aac0c930c0bbf93da7ff5b479
serManagerService.java
5d5f19a339bc4a8f10f75b51625d8d50ee0729e0 15-May-2014 Narayan Kamath <narayan@google.com> am 6e2e6868: am 706b1d7e: Merge "Remove "required" prefix from ABI fields."

* commit '6e2e686889037711170ee145f9dfdb442cee85db':
Remove "required" prefix from ABI fields.
1e74c37f8e1acb595f407e0f65744bb6b00c9314 15-May-2014 Narayan Kamath <narayan@google.com> Merge "Remove "required" prefix from ABI fields."
3a44f3f1b446315ef894e01d2ab9b5388c2bd8c4 29-Apr-2014 Jeff Sharkey <jsharkey@android.com> Initial support for split APKs, PackageInstaller.

Defines a new PackageInstaller class that will be used for installing
and upgrading packages. An application desiring to install an
application creates a session, stages one or more package files in
that session, and then kicks off the install.

Previously, PackageManager would always make its own copy of a package
before inspecting it, to ensure the data could be trusted. This new
session concept allows the installer to write package data directly to
its final resting place on disk, reducing disk I/O and footprint
requirements. Writes are directed through an intermediate pipe
to ensure we can prevent mutations once an install has been initiated.
Also uses fallocate() internally to support optimal ext4 block
allocation using extents to reduce fragmentation.

Sessions are also the way we support installing multiple "split" APKs
in a single atomic operation. For a set of packages to form a valid
application, they must have exactly the same package name, version
code, and certificates. A session can also be used to add a small
handful of splits to an application by inheriting existing packages
when not performing a full install.

Add PackageParser support for extracting split names and certificates.

Bug: 14975160
Change-Id: I23d1bf4fbeb9f99a8c83be0c458900a0f0d1bccc
ackageInstallerService.java
ackageInstallerSession.java
ackageManagerService.java
cea2978737146485b88f06b24b5df5656f9586e1 06-May-2014 Alexandra Gherghina <alexgherghina@google.com> Ensure only enabled profile apps can be launched

Change-Id: I396e99eb6b8a957d994962300eeffeec61d7c46a
Bug: 13691041
auncherAppsService.java
34f6084bc21b07ae9112be6e7a8f50c49828ac9c 30-Apr-2014 Narayan Kamath <narayan@google.com> Remove "required" prefix from ABI fields.

As per a comment on an earlier code review.

Change-Id: I3ae30f8a7bc90730068644f93b926e0e05a2cdfb
ackageManagerService.java
ackageSetting.java
ackageSettingBase.java
ettings.java
027c75d5e2861e90058bcd2d267b47498caf82cf 13-May-2014 Brian Carlstrom <bdc@google.com> am f230061b: am 2ce02bba: am b7d7cbc9: Merge "Fix background PackageUsage writing."

* commit 'f230061b383f3e5fa63a266d84477963dc5f226c':
Fix background PackageUsage writing.
f230061b383f3e5fa63a266d84477963dc5f226c 13-May-2014 Brian Carlstrom <bdc@google.com> am 2ce02bba: am b7d7cbc9: Merge "Fix background PackageUsage writing."

* commit '2ce02bba1eea682282408b8521dad8c91837fbab':
Fix background PackageUsage writing.
809146690d03b3ec3404c37c1fb467f7b7234692 09-May-2014 Brian Carlstrom <bdc@google.com> am 09d11896: am edc31509: am b98ca5b0: Merge "If PackageUsage information is missing, treat as first boot and compile everything"

* commit '09d1189668a74b2cd4a6af124e95c9e6786499f2':
If PackageUsage information is missing, treat as first boot and compile everything
09d1189668a74b2cd4a6af124e95c9e6786499f2 09-May-2014 Brian Carlstrom <bdc@google.com> am edc31509: am b98ca5b0: Merge "If PackageUsage information is missing, treat as first boot and compile everything"

* commit 'edc31509c2ff8cba86f30c836934d32a3e249dec':
If PackageUsage information is missing, treat as first boot and compile everything
be81c800ae6216e30b6008b4c73172b36531c405 22-Apr-2014 Jessica Hummel <jhummel@google.com> Add api for getting the parent of a profile.

Change-Id: Ife59665cdf6531a118d74def864c8cfc92c92a42
serManagerService.java
86e80290792b3a259dc6db7958a2f7ace7f9c6e4 08-May-2014 Emily Bernier <ember@google.com> Merge "New user restrictions for EDU"
26ecbefea064af5ae616b135aa56fec1009296e7 08-May-2014 Kenny Guy <kennyguy@google.com> Merge "Limit package launcher apps callback to enabled users."
dfad99ad9fd5953b9d726715c40197a3e70e7dd0 08-May-2014 Brian Carlstrom <bdc@google.com> resolved conflicts for merge of 0b5598c9 to master

Change-Id: Ie911d6b0b5e2b87e2b4669fa2465a82bb5807893
6422abef786632e53337c6c298ffa64f7ddf4d90 07-May-2014 Brian Carlstrom <bdc@google.com> resolved conflicts for merge of 3bbef521 to master

Change-Id: I0bbb7c80f6c4f003779da784475d7acbfb898c94
394a6cdd987fed79bd040f39e2d3e47d4484bab4 07-May-2014 Emily Bernier <ember@google.com> New user restrictions for EDU

New user restrictions will allow schools to prevent students from 1) using
device microphones, 2) adjusting device volume, and 3) mounting physical
external media.

Change-Id: Ib2fcb7ce8fbc489a25d2c97a122b2124012a9e3c
serManagerService.java
0b5598c924fc140db5cfee08c17fd91e630b1c9e 07-May-2014 Brian Carlstrom <bdc@google.com> am 691079dd: am a21ba5be: Merge "Add BackgroundDexOptService"

* commit '691079ddc0055fac9b82dccaf35b4591978b2a55':
Add BackgroundDexOptService
3bbef521d4b07f86010ba0729a36ff8b73bcb0ac 07-May-2014 Brian Carlstrom <bdc@google.com> resolved conflicts for merge of f2db00fd to klp-modular-dev-plus-aosp

Change-Id: I745164033962f6222832f8f19fa316a2e2634fd0
2871654830e94445842d6a67d775d7c317a7f2c0 07-May-2014 Kenny Guy <kennyguy@google.com> Limit package launcher apps callback to enabled users.

Change-Id: I8e42756647025677203a7dfb1dd2d040ac6e32db
auncherAppsService.java
010cfd458121034075c7439020ffef4eedbcc0fc 16-Apr-2014 Adam Connors <adamconnors@google.com> Add enableSystemApp methods to DevicePolicyManager

These methods allow profile or device owners to enable
systems apps pre-installed in the primary user in the
managed profile. Apps can be specified by either package
name or intent.

Bug: 13587051

Change-Id: Ifcbc68c139308506b6c18cf3c0ea62b8026ff75f
ackageManagerService.java
d46d0f9dcd72dfaa93a57d07d896def6ce53bbae 23-Apr-2014 Julia Reynolds <juliacr@google.com> Add new EDU user restrictions.

Change-Id: I6aad10466d99cda6be378c72025df686fe665071
serManagerService.java
c79586ede6dcd6a167bc8360f058cb5cc655b33d 06-May-2014 Nicolas Prevot <nprevot@google.com> Cleaning code related to the forwarding intent filters.

Checking for INTERACT_ACROSS_USERS_FULL
Adding equivalent methods in the PackageManager

Change-Id: Iaa1328fa666613a78e67ca669ea045144275e895
ackageManagerService.java
6fee7d4cf991a8d39bdefb782937250c87f60f25 01-May-2014 Nicolas Prevot <nprevot@google.com> Introducing removable and non-removable ForwardingIntentFilters.

clearForwardingIntentFilters removes only non-removable IntentFilters.
The ForwardingIntentFilters set by the profile owner are always removable.

Change-Id: If950ccd7e69261b86360ea647fdb501c92f5440b
orwardingIntentFilter.java
ackageManagerService.java
7b66ed588525d2d79ef0df8b3024bae138d8681d 14-Apr-2014 Adam Connors <adamconnors@google.com> Send ACTION_MANAGED_PROFILE_REMOVED broadcast.

When the managed profile is removed, this new intent
is used to inform the rest of the system.

Change-Id: I1748bed0a7ee0122f69d5c78235a79f8e205efec
serManagerService.java
932249db930d78131c4314ff46ec5fca76cb46cd 01-May-2014 Amith Yamasani <yamasani@google.com> Deliver package broadcasts only to related profiles.

Store the listener's userhandle in a cookie and compare profile
relationships before delivering package broadcasts to a listener.

Basically, don't leave TODOs around, they'll result in bugs :)

Bug: 14436558
Change-Id: I57a21719caab6cf54b78de7be2eca3e398dc6288
auncherAppsService.java
531381056fac077cffcd509b1e89d9b41f400fca 01-May-2014 Narayan Kamath <narayan@google.com> am 5dca099d: am 1cec7f85: Merge "Don\'t adjust ABI if PackageSetting#pkg is null."

* commit '5dca099df7100c531e111b50435605c318f1e6d4':
Don't adjust ABI if PackageSetting#pkg is null.
d6809b35aff02fdccf7ac433005aba2d06bbc3ff 01-May-2014 Narayan Kamath <narayan@google.com> am c1f81f90: am 27f2bfc4: Merge "Fix dex file pruning logic."

* commit 'c1f81f9086037dde6e082b8a80c84277cb727726':
Fix dex file pruning logic.
fbd80b58db2aa8f650acf26305e8cbed24a5755b 01-May-2014 Narayan Kamath <narayan@google.com> am 51f4367c: am bcc3b312: Merge "Adjust instruction sets for shared UID apps."

* commit '51f4367cac606580a5ca10ec1cf2dcab3982aebc':
Adjust instruction sets for shared UID apps.
3a951e52d93697b7e232501b78f9ffb0ec605516 01-May-2014 Narayan Kamath <narayan@google.com> resolved conflicts for merge of 69da8a12 to klp-modular-dev-plus-aosp

Change-Id: Ie07b88f324749afcf8417b50d4dbbc6e2a271a2a
d2ec8724d2a3407e28161299d44e2e113fe437ec 01-May-2014 Narayan Kamath <narayan@google.com> am d85ded89: am 645a920f: Merge "Fix OEM native library path bug."

* commit 'd85ded890d86d454a0571c63911ff911633e3a95':
Fix OEM native library path bug.
f5c6a1b3eb10f0374fcbab55853f400778f0f8e7 01-May-2014 Narayan Kamath <narayan@google.com> am eb573498: am 986b901a: Merge "Fix native-lib dir assignment & updating"

* commit 'eb5734989b3ef5455359f8807684a860ad04c134':
Fix native-lib dir assignment & updating
0338af46f968e2e1c2fd8c62e9387546fa9ed86b 01-May-2014 Narayan Kamath <narayan@google.com> am 99253c2d: am fde59428: Merge "Handle /oem and /vendor as well"

* commit '99253c2da945cbd4725efced6cac2dc40c858d6c':
Handle /oem and /vendor as well
5bc12a1b5dadfd504fb03875fad97cda8d39cf25 01-May-2014 Narayan Kamath <narayan@google.com> am a7b465ef: am d91358b2: Merge "Support per-package lib dirs for bundled apps"

* commit 'a7b465efc4eede46b8dfc8932c6c30346e8e79de':
Support per-package lib dirs for bundled apps
3c4d9c56db5b24699956de0a5a841196185363cc 01-May-2014 Alexandra Gherghina <alexgherghina@google.com> Merge "Adds an enabled state in UserInfo instead of DevicePolicyManager"
df35d570ed25257c6782e632ab1bae5e1603855a 09-Apr-2014 Alexandra Gherghina <alexgherghina@google.com> Adds an enabled state in UserInfo instead of DevicePolicyManager

Bug: 14377459
Change-Id: Ib4ec43d87da96c3dddaf9b7ae1796f261863a182
serManagerService.java
ff2e05e1f69eb0cbe9ba68cb1adbd2b2922eeeb7 01-May-2014 Nicolas Prevot <nprevot@google.com> Merge "Introduce forwarding intents across profiles."
10fa67c77e11699391e27975fc2d276a0b8c7cbb 24-Mar-2014 Nicolas Prevot <nprevot@google.com> Introduce forwarding intents across profiles.

The package manager service maintains, for some user ids, a list of forwarding intent filters.
A forwarding intent filter is an intent filter with a destination (a user id).
If an intent matches the forwarding intent filter, then activities in the destination can also respond to the intent.

When the package manager service is asked for components that resolve an intent:
If the intent matches the forwarding intent filter, and at least one activity in the destination user can respond to the intent:
The package manager service also returns the IntentForwarderActivity.
This activity will forward the intent to the destination.

Change-Id: Id8957de3e4a4fdbc1e0dea073eadb45e04ef985a
orwardingIntentFilter.java
orwardingIntentResolver.java
ackageManagerService.java
ettings.java
7e5264ced758107d83da88d6e476d16028b3cc71 30-Apr-2014 Kenny Guy <kennyguy@google.com> Merge "Extend LauncherApps service to expose enabled state."
ab45d1d6d296f4f61632a472cf7bd8626c8d5a06 30-Apr-2014 Narayan Kamath <narayan@google.com> Don't adjust ABI if PackageSetting#pkg is null.

If means the package hasn't been scanned yet, and we
will adjust the ABI during the scan of the last package
in the shared user group.

NOTE: This needs some more cleaning up, which will be
done along with the remaining TODO in this function.

Change-Id: Ie332806b64e22ab4a4856e1ccd064ff6a01616bf
ackageManagerService.java
f6b635e4f00cd40d4c46730f7d23df6cc8bf4aa4 29-Apr-2014 Narayan Kamath <narayan@google.com> Fix dex file pruning logic.

We should now prune all normal files from /data/dalvik-cache
in addition to looking for dex files in all subdirectories of
/data/dalvik-cache.

Change-Id: I4abb2b01b359bbb1b8ece2c9025541a5d5e335f5
ackageManagerService.java
df6d6dc2aac2912e98de3fe37869d2b179eb23db 28-Apr-2014 Narayan Kamath <narayan@google.com> Adjust instruction sets for shared UID apps.

Since shared UID apps are run in the same process,
we'll need to make sure they're compiled for the same
instruction set.

This change implements the recompilation of apps that
don't have any ABI constraints.

Apps that *do* have ABI constraints are harder to deal
with, since we'll need to rescan them to figure out the
full list of ABIs they support and then re-extract the
native libraries from these apps once we find an ABI we
can use throughout.

Change-Id: I365c6b0b18187df814d4736da61b199dd4494e3c
ackageManagerService.java
ettings.java
0f206a149d27385ef092a34e0009a8607d663659 12-Apr-2014 Narayan Kamath <narayan@google.com> Package manager changes for dual zygote stack.

- Pass down the app's instruction set to dexopt so that
it can compile the dex file for the right architecture.

- Also pass down the app's instruction set to rmdex, movedex
and getSize so that they can construct the cache file
location properly.

- Temporarily compile "system" jars such as am,wm etc. for
both architectures. A follow up change will ensure that
they're compiled only for one architecture (the same
arch. as the system server).

- Java "shared" libraries are now compiled for the right
architecture when an app requires them.

- Improve the app native library ABI detection to account
for system apps installed in /system/lib{64}/<packagename>
and also handle sdcard and forward locked apps correctly.

Change-Id: I4f380b146137803e51d56fdf355c3bdfc92c409d
nstaller.java
ackageManagerService.java
53fa4ec7f466e70fe3e33d15c4abfc9bb557eb10 29-Apr-2014 Kenny Guy <kennyguy@google.com> Extend LauncherApps service to expose enabled state.

Provide methods for checking if a package or activity
is enabled for a given profile.

Change-Id: If9cb15dc9398a709e60e7b689b664c24c49fcc16
auncherAppsService.java
a8e65fd82a323e6065ae9ae6cc8eaa130d3c1efd 24-Apr-2014 Kenny Root <kroot@google.com> Only remember the signer certificates for Signatures

Previously we would use the JarEntry#getCertificates API which would
return a flattened array of all the signers and their certificate chain.
Since this isn't what was intended, switch to reading the certificate
chains and only paying attention to the signer certificate.

In order to migrate during upgrades of the platform, we'll scan on boot
with a compatibility mode which will check the stores signatures in the
old format by flattening the chains of the scanned packages then
comparing the two sets.

Bug: 13678484
Change-Id: I02a5c53121d8d6f70a51d7e3b98168a41e11482e
ackageManagerService.java
ettings.java
10596fbcce710a76ffc7e917400df13af5c2ebcb 28-Apr-2014 Elliott Hughes <enh@google.com> resolved conflicts for merge of 3ce4f3d0 to master

Change-Id: Id5c5997ad8f801b32e1dbd97413ea42e38c27210
3ce4f3d0af8b20f915631ab927aafa76a6105135 28-Apr-2014 Elliott Hughes <enh@google.com> am 685a0a72: am bbd87eb9: Merge "Track libcore.os\' move to android.system."

* commit '685a0a72d445515167a2071330679cdf9b53a62d':
Track libcore.os' move to android.system.
33417df78aea04a9afe6fe73958d2dac73338666 24-Apr-2014 Jeff Sharkey <jsharkey@android.com> Fix OEM native library path bug.

Bug: 13340779
Change-Id: I3d69b3453d3d284295bbfa771e6fb4a36bca05c5
ackageManagerService.java
a466b101be24c1e0df098856fe0989749afe49ce 26-Apr-2014 Kenny Root <kroot@google.com> Merge "PackageManager: add versioning to packages.xml file"
250bb6e3e045a88022db526b074e7ab38c47d93c 25-Apr-2014 Amith Yamasani <yamasani@google.com> Merge "Allow profile owners to set user restrictions"
c1c0d3c4f461be5649a64920cad7b58dd4162680 24-Apr-2014 Kenny Root <kroot@google.com> PackageManager: add versioning to packages.xml file

During development, a new feature might be added that requires the
packages.xml format be updated. To that end, add a database version
attribute that allows this to happen.

Change-Id: I3340a0bd55017acd625c3cba523cec10a18a4805
ackageManagerService.java
ettings.java
91097de49b0f683b00e26a75dbc0ac6082344137 05-Apr-2014 Dianne Hackborn <hackbod@google.com> Initial implementation of new voice interaction API.

This gives a basic working implementation of a persist
running service that can start a voice interaction when
it wants, with the target activity(s) able to go through
the protocol to interact with it. It may even work when
the screen is off by putting the activity manager in the
correct state to act like the screen is on.

Includes a sample app that is a voice interation service
and also has an activity it can launch.

Now that I have this initial implementation, I think I
want to rework some aspects of the API.

Change-Id: I7646d0af8fb4ac768c63a18fe3de43f8091f60e9
ackageManagerService.java
898be168bda75b204611e8e24439d33213ecab5f 25-Apr-2014 Dianne Hackborn <hackbod@google.com> Merge "Add support for muliple active development codenames."
12e75126909152c448f70c48f3d2f2884cb359bd 25-Apr-2014 Christopher Tate <ctate@google.com> Merge "Fix native-lib dir assignment & updating"
be46532c9fbebf3ab6498c1b78013a33f620cd31 24-Apr-2014 Amith Yamasani <yamasani@google.com> Allow profile owners to set user restrictions

Pass the setting along to UserManager.

Fixes a security exception when fetching the profile's enabled state.

Change-Id: If71698cf32c52cce1158cf2027443a339bc58488
serManagerService.java
ffcda1086185f217ebfbac0735f92fcc8a9196c8 24-Apr-2014 Dianne Hackborn <hackbod@google.com> Add support for muliple active development codenames.

The resource API level is also bumped by the number of
active codenames there are.

Change-Id: Ic1bac452d5c13dc3f48040ffa47f54b28abe2ccc
ackageManagerService.java
353e39a973dbbadce82fee2f83ad194e04a47449 24-Apr-2014 Christopher Tate <ctate@google.com> Fix native-lib dir assignment & updating

The per-package /system/lib/* feature introduced bugs in the
native library path handling during app upgrade installs. The
crux of the fix is that when recalulating the desired native
library directory, the basis for the calculation needs to be
the scanned APK's location rather than the extant package
settings entry -- because that entry refers to the pre-upgrade
state of the application, not the new state.

Bug 14233983

Change-Id: I76c3249c72ecc055115d430529d386599e52ae42
ackageManagerService.java
97efc15b32b61a5deb1f54c6c08844b788785c39 24-Apr-2014 Kenny Root <kroot@google.com> Merge "PackageManager: remove GET_CERTIFICATES boolean"
07c79fcc7f2538e849a3f9961abb81df72b8d0a4 24-Apr-2014 Kenny Root <kroot@google.com> PackageManager: remove GET_CERTIFICATES boolean

This is a really old debugging flag that is not useful and also
dangerous.

Change-Id: I3badb5e361a8fe8458a355bf7d9ab055cb1b57d5
ackageManagerService.java
1c299031982b6145e372aa43a3b8a5c683fad3da 24-Apr-2014 Kenny Guy <kennyguy@google.com> Merge "Fix bug with getLauncherActivities ignoring packageName."
1a4e0b998030bb86196559947f417ee6fe117644 23-Apr-2014 Kenny Guy <kennyguy@google.com> Fix bug with getLauncherActivities ignoring packageName.

Change-Id: Ica5817378a24cb4b68e2c99e37cd214d3fde8ba4
auncherAppsService.java
385124d8cee38dee00d4fac31e8fbe46fb30565b 03-Apr-2014 Alexandra Gherghina <alexgherghina@google.com> Modify getUserProfiles to return only enabled profiles:

Add a new enabled state for a managed profile.
Expose that as a new API on DevicePolicyManager.
Set the new state when enabling the profile.
Return only enabled profiles from the user manager.

Bug: 13755441
Bug: 13755091
Change-Id: I2907b182e19b3562592da688b3f68ef5f4088557
serManagerService.java
7a2b4d11c741de8b78570c0e11f49deb165e35da 23-Apr-2014 Emily Bernier <ember@google.com> Allow device or profile owner app to modify user restrictions.

Currently this is gated on being a system or root app with the
MANAGE_USERS permission; third-party MDM apps set as device or profile
owner should have this ability as well.

Bug: 13585295

Change-Id: I61d21b13b9ec66fc0cb497ec2007ee732461d448
serManagerService.java
d236d625b4a4e938629fbcc55687ca7bebaab6e8 22-Apr-2014 Nick Kralevich <nnk@google.com> am 3ab7882a: am a67d4a6e: Merge "remove unused import."

* commit '3ab7882a57d3c7a0e13f58837cd02138df43f301':
remove unused import.
740888f62eae158d5775be716620f0d56d87f587 18-Apr-2014 Christopher Tate <ctate@google.com> Handle /oem and /vendor as well

Bug 13170859

Change-Id: I95dec4cd68e3d64517d08b3f08eefb849ce37b86
ackageManagerService.java
0153487d01e4921a7e3dc42c2fd68642622dd6f6 18-Apr-2014 Christopher Tate <ctate@google.com> Merge "Support per-package lib dirs for bundled apps"
addfbdc09ccf258395db8bfc510989a4c583f7ab 11-Apr-2014 Christopher Tate <ctate@google.com> Support per-package lib dirs for bundled apps

Bundled apps can now use /system/lib/apkname or /system/lib64/apkname
in addition to the (globally shared) /system/lib and /system/lib64
directories. Note that when an app is updated post hoc the update APK
will look to its normal library install directory in
/data/data/[packagename]/lib, so such updates must include *all*
needed libraries -- the private /system/lib/apkname dir will not be in
the path following such an update.

"apkname" here is the base name of the physical APK that holds the
package's code. For example, if a 32-bit package is resident on disk
as /system/priv-app/SettingsProvider.apk then its app-specific lib
directory will be /system/lib/SettingsProvider

Bug 13170859

Change-Id: Ic44cc75312f33d2f5d402a1c261b2eca3fe8badc
ackageManagerService.java
66e5d96cf9e689148b202787bdc269519c4b6f8f 09-Apr-2014 Robin Lee <rgl@google.com> Allow ProfileOwner apps to manage app restrictions

Simple wrapper around the UserManager.{get|set}ApplicationRestrictions
APIs. Also added a new Intent to signal to running apps that the set
of restrictions has changed since startup.

Change-Id: Ifd108108a73f87325b499d9de2e1b2aacc59b264
serManagerService.java
f148f36d140e995ec8f755e60bbb0b37f33c3da7 10-Apr-2014 Narayan Kamath <narayan@google.com> am 9e289d70: am 1d26a3f1: am 09e13cc5: Merge "System services detect and register app CPU ABIs"

* commit '9e289d70a8baaed0030413b5991653792e2a816d':
System services detect and register app CPU ABIs
d11f223c535ed9ce628fe5aaf0fd5692dd0cf9e4 10-Apr-2014 Narayan Kamath <narayan@google.com> resolved conflicts for merge of 286a247e to master

Change-Id: I63df9d482da3ce2ac851959223b9180020ffad0c
9e289d70a8baaed0030413b5991653792e2a816d 10-Apr-2014 Narayan Kamath <narayan@google.com> am 1d26a3f1: am 09e13cc5: Merge "System services detect and register app CPU ABIs"

* commit '1d26a3f1efd0d965e8751e8515608c31789bdbe2':
System services detect and register app CPU ABIs
286a247e4c8fcecb59636f668678d24e33142744 10-Apr-2014 Narayan Kamath <narayan@google.com> am 0fd40cb1: am 80413c9f: Merge "Re-implement native library search and copies."

* commit '0fd40cb100bccbd5d9ad6109ca39c818a857f889':
Re-implement native library search and copies.
c03dea76307163b95a313ba3e887aa94ed01dc2c 09-Apr-2014 Sander Alewijnse <salewijnse@google.com> Merge "Changed tag name and error strings for PersistentPreferredActivity storage."
4f58263d02f296430a9653126d28501e95c7bb6c 19-Feb-2014 Amith Yamasani <yamasani@google.com> Launcher APIs and broadcasts for managed profiles

UserManager
- Corp badging
- Querying list of managed profiles

Launcher API
- LauncherApps and Service to proxy changes in managed profile
to the launcher in the primary profile
- Querying and launching launchable apps across profiles

Change-Id: Id8f7b4201afdfb5f414d04156d7b81300119289e
auncherAppsService.java
serManagerService.java
ed3db02c051f52f9ad3770e3c6b5b90c71a04fb1 04-Apr-2014 Christopher Tate <ctate@google.com> Significant preconditions are significant

If you are going to check whether we've failed yet, make sure that
the default state to test against has been established properly.

Bug 13790971

Change-Id: I7fc6ff1bbbd9e569df59dcb65cc30f120c128efa
ackageManagerService.java
c935d1f11144443a91b3c03d7da82314db6e049b 31-Mar-2014 Christopher Tate <ctate@google.com> Refuse update of a system app if it changes its shared uid

Bug 13657183

Change-Id: I6d8fb9c8810ca896d2d10e5a80a3c4a50c9e4fed
ackageManagerService.java
1ccace916c8fdc61f1a8db6677aed518d31647e6 02-Apr-2014 Kenny Guy <kennyguy@google.com> Merge "Rename related users to profiles."
2a764949c943681a4d25a17a0b203a0127a4a486 02-Apr-2014 Kenny Guy <kennyguy@google.com> Rename related users to profiles.

Rename the related user concept as profiles.
When returning profiles of a user include the
user as a profile of itself.

Change-Id: Id5d4f29017b7ca6844632ce643f10331ad733e1d
serManagerService.java
f74aa094b413f113f7dd8cef0ce28fb933a27a5d 01-Apr-2014 Christopher Tate <ctate@google.com> Handle bad package name arguments sensically

Don't blithly go ahead and assume package name arguments are non-null,
and don't continue to do a bunch of work after an early failure on
invalid non-null package names.

Bug 13745101

Change-Id: I12ccae343066b39162dedeb46dc58869f55be0ba
ackageManagerService.java
0e290b7708e2ac59e645f499d8348a3a087a9568 31-Mar-2014 Nick Kralevich <nnk@google.com> am ce30fca8: am e531e2ec: am 3b2a9d22: Merge "Change when the SELinux relabel of /data/data occurs."

* commit 'ce30fca85deec8e268009a2acaefe85541ab1e58':
Change when the SELinux relabel of /data/data occurs.
ce30fca85deec8e268009a2acaefe85541ab1e58 31-Mar-2014 Nick Kralevich <nnk@google.com> am e531e2ec: am 3b2a9d22: Merge "Change when the SELinux relabel of /data/data occurs."

* commit 'e531e2ec6b311c35b077cc228e832b3f1530dffa':
Change when the SELinux relabel of /data/data occurs.
f1977b4500e82b72ea6aa5c46d97406a20017caf 25-Mar-2014 Christopher Tate <ctate@google.com> Expand install observer semantics

...and now fail conservatively when two apps both attempt to define
the same permission. Apps signed with the same certificate are
permitted to redefine permissions.

We also finally have a (hidden) interface class for observing package
installation so that we can now rev the interface without breaking
existing callers.

Bug 13551375

Change-Id: Ifa4e59154dcccbb286ee46a35a6f25e4ad0f0f01
ackageManagerService.java
1ee4eb074c2d85148658e93e865a18834bdced72 26-Mar-2014 Glenn Kasten <gkasten@google.com> Merge "Revert "Expand install observer semantics""
7629a18a3f190368e6268d3f2827824905683268 26-Mar-2014 Glenn Kasten <gkasten@google.com> Revert "Expand install observer semantics"

This reverts commit ab8a501f255b272af887acb0e66eb71cdf24c755.

Change-Id: I4ab4ae1a96efa2adf9d5a513793d8b84eef38b4e
ackageManagerService.java
9067dc03ffc76c5210d26d5a53a211eff046d412 26-Mar-2014 Christopher Tate <ctate@google.com> Merge "Expand install observer semantics"
c76275377cbc807b3bbc2fc1662ff18c59043e5b 26-Mar-2014 Nick Kralevich <nnk@google.com> am 32cc40a9: am fdd63510: am 491eaf22: Merge "Note libselinux dependency on packages.list format changes."

* commit '32cc40a9b57750451a6489e01526dc6a14d72bff':
Note libselinux dependency on packages.list format changes.
32cc40a9b57750451a6489e01526dc6a14d72bff 26-Mar-2014 Nick Kralevich <nnk@google.com> am fdd63510: am 491eaf22: Merge "Note libselinux dependency on packages.list format changes."

* commit 'fdd6351067740f80148ff03c43d2ebc91f1d9656':
Note libselinux dependency on packages.list format changes.
ab8a501f255b272af887acb0e66eb71cdf24c755 25-Mar-2014 Christopher Tate <ctate@google.com> Expand install observer semantics

...and now fail conservatively when two apps both attempt to define
the same permission.

We also finally have a (hidden) interface class for observing package
installation so that we can now rev the interface without breaking
existing callers.

Bug 13551375

Change-Id: I3a286d024a30e812ee4b098f345401df3c00e178
ackageManagerService.java
99d607844da2b100afe3d134c1c006f4cc5b35b1 25-Mar-2014 Adam Lesinski <adamlesinski@google.com> am 415e6f8e: Merge "Fix issue with early service start" into klp-modular-dev

* commit '415e6f8ed46a70e6ae50e05cda56356dae31718c':
Fix issue with early service start
a6db4ab6193626c880970572a0d03db511d403af 24-Mar-2014 Adam Lesinski <adamlesinski@google.com> Fix issue with early service start

NotificationListener services would start too early
and crash due to system_server not being ready.

Bug: 13439345
Change-Id: I86ee93b50d016bfa0119e21a8cde8635212b16a4
serManagerService.java
af597627cb344a144cbeb0a982e97e282cfd8f82 20-Mar-2014 Sander Alewijnse <salewijnse@google.com> Changed tag name and error strings for PersistentPreferredActivity storage.

They still referred to hard preferred activity, which was renamed
to persistent preferred activity.

Change-Id: Ib06baa5da746ea1e4cbd035cd73e8847acba3f7c
ersistentPreferredActivity.java
ettings.java
c55f9c04427796d5b6f833fe43adffd9d7b99ad2 21-Mar-2014 Christopher Tate <ctate@google.com> Cap the size of app-defined permission trees

Bug 13529742

Change-Id: I46c2ebc39caf4a9eacbffbb35fc386c2a1cedc12
ackageManagerService.java
244d18bfb3ae7ff9781616b35e29ffb84713ef68 20-Mar-2014 Nick Kralevich <nnk@google.com> am 857fe511: am 0b4f63c3: am dd6b7495: am 83725810: Merge "Get rid of noise during boot."

* commit '857fe511fe7139a41ad3d587a73758be53340e90':
Get rid of noise during boot.
0b4f63c319f211ddd0d572b6b1eb647d0a6dc8a7 20-Mar-2014 Nick Kralevich <nnk@google.com> am dd6b7495: am 83725810: Merge "Get rid of noise during boot."

* commit 'dd6b7495577eca7a00aa37bfdca3449cf1443681':
Get rid of noise during boot.
70b7d163aa0d4b2911eff525f83c9f245bfd9813 19-Mar-2014 Nick Kralevich <nnk@google.com> am 31654e19: am b630ffe3: am e75d340a: am 5c8e1a6e: Merge "Allow PMS to restorecon directories under /data."

* commit '31654e19c92c94675c0e2f2a86b59683d4c48d2f':
Allow PMS to restorecon directories under /data.
b630ffe3fdd72be186495f2c0a8d05b936a73d46 19-Mar-2014 Nick Kralevich <nnk@google.com> am e75d340a: am 5c8e1a6e: Merge "Allow PMS to restorecon directories under /data."

* commit 'e75d340ae5919942d19f57856ae9e3f8bc62e098':
Allow PMS to restorecon directories under /data.
1be762c1ba0f4ab57c9d2038620e03d45eeb1f0a 06-Mar-2014 Jeff Sharkey <jsharkey@android.com> Define an OEM directory, scan features and APKs.

To support OEM customizations, define a new top-level directory
that roughly mirrors the layout of the system partition. Scan this
location for (non-privileged) apps, and for additional features.

Bug: 13340779
Change-Id: Idb6d6626655061ee31ad952cab734d30ea6130b9
ackageManagerService.java
10ad98223fd1fabb7b893de55d1384fd012aed7b 17-Mar-2014 Dianne Hackborn <hackbod@google.com> Start enforcing explicit intents for Context.bindService()

No longer prints a warning, now throws an exception.

Also fix a bug in UserManagerService that was causing an
exception while booting.

Change-Id: I3b43cfe08067da840b6850b9bed58664d36d34f1
serManagerService.java
00d115a7533df23027f671c90c0ae52684392e4a 14-Mar-2014 Brian Carlstrom <bdc@google.com> resolved conflicts for merge of aa737c49 to klp-modular-dev-plus-aosp

Change-Id: I1f4e555773fe6138efaf73444525da0f747b01d5
aa737c49df79749fe92b89d745eba7442762e2b5 13-Mar-2014 Narayan Kamath <narayan@google.com> am 9af19bee: am 52af2ca9: DO NOT MERGE - Remove data dirs if a new install fails dexopt.

* commit '9af19bee1c7da8d2e8bc6e40c6e9c1e28e0640c6':
DO NOT MERGE - Remove data dirs if a new install fails dexopt.
2d3ddc2ba9f86d795e437ea90dccb59cf1ebfd11 08-Mar-2014 Dave Allison <dallison@google.com> am 199670c4: am 324aa693: am b94904ab: am 3fc3b9fd: Merge "ART profiler usage."

* commit '199670c46a9950bd2e06af43ea082427b542060a':
ART profiler usage.
324aa693b82656809b97e307676adbbce37c3d95 08-Mar-2014 Dave Allison <dallison@google.com> am b94904ab: am 3fc3b9fd: Merge "ART profiler usage."

* commit 'b94904ab6dfbb9db7e8042f10886042a295857d4':
ART profiler usage.
75870cf391eb6f1ec91f512e0a6f28840093d413 06-Mar-2014 Dianne Hackborn <hackbod@google.com> am 75374879: am ea391750: am 5e578e17: am 40a26004: Issue #13308712: Add --checkin to package manager dump.

* commit '75374879938c1767b0266132672361487f2f58d4':
Issue #13308712: Add --checkin to package manager dump.
75374879938c1767b0266132672361487f2f58d4 06-Mar-2014 Dianne Hackborn <hackbod@google.com> am ea391750: am 5e578e17: am 40a26004: Issue #13308712: Add --checkin to package manager dump.

* commit 'ea391750fbf78b395b414147dba6426ad907431d':
Issue #13308712: Add --checkin to package manager dump.
7a4e519eda4e0e7bac9ad0159b29b11f61b50e01 05-Mar-2014 Christopher Tate <ctate@google.com> am 8106dce7: am a6c59158: am f63ae644: am 1e995c76: Merge "Update PackageMonitor to recognize new \'replacing\' semantics" into klp-dev

* commit '8106dce705ba69d5bc0ccafa8e21068216f42a5f':
Update PackageMonitor to recognize new 'replacing' semantics
8106dce705ba69d5bc0ccafa8e21068216f42a5f 05-Mar-2014 Christopher Tate <ctate@google.com> am a6c59158: am f63ae644: am 1e995c76: Merge "Update PackageMonitor to recognize new \'replacing\' semantics" into klp-dev

* commit 'a6c59158761423551941f6ed338a117658e581ad':
Update PackageMonitor to recognize new 'replacing' semantics
98bab263500b258025c9c6ca64f8aaff7dc914f4 27-Feb-2014 Christopher Tate <ctate@android.com> am 4522bd12: am a58c03f6: am 41bfe121: am 16678ac6: Merge "Fixed upgrading from forward-lock application to system application"

* commit '4522bd12a4f3d2b0c3156fc70937f78bed15a1f8':
Fixed upgrading from forward-lock application to system application
a58c03f603cd90d1fed5566c88af5cd6c6f4caf5 27-Feb-2014 Christopher Tate <ctate@android.com> am 41bfe121: am 16678ac6: Merge "Fixed upgrading from forward-lock application to system application"

* commit '41bfe121cfa889df803a8916000e1fd0fbe87d5a':
Fixed upgrading from forward-lock application to system application
c6d033ed11f3b6b73f2650c56827ed0427411e9e 27-Feb-2014 Nicolas Prevot <nprevot@google.com> Correcting a deadlock in CreateRelatedUser

A deadlock sometimes happened in CreateRelatedUser of UserManagerService.
A lock was kept when it should have been released.

Change-Id: I15444c0b5d0d5d1e14e7bf29c2115aa954b7dfc0
serManagerService.java
f475ca33d9232785710aaa438f17915029dfa83b 17-Feb-2014 Sander Alewijnse <salewijnse@google.com> Enables a profile owner or device owner to set and clear default intent handler activities.

Those intent handlers are persistent preferences. They will remain the default intent
handler even if the set of potential event handlers for the intent filter changes
and if the intent preferences are reset.

Change-Id: Id0cfae46f93c10d89e441f272096a205ec518dd0
ackageManagerService.java
ersistentPreferredActivity.java
ersistentPreferredIntentResolver.java
ettings.java
55b8ddc30386ec15073304b1f9fabc7eb789f52e 19-Feb-2014 Adam Lesinski <adamlesinski@google.com> am 0817d16c: am 04520a01: am 6feaa267: Merge "Add fastpath for single signature comparison" into klp-modular-dev

* commit '0817d16c539ca6b499da9f807e8ac6988233e9c3':
Add fastpath for single signature comparison
04520a01b8469729379e73a7995a188ffea2b187 19-Feb-2014 Adam Lesinski <adamlesinski@google.com> am 6feaa267: Merge "Add fastpath for single signature comparison" into klp-modular-dev

* commit '6feaa267a585f22595f846c9e3d09a76dc3db47a':
Add fastpath for single signature comparison
f5b3a01e54d9b2e496f865e05b18f9455b0b8038 19-Feb-2014 Adam Lesinski <adamlesinski@google.com> Add fastpath for single signature comparison

PackageManager does not need to create a hash set
when comparing two sets of signatures, where each set
contains one signature. This is the common case for
most applications.

Bug:13029313
Change-Id: I61883d85960db7b376e234d7abae6149c4d20245
ackageManagerService.java
d5c8044e7e1f1402fdd4a035690329294ab07b33 12-Feb-2014 Nick Kralevich <nnk@google.com> resolved conflicts for merge of 1cbea39f to master

Change-Id: Ib33484546c6a03cbc4cd96e97d9d785d68e10700
dd3d95f182a634acdcc1b1e8e4954234d048eb54 12-Feb-2014 Nick Kralevich <nnk@google.com> resolved conflicts for merge of 4ad93639 to klp-modular-dev-plus-aosp

Change-Id: I7ad222301ec0b863d48a1a9a839469436c385ea0
7b0e2827153752ae51c3ae80746e42ee185e7358 11-Feb-2014 Jeff Sharkey <jsharkey@android.com> Merge "First <provider> always wins."
c6809bb6853c6f055905cbbbf873bbe4066c5d21 11-Feb-2014 Jeff Sharkey <jsharkey@android.com> First <provider> always wins.

In scanPackageLI(), the first provider to claim an authority wins
over any other later providers. To match this behavior, this changes
ProviderIntentResolver to ignore later providers with the same
ComponentName.

Without this behavior, AM.getContentProvider() could end up wedged
waiting for a provider that generateApplicationProvidersLocked()
never decided to spin up.

Bug: 12956224
Change-Id: I37d3e6e9cf3eea2cac4c0e914134f6c83b2fc2bf
ackageManagerService.java
826e51c4da2beac50c0ed1e1359787a0b69c878c 11-Feb-2014 Kenny Guy <kennyguy@google.com> Merge "Add concepts of related users and managed profiles to user manager."
a52dc3eb40777b055c0ca8d7885bd2c9577bcd1a 11-Feb-2014 Kenny Guy <kennyguy@google.com> Add concepts of related users and managed profiles to user manager.

Related users are a group that will share things like notifications.
Managed profiles are a profile of another user.

Change-Id: I2d0532f1abf939810f0fa3fc7c77ad13fa567833
serManagerService.java
cab8617b8ccea3a99b1ee15e15915c512a10c738 11-Feb-2014 Jeff Brown <jeffbrown@google.com> am 25df673b: am 1b51c9cb: Merge "Make SystemService constructor take a Context." into klp-modular-dev

* commit '25df673b849de374cf1de40250dfd8a48b7ac28b':
Make SystemService constructor take a Context.
25df673b849de374cf1de40250dfd8a48b7ac28b 11-Feb-2014 Jeff Brown <jeffbrown@google.com> am 1b51c9cb: Merge "Make SystemService constructor take a Context." into klp-modular-dev

* commit '1b51c9cb96fe2a0818289857a016521eed1ec183':
Make SystemService constructor take a Context.
b880d880c6cd989eacc28c365fc9a41d31900da1 11-Feb-2014 Jeff Brown <jeffbrown@google.com> Make SystemService constructor take a Context.

This change simplifies the process of initializing a SystemService
by folding the onCreate() step back into the constructor. It removes
some ambuiguity about what work should happen in the constructor and
should make it possible for services to retain most of their final
fields after refactoring into the new pattern.

Change-Id: I25f41af0321bc01898658ab44b369f9c5d16800b
nstaller.java
d8efad825df245f0b235a91fdb381b5be8248379 10-Feb-2014 Christopher Tate <ctate@android.com> am 88daefd4: am 379bb6ed: am ff27e6bc: Merge "Use canonical path for /vendor/app"

* commit '88daefd40767695f7e8a67d1d52dfaac2ab6bdb6':
Use canonical path for /vendor/app
88daefd40767695f7e8a67d1d52dfaac2ab6bdb6 08-Feb-2014 Christopher Tate <ctate@android.com> am 379bb6ed: am ff27e6bc: Merge "Use canonical path for /vendor/app"

* commit '379bb6ed4ea4de035569b04018f84d7ce95a8036':
Use canonical path for /vendor/app
8b3e3ecc3d1a0ab45c02e7cb84bc7db856d21f1d 09-Jan-2014 Christopher Tate <ctate@google.com> Update PackageMonitor to recognize new 'replacing' semantics

The ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE broadcast now uses the
EXTRA_REPLACING intent extra when it is sent as part of an upgrade operation
on a forward-locked application. Update PackageMonitor to recognize this
new information and express it appropriately to the observer.

Bug 11988313

Change-Id: I34dfaa965dd322f4fa8945e7b83c9f2e8cf5269a
ackageManagerService.java
79bea304eababaae0421a0ee563f783faf1638ac 22-Jan-2014 Christopher Tate <ctate@android.com> am 46c95dfc: am b450505c: am a7a9327b: am 5474f085: am 9fc157a4: Merge "FLAG_PRIVILEGED disappears if privileged app is updated and rebooted"

* commit '46c95dfc1009607184ea023921e1f262f38cd61e':
FLAG_PRIVILEGED disappears if privileged app is updated and rebooted
46c95dfc1009607184ea023921e1f262f38cd61e 22-Jan-2014 Christopher Tate <ctate@android.com> am b450505c: am a7a9327b: am 5474f085: am 9fc157a4: Merge "FLAG_PRIVILEGED disappears if privileged app is updated and rebooted"

* commit 'b450505c2e0d0dfd67bc228961a00a6eaaf092df':
FLAG_PRIVILEGED disappears if privileged app is updated and rebooted
509cc13b705f8c488774e7097ab17471c3dacd2e 18-Jan-2014 Jeff Brown <jeffbrown@google.com> am e2c9cd58: Merge "Refactor display manager service to new pattern." into klp-modular-dev

* commit 'e2c9cd583f4f706b48270b8cbe84df627c69af24':
Refactor display manager service to new pattern.
84aa8ab3c6b6cd5fca2a06e47ae29c01b037eed8 17-Jan-2014 Dianne Hackborn <hackbod@google.com> Merge "Add --checkin to package manager dump."
60dc0d97fc0a40caae2fa91fbf296b8ac630d748 17-Jan-2014 Dianne Hackborn <hackbod@google.com> Add --checkin to package manager dump.

Change-Id: Ibafd82f40dd4fa6a5b700a8b6725b007a528a92f
ackageManagerService.java
ettings.java
4ccb823a9f62e57f9d221f83a97e82967e79a9e5 17-Jan-2014 Jeff Brown <jeffbrown@google.com> Refactor display manager service to new pattern.

Transform DisplayManagerService into a SystemService and start cleaning
up other local services that it uses from window manager and input manager.

Clean up service thread initialization.

Remove unnecessary static variables from ActivityManagerService.

It's starting to become clear that we really need a better way to manage
service dependencies. Boot phases don't quite cut it.

Change-Id: If319dbd7cbfbd4812fe55ece969e818d4b20755b
ackageManagerService.java
09d30981f8e882ffaa336aa4665bfe348557895a 16-Jan-2014 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of 6f357d32 to master

Change-Id: I1979e6ed1acddbe656f5010114fd900f10865e75
6f357d3284a833cc50a990e14b39f389b8972254 16-Jan-2014 Jeff Brown <jeffbrown@google.com> Start untangling system server early bootstrapping.

Refactored SystemServer to get rid of a bunch of legacy cruft related
to how the ServerThread used to be started up.

Create system context first when system server starts. This removes
the tangled initialization order dependency that forced us to start
the activity manager service before most anything else.

Moved factory test related constants into the FactoryTest class.

Partially migrated Installer, ActivityManagerService, and
PowerManagerService to the new SystemService pattern. There's more
work to be done here, particularly around the lifecycle of the
power manager.

Bug: 12172368
Change-Id: Ia527dd56e3b3fd90f9eeb41289dbe044921230d4
nstaller.java
ackageManagerService.java
08af733f87857dc8fdb83f25554874bd6a561287 08-Jan-2014 Christopher Tate <ctate@google.com> Don't just log this warning; record the situation for posterity

When a previously 3rd-party permission declaration is superseded
by a new system-owned declaration, don't just log; leave a persistent
record of the fact for post-hoc recognition of what happened even
after reboots.

Change-Id: I816a5003f8f8ef2dfbdbfa36316c4bae5005dfbf
ackageManagerService.java
49782e46c0eb85a25ae2abcf80880c48dbab5aea 20-Dec-2013 Amith Yamasani <yamasani@google.com> am 9158825f: Move some system services to separate directories

* commit '9158825f9c41869689d6b1786d7c7aa8bdd524ce':
Move some system services to separate directories
9158825f9c41869689d6b1786d7c7aa8bdd524ce 22-Nov-2013 Amith Yamasani <yamasani@google.com> Move some system services to separate directories

Refactored the directory structure so that services can be optionally
excluded. This is step 1. Will be followed by another change that makes
it possible to remove services from the build.

Change-Id: Ideacedfd34b5e213217ad3ff4ebb21c4a8e73f85
asePermission.java
rantedPermissions.java
nstaller.java
eySetManager.java
ackageKeySetData.java
ackageManagerService.java
ackageSetting.java
ackageSettingBase.java
ackageSignatures.java
ackageVerificationResponse.java
ackageVerificationState.java
endingPackage.java
referredActivity.java
referredComponent.java
referredIntentResolver.java
ELinuxMMAC.java
ettings.java
haredUserSetting.java
serManagerService.java