Merge changes from topic "OutputConfigurationParcel" into sc-dev

* changes:
  OutputConfiguration: fix CREATOR readList for sensor pixel modes.
  camera2: Fix exception swallowing in params classes createFromParcel
This commit is contained in:
Jayant Chowdhary
2021-06-15 00:49:30 +00:00
committed by Android (Google) Code Review
4 changed files with 17 additions and 32 deletions

View File

@@ -735,8 +735,7 @@ public final class OutputConfiguration implements Parcelable {
source.readTypedList(surfaces, Surface.CREATOR);
String physicalCameraId = source.readString();
boolean isMultiResolutionOutput = source.readInt() == 1;
ArrayList<Integer> sensorPixelModesUsed = new ArrayList<Integer>();
source.readList(sensorPixelModesUsed, Integer.class.getClassLoader());
int[] sensorPixelModesUsed = source.createIntArray();
checkArgumentInRange(rotation, ROTATION_0, ROTATION_270, "Rotation constant");
mSurfaceGroupId = surfaceSetId;
@@ -760,7 +759,7 @@ public final class OutputConfiguration implements Parcelable {
}
mPhysicalCameraId = physicalCameraId;
mIsMultiResolution = isMultiResolutionOutput;
mSensorPixelModesUsed = sensorPixelModesUsed;
mSensorPixelModesUsed = convertIntArrayToIntegerList(sensorPixelModesUsed);
}
/**
@@ -826,13 +825,7 @@ public final class OutputConfiguration implements Parcelable {
new Parcelable.Creator<OutputConfiguration>() {
@Override
public OutputConfiguration createFromParcel(Parcel source) {
try {
OutputConfiguration outputConfiguration = new OutputConfiguration(source);
return outputConfiguration;
} catch (Exception e) {
Log.e(TAG, "Exception creating OutputConfiguration from parcel", e);
return null;
}
return new OutputConfiguration(source);
}
@Override
@@ -854,6 +847,17 @@ public final class OutputConfiguration implements Parcelable {
return integerArray;
}
private static ArrayList<Integer> convertIntArrayToIntegerList(int[] intArray) {
ArrayList<Integer> integerList = new ArrayList<Integer>();
if (intArray == null) {
return integerList;
}
for (int i = 0; i < intArray.length; i++) {
integerList.add(intArray[i]);
}
return integerList;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
if (dest == null) {
@@ -871,7 +875,6 @@ public final class OutputConfiguration implements Parcelable {
dest.writeInt(mIsMultiResolution ? 1 : 0);
// writeList doesn't seem to work well with Integer list.
dest.writeIntArray(convertIntegerToIntList(mSensorPixelModesUsed));
//dest.writeArray(mSensorPixelModesUsed.toArray());
}
/**

View File

@@ -146,13 +146,7 @@ public final class SessionConfiguration implements Parcelable {
new Parcelable.Creator<SessionConfiguration> () {
@Override
public SessionConfiguration createFromParcel(Parcel source) {
try {
SessionConfiguration sessionConfiguration = new SessionConfiguration(source);
return sessionConfiguration;
} catch (Exception e) {
Log.e(TAG, "Exception creating SessionConfiguration from parcel", e);
return null;
}
return new SessionConfiguration(source);
}
@Override

View File

@@ -36,13 +36,7 @@ public final class VendorTagDescriptor implements Parcelable {
new Parcelable.Creator<VendorTagDescriptor>() {
@Override
public VendorTagDescriptor createFromParcel(Parcel source) {
try {
VendorTagDescriptor vendorDescriptor = new VendorTagDescriptor(source);
return vendorDescriptor;
} catch (Exception e) {
Log.e(TAG, "Exception creating VendorTagDescriptor from parcel", e);
return null;
}
return new VendorTagDescriptor(source);
}
@Override

View File

@@ -36,13 +36,7 @@ public final class VendorTagDescriptorCache implements Parcelable {
new Parcelable.Creator<VendorTagDescriptorCache>() {
@Override
public VendorTagDescriptorCache createFromParcel(Parcel source) {
try {
VendorTagDescriptorCache vendorDescriptorCache = new VendorTagDescriptorCache(source);
return vendorDescriptorCache;
} catch (Exception e) {
Log.e(TAG, "Exception creating VendorTagDescriptorCache from parcel", e);
return null;
}
return new VendorTagDescriptorCache(source);
}
@Override