Commit Graph

9305 Commits

Author SHA1 Message Date
TreeHugger Robot
e40b321ee6 Merge "Add test for permission APEX." into rvc-dev 2020-05-29 21:40:19 +00:00
Ryan Mitchell
d32418a72a Merge "Install system app in greatest priority partition" into rvc-dev 2020-05-29 18:05:31 +00:00
TreeHugger Robot
d220529254 Merge "Add DPC restriction for INTERACT_ACROSS_PROFILES to javadoc." into rvc-dev 2020-05-29 13:22:27 +00:00
Alex Kershaw
4da9c2097d Add DPC restriction for INTERACT_ACROSS_PROFILES to javadoc.
Fixes: 157229284
Test: Javadoc only
Change-Id: I21f6276ba08e62c1f17a279241838fdbd352c8d8
2020-05-29 12:43:08 +01:00
Hai Zhang
3562068af9 Add test for permission APEX.
Bug: 152055112
Test: atest PermissionApexTests
Change-Id: I4201501d586fe62df7a04d0e2da955d6d873d3df
2020-05-28 16:19:07 -07:00
Ryan Mitchell
d4e7f93df5 Install system app in greatest priority partition
On Pixel 2 devices, /product is a symlink to /system/product. The
product partition has a higher partition precedence than the system
partition so the app should be installed as a system app on the product
partition.

This change also unifies methods for checking whether a file is within
a partition so we will paths will always be canonicalized before the
check.

Bug: 152522330
Test: update system app in system/product/privapp, uninstall updates,
      verify that the app was scanned as privileged
Change-Id: I646a5f293b977a78daa2102b73f1d3122f774a2a
2020-05-28 16:06:30 -07:00
TreeHugger Robot
f37b09335f Merge "Remove InstantAppResolverTests for migration to CTS" into rvc-dev 2020-05-28 00:23:16 +00:00
Mehdi Alizadeh
c95be6995a Merge "Adds cacheFlags parameter to cache/uncacheShortcuts() methods" into rvc-dev 2020-05-27 19:23:39 +00:00
TreeHugger Robot
80a18c0a7b Merge "Camera: Extend FEATURE_CAMERA_CONCURRENT to old API levels" into rvc-dev 2020-05-27 00:45:04 +00:00
Michael Groover
2046776127 Merge "Address edge cases for signing certificate lineages in sharedUids" into rvc-dev 2020-05-26 16:07:57 +00:00
Mehdi Alizadeh
a3d22cec32 Adds cacheFlags parameter to cache/uncacheShortcuts() methods
Bug: 155135890
Test: atest ShortcutManagerTest1 ShortcutManagerTest11 \
            ConversationInfoTest DataManagerTest \
            NotificationManagerServiceTest
Change-Id: Idda777ba032546bd616ee3079b9c8dc8676dc589
2020-05-26 03:30:55 +00:00
Michael Groover
f1744af7ed Address edge cases for signing certificate lineages in sharedUids
Currently when a package is installed / updated in a sharedUid the
signatures for the sharedUid are not updated unless the new package
adds a new signer to the lineage; in this case the new lineage is
assigned to the sharedUid without consideration for the existing
lineage. This leads to the following problems:

1. If the current sharedUid lineage is A -> B and the new package has
lineage B -> C then this is used for the sharedUid and A is lost from
the lineage.
2. If the new lineage revokes one or more capabilities from a previous
signer in the lineage these updated capabilities are ignored unless the
lineage added a new signer as well.
3. If the new lineage revokes the sharedUid capability from a previous
signing key in the lineage and another app is installed as part of the
sharedUid and signed with that key the new app's installation is allowed
to proceed.
4. If only a single app is installed as part of a sharedUid, and that
app is updated with a rotated key and a lineage that revokes the
previous signing key's sharedUid capability the update is blocked.
5. If an app is installed as part of the sharedUid and has a diverged
signer in the lineage (ie sharedUid lineage is Y -> A -> B and new app
lineage is Z -> A -> B -> C) the installation is allowed and Y is lost
from the lineage.

Problems 1 and 2 are addressed with the new SigningDetails
mergeLineageWith method that merges common signers between two lineages
and also updates their capabilities to the most restrictive between
the two lineages (capabilities are anded together). Problems 3 is
addressed by checking the signatures of each of the packages in the
sharedUid for any signed with an ancestor for which the sharedUid
capability may have been revoked. Problem 4 is addressed by checking
if the package being updated is the only one in the sharedUid; if so
the update to the new lineage is allowed to proceed. Problem 5 is
addressed by verifying the new app's lineage is the same, a subset, or
a superset of the other.

Bug: 152046935
Test: atest PkgInstallSignatureVerificationTest
Test: atest SigningDetailsTest
Test: atest PackageManagerTests
Test: atest PackageManagerTest
Change-Id: I420c309f522bb47b65ca40ee848024c85cd5804d
2020-05-22 23:50:52 +00:00
TreeHugger Robot
2f988b5a82 Merge "Don't truncate an app's own label when forcing safe label." into rvc-dev 2020-05-21 19:06:51 +00:00
Winson
badad7b62f Remove InstantAppResolverTests for migration to CTS
See change I79b7c42e8a495c0f4ba4cd42a076ac3b43ee2919

Bug: 155114274
Bug: 155115137
Bug: 155115845
Bug: 155116506
Bug: 155116748
Bug: 155117421

Test: atest CtsInstantAppTests

Change-Id: I09023d098c93758c049169a909c27c230bb3dd9b
2020-05-21 11:50:43 -07:00
Hai Zhang
5177cfa1bd Don't truncate an app's own label when forcing safe label.
Fixes: 152973001
Test: manually confirm default apps title isn't truncated in RU.
Change-Id: Ic54ea66fa4b9117d633b58838465adfb9d2ae7fa
2020-05-20 14:51:00 -07:00
Julia Reynolds
8d34af82ac Update conversation labels
By adding a util method that prefers longlabel and
falls back to shortlabel.

Test: atest
Bug: 157140669
Change-Id: Ib7229b75b7a8ab87274e9aab1c7816129f04e505
2020-05-20 17:03:35 -04:00
TreeHugger Robot
db48450e84 Merge "Fix parsing sCachedPackageReadCount" into rvc-dev 2020-05-19 18:57:33 +00:00
Winson
46220780ba Fix parsing sCachedPackageReadCount
This was moved to PackageCacher, but the old and unused counter
was not removed.

Bug: 154310064

Test: manual device reboots and logs cached count >0

Change-Id: I32fdb4b8fccd281fe61c64f231cb0ba154934679
2020-05-19 09:37:36 -07:00
Patrick Baumann
ce6252e5a4 Merge "Doc update re use of MATCH_UNINSTALLED flag" into rvc-dev 2020-05-18 21:31:02 +00:00
Patrick Baumann
5bbb8fe00a Doc update re use of MATCH_UNINSTALLED flag
This change updates the docs for the MATCH_UNINSTALLED flag to note that
without the QUERY_ALL_PACKAGES permission, uninstalled packages will not
be returned.

Bug: 149846504
Test: builds
Change-Id: Id0c5b7f29172bd334dc1b2a32ce1f4eb7b1f0bd3
2020-05-15 16:24:12 -07:00
Winson
7029b75f67 Remove PlatformCompat dependency from getPackageArchiveInfo
It requires a permission which we can't force apps to take to
maintain backwards compatibility. We also arguably cannot because
it leaks visibility, although only for debuggable apps/non-release
builds.

Instead, there's a new static method for getting the raw targetSdk
to gate against and the check is done manually, ignoring
enabled/disabled state. This will cause a mismatch between certain
apps and some system services like AppIntegrityManager, but the
effects should be minimal if we assume that most people ship
valid APKs. At worse the integrity check will pass an APK that
PM will fail, which doesn't break the feature.

Bug: 156356591
Bug: 156778241

Test: manual device boots

Change-Id: I877a5061476b86b9d63c34e75f16b38be8c3e1c2
2020-05-15 15:52:05 -07:00
Patrick Baumann
84249ed31e Treat mimegroup as wildcard for app enumeration
This change treats any filter with a mimegroup as if it matches all or
no mime types when matching for the purpose of app enumeration.

Fixes: 155379839
Test: atest IntentFilterTest
Change-Id: I358872082524a4001179bb145053d006622898a7
2020-05-14 16:11:49 -07:00
Patrick Baumann
97980133d5 Ignore port when matching with wildcards
This change ensures that we don't take port into account when matching
queries tags against intent filters as port is not a supported value in
a queries intent tag. Adding support for this in a future release will
just limit the scope of the queries tag on thos releases; it will still
be ignored in this release.

Bug: 151638510
Test: atest IntentFilterTest
Change-Id: I69d77ae6bebf3984bfe8e8a0f6c2e9e91ee69298
2020-05-14 16:03:23 -07:00
Eino-Ville Talvala
fdf749b2c6 Camera: Extend FEATURE_CAMERA_CONCURRENT to old API levels
Since running the front and back camera at the same time has been
possible since forever, there's no reason devices on older API levels
can't declare the FEATURE_CAMERA_CONCURRENT flag, even with the new
query APIs not present.  Explicitly document that the flag can be set
on API level 29 or earlier, and what it means.

Test: m offline-sdk-docs
Bug: 77960042
Change-Id: I186cb53d95debcc62c98afdef8c629bd9c6a5919
2020-05-14 15:20:10 -07:00
Matt Pietal
9788fd4afd Controls API - Flag controls support
Add a package manager flag so that apps can programmatically query
whether the device have system interface to support the Controls API

Bug: 156096063
Test: manual
Change-Id: I2dab2ecb762b59308c51615137f89733ff42caeb
2020-05-13 14:11:34 -04:00
Robert Horvath
f424274d8e Merge "Add PackageInstaller#uninstallExistingPackage" into rvc-dev 2020-05-12 11:40:10 +00:00
Robert Horvath
77880fa860 Add PackageInstaller#uninstallExistingPackage
This new API allows an app to be uninstalled silently by any app holding
the DELETE_PACKAGES permission, as long as the app is installed in
another user so won't be fully removed from the device.

Bug: 149601842
Test: atest UninstallExistingPackageTest
Merged-In: I69fe4d1dd4e9da83574b431257f7be6d1ac8b2bb
Change-Id: I69fe4d1dd4e9da83574b431257f7be6d1ac8b2bb
2020-05-12 09:18:56 +00:00
Riddle Hsu
e03b9669e3 Add support to override display adjustments by token
This is the bridge to link customized adjustments to an activity
or window token.

The DisplayAdjustments in ResourcesImpl is associated with
ResourcesKey. The new usage requires to associate with token.
That is why the new field is added in Resources.

Bug: 147213487
Test: atest ResourcesManagerTest#testOverrideDisplayAdjustments
Change-Id: Ie79c331654d564aee7af8c6ce98a4c72dd3132b1
2020-05-11 13:30:14 +08:00
Nikita Ioffe
a2962fa93f PackageParser2: collect certificates if requested
This is a relatively easy and safe change that should significantly
reduce boot time.

Test: atest google/perf/boottime/boottime-test
Test: atest PackageManagerTest
Bug: 155535721
Bug: 155513789
Bug: 155525390
Change-Id: Ib5152892184d407361ce3698575075ec0138edbf
2020-05-07 21:09:21 +01:00
TreeHugger Robot
a83fad74b4 Merge "Migrate remaining parsePackage V1 to V2" into rvc-dev 2020-05-06 03:57:38 +00:00
Winson
3cb5610a99 Migrate remaining parsePackage V1 to V2
Uses ParsingPackageImpl to generate the PackageInfo for
PackageManager's getPackageArchiveInfo API.

This keeps the migration to v2 hidden and thus the API can
be shipped for this release and then deprecated entirely
if necessary.

Exempt-From-Owner-Approval: Has approval on previous patchsets,
    will need non-logic updates to resolve merge conflict and CP
    into rvc-dev properly

Bug: 135203078
Bug: 146575910
Bug: 153880854

Test: atest com.android.server.pm.parsing
Test: atest android.content.pm.PackageManagerTests

Merged-In: Ib21dbbdc556502144df8e3d7a26b7a9d33885cd9
Change-Id: Ib21dbbdc556502144df8e3d7a26b7a9d33885cd9
2020-05-05 16:35:34 -07:00
Varun Shah
2806da306b Merge "Update some ContentResolver docs." into rvc-dev 2020-05-05 23:18:55 +00:00
Varun Shah
5de2589627 Update some ContentResolver docs.
Clarify when some of the ContentResolver APIs could return null.

Bug: 112833761
Test: builds (documentation update)
Change-Id: I3af1a23bc484d05b167a86bbff0c93ff1bd364e7
2020-05-05 12:25:30 -07:00
Andrew Solovay
369f2eeaf9 docs: Fixing broken Javadoc comments
Two recent checkins broke the Javadoc (in both cases, an <h3> wasn't
properly closed). Made the fix by hand to the HTML output in
cl/309818465 but we need to make the corresponding change to
the Java source or it'll get reverted next time we update the reference
docs.

Staged to:

go/dac-stage/reference/android/content/pm/LauncherApps.PinItemRequest
go/dac-stage/reference/android/service/autofill/AutofillService

go/dac-stage/reference/kotlin/android/content/pm/LauncherApps.PinItemRequest
go/dac-stage/reference/kotlin/android/service/autofill/AutofillService

BUG: 155669442
Exempt-from-owner-approval: Docs-only change
Test: make ds-docs
Change-Id: I97be9550689544304dff276cf3c9406f9cd98408
2020-05-04 16:03:17 -07:00
Andrew Sapperstein
975ca816ec Merge changes from topic "cherrypick-ctor-refs-03y8i58ine" into rvc-dev
* changes:
  Update inner class constructor refs to use proper syntax.
  Fix broken @see tags in public documentation.
2020-05-02 00:21:33 +00:00
Winson Chiu
2728af853a Merge "Add skip functionality to package parsing" into rvc-dev 2020-05-01 20:20:49 +00:00
Andrew Sapperstein
8fe35e5f21 Fix broken @see tags in public documentation.
These were previously being suppressed by doclava but with this change,
all failures are fixed and the suppression logic has been removed.

To fix the issues, there were a few possible changes made:
- broken reference to a public API (such as incorrect parameters): fixed
- unnecessary @link inside an @see tag: fixed
- @see referring to an @hide or @SystemApi: reference removed
- broken references to inner class constructors
 - worked around by fully qualifying the constructor

Bug: 6963924
Test: make doc-comment-check-docs
Exempt-From-Owner-Approval: cherry-picked from master
Change-Id: Ifbdce2de96cdffa560bd90f549fa7184d1f9af85
Merged-In: Ifbdce2de96cdffa560bd90f549fa7184d1f9af85
(cherry picked from commit e0624c7a40)
2020-05-01 18:25:32 +00:00
Winson
b58595b767 Add skip functionality to package parsing
There are specific cases where a package should be ignored by
whoever is parsing it, either because the device was configured to
ignore it, or the device doesn't support it.

While mostly used for testing, this adds a skip method to
ParseInput and a matching install error code to explicitly express
this case during parsing.

Bug: 155420149

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

Change-Id: I7eff53544341e21108d9d027f3afe75a1e845f40
2020-05-01 10:49:15 -07:00
Patrick Baumann
40bdf5c5e6 Adds new activity flags to the @Flags annotation.
Bug: 148452357
Change-Id: I01c1a6f5a678f92402c489679b47310f132a445c
Test: Builds
2020-05-01 17:22:30 +00:00
Nikita Ioffe
0b7f9b9b99 Merge "Teach PackageManager.getApplicationInfo about MATCH_APEX" into rvc-dev 2020-04-30 10:49:37 +00:00
Ryan Mitchell
e3c40062e6 Merge "Allow pre-R apps to test compressed ARSC error" into rvc-dev 2020-04-30 00:13:16 +00:00
Jeff Sharkey
1eb3fcfb33 Merge "Update more Parcelables to send Strings UTF-8." into rvc-dev 2020-04-29 23:55:03 +00:00
Nikita Ioffe
69a3f399fe Teach PackageManager.getApplicationInfo about MATCH_APEX
Test: atest android.content.pm.cts.PackageManagerTest#testGetApplicationInfo_ApexSupported_MatchesApex
Bug: 155092136
Change-Id: I489e186242d4db4de4753a11e90ce23e35f2aa80
2020-04-30 00:10:50 +01:00
TreeHugger Robot
265622e3c7 Merge "Update public documentation." into rvc-dev 2020-04-29 22:07:45 +00:00
Jeff Sharkey
1639e6b8ee Update more Parcelables to send Strings UTF-8.
An earlier CL with benchmarks has shown that sending strings as UTF-8
is 50% faster for US-ASCII strings, and still 68% faster for complex
strings referencing higher Unicode planes.  (So an improvement in
both cases!)

Since code across the OS still makes heavy assumptions about Parcel
strings typically being UTF-16, we need to carefully migrate
Parcelables by hand, which is what this CLs begins doing.

Bug: 154436100
Test: manual
Change-Id: I9a675473e0ce3a4a5c5e305dd851b40bb1560e1c
2020-04-29 14:54:44 -06:00
Todd Kennedy
ae3af93daa Update public documentation.
Looks like we haven't returned `null` in years.

Fixes: 149837263
Test: None. Documentation only.
Change-Id: I6900458d0b69152a54034e572a6b994e8e6585bd
2020-04-29 12:33:31 -07:00
Alex Buynytskyy
7e0a1a8ec7 Unavailable DataLoader status.
This is a temporary failure, does not fail the session, but requires
caller to re-commit. E.g. there are connectivity issues which can be
fixed later.

Bug: b/153874006
Test: atest PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest IncrementalServiceTest
Change-Id: I02791a2963130dbecb510c4a7cafcf04f6245761
2020-04-29 04:23:49 +00:00
TreeHugger Robot
8ba4e7599a Merge "Resolve IndexOOBException in SigningDetails#hasAncestor" into rvc-dev 2020-04-29 01:21:27 +00:00
Michael Groover
09c24c3c4f Resolve IndexOOBException in SigningDetails#hasAncestor
When a package that is part of a shareduid is installed / updated its
lineage is compared against the current signature / lineage for the
shareduid. If the new package has more than one signature in the lineage
an IndexOutOfBoundsException is thrown by SigningDetails#hasAncestor
crashing the system server. This commit ensures the ancestor check
is only performed against the current signer for the shareduid.

Fixes: 155134046
Test: atest SigningDetailsTest
Change-Id: Icef9f21c6901e255e5276085259d2f773f41e858
2020-04-28 15:08:20 -07:00
Ryan Mitchell
72e144cd18 Allow pre-R apps to test compressed ARSC error
This change removes the initial target SDK check which prevents apps
that target pre-Q from testing that they fail to be install if the
compatibility change is enabled for pre-Q packages.

Bug: 132742131
Test: adb shell am compat enable 132742131 for app with compressed ARSC
      that targets pre-R
Change-Id: I7e568a9e99045c09565bb372e454f573b954fea5
2020-04-28 11:13:51 -07:00