diff options
author | 2021-09-06 08:51:21 +0100 | |
---|---|---|
committer | 2021-09-06 08:51:21 +0100 | |
commit | c087f6248276c21f7f89a424f1765b63dba4133c (patch) | |
tree | 05e07bc46c4c8066cd1fd84c78fa0ebb8a4b1579 | |
parent | e22278838e655ed80b5c8e060632835a11df45eb (diff) |
Don't throw for LazyValue in Parcel.hasFileDescriptors()
In aosp/1819733 we extracted Parcel.hasFileDescriptor() for types
produced by Parcel.writeValue() and consumed by Parcel.readValue() out
of Bundle into Parcel. It's supposed to handle LazyValue too.
However, we put a check to verify that it was a type supported by
readValue()/writeValue() by retrieving the VAL_XXX type of the value via
Parcel.getValueType(), however, that method throws for LazyValue since
we don't actually write that special type on the wire. However, we still
want Parcel.hasFileDescriptor() to support it, so moving the check into
a last 'else' statement, making sure we don't throw in case the value is
a LazyValue.
Bug: 195622897
Bug: 198433827
Test: atest CtsNetTestCases android.net.cts.CaptivePortalTest#testCaptivePortalIsNotDefaultNetwork
Change-Id: I1e6ec122557c12e74db6890e1631fec3cefe31f6
-rw-r--r-- | core/java/android/os/Parcel.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java index 575eb375abc6..00db972bf709 100644 --- a/core/java/android/os/Parcel.java +++ b/core/java/android/os/Parcel.java @@ -665,7 +665,6 @@ public final class Parcel { * @hide */ public static boolean hasFileDescriptors(Object value) { - getValueType(value); // Will throw if value is not supported if (value instanceof LazyValue) { return ((LazyValue) value).hasFileDescriptors(); } else if (value instanceof Parcelable) { @@ -706,6 +705,8 @@ public final class Parcel { } } } + } else { + getValueType(value); // Will throw if value is not supported } return false; } |