* changes:
Hand-migration to TypedXml interface.
Mechanically apply TypedXml refaster template.
Refaster templates for new TypedXml classes.
Mechanical refactoring to new XML resolvers.
Refine TypedXmlPullParser API interface.
* changes:
Log only current client data in IME tracing
Optimized workflow for IME tracing on InputMethodManagerService side
Optimized workflow for IME tracing on InputMethodService side
Optimized workflow for IME tracing on clients side
Techincally our additions should match the shape of the upstream
XmlPullParser interface, which throws XmlPullParserException when
there is a parsing issue; IOException should be reserved for actual
disk I/O issues.
Improve BinaryXmlPullParser handling of invalid inputs to match
how ForcedTypedXmlPullParser throws on any parsing trouble.
Bug: 171832118
Test: atest FrameworksCoreTests:android.util.XmlTest
Test: atest FrameworksCoreTests:android.util.BinaryXmlTest
Change-Id: I8f0e95d536b53570055a9e174f0849cf635da48c
A recent set of patches had mismatched handling of UTF-8 vs modified
UTF-8; this change converges all paths towards using modified UTF-8
to match the DataInput/Output API contract.
New tests verify that underlying raw data is compatible between the
upstream and local implementations.
Bug: 171832118
Test: atest FrameworksCoreTests:android.util.CharsetUtilsTest
Test: atest FrameworksCoreTests:android.util.XmlTest
Test: atest FrameworksCoreTests:android.util.BinaryXmlTest
Test: atest FrameworksCoreTests:com.android.internal.util.FastDataTest
Change-Id: I49423edc867839fb6626cd8bd361abe7bc512633
IME tracing information is added to bugreport if tracing was
previously enabled. IME tracing is reenabled after data is
dumped in the bugreport.
InputMethodManagerService state information is also dumped
in proto format.
Bug: 167948910, 154348613
Test: start trace by calling "adb shell ime tracing start"
create a bugreport by calling "adb bugreport"
check info in the bugreport zip file or upload to Winscope
Change-Id: Ie87eb8423e2bb70f28c330983d45b95e2e07062d
This change moves from dumping information of all Input Method client
instances to dumping only the current client, which is the one in which
the triggering event happened.
Bug: 154348613
Test: flash a device
start IME tracing by calling "adb shell ime tracing start"
end IME tracing by calling "adb shell ime tracing stop"
pull generated trace files and visualize in Winscope
or start tracing directly through ADB Connect and visualize traces
Change-Id: I46460d3d08947c7d37a8969a2fed6539f35aaf91
Optimized the tracing logic for the IMMS information. The
InputMethodManagerService triggers a tracing dump through the new
method triggerManagerServiceDump, exposed by the ImeTracing
interface.
This change only covers the IMMS information. The clients and
IMS information were added on previous changes.
Bug: 154348613
Test: start IME tracing by calling "adb shell ime tracing start"
end IME tracing by calling "adb shell ime tracing stop"
pull trace using "adb pull /data/misc/wmtrace/ime_trace_managerservice.pb ime_trace_managerservice.pb"
Change-Id: Ia5fb8f47769ec8c6a1a24c18cd19952c0c550274
Optimized the tracing logic for the IMS information. The
InputMethodService triggers a tracing dump through the new method
triggerServiceDump, exposed by the meTracing interface. This
change was done to be able to support custom dumps from clients
and custom dumps from InputMethodService.
This change only covers the IMS information. The IMMS
information will be dumped in next changes.
Bug: 154348613
Test: start IME tracing by calling "adb shell ime tracing start"
end IME tracing by calling "adb shell ime tracing stop"
pull trace using "adb pull /data/misc/wmtrace/ime_trace_service.pb ime_trace_service.pb"
Change-Id: Icda0f82d76fb7db5b2bd8d021069b1ff15a4e15b
Optimized the tracing logic for the IME clients information. The
clients trigger a tracing dump through the new method triggerClientDump
exposed by the ImeTracing interface. This change was done
to be able to support custom dump for clients information and
custom dump from IMS.
This change only covers the clients information. The IMS and IMMS
information will be dumped in next changes.
Bug: 154348613
Test: start IME tracing by calling "adb shell ime tracing start"
end IME tracing by calling "adb shell ime tracing stop"
pull trace using "adb pull /data/misc/wmtrace/ime_trace_clients.pb ime_trace_clients.pb"
Change-Id: I499cb5f45a3e78912b09b9c6cedf1ce5443e797a
* changes:
Custom binary XML wire protocol.
Progress towards efficient XML serialization.
More efficient alternatives to ByteBuffer.
CharsetUtils alternatives that avoid allocations.
We've identified that XML writing and reading uses roughly 1.5% of
all system_server CPU, and can generate many temporary objects.
Building on the recent TypedXmlSerializer/PullParser interfaces, this
change introduces new BinaryXmlSerializer/PullParser implementations
that store data using a custom binary wire protocol. Benchmarking of
a typical packages.xml has shown this new binary approach can write
4.3x faster and read 8.5x faster, while using 2.4x less disk space:
timeWrite_Fast_mean: 27946635
timeWrite_Binary_mean: 6519341
timeRead_Fast_mean: 59562531
timeRead_Binary_mean: 7020185
A major factor in choosing to invest in this new wire protocol is
that it enables the long-tail of over 100 unique XML schemas used
across the OS internals to be transparently upgraded to gain these
benefits with only minimal changes, reducing the risks associated
with rewriting those schemas.
Finally, since the wire protocol is essentially a serialized event
stream, it's trivial to transparently convert this new protocol
into human-readable XML and vice-versa. The tests in this change
demonstrate this translation working correctly, and future changes
will introduce new shell tools to aid development work.
Bug: 171832118
Test: atest FrameworksCoreTests:android.util.XmlTest
Test: atest FrameworksCoreTests:android.util.BinaryXmlTest
Test: atest CorePerfTests:android.util.XmlPerfTest
Change-Id: Ib9390701f09562dca952b3786622675b9c68a462
We've identified that XML writing and reading uses roughly 1.5% of
all system_server CPU, and can generate many temporary objects.
To set the stage for some long-term improvements, this change
introduces new TypedXmlSerializer and TypedXmlPullParser interfaces
which offer efficient access to primitive attributes and text.
This change also updates XmlUtils to redirect primitive operations
through these new interfaces.
Bug: 171832118
Test: atest FrameworksCoreTests:android.util.XmlTest
Change-Id: I5ba3ad87cf79ca10705a96b98855164a27fee021
Internally String.getBytes() calls libcore.util.CharsetUtils methods
for a handful of common charsets, but that path requires new memory
allocations for every call.
This change introduces alternative versions of those methods which
attempt to encode data directly into an already-allocated memory
region. If the destination is to small, callers can detect and pivot
back to calling String.getBytes().
The included benchmarks reveal these raw performance improvements,
in addition to the reduced GC load which is harder to measure:
timeLocal_LargeBuffer[simple]_mean: 424
timeLocal_SmallBuffer[simple]_mean: 511
timeUpstream[simple]_mean: 800
timeLocal_LargeBuffer[complex]_mean: 977
timeLocal_SmallBuffer[complex]_mean: 1266
timeUpstream[complex]_mean: 1468
Bug: 171832118
Test: atest CorePerfTests:android.util.CharsetUtilsPerfTest
Test: atest FrameworksCoreTests:android.util.CharsetUtilsTest
Change-Id: Iac1151e7cb8e88bf82339cada64b0936e1a7578b
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.
This is a resubmit of ag/12929664 with some APIs excluded that caused
test failures; see bugs 171886397, 171888296, 171864568.
APIs excluded:
Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord;
Landroid/os/Process;->myPpid()I
Landroid/os/SharedMemory;->getFd()I
Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I
Bug: 170729553
Test: Treehugger
Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.
Bug: 170729553
Test: Treehugger
Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
The recently added TextUtils.formatSimple() can efficiently format
simple strings, roughly 6.5x faster than using String.format().
This change starts using this new method in hot codepaths identified
from pprof traces, and this CL alone should reduce system_process CPU
usage by 0.24%. Linked bug has detailed pprof screenshots.
Bug: 170978902
Test: atest FrameworksCoreTests:android.text.TextUtilsTest
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: Ie5a21a24be6dfcdb29768fe235e20f050fc111c7
* changes:
Apply fixes for EfficientStrings.
Apply fixes for EfficientStrings.
Apply fixes for EfficientStringsChecker.
Apply fixes for EfficientCollections.
Trivial refactor for consistent naming.
Expand formatSimple() to support widths.
Refinement of EfficientStringsChecker.
Drop-in replacements suggested for inefficient collections. Also
annotate a handful of places where we're unable to update.
Bug: 155703208
Test: none
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: I48b600508df8160ac9b40fea7afca974b2c972f6
Those annotations could be inferred by some tools (like Kotlin), but the
https://checkerframework.org/ doesn't check inherited annotations
complaining about all equals() invocations that get nullable argument.
The change was generated by running
find . -name \*.java | xargs sed -i 's/public boolean equals(Object /public boolean equals(@Nullable Object /'
in the frameworks/base directory and by automatically adding and
formatting required imports if needed. No manual edits.
Bug: 170883422
Test: Annotation change only. Should have not impact.
Exempt-From-Owner-Approval: Mechanical change not specific to any component.
Change-Id: I5eedb571c9d78862115dfdc5dae1cf2a35343580
The javadoc for Log stated that verbose logs are not compiled into apps
and debug logs are stripped at runtime, but this doesn't happen
automatically and is up to the app's Proguard/R8 configuration and/or
explicit use of isLoggable. Just remove this.
Fixes: 27286343
Test: m offline-sdk-docs
Change-Id: I0376b20e5c324f422a5fff0201f144e447d8eac2
To determine whether a user has a badge, the
correct call is now hasBadge, rather than isManagedProfile.
Currently, the only user that actually can have a badge
is a managed profile, so this change is a no-op. In the future,
if further profile support is expanded, then hasBadge will
be correct.
Bug: 170249807
Test: Treehugger (this cl is a no-op)
Change-Id: I9144c4dc519936dfc5a2aeae0eb0bd91bea89db2
This CL implements a mechanism to dump IME related client states into
a proto file which can later be imported to winscope to allow easy
debugging. A new abstract class ImeTracing.java declares the methods
related to scheduling, collecting and dumping logs. Two child class
implement these methods for server and client separately.
The Design Doc for the IME tracing project is: go/ime-tracing
Bug: 154348613
Test: start trace by calling "adb shell ime tracing start"
end trace by calling "adb shell ime tracing stop"
pull trace using "adb pull /data/misc/wmtrace/ime_trace.pb ime_trace.pb"
Change-Id: Ia89f11d5ef8a220ea7746191b18769cea5a8359d
The change which removed the IllegalArgumentException was released in O (API level 26) (8143fa57ad), so the exception is thrown till API level 25, NOT 23 as the documentation currently states.
Bug: 124593220
Change-Id: Ia4c094cd7ae68f978bd5f49a9b294286dbe5bb61
PackageManager Settings will now read permission state from
PermissionManager as well, to maintain compatibility for dump and the
package list file. As a result, we no longer need to write back to
this legacy state before dump and writing package list. We still need
to do so before we finish persistence migration though.
The new AppIdPermissionState will be a system API once we finish
migration of BasePermission.
Bug: 158736025
Test: presubmit
Change-Id: I3c7f20cef54084255108a0a889d8a3d7e3ab9d88
SparseArrayMap required Strings as keys, which restricted its uses. Now
it can take any object as a key, which better reflects the underlying
ArrayMap generalization.
Bug: 138469672
Test: atest com.android.server.job.controllers.QuotaControllerTest
Test: atest QuotaTrackerTest
Test: atest SparseArrayMapTest
Change-Id: If6da7dfdf3cdd9be0fe9006484c78c574ef2028b