Revert "Revert "Migrate unsafe parcel APIs in framework-minus-apex""
This reverts commit 331be9a6431d6489f8d1e1b80cb510d0ee073c50.
Reintroducing ag/16366278 since it seems unrelated to b/214053959 (more details on b/214053959#comment55).
Original commit message:
Migrate unsafe parcel APIs in framework-minus-apex
Migrate the following unsafe parcel APIs in framework-minus-apex:
* Parcel.readSerializable()
* Parcel.readArrayList()
* Parcel.readList()
* Parcel.readParcelable()
* Parcel.readParcelableList()
* Parcel.readSparseArray()
This CL was generated by applying lint fixes that infer the expected
type from the caller code and provide that as the type parameter
(ag/16365240).
A few observations:
* In some classes we couldn't migrate because the class also belonged to
another build module whose min SDK wasn't current (as is the case for
framework-minus-apex), hence I suppressed the lint check
(since I'll eventually submit the lint check to the tree).
* In some cases, I needed to do the cast in
https://stackoverflow.com/a/1080525/5765705 to make the compiler happy
since there isn't another way of providing a class of type
Class<MyClassWithGenerics<T>>.
* In the readSerializable() case, the new API also requires the class
loader, that was inferred to by InferredClass.class.getClassLoader().
* Note that automatic formatting and import rely on running hooked up
to the IDE, which wasn't the case here.
Bug: 195622897
Change-Id: I272432e6e082a973f7a50492ec35d79c2b577c93
Test: TH passes
diff --git a/telecomm/java/android/telecom/ConnectionRequest.java b/telecomm/java/android/telecom/ConnectionRequest.java
index be5fae4..1172e13 100644
--- a/telecomm/java/android/telecom/ConnectionRequest.java
+++ b/telecomm/java/android/telecom/ConnectionRequest.java
@@ -272,17 +272,17 @@
}
private ConnectionRequest(Parcel in) {
- mAccountHandle = in.readParcelable(getClass().getClassLoader());
- mAddress = in.readParcelable(getClass().getClassLoader());
- mExtras = in.readParcelable(getClass().getClassLoader());
+ mAccountHandle = in.readParcelable(getClass().getClassLoader(), android.telecom.PhoneAccountHandle.class);
+ mAddress = in.readParcelable(getClass().getClassLoader(), android.net.Uri.class);
+ mExtras = in.readParcelable(getClass().getClassLoader(), android.os.Bundle.class);
mVideoState = in.readInt();
mTelecomCallId = in.readString();
mShouldShowIncomingCallUi = in.readInt() == 1;
- mRttPipeFromInCall = in.readParcelable(getClass().getClassLoader());
- mRttPipeToInCall = in.readParcelable(getClass().getClassLoader());
+ mRttPipeFromInCall = in.readParcelable(getClass().getClassLoader(), android.os.ParcelFileDescriptor.class);
+ mRttPipeToInCall = in.readParcelable(getClass().getClassLoader(), android.os.ParcelFileDescriptor.class);
mParticipants = new ArrayList<Uri>();
- in.readList(mParticipants, getClass().getClassLoader());
+ in.readList(mParticipants, getClass().getClassLoader(), android.net.Uri.class);
mIsAdhocConference = in.readInt() == 1;
}