diff options
Diffstat (limited to 'camera2/portability/src')
3 files changed, 30 insertions, 36 deletions
diff --git a/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2AgentImpl.java b/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2AgentImpl.java index 62cb700..913a575 100644 --- a/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2AgentImpl.java +++ b/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2AgentImpl.java @@ -160,7 +160,7 @@ class AndroidCamera2AgentImpl extends CameraAgent { } private static abstract class CaptureAvailableListener - extends CameraCaptureSession.CaptureCallback + extends CameraCaptureSession.CaptureListener implements ImageReader.OnImageAvailableListener {}; private class Camera2Handler extends HistoryHandler { @@ -231,7 +231,7 @@ class AndroidCamera2AgentImpl extends CameraAgent { mOpenCallback.onCameraDisabled(msg.arg1); break; } - mCameraManager.openCamera(mCameraId, mCameraDeviceStateCallback, this); + mCameraManager.openCamera(mCameraId, mCameraDeviceStateListener, this); break; } @@ -297,7 +297,7 @@ class AndroidCamera2AgentImpl extends CameraAgent { mSession.setRepeatingRequest( mPersistentSettings.createRequest(mCamera, CameraDevice.TEMPLATE_PREVIEW, mPreviewSurface), - /*listener*/mCameraResultStateCallback, /*handler*/this); + /*listener*/mCameraResultStateListener, /*handler*/this); } catch(CameraAccessException ex) { Log.w(TAG, "Unable to start preview", ex); changeState(AndroidCamera2StateHolder.CAMERA_PREVIEW_READY); @@ -379,8 +379,8 @@ class AndroidCamera2AgentImpl extends CameraAgent { // However, it will probably take longer than that, so once that happens, // just start checking the repeating preview requests as they complete. final CameraAFCallback callback = (CameraAFCallback) msg.obj; - CameraCaptureSession.CaptureCallback deferredCallbackSetter = - new CameraCaptureSession.CaptureCallback() { + CameraCaptureSession.CaptureListener deferredCallbackSetter = + new CameraCaptureSession.CaptureListener() { private boolean mAlreadyDispatched = false; @Override @@ -400,13 +400,13 @@ class AndroidCamera2AgentImpl extends CameraAgent { private void checkAfState(CaptureResult result) { if (result.get(CaptureResult.CONTROL_AF_STATE) != null && !mAlreadyDispatched) { - // Now our mCameraResultStateCallback will invoke the callback + // Now our mCameraResultStateListener will invoke the callback // the first time it finds the focus motor to be locked. mAlreadyDispatched = true; mOneshotAfCallback = callback; // This is an optimization: check the AF state of this frame // instead of simply waiting for the next. - mCameraResultStateCallback.monitorControlStates(result); + mCameraResultStateListener.monitorControlStates(result); } } @@ -542,8 +542,8 @@ class AndroidCamera2AgentImpl extends CameraAgent { // trigger capture has made it into the pipeline, we'll start checking // for the completion of that convergence, capturing when that happens. Log.i(TAG, "Forcing pre-capture autoexposure convergence"); - CameraCaptureSession.CaptureCallback deferredCallbackSetter = - new CameraCaptureSession.CaptureCallback() { + CameraCaptureSession.CaptureListener deferredCallbackSetter = + new CameraCaptureSession.CaptureListener() { private boolean mAlreadyDispatched = false; @Override @@ -563,13 +563,13 @@ class AndroidCamera2AgentImpl extends CameraAgent { private void checkAeState(CaptureResult result) { if (result.get(CaptureResult.CONTROL_AE_STATE) != null && !mAlreadyDispatched) { - // Now our mCameraResultStateCallback will invoke the + // Now our mCameraResultStateListener will invoke the // callback once the autoexposure routine has converged. mAlreadyDispatched = true; mOneshotCaptureCallback = listener; // This is an optimization: check the AE state of this frame // instead of simply waiting for the next. - mCameraResultStateCallback.monitorControlStates(result); + mCameraResultStateListener.monitorControlStates(result); } } @@ -663,7 +663,7 @@ class AndroidCamera2AgentImpl extends CameraAgent { mSession.setRepeatingRequest( mPersistentSettings.createRequest(mCamera, CameraDevice.TEMPLATE_PREVIEW, mPreviewSurface), - /*listener*/mCameraResultStateCallback, /*handler*/this); + /*listener*/mCameraResultStateListener, /*handler*/this); } catch (CameraAccessException ex) { Log.e(TAG, "Failed to apply updated request settings", ex); } @@ -710,7 +710,7 @@ class AndroidCamera2AgentImpl extends CameraAgent { try { mCamera.createCaptureSession( Arrays.asList(mPreviewSurface, mCaptureReader.getSurface()), - mCameraPreviewStateCallback, this); + mCameraPreviewStateListener, this); } catch (CameraAccessException ex) { Log.e(TAG, "Failed to create camera capture session", ex); } @@ -731,14 +731,14 @@ class AndroidCamera2AgentImpl extends CameraAgent { mCameraState.setState(newState); if (newState < AndroidCamera2StateHolder.CAMERA_PREVIEW_ACTIVE) { mCurrentAeState = CaptureResult.CONTROL_AE_STATE_INACTIVE; - mCameraResultStateCallback.resetState(); + mCameraResultStateListener.resetState(); } } } - // This callback monitors our connection to and disconnection from camera devices. - private CameraDevice.StateCallback mCameraDeviceStateCallback = - new CameraDevice.StateCallback() { + // This listener monitors our connection to and disconnection from camera devices. + private CameraDevice.StateListener mCameraDeviceStateListener = + new CameraDevice.StateListener() { @Override public void onOpened(CameraDevice camera) { mCamera = camera; @@ -778,9 +778,9 @@ class AndroidCamera2AgentImpl extends CameraAgent { } }}; - // This callback monitors our camera session (i.e. our transition into and out of preview). - private CameraCaptureSession.StateCallback mCameraPreviewStateCallback = - new CameraCaptureSession.StateCallback() { + // This listener monitors our camera session (i.e. our transition into and out of preview). + private CameraCaptureSession.StateListener mCameraPreviewStateListener = + new CameraCaptureSession.StateListener() { @Override public void onConfigured(CameraCaptureSession session) { mSession = session; @@ -802,16 +802,16 @@ class AndroidCamera2AgentImpl extends CameraAgent { } }}; - private abstract class CameraResultStateCallback - extends CameraCaptureSession.CaptureCallback { + private abstract class CameraResultStateListener + extends CameraCaptureSession.CaptureListener { public abstract void monitorControlStates(CaptureResult result); public abstract void resetState(); } - // This callback monitors requested captures and notifies any relevant callbacks. - private CameraResultStateCallback mCameraResultStateCallback = - new CameraResultStateCallback() { + // This listener monitors requested captures and notifies any relevant callbacks. + private CameraResultStateListener mCameraResultStateListener = + new CameraResultStateListener() { private int mLastAfState = -1; private long mLastAfFrameNumber = -1; private long mLastAeFrameNumber = -1; @@ -905,7 +905,7 @@ class AndroidCamera2AgentImpl extends CameraAgent { mPersistentSettings.createRequest(mCamera, CameraDevice.TEMPLATE_STILL_CAPTURE, mCaptureReader.getSurface()), - /*callback*/mOneshotCaptureCallback, + /*listener*/mOneshotCaptureCallback, /*handler*/Camera2Handler.this); } catch (CameraAccessException ex) { Log.e(TAG, "Unable to initiate capture", ex); diff --git a/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2Settings.java b/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2Settings.java index 540d8df..d668f85 100644 --- a/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2Settings.java +++ b/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2Settings.java @@ -206,7 +206,7 @@ public class AndroidCamera2Settings extends CameraSettings { } else if (setting == CONTROL_AF_REGIONS) { return mFocusAreas.size() == 0; } else if (setting == CONTROL_AE_TARGET_FPS_RANGE) { - Range<Integer> defaultFpsRange = mTemplateSettings.get(CONTROL_AE_TARGET_FPS_RANGE); + Range defaultFpsRange = mTemplateSettings.get(CONTROL_AE_TARGET_FPS_RANGE); return (mPreviewFpsRangeMin == 0 && mPreviewFpsRangeMax == 0) || (defaultFpsRange != null && mPreviewFpsRangeMin == defaultFpsRange.getLower() && mPreviewFpsRangeMax == defaultFpsRange.getUpper()); diff --git a/camera2/portability/src/com/android/ex/camera2/portability/LegacyVendorTags.java b/camera2/portability/src/com/android/ex/camera2/portability/LegacyVendorTags.java index 7eb5c33..e55748d 100644 --- a/camera2/portability/src/com/android/ex/camera2/portability/LegacyVendorTags.java +++ b/camera2/portability/src/com/android/ex/camera2/portability/LegacyVendorTags.java @@ -17,7 +17,6 @@ package com.android.ex.camera2.portability; import android.hardware.camera2.CameraCharacteristics; -import android.util.Log; import java.lang.ExceptionInInitializerError; import java.lang.reflect.Field; @@ -28,24 +27,19 @@ import java.lang.reflect.Method; */ public class LegacyVendorTags { - private static final String TAG = "LegacyVendorTags"; - /** * Hidden enum for scene modes supported only by the Camera1 API. */ public static final int CONTROL_SCENE_MODE_HDR; static { - int tempSceneMode = -1; try { - tempSceneMode = + CONTROL_SCENE_MODE_HDR = Class.forName("android.hardware.camera2.CameraCharacteristics"). getField("CONTROL_SCENE_MODE_HDR").getInt(null); } catch (Exception e) { - Log.e(TAG, "Error while reflecting on SCENE_MODE_HDR enum, HDR will not be available: " - + e); - } finally { - CONTROL_SCENE_MODE_HDR = tempSceneMode; + throw new ExceptionInInitializerError( + "Error while reflecting on LegacyVendorTags: " + e); } } |