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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user