Commit Graph

9280 Commits

Author SHA1 Message Date
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
TreeHugger Robot
046df72d9a Merge "Revert "Q Upstream: Use ParcelFileDescriptor for storing large clip data."" into rvc-dev 2020-04-28 02:12:12 +00:00
Mehdi Alizadeh
082d0c47b7 Merge "Adds unit tests for ShortcutChangeCallback APIs" into rvc-dev 2020-04-27 19:34:25 +00:00
Mehdi Alizadeh
666796b0fa Merge "Include cache-only and pinned-only shortcuts as Sharing shortcuts as well" into rvc-dev 2020-04-27 17:47:23 +00:00
Satoshi Niwa
921fc028f3 Revert "Q Upstream: Use ParcelFileDescriptor for storing large clip data."
This reverts commit 472371c6ad.

Reason for revert: The feature should never be enabled on R and above.

Bug: 111577843
Change-Id: I4e15231909d120d548fa7b7623276e518e32f7a5
Test: ClipboardManagerTest
2020-04-25 05:42:59 +00:00
Eugene Susla
181ef8dfa1 Merge "Update auto revoke deeplink action javadoc: extra -> Uri" into rvc-dev 2020-04-24 22:27:00 +00:00
Mehdi Alizadeh
e65b53e5d7 Include cache-only and pinned-only shortcuts as Sharing shortcuts as well
Bug: 154249544
Test: atest com.android.server.pm.ShortcutManagerTest1
            com.android.server.pm.ShortcutManagerTest2
            com.android.server.pm.ShortcutManagerTest3
            com.android.server.pm.ShortcutManagerTest4
            com.android.server.pm.ShortcutManagerTest5
            com.android.server.pm.ShortcutManagerTest6
            com.android.server.pm.ShortcutManagerTest7
            com.android.server.pm.ShortcutManagerTest8
            com.android.server.pm.ShortcutManagerTest9
            com.android.server.pm.ShortcutManagerTest10
Change-Id: Iacbca104e0fee91d80768bd0280db252aca2c5c0
2020-04-23 18:37:08 -07:00
Eugene Susla
f33f0315ad Update auto revoke deeplink action javadoc: extra -> Uri
Test: presubmit
Bug: 153607914
Change-Id: I02816b71a898d3cac0d50f988b1fdc3427067e14
2020-04-23 16:05:03 -07:00
TreeHugger Robot
a721ccdc7c Merge changes from topic "bound status" into rvc-dev
* changes:
  DataLoader cleanup: return plain FD from Java.
  Keep only service binding in DataLoaderManager.
2020-04-23 22:50:46 +00:00
TreeHugger Robot
9b8965044c Merge "Parses package/provider with non-configuration strings" into rvc-dev 2020-04-23 20:55:02 +00:00
Alex Buynytskyy
ea1390ff32 Keep only service binding in DataLoaderManager.
This simplifies:
- resource management - no extra copies of controls,
- state management - all states in one place, no more hidden (bound but
not created) state.

Bug: b/153874006
Test: atest PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest IncrementalServiceTest
Change-Id: I3d16a099c7f42fcf14637c5a8e96bd6f99e073d1
2020-04-23 19:38:44 +00:00
Patrick Baumann
3361f334d5 Parses package/provider with non-configuration strings
Fixes: 153658673
Test: AppEnumerationTests
Change-Id: I7fb09f2746f9ccf151d8675cc4ab1360eac1dcd6
2020-04-23 10:37:25 -07:00
Kholoud Mohamed
4bf358fe39 Merge "Fix javadoc for CrossProfileApps#canRequestInteractAcrossProfiles" into rvc-dev 2020-04-23 10:12:36 +00:00
Charles Chen
1e52a093ae Merge "Limit number of window context without any window" into rvc-dev 2020-04-23 03:34:37 +00:00
kholoud mohamed
716cf78bfe Fix javadoc for CrossProfileApps#canRequestInteractAcrossProfiles
Remove the app being whitelisted requirement from
the javadoc.

Fixes: 154712757
Test: N/A
Change-Id: Ib476d0b19717e901d26039194d33f8c43f7e3f74
2020-04-22 17:03:21 +00:00
Alex Buynytskyy
d48ca975b6 Merge "Packages on IncrementalFS can't have oat dir." into rvc-dev 2020-04-22 17:01:00 +00:00
Charles Chen
2622d3ef7e Limit number of window context without any window
This change is to prevent misuse of window context from app
and leads to performance drop on system by limit the numer of window
context an app can use. Code snippet below is a sample to cause
this issue:
```
Rect getBounds() {
    Context windowContext = context.createWindowContext(...);
    return windowContext.getSystemService(WindowManager.class)
            .getCuttentWindowMetrics().getBounds()
}
```
This method could be invoked dozens of times and produce dozens of window
tokens. It would slow down the speed of window traversalling. These
token won't be removed until system server has been GC'd.

Test: atest WindowContextTests WindowContextPolicyTests
fixes: 152934797
Bug: 153369119

Change-Id: I927e85a45c05c4d90b51a624ea408ff3a3ffce93
2020-04-22 18:16:56 +08:00
Alex Buynytskyy
d29a2ccced Packages on IncrementalFS can't have oat dir.
Bug: b/154535403
Test: atest PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest IncrementalServiceTest
Change-Id: I7428f3c0a28cc300586ad083cc4ab12082d67e72
2020-04-21 16:39:38 -07:00
Jeff Sharkey
b67e70aa40 Merge changes from topic "apr19" into rvc-dev
* changes:
  Update some Parcelables to send Strings UTF-8.
  Offer to write Strings through Parcels as UTF-8.
2020-04-21 22:59:40 +00:00
Jeff Sharkey
0223df096c Update some 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.

This is a purely mechanical refactoring with no functional changes.

Bug: 154436100
Test: manual
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: Ia9e581efd7c40269342b7528ca07363deb843c0f
2020-04-21 22:59:26 +00:00
TreeHugger Robot
2f14c3a752 Merge "DataLoader statuses, explained." into rvc-dev 2020-04-21 22:44:40 +00:00
Alex Buynytskyy
785957d352 DataLoader statuses, explained.
Bug: b/153874006
Test: comment-only change
Change-Id: I6c85c1c6fc5c922e9d789b3ecd31a94c812dc3a1
2020-04-21 13:36:19 -07:00
Jeff Sharkey
d387e79ae1 Offer to write Strings through Parcels as UTF-8.
Recently while investigating some Binder limits, I discovered that
we're still sending Strings across Binder as UTF-16, which is very
wasteful for two reasons:

1. The majority of data flowing through APIs like PackageManager is
already limited to US-ASCII, and by sending UTF-16 we're wasting
half of our transactions on null-byte overhead.

2. Internally ART is already "compressing" simple strings by storing
them as US-ASCII instead of UTF-16, meaning every time we want to
write a simple string to Binder, we're forced to first inflate it
to UTF-16.

This change first updates Parcel.cpp to accept char* UTF-8 strings,
similar to how it accepts char16_t* for UTF-16.  It then offers
both UTF-8 and UTF-16 variants to Parcel.java via JNI.  We also
update the String8 handling to behave identical to String16.

This change adds benchmarking to show that these new methods are
about 50% faster for US-ASCII strings, and about 68% faster for
complex strings that reference higher Unicode planes.  (So an
improvement in both cases!)

Bug: 154436100
Test: atest FrameworksCoreTests:ParcelTest
Test: make core-libart conscrypt okhttp bouncycastle vogar caliper && vogar --mode app_process --benchmark frameworks/base/core/tests/benchmarks/src/android/os/ParcelStringBenchmark.java
Change-Id: I22a11d3497486d922ec8e14c85df66ca096b8f2a
2020-04-21 09:38:36 -06:00
Jeongik Cha
9ccdd32880 Support multiple requiredSystemProperty in overlay
As-is: Only one requiredSystemProperty is allowed
To-be: It supports several requiredSystemProperty

Here is format for multiple fields.
  android:requiredSystemPropertyName="rw.num,rw.char"
  android:requiredSystemPropertyValue="1,a"

Test: m
Test: Make two overlay with different condition
      Check if it works properly depending on condition
      If there is no overlay package matching the condition, both aren't
      applied

Bug: 137628879
Merged-In: I4c8c4a1304dc52d6568767d90e3dcbf6acef024a
(cherry picked from commit 5e6a87013f)
Change-Id: If3765218c96f8922c155e18e99b0f4bb6a032ff1
2020-04-20 08:11:45 +00:00
TreeHugger Robot
dd08939ba8 Merge "RESTRICT AUTOMERGE: Autocork package invalidations" into rvc-dev 2020-04-17 23:26:42 +00:00
TreeHugger Robot
e185aca339 Merge changes If07d6938,I32f9b89a,Ife4f8c4e into rvc-dev
* changes:
  RESTRICT AUTOMERGE: Add a facility for time-based cache corking
  RESTRICT AUTOMERGE: Cork permission and package cache around bulk permission update
  RESTRICT AUTOMERGE: Cork package information cache invalidations during boot
2020-04-17 23:25:02 +00:00