summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJay Wang <jaywang@codeaurora.org>2017-06-27 14:25:25 -0700
committerJay Wang <jaywang@codeaurora.org>2017-07-07 13:45:56 -0700
commit32ea9086c31a48fbb5345dc0f620542772554940 (patch)
tree55f94b8ee6e503401c7fcece4c6825eff0ba3b9d /src
parentb8f8b6b7c4c6d63ae2b4b44835c72db07569e892 (diff)
downloadandroid_packages_apps_Snap-32ea9086c31a48fbb5345dc0f620542772554940.tar.gz
android_packages_apps_Snap-32ea9086c31a48fbb5345dc0f620542772554940.tar.bz2
android_packages_apps_Snap-32ea9086c31a48fbb5345dc0f620542772554940.zip
Minimum change to enable non-ZSL preview for Camx
Change-Id: I191c16070c96a8ec5a06dd6496313911dd146e5c
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/CaptureModule.java66
-rwxr-xr-xsrc/com/android/camera/SettingsManager.java55
2 files changed, 75 insertions, 46 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 96ec5d8f2..37e9abbf1 100644
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -1043,9 +1043,10 @@ public class CaptureModule implements CameraModule, PhotoController,
if(id == getMainCameraId()) {
mCurrentSession = cameraCaptureSession;
}
- initializePreviewConfiguration(id);
+
+ //Todo initializePreviewConfiguration(id);
setDisplayOrientation();
- updateFaceDetection();
+ //Todo updateFaceDetection();
try {
if (isBackCamera() && getCameraMode() == DUAL_MODE) {
linkBayerMono(id);
@@ -1071,6 +1072,7 @@ public class CaptureModule implements CameraModule, PhotoController,
} catch(IllegalStateException e) {
e.printStackTrace();
}
+
}
@Override
@@ -1826,8 +1828,11 @@ public class CaptureModule implements CameraModule, PhotoController,
if (mVideoSnapshotImageReader != null) {
mVideoSnapshotImageReader.close();
}
- mVideoSnapshotImageReader = ImageReader.newInstance(mVideoSnapshotSize.getWidth(),
- mVideoSnapshotSize.getHeight(), ImageFormat.JPEG, 2);
+/*Todo mVideoSnapshotImageReader = ImageReader.newInstance(mVideoSnapshotSize.getWidth(),
+ mVideoSnapshotSize.getHeight(), ImageFormat.JPEG, 2);*/
+
+ mVideoSnapshotImageReader = ImageReader.newInstance(3840, 2160, mChosenImageFormat, 10);
+Log.e("JW", "Image="+mChosenImageFormat);
mVideoSnapshotImageReader.setOnImageAvailableListener(
new ImageReader.OnImageAvailableListener() {
@Override
@@ -2305,39 +2310,31 @@ public class CaptureModule implements CameraModule, PhotoController,
updateMaxVideoDuration();
}
- private void updatePreviewSize() {
+ private Size checkOverridePreviewSize(int cur_width, int cur_height) {
int preview_resolution = PersistUtil.getCameraPreviewSize();
- int width = mPreviewSize.getWidth();
- int height = mPreviewSize.getHeight();
- String makeup = mSettingsManager.getValue(SettingsManager.KEY_MAKEUP);
- boolean makeupOn = makeup != null && !makeup.equals("0");
- if (makeupOn) {
- width = mVideoSize.getWidth();
- height = mVideoSize.getHeight();
- }
switch (preview_resolution) {
case 1: {
- width = 640;
- height = 480;
+ cur_width = 640;
+ cur_height = 480;
Log.v(TAG, "Preview resolution hardcoded to 640x480");
break;
}
case 2: {
- width = 720;
- height = 480;
+ cur_width = 720;
+ cur_height = 480;
Log.v(TAG, "Preview resolution hardcoded to 720x480");
break;
}
case 3: {
- width = 1280;
- height = 720;
+ cur_width = 1280;
+ cur_height = 720;
Log.v(TAG, "Preview resolution hardcoded to 1280x720");
break;
}
case 4: {
- width = 1920;
- height = 1080;
+ cur_width = 1920;
+ cur_height = 1080;
Log.v(TAG, "Preview resolution hardcoded to 1920x1080");
break;
}
@@ -2346,7 +2343,20 @@ public class CaptureModule implements CameraModule, PhotoController,
break;
}
}
- mPreviewSize = new Size(width, height);
+ return new Size(cur_width, cur_height);
+ }
+
+ private void updatePreviewSize() {
+ int width = mPreviewSize.getWidth();
+ int height = mPreviewSize.getHeight();
+
+ String makeup = mSettingsManager.getValue(SettingsManager.KEY_MAKEUP);
+ boolean makeupOn = makeup != null && !makeup.equals("0");
+ if (makeupOn) {
+ width = mVideoSize.getWidth();
+ height = mVideoSize.getHeight();
+ }
+ mPreviewSize = checkOverridePreviewSize(width, height);
mUI.setPreviewSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());
}
@@ -2387,7 +2397,7 @@ public class CaptureModule implements CameraModule, PhotoController,
} else if(mPostProcessor.isFilterOn() || getFrameFilters().size() != 0 || mPostProcessor.isSelfieMirrorOn()) {
mChosenImageFormat = ImageFormat.YUV_420_888;
} else {
- mChosenImageFormat = ImageFormat.JPEG;
+ mChosenImageFormat = ImageFormat.YUV_420_888; //JW ImageFormat.JPEG;
}
setUpCameraOutputs(mChosenImageFormat);
@@ -3022,9 +3032,11 @@ public class CaptureModule implements CameraModule, PhotoController,
Size[] prevSizes = mSettingsManager.getSupportedOutputSize(getMainCameraId(),
SurfaceHolder.class);
mSupportedMaxPictureSize = prevSizes[0];
- Size[] rawSize = mSettingsManager.getSupportedOutputSize(getMainCameraId(),
+ if (mSaveRaw == true) {
+ Size[] rawSize = mSettingsManager.getSupportedOutputSize(getMainCameraId(),
ImageFormat.RAW10);
- mSupportedRawPictureSize = rawSize[0];
+ mSupportedRawPictureSize = rawSize[0];
+ }
mPreviewSize = getOptimalPreviewSize(mPictureSize, prevSizes);
Size[] thumbSizes = mSettingsManager.getSupportedThumbnailSizes(getMainCameraId());
mPictureThumbSize = getOptimalPreviewSize(mPictureSize, thumbSizes); // get largest thumb size
@@ -3056,6 +3068,8 @@ public class CaptureModule implements CameraModule, PhotoController,
Size[] prevSizes = mSettingsManager.getSupportedOutputSize(getMainCameraId(),
MediaRecorder.class);
mVideoPreviewSize = getOptimalPreviewSize(mVideoSize, prevSizes);
+ mVideoPreviewSize = checkOverridePreviewSize(mVideoPreviewSize.getWidth(),
+ mVideoPreviewSize.getHeight());
}
private void updateVideoSnapshotSize() {
@@ -3222,7 +3236,7 @@ public class CaptureModule implements CameraModule, PhotoController,
}
}, null);
} else {
- surfaces.add(mVideoSnapshotImageReader.getSurface());
+ //JW surfaces.add(mVideoSnapshotImageReader.getSurface());
mCameraDevice[cameraId].createCaptureSession(surfaces, new CameraCaptureSession
.StateCallback() {
diff --git a/src/com/android/camera/SettingsManager.java b/src/com/android/camera/SettingsManager.java
index 7119ed0cb..4ed4f5c18 100755
--- a/src/com/android/camera/SettingsManager.java
+++ b/src/com/android/camera/SettingsManager.java
@@ -841,7 +841,7 @@ public class SettingsManager implements ListMenu.SettingsListener {
//TODO: Modify this after bayer/mono/front/back determination is done
entryValues[0] = "" + CaptureModule.BAYER_ID;
entries[0] = "BACK";
- if (mIsFrontCameraPresent) {
+ if (mIsFrontCameraPresent && (numOfCameras > 1)) {
entryValues[1] = "" + CaptureModule.FRONT_ID;
entries[1] = "FRONT";
}
@@ -1050,9 +1050,11 @@ public class SettingsManager implements ListMenu.SettingsListener {
public boolean isFaceDetectionSupported(int id) {
int[] faceDetection = mCharacteristics.get(id).get
(CameraCharacteristics.STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES);
- for (int value: faceDetection) {
- if (value == CameraMetadata.STATISTICS_FACE_DETECT_MODE_SIMPLE)
- return true;
+ if (faceDetection != null) {
+ for (int value: faceDetection) {
+ if (value == CameraMetadata.STATISTICS_FACE_DETECT_MODE_SIMPLE)
+ return true;
+ }
}
return false;
}
@@ -1270,15 +1272,20 @@ public class SettingsManager implements ListMenu.SettingsListener {
private List<String> getSupportedIso(int cameraId) {
Range<Integer> range = mCharacteristics.get(cameraId).get(CameraCharacteristics
.SENSOR_INFO_SENSITIVITY_RANGE);
- int max = range.getUpper();
- int value = 50;
List<String> supportedIso = new ArrayList<>();
supportedIso.add("auto");
- while (value <= max) {
- if (range.contains(value)) {
- supportedIso.add("" + value);
+
+ if (range != null) {
+ int max = range.getUpper();
+ int value = 50;
+ while (value <= max) {
+ if (range.contains(value)) {
+ supportedIso.add("" + value);
+ }
+ value += 50;
}
- value += 50;
+ } else {
+ Log.w(TAG, "Supported ISO range is null.");
}
return supportedIso;
}
@@ -1336,9 +1343,11 @@ public class SettingsManager implements ListMenu.SettingsListener {
int[] noiseReduction = mCharacteristics.get(cameraId).get(CameraCharacteristics
.NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES);
List<String> modes = new ArrayList<>();
- for (int mode : noiseReduction) {
- String str = SettingTranslation.getNoiseReduction(mode);
- if (str != null) modes.add(str);
+ if (noiseReduction != null) {
+ for (int mode : noiseReduction) {
+ String str = SettingTranslation.getNoiseReduction(mode);
+ if (str != null) modes.add(str);
+ }
}
return modes;
}
@@ -1373,15 +1382,21 @@ public class SettingsManager implements ListMenu.SettingsListener {
}
public List<String> getSupportedInstantAecAvailableModes(int cameraId) {
- int[] instantAecAvailableModes = mCharacteristics.get(cameraId).get(
- CaptureModule.InstantAecAvailableModes);
- if (instantAecAvailableModes == null) {
- return null;
- }
List<String> modes = new ArrayList<>();
- for (int i : instantAecAvailableModes) {
- modes.add(""+i);
+
+ try {
+ int[] instantAecAvailableModes = mCharacteristics.get(cameraId).get(
+ CaptureModule.InstantAecAvailableModes);
+ if (instantAecAvailableModes == null) {
+ return null;
+ }
+ for (int i : instantAecAvailableModes) {
+ modes.add("" + i);
+ }
+ } catch(NullPointerException e) {
+ } catch(IllegalArgumentException e) {
}
+
return modes;
}