summaryrefslogtreecommitdiff
path: root/core/java/android/util/Xml.java
Commit message (Collapse)AuthorAgeFilesLines
* Enable binary XML by default.Jeff Sharkey2020-12-171-1/+1
| | | | | | | | | | | | | This change enables the feature-flag which pivots most of the XML data stored by the system_server to using a binary XML wire format. Benchmarks have shown this binary format can be written over 4x faster and parsed over 8x faster than human-readable XML while seamlessly enabling client code to pivot between the two formats. Bug: 171832118 Test: atest FrameworksServicesTests Change-Id: Id43edc0627866aba55e580d17958c689a6cfcfad
* Prepare for binary XML pivot.Jeff Sharkey2020-12-171-2/+6
| | | | | | | | | | | | | | | | | | As part of preparing to enable the new binary XML wire format across the device, we ran a large suite of unit tests which uncovered a handful of bugs where client code was assuming that the serializer would create TEXT tokens for newlines between tags. Also relaxes all binary XML classes to accept either "UTF-8" or "utf-8" as the encoding name. Slight bug fixes to clear names, text, and attributes for each event to match XmlPullParser documentation. Fixes for existing unit tests that were assuming human-readable XML, or assuming that the serialization would perform UTF-8 validation. Bug: 171832118 Test: atest FrameworksServicesTests Change-Id: I841fe41e4967b36ab17551294ae0f42fb87a8e71
* Additional hand-migration to TypedXml interface.Jeff Sharkey2020-11-301-0/+2
| | | | | | | | | | | | Previous changes have applied mechanical refactorings, but this change hand-migrates the remaining logic which was too complex to identify. This change should have no behavior change; famous last words. Bug: 171832118 Test: manual Exempt-From-Owner-Approval: trivial refactoring Change-Id: If2d4b1a354481a83edb4bbcfa22f690b7f5e97c3
* "Resolve" both human-readable and binary XML.Jeff Sharkey2020-11-301-5/+38
| | | | | | | | | | | | | | | | | | | | Recent refactorings have pivoted many XML users across the system to call resolveSerializer() and resolvePullParser(), which gives us an easy path to pivot between human-readable XML and our binary XML wire format. This change introduces a feature flag (still disabled by default) for emitting binary XML by default when serializing. It also adds logic to automatically select the relevant parser by sniffing the magic file header. This is the key to our upgrade strategy: we'll gladly parse human-readable XML from old devices, or binary XML from new devices. Bug: 171832118 Test: atest FrameworksCoreTests:android.util.XmlTest Test: atest FrameworksCoreTests:android.util.BinaryXmlTest Change-Id: I14fdab9a6667819db38116a8ce126f5f2a5a04df
* Custom binary XML wire protocol.Jeff Sharkey2020-11-101-0/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Progress towards efficient XML serialization.Jeff Sharkey2020-11-101-0/+83
| | | | | | | | | | | | | | | | 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
* Move XML object factory logic to libcoreNeil Fuller2018-07-111-32/+14
| | | | | | | | | | | | | It makes sense to hide the details of the parser implementation (and other similar objects) in libcore so it could be changed. This change removes the "ExpatPerformanceTest" which appears not to have been maintained and was comparing KxmlParser with itself. It is assumed that android.util.Xml used to return the expat parser. Test: build Bug: 111055375 Change-Id: Ibad247323ba90cd949aecb2bd92f2f73306a4327
* Tracking merge of dalvik-dev to masterBrian Carlstrom2011-04-011-21/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git cherry-pick --no-commit a80febd83c8bf0b6717da2a7136179bdc906a5b7 git cherry-pick --no-commit 5e642b41cf44c5da7afdd95ab3d5e2bdbf7b31dd git cherry-pick --no-commit 4886db14c9eee4b6fee69bd54c57c5af04709c4c git cherry-pick --no-commit 560c685e448769904047507b9484ce8111967d7e git cherry-pick --no-commit 63dde7a2fcfa53dc531558635b64cea613d3cdb4 git cherry-pick --no-commit 74e5cb91060a379d98dd3a333b5f231bfb4f502e git cherry-pick --no-commit 1cc8c9708b555e2e338b7798d38887a2fefcfea6 git cherry-pick --no-commit 09625a21f5abe0c0db15757f58585d552d62c3d7 git cherry-pick --no-commit fcb02dfe0f5a2bb7c07e6d6fc69f756a484b5458 git cherry-pick --no-commit a68cb7fa3ab42854768b8145ff85231663770292 git cherry-pick --no-commit 716beb1c131dd2c6b805d4f681debaa20075010c git cherry-pick --no-commit 8c29b1097a7afe3a77e27546a56e396f3620a4ec git cherry-pick --no-commit 9c6a1a55d1c8086c1cc57464eea43725694ff70c git cherry-pick --no-commit b14f5ea5c57acdd009ba5b51f1bbe430f3d353b8 Change-Id: I8cc94175441b009e23549762d6baee1dbace4881
* Remove default constructors from static utility classes.Jesse Wilson2011-02-241-4/+5
| | | | | Change-Id: Id8dc55a30a03e1da87500b66c429de9268033b9e http://b/3344646
* Remove inappropriate conversion of IOException to AssertionErrorTom O'Neill2010-11-051-9/+5
| | | | | | | | | An IOException is a recoverable condition, and AssertionError should be used for non-recoverable conditions. Fixes b/3169361 Change-Id: Ie71a537293e01ffb49c5f535412e2631e27c84c8
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-0/+185
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-185/+0
|
* Initial ContributionThe Android Open Source Project2008-10-211-0/+185