Get rid of writeSerializable in CarPropertyConfig
Change-Id: Ib245d328f6a9ba907805761214399485c1176b96
Fix: b/28294318
diff --git a/car-lib/src/android/car/hardware/CarPropertyConfig.java b/car-lib/src/android/car/hardware/CarPropertyConfig.java
index dc7f887..a93f2bc 100644
--- a/car-lib/src/android/car/hardware/CarPropertyConfig.java
+++ b/car-lib/src/android/car/hardware/CarPropertyConfig.java
@@ -119,7 +119,7 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(mPropertyId);
- dest.writeSerializable(mType);
+ dest.writeString(mType.getName());
dest.writeInt(mAreaType);
dest.writeInt(mSupportedAreas.size());
for (int i = 0; i < mSupportedAreas.size(); i++) {
@@ -131,7 +131,12 @@
@SuppressWarnings("unchecked")
private CarPropertyConfig(Parcel in) {
mPropertyId = in.readInt();
- mType = (Class<T>) in.readSerializable();
+ String className = in.readString();
+ try {
+ mType = (Class<T>) Class.forName(className);
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException("Class not found: " + className);
+ }
mAreaType = in.readInt();
int areaSize = in.readInt();
mSupportedAreas = new SparseArray<>(areaSize);