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:
committed by
Android (Google) Code Review
commit
a0c39535ac
@@ -735,8 +735,7 @@ public final class OutputConfiguration implements Parcelable {
|
|||||||
source.readTypedList(surfaces, Surface.CREATOR);
|
source.readTypedList(surfaces, Surface.CREATOR);
|
||||||
String physicalCameraId = source.readString();
|
String physicalCameraId = source.readString();
|
||||||
boolean isMultiResolutionOutput = source.readInt() == 1;
|
boolean isMultiResolutionOutput = source.readInt() == 1;
|
||||||
ArrayList<Integer> sensorPixelModesUsed = new ArrayList<Integer>();
|
int[] sensorPixelModesUsed = source.createIntArray();
|
||||||
source.readList(sensorPixelModesUsed, Integer.class.getClassLoader());
|
|
||||||
checkArgumentInRange(rotation, ROTATION_0, ROTATION_270, "Rotation constant");
|
checkArgumentInRange(rotation, ROTATION_0, ROTATION_270, "Rotation constant");
|
||||||
|
|
||||||
mSurfaceGroupId = surfaceSetId;
|
mSurfaceGroupId = surfaceSetId;
|
||||||
@@ -760,7 +759,7 @@ public final class OutputConfiguration implements Parcelable {
|
|||||||
}
|
}
|
||||||
mPhysicalCameraId = physicalCameraId;
|
mPhysicalCameraId = physicalCameraId;
|
||||||
mIsMultiResolution = isMultiResolutionOutput;
|
mIsMultiResolution = isMultiResolutionOutput;
|
||||||
mSensorPixelModesUsed = sensorPixelModesUsed;
|
mSensorPixelModesUsed = convertIntArrayToIntegerList(sensorPixelModesUsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -826,13 +825,7 @@ public final class OutputConfiguration implements Parcelable {
|
|||||||
new Parcelable.Creator<OutputConfiguration>() {
|
new Parcelable.Creator<OutputConfiguration>() {
|
||||||
@Override
|
@Override
|
||||||
public OutputConfiguration createFromParcel(Parcel source) {
|
public OutputConfiguration createFromParcel(Parcel source) {
|
||||||
try {
|
return new OutputConfiguration(source);
|
||||||
OutputConfiguration outputConfiguration = new OutputConfiguration(source);
|
|
||||||
return outputConfiguration;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "Exception creating OutputConfiguration from parcel", e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -854,6 +847,17 @@ public final class OutputConfiguration implements Parcelable {
|
|||||||
return integerArray;
|
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
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
if (dest == null) {
|
if (dest == null) {
|
||||||
@@ -871,7 +875,6 @@ public final class OutputConfiguration implements Parcelable {
|
|||||||
dest.writeInt(mIsMultiResolution ? 1 : 0);
|
dest.writeInt(mIsMultiResolution ? 1 : 0);
|
||||||
// writeList doesn't seem to work well with Integer list.
|
// writeList doesn't seem to work well with Integer list.
|
||||||
dest.writeIntArray(convertIntegerToIntList(mSensorPixelModesUsed));
|
dest.writeIntArray(convertIntegerToIntList(mSensorPixelModesUsed));
|
||||||
//dest.writeArray(mSensorPixelModesUsed.toArray());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -146,13 +146,7 @@ public final class SessionConfiguration implements Parcelable {
|
|||||||
new Parcelable.Creator<SessionConfiguration> () {
|
new Parcelable.Creator<SessionConfiguration> () {
|
||||||
@Override
|
@Override
|
||||||
public SessionConfiguration createFromParcel(Parcel source) {
|
public SessionConfiguration createFromParcel(Parcel source) {
|
||||||
try {
|
return new SessionConfiguration(source);
|
||||||
SessionConfiguration sessionConfiguration = new SessionConfiguration(source);
|
|
||||||
return sessionConfiguration;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "Exception creating SessionConfiguration from parcel", e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -36,13 +36,7 @@ public final class VendorTagDescriptor implements Parcelable {
|
|||||||
new Parcelable.Creator<VendorTagDescriptor>() {
|
new Parcelable.Creator<VendorTagDescriptor>() {
|
||||||
@Override
|
@Override
|
||||||
public VendorTagDescriptor createFromParcel(Parcel source) {
|
public VendorTagDescriptor createFromParcel(Parcel source) {
|
||||||
try {
|
return new VendorTagDescriptor(source);
|
||||||
VendorTagDescriptor vendorDescriptor = new VendorTagDescriptor(source);
|
|
||||||
return vendorDescriptor;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "Exception creating VendorTagDescriptor from parcel", e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -36,13 +36,7 @@ public final class VendorTagDescriptorCache implements Parcelable {
|
|||||||
new Parcelable.Creator<VendorTagDescriptorCache>() {
|
new Parcelable.Creator<VendorTagDescriptorCache>() {
|
||||||
@Override
|
@Override
|
||||||
public VendorTagDescriptorCache createFromParcel(Parcel source) {
|
public VendorTagDescriptorCache createFromParcel(Parcel source) {
|
||||||
try {
|
return new VendorTagDescriptorCache(source);
|
||||||
VendorTagDescriptorCache vendorDescriptorCache = new VendorTagDescriptorCache(source);
|
|
||||||
return vendorDescriptorCache;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "Exception creating VendorTagDescriptorCache from parcel", e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user