Loading core/java/android/hardware/camera2/CaptureRequest.java +25 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.hardware.camera2.impl.SyntheticKey; import android.hardware.camera2.params.OutputConfiguration; import android.hardware.camera2.utils.HashCodeHelpers; import android.hardware.camera2.utils.TypeReference; import android.hardware.camera2.utils.SurfaceUtils; import android.os.Parcel; import android.os.Parcelable; import android.util.ArraySet; Loading Loading @@ -643,6 +644,30 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>> break; } } if (!streamFound) { // Check if we can match s by native object ID long reqSurfaceId = SurfaceUtils.getSurfaceId(s); for (int j = 0; j < configuredOutputs.size(); ++j) { int streamId = configuredOutputs.keyAt(j); OutputConfiguration outConfig = configuredOutputs.valueAt(j); int surfaceId = 0; for (Surface outSurface : outConfig.getSurfaces()) { if (reqSurfaceId == SurfaceUtils.getSurfaceId(outSurface)) { streamFound = true; mStreamIdxArray[i] = streamId; mSurfaceIdxArray[i] = surfaceId; i++; break; } surfaceId++; } if (streamFound) { break; } } } if (!streamFound) { mStreamIdxArray = null; mSurfaceIdxArray = null; Loading core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java +1 −1 Original line number Diff line number Diff line Loading @@ -730,7 +730,7 @@ public class LegacyCameraDevice implements AutoCloseable { LegacyExceptionUtils.throwOnError(nativeSetSurfaceDimens(surface, width, height)); } static long getSurfaceId(Surface surface) throws BufferQueueAbandonedException { public static long getSurfaceId(Surface surface) throws BufferQueueAbandonedException { checkNotNull(surface); try { return nativeGetSurfaceId(surface); Loading core/java/android/hardware/camera2/utils/SurfaceUtils.java +14 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,20 @@ public class SurfaceUtils { return LegacyCameraDevice.isVideoEncoderConsumer(surface); } /** * Get the native object id of a surface. * * @param surface The surface to be checked. * @return the native object id of the surface, 0 if surface is not backed by a native object. */ public static long getSurfaceId(Surface surface) { try { return LegacyCameraDevice.getSurfaceId(surface); } catch (BufferQueueAbandonedException e) { return 0; } } /** * Get the Surface size. * Loading Loading
core/java/android/hardware/camera2/CaptureRequest.java +25 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.hardware.camera2.impl.SyntheticKey; import android.hardware.camera2.params.OutputConfiguration; import android.hardware.camera2.utils.HashCodeHelpers; import android.hardware.camera2.utils.TypeReference; import android.hardware.camera2.utils.SurfaceUtils; import android.os.Parcel; import android.os.Parcelable; import android.util.ArraySet; Loading Loading @@ -643,6 +644,30 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>> break; } } if (!streamFound) { // Check if we can match s by native object ID long reqSurfaceId = SurfaceUtils.getSurfaceId(s); for (int j = 0; j < configuredOutputs.size(); ++j) { int streamId = configuredOutputs.keyAt(j); OutputConfiguration outConfig = configuredOutputs.valueAt(j); int surfaceId = 0; for (Surface outSurface : outConfig.getSurfaces()) { if (reqSurfaceId == SurfaceUtils.getSurfaceId(outSurface)) { streamFound = true; mStreamIdxArray[i] = streamId; mSurfaceIdxArray[i] = surfaceId; i++; break; } surfaceId++; } if (streamFound) { break; } } } if (!streamFound) { mStreamIdxArray = null; mSurfaceIdxArray = null; Loading
core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java +1 −1 Original line number Diff line number Diff line Loading @@ -730,7 +730,7 @@ public class LegacyCameraDevice implements AutoCloseable { LegacyExceptionUtils.throwOnError(nativeSetSurfaceDimens(surface, width, height)); } static long getSurfaceId(Surface surface) throws BufferQueueAbandonedException { public static long getSurfaceId(Surface surface) throws BufferQueueAbandonedException { checkNotNull(surface); try { return nativeGetSurfaceId(surface); Loading
core/java/android/hardware/camera2/utils/SurfaceUtils.java +14 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,20 @@ public class SurfaceUtils { return LegacyCameraDevice.isVideoEncoderConsumer(surface); } /** * Get the native object id of a surface. * * @param surface The surface to be checked. * @return the native object id of the surface, 0 if surface is not backed by a native object. */ public static long getSurfaceId(Surface surface) { try { return LegacyCameraDevice.getSurfaceId(surface); } catch (BufferQueueAbandonedException e) { return 0; } } /** * Get the Surface size. * Loading