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
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
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
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
This reverts commit 472371c6ad.
Reason for revert: The feature should never be enabled on R and above.
Bug: 111577843
Change-Id: I4e15231909d120d548fa7b7623276e518e32f7a5
Test: ClipboardManagerTest
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
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
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
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
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
Below are some test runs that show 100 iterations of getInstalledPackages ran
at activity startup of touchlatency app to demonstrate the perf cost.
R Baseline:
https://screenshot.googleplex.com/PnVi5APraJohttps://pprof.corp.google.com/?id=dc105ca9592f8367c381e2dcf7f1847d
R Optimized:
https://pprof.corp.google.com/?id=2d1d9fadc20bcc61d41bd52116bd94e3https://screenshot.googleplex.com/OAwJnvwPqPH
Savings: 8% of system_server binder response time when the call is executed.
In terms total binder transaction time. Savings are 2% of the total
binder call time.
Exempt-From-Owner-Approval: CP to correct branch for R
Bug: 153656459
Test: atest FrameworksServicesTests:PackageParserTest
Test: atest FrameworksServicesTests:PackageParserLegacyCoreTest
Test: atest FrameworksServicesTests:ScanTests
Test: atest FrameworksServicesTests:ParallelPackageParserTest
Merged-In: I2de9cf1f754a505239d4416e1fc70bf77932c5db
Change-Id: I2de9cf1f754a505239d4416e1fc70bf77932c5db
(cherry picked from commit 7cb9e5f671)
Also fixes small bugs and TODOs here and there for tests to pass.
Bug: 153266100
Bug: 153107300
Bug: 148560657
Bug: 148615405
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
com.android.server.pm.ShortcutManagerTest11
Change-Id: I702de148059296af0a5db70e1a11e4620588a00a
For incremental installations only, we skip the verification
request broadcast and instead always send a verified broadcast
with the root hash.
Bug: 151240337
Test: Manual. Install APK normally and see the verifier request broadcast is sent
Test: Manual. Install APK incrementally and see verifier request broadcast is not sent, and verified broadcast is sent with root hash
Change-Id: I2599472818b63ea172d2d412741e5540c8a52176
The <extension-sdk> manifest tag was added in ag/1004614 to
allow apps to specify the minimum versions they need of
extension SDKs.
This adds the min extension versions to ParsingPackage.
This will be needed to allow us to perform checks that rollbacks do
not violate the min extension versions of installed apps (see
go/sdk-extensions-and-rollback).
Bug: 152737927
Test: atest PackageParserLegacyCoreTest#testUsesSdk
Change-Id: I2e080e46aaea6de489766dac0d323d7d2c7302ca
This exposes errors directly, which mirrors what PackageParser
used to do. Just a leftover TODO from the refactor.
Bug: 153472626
Test: manual install broken APK and check the error is logged
Change-Id: I06804ad7396196e28ce2177a671d4eef3958e1d6
If an application targets R+, prevent the application from being
installed if the app has a compressed resources.arsc or if the
resources.arsc is not aligned on a 4-byte boundary. Resources tables
that cannot be memory mapped have to be read into a buffer in RAM
and exert unnecessary memory pressure on the system.
Bug: 132742131
Test: manual (adding CTS tests)
Change-Id: Ieef764c87643863de24531fac12cc520fe6d90d0
We've heard reports that some ContentProviders are sensitive to their
notifications being delayed, so this change adds a NOTIFY_NO_DELAY
flag that they can use to bypass any background delays.
Bug: 149370968
Test: none
Change-Id: I0465c8dee92cd5708c04035bc0396ce2d1083f67
This change ensures that only the system (appId < 10000) may see apps
with receivers of protected broadcasts.
Test: atest AppsFilterTest
Fixes: 142386375
Change-Id: Ia421d2aa22d37eafbb6c1cd217ab2cb1626480b0