diff options
| author | 2023-08-21 14:18:04 +0000 | |
|---|---|---|
| committer | 2023-08-21 14:18:04 +0000 | |
| commit | d56e8e7f103ec46ee4be086934d9c537fa48e804 (patch) | |
| tree | f8b29f58efabdf5a9ff341fff87113617060f19e | |
| parent | e1ee1aab9f99d05ca97dee3701afb894a6129446 (diff) | |
Remove unused RenderScript functions from Camera
Remove unused `createPreviewAllocation` and
`setPreviewCallbackAllocation` functions from `Camera`.
Bug: 296813467
Test: atest CtsCameraTestCases
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:aa52270a8e643f7caa264f4e91c78b8030f812be)
Merged-In: I596de3fc844e1c951d8d3cd8fe2e7efc61bec4a1
Change-Id: I596de3fc844e1c951d8d3cd8fe2e7efc61bec4a1
| -rw-r--r-- | core/java/android/hardware/Camera.java | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java index ccc39b6080d7..039644387715 100644 --- a/core/java/android/hardware/Camera.java +++ b/core/java/android/hardware/Camera.java @@ -41,11 +41,6 @@ import android.os.Message; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; -import android.renderscript.Allocation; -import android.renderscript.Element; -import android.renderscript.RSIllegalArgumentException; -import android.renderscript.RenderScript; -import android.renderscript.Type; import android.text.TextUtils; import android.util.Log; import android.view.Surface; @@ -1007,132 +1002,6 @@ public class Camera { private native final void _addCallbackBuffer( byte[] callbackBuffer, int msgType); - /** - * <p>Create a {@link android.renderscript RenderScript} - * {@link android.renderscript.Allocation Allocation} to use as a - * destination of preview callback frames. Use - * {@link #setPreviewCallbackAllocation setPreviewCallbackAllocation} to use - * the created Allocation as a destination for camera preview frames.</p> - * - * <p>The Allocation will be created with a YUV type, and its contents must - * be accessed within Renderscript with the {@code rsGetElementAtYuv_*} - * accessor methods. Its size will be based on the current - * {@link Parameters#getPreviewSize preview size} configured for this - * camera.</p> - * - * @param rs the RenderScript context for this Allocation. - * @param usage additional usage flags to set for the Allocation. The usage - * flag {@link android.renderscript.Allocation#USAGE_IO_INPUT} will always - * be set on the created Allocation, but additional flags may be provided - * here. - * @return a new YUV-type Allocation with dimensions equal to the current - * preview size. - * @throws RSIllegalArgumentException if the usage flags are not compatible - * with an YUV Allocation. - * @see #setPreviewCallbackAllocation - * @hide - */ - public final Allocation createPreviewAllocation(RenderScript rs, int usage) - throws RSIllegalArgumentException { - Parameters p = getParameters(); - Size previewSize = p.getPreviewSize(); - Type.Builder yuvBuilder = new Type.Builder(rs, - Element.createPixel(rs, - Element.DataType.UNSIGNED_8, - Element.DataKind.PIXEL_YUV)); - // Use YV12 for wide compatibility. Changing this requires also - // adjusting camera service's format selection. - yuvBuilder.setYuvFormat(ImageFormat.YV12); - yuvBuilder.setX(previewSize.width); - yuvBuilder.setY(previewSize.height); - - Allocation a = Allocation.createTyped(rs, yuvBuilder.create(), - usage | Allocation.USAGE_IO_INPUT); - - return a; - } - - /** - * <p>Set an {@link android.renderscript.Allocation Allocation} as the - * target of preview callback data. Use this method for efficient processing - * of camera preview data with RenderScript. The Allocation must be created - * with the {@link #createPreviewAllocation createPreviewAllocation } - * method.</p> - * - * <p>Setting a preview allocation will disable any active preview callbacks - * set by {@link #setPreviewCallback setPreviewCallback} or - * {@link #setPreviewCallbackWithBuffer setPreviewCallbackWithBuffer}, and - * vice versa. Using a preview allocation still requires an active standard - * preview target to be set, either with - * {@link #setPreviewTexture setPreviewTexture} or - * {@link #setPreviewDisplay setPreviewDisplay}.</p> - * - * <p>To be notified when new frames are available to the Allocation, use - * {@link android.renderscript.Allocation#setIoInputNotificationHandler Allocation.setIoInputNotificationHandler}. To - * update the frame currently accessible from the Allocation to the latest - * preview frame, call - * {@link android.renderscript.Allocation#ioReceive Allocation.ioReceive}.</p> - * - * <p>To disable preview into the Allocation, call this method with a - * {@code null} parameter.</p> - * - * <p>Once a preview allocation is set, the preview size set by - * {@link Parameters#setPreviewSize setPreviewSize} cannot be changed. If - * you wish to change the preview size, first remove the preview allocation - * by calling {@code setPreviewCallbackAllocation(null)}, then change the - * preview size, create a new preview Allocation with - * {@link #createPreviewAllocation createPreviewAllocation}, and set it as - * the new preview callback allocation target.</p> - * - * <p>If you are using the preview data to create video or still images, - * strongly consider using {@link android.media.MediaActionSound} to - * properly indicate image capture or recording start/stop to the user.</p> - * - * @param previewAllocation the allocation to use as destination for preview - * @throws IOException if configuring the camera to use the Allocation for - * preview fails. - * @throws IllegalArgumentException if the Allocation's dimensions or other - * parameters don't meet the requirements. - * @see #createPreviewAllocation - * @see #setPreviewCallback - * @see #setPreviewCallbackWithBuffer - * @hide - */ - public final void setPreviewCallbackAllocation(Allocation previewAllocation) - throws IOException { - Surface previewSurface = null; - if (previewAllocation != null) { - Parameters p = getParameters(); - Size previewSize = p.getPreviewSize(); - if (previewSize.width != previewAllocation.getType().getX() || - previewSize.height != previewAllocation.getType().getY()) { - throw new IllegalArgumentException( - "Allocation dimensions don't match preview dimensions: " + - "Allocation is " + - previewAllocation.getType().getX() + - ", " + - previewAllocation.getType().getY() + - ". Preview is " + previewSize.width + ", " + - previewSize.height); - } - if ((previewAllocation.getUsage() & - Allocation.USAGE_IO_INPUT) == 0) { - throw new IllegalArgumentException( - "Allocation usage does not include USAGE_IO_INPUT"); - } - if (previewAllocation.getType().getElement().getDataKind() != - Element.DataKind.PIXEL_YUV) { - throw new IllegalArgumentException( - "Allocation is not of a YUV type"); - } - previewSurface = previewAllocation.getSurface(); - mUsingPreviewAllocation = true; - } else { - mUsingPreviewAllocation = false; - } - setPreviewCallbackSurface(previewSurface); - } - private native final void setPreviewCallbackSurface(Surface s); private class EventHandler extends Handler |