summaryrefslogtreecommitdiff
path: root/tools/aapt2/java/JavaClassGenerator_test.cpp
diff options
context:
space:
mode:
authorTobias Thierer <tobiast@google.com>2019-05-08 22:00:38 +0100
committerTobias Thierer <tobiast@google.com>2020-02-05 18:13:24 +0000
commitf35f2913f88610764efb8b4ac2db6bbf393326ee (patch)
tree13893e298d809e83f3acab2932845b7f1929c9a2 /tools/aapt2/java/JavaClassGenerator_test.cpp
parent7891cda86230619d1383f28aec29f8fa9dbeeaab (diff)
Parcel only the canonical Uri.Part representation, not both.
Before this CL, Uri.AbstractPart's implementation of Parcelable was parceling and unparceling both the encoded and the decoded representation. A Uri with inconsistent decoded/encoded representation of its Parts would have remained inconsistent across parcel/unparcel cycles. For example, such a Uri's uri.getDecodedAuthority() might have returned "good.com" while url.getEncodedAuthority() (used e.g. for toString()) returned "evil.com". After this CL, AbstractPart's constructor allows at most one of the representations to be set (exception: NULL and EMPTY); this means that no Part instance with inconsistent values can be constructed via the constructor (e.g. by unparceling parceled data). The historical parcel representation of a Part with both values present can no longer be unparceled, which is safe because Parcel does not guarantee backwards compatibility (the parceled form must not be persisted across Android version upgrades). When parceling, only one of the values is now stored, namely the (canonical) one that was passed to the constructor. Fixes: 124526860 Test: atest FrameworksCoreTests:android.net.UriTest Test: Checked that if run before this CL, the added tests would fail with a failure along the lines of: ComparisonFailure: expected:</foo/[b]> but was:</foo/[a]> or (if the first assertion was commented out): ComparisonFailure: expected:<[b].com> but was:<[a].com> Change-Id: I2bc2008e49de5a66641ecdbd8e5354dfa647269d Merged-In: I2bc2008e49de5a66641ecdbd8e5354dfa647269d (cherry picked from commit c9afa38f974317b6b0e28410bbc3426a41791660)
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator_test.cpp')
0 files changed, 0 insertions, 0 deletions