diff options
Diffstat (limited to 'core/java/android/hardware/camera2/impl/CameraDeviceImpl.java')
-rw-r--r-- | core/java/android/hardware/camera2/impl/CameraDeviceImpl.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java index 91388c3..1e680dfd 100644 --- a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java +++ b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java @@ -605,6 +605,29 @@ public class CameraDeviceImpl extends CameraDevice { } } + public void prepare(Surface surface) throws CameraAccessException { + synchronized(mInterfaceLock) { + int streamId = -1; + for (int i = 0; i < mConfiguredOutputs.size(); i++) { + if (surface == mConfiguredOutputs.valueAt(i).getSurface()) { + streamId = mConfiguredOutputs.keyAt(i); + break; + } + } + if (streamId == -1) { + throw new IllegalArgumentException("Surface is not part of this session"); + } + try { + mRemoteDevice.prepare(streamId); + } catch (CameraRuntimeException e) { + throw e.asChecked(); + } catch (RemoteException e) { + // impossible + return; + } + } + } + public int capture(CaptureRequest request, CaptureCallback callback, Handler handler) throws CameraAccessException { if (DEBUG) { @@ -1056,6 +1079,14 @@ public class CameraDeviceImpl extends CameraDevice { public void onIdle(CameraDevice camera) { // Default empty implementation } + + /** + * The method called when the camera device has finished preparing + * an output Surface + */ + public void onSurfacePrepared(Surface surface) { + // Default empty implementation + } } static class CaptureCallbackHolder { @@ -1643,6 +1674,31 @@ public class CameraDeviceImpl extends CameraDevice { } } + @Override + public void onPrepared(int streamId) { + final OutputConfiguration output; + final StateCallbackKK sessionCallback; + + if (DEBUG) { + Log.v(TAG, "Stream " + streamId + " is prepared"); + } + + synchronized(mInterfaceLock) { + output = mConfiguredOutputs.get(streamId); + sessionCallback = mSessionStateCallback; + } + + if (sessionCallback == null) return; + + if (output == null) { + Log.w(TAG, "onPrepared invoked for unknown output Surface"); + return; + } + final Surface surface = output.getSurface(); + + sessionCallback.onSurfacePrepared(surface); + } + /** * Called by onDeviceError for handling single-capture failures. */ |