Sync sample prebuilts for mnc-dev
Synced to //developers/samples/android commit 89d2da0f4b. Change-Id: I904da8210517922531d1ac1ba1e747f1c7bf00b3
This commit is contained in:
@@ -55,7 +55,6 @@ import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
@@ -264,14 +263,16 @@ public class Camera2BasicFragment extends Fragment implements View.OnClickListen
|
||||
break;
|
||||
}
|
||||
case STATE_WAITING_LOCK: {
|
||||
int afState = result.get(CaptureResult.CONTROL_AF_STATE);
|
||||
if (CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED == afState ||
|
||||
Integer afState = result.get(CaptureResult.CONTROL_AF_STATE);
|
||||
if (afState == null) {
|
||||
captureStillPicture();
|
||||
} else if (CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED == afState ||
|
||||
CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED == afState) {
|
||||
// CONTROL_AE_STATE can be null on some devices
|
||||
Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE);
|
||||
if (aeState == null ||
|
||||
aeState == CaptureResult.CONTROL_AE_STATE_CONVERGED) {
|
||||
mState = STATE_WAITING_NON_PRECAPTURE;
|
||||
mState = STATE_PICTURE_TAKEN;
|
||||
captureStillPicture();
|
||||
} else {
|
||||
runPrecaptureSequence();
|
||||
@@ -636,6 +637,8 @@ public class Camera2BasicFragment extends Fragment implements View.OnClickListen
|
||||
(float) viewWidth / mPreviewSize.getWidth());
|
||||
matrix.postScale(scale, scale, centerX, centerY);
|
||||
matrix.postRotate(90 * (rotation - 2), centerX, centerY);
|
||||
} else if (Surface.ROTATION_180 == rotation) {
|
||||
matrix.postRotate(180, centerX, centerY);
|
||||
}
|
||||
mTextureView.setTransform(matrix);
|
||||
}
|
||||
@@ -657,7 +660,7 @@ public class Camera2BasicFragment extends Fragment implements View.OnClickListen
|
||||
CameraMetadata.CONTROL_AF_TRIGGER_START);
|
||||
// Tell #mCaptureCallback to wait for the lock.
|
||||
mState = STATE_WAITING_LOCK;
|
||||
mCaptureSession.setRepeatingRequest(mPreviewRequestBuilder.build(), mCaptureCallback,
|
||||
mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback,
|
||||
mBackgroundHandler);
|
||||
} catch (CameraAccessException e) {
|
||||
e.printStackTrace();
|
||||
@@ -794,8 +797,6 @@ public class Camera2BasicFragment extends Fragment implements View.OnClickListen
|
||||
try {
|
||||
output = new FileOutputStream(mFile);
|
||||
output.write(bytes);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user