Loading core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java +86 −72 Original line number Diff line number Diff line Loading @@ -286,7 +286,8 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession } @Override public synchronized void abortCaptures() throws CameraAccessException { public void abortCaptures() throws CameraAccessException { synchronized (this) { checkNotClosed(); if (DEBUG) { Loading @@ -300,10 +301,15 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession mAborting = true; mAbortDrainer.taskStarted(); } synchronized (mDeviceImpl.mInterfaceLock) { synchronized (this) { mDeviceImpl.flush(); // The next BUSY -> IDLE set of transitions will mark the end of the abort. } } } @Override public boolean isReprocessable() { Loading @@ -330,7 +336,8 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession * @see CameraCaptureSession#close */ @Override public synchronized void replaceSessionClose() { public void replaceSessionClose() { synchronized (this) { /* * In order for creating new sessions to be fast, the new session should be created * before the old session is closed. Loading @@ -352,16 +359,16 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession // configureOutputsChecked(null) has already been called. // // Do not call configureOutputsChecked(null) going forward, since it would race with the // configuration for the new session. If it was already called, then we don't care, since it // won't get called again. // configuration for the new session. If it was already called, then we don't care, // since it won't get called again. mSkipUnconfigure = true; } close(); } @Override public synchronized void close() { public void close() { synchronized (this) { if (mClosed) { if (DEBUG) Log.v(TAG, mIdString + "close - reentering"); return; Loading @@ -370,7 +377,10 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession if (DEBUG) Log.v(TAG, mIdString + "close - first time"); mClosed = true; } synchronized (mDeviceImpl.mInterfaceLock) { synchronized (this) { /* * Flush out any repeating request. Since camera is closed, no new requests * can be queued, and eventually the entire request queue will be drained. Loading @@ -378,8 +388,8 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession * If the camera device was already closed, short circuit and do nothing; since * no more internal device callbacks will fire anyway. * * Otherwise, once stopRepeating is done, wait for camera to idle, then unconfigure the * camera. Once that's done, fire #onClosed. * Otherwise, once stopRepeating is done, wait for camera to idle, then unconfigure * the camera. Once that's done, fire #onClosed. */ try { mDeviceImpl.stopRepeating(); Loading @@ -399,10 +409,14 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession // TODO: call onError instead of onClosed if this happens } } } synchronized (this) { // If no sequences are pending, fire #onClosed immediately mSequenceDrainer.beginDrain(); } } /** * Whether currently in mid-abort. Loading Loading
core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java +86 −72 Original line number Diff line number Diff line Loading @@ -286,7 +286,8 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession } @Override public synchronized void abortCaptures() throws CameraAccessException { public void abortCaptures() throws CameraAccessException { synchronized (this) { checkNotClosed(); if (DEBUG) { Loading @@ -300,10 +301,15 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession mAborting = true; mAbortDrainer.taskStarted(); } synchronized (mDeviceImpl.mInterfaceLock) { synchronized (this) { mDeviceImpl.flush(); // The next BUSY -> IDLE set of transitions will mark the end of the abort. } } } @Override public boolean isReprocessable() { Loading @@ -330,7 +336,8 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession * @see CameraCaptureSession#close */ @Override public synchronized void replaceSessionClose() { public void replaceSessionClose() { synchronized (this) { /* * In order for creating new sessions to be fast, the new session should be created * before the old session is closed. Loading @@ -352,16 +359,16 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession // configureOutputsChecked(null) has already been called. // // Do not call configureOutputsChecked(null) going forward, since it would race with the // configuration for the new session. If it was already called, then we don't care, since it // won't get called again. // configuration for the new session. If it was already called, then we don't care, // since it won't get called again. mSkipUnconfigure = true; } close(); } @Override public synchronized void close() { public void close() { synchronized (this) { if (mClosed) { if (DEBUG) Log.v(TAG, mIdString + "close - reentering"); return; Loading @@ -370,7 +377,10 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession if (DEBUG) Log.v(TAG, mIdString + "close - first time"); mClosed = true; } synchronized (mDeviceImpl.mInterfaceLock) { synchronized (this) { /* * Flush out any repeating request. Since camera is closed, no new requests * can be queued, and eventually the entire request queue will be drained. Loading @@ -378,8 +388,8 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession * If the camera device was already closed, short circuit and do nothing; since * no more internal device callbacks will fire anyway. * * Otherwise, once stopRepeating is done, wait for camera to idle, then unconfigure the * camera. Once that's done, fire #onClosed. * Otherwise, once stopRepeating is done, wait for camera to idle, then unconfigure * the camera. Once that's done, fire #onClosed. */ try { mDeviceImpl.stopRepeating(); Loading @@ -399,10 +409,14 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession // TODO: call onError instead of onClosed if this happens } } } synchronized (this) { // If no sequences are pending, fire #onClosed immediately mSequenceDrainer.beginDrain(); } } /** * Whether currently in mid-abort. Loading