summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorxianming wang <mingwax@codeaurora.org>2018-11-14 14:37:57 +0800
committerxianming wang <mingwax@codeaurora.org>2018-11-14 14:40:58 +0800
commit467c237e0694853a833b52fa8d17bc5a43398e16 (patch)
tree0d52ea29297353fe21aa0e59641310d7b06584a8 /src
parent78b730055695188e43819ddf108b63021c9d7d7c (diff)
downloadandroid_packages_apps_Snap-467c237e0694853a833b52fa8d17bc5a43398e16.tar.gz
android_packages_apps_Snap-467c237e0694853a833b52fa8d17bc5a43398e16.tar.bz2
android_packages_apps_Snap-467c237e0694853a833b52fa8d17bc5a43398e16.zip
SnapdragonCamera: Completed the function of FS
Completed the function of FS for special sensor mode. CRs-Fixed: 2334834 Change-Id: Ia32111be5e1fd14bdb31407a43ad8eb3b97f5415
Diffstat (limited to 'src')
-rwxr-xr-xsrc/com/android/camera/CaptureModule.java82
-rwxr-xr-xsrc/com/android/camera/SettingsManager.java18
2 files changed, 94 insertions, 6 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 5ec6f5be9..7dedfa828 100755
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -250,6 +250,7 @@ public class CaptureModule implements CameraModule, PhotoController,
private static final int STREAM_CONFIG_MODE_QTIEIS_LOOKAHEAD = 0xF008;
private static final int STREAM_CONFIG_MODE_FOVC = 0xF010;
private static final int STREAM_CONFIG_MODE_ZZHDR = 0xF002;
+ private static final int STREAM_CONFIG_MODE_FS2 = 0xF040;
public static final boolean DEBUG =
(PersistUtil.getCamera2Debug() == PersistUtil.CAMERA2_DEBUG_DUMP_LOG) ||
@@ -393,6 +394,11 @@ public class CaptureModule implements CameraModule, PhotoController,
private static final CaptureRequest.Key<Byte> custom_noise_reduction =
new CaptureRequest.Key<>("org.quic.camera.CustomNoiseReduction.CustomNoiseReduction", byte.class);
+ public static final CaptureRequest.Key<Byte> sensor_mode_fs =
+ new CaptureRequest.Key<>("org.quic.camera.SensorModeFS ", byte.class);
+ public static CameraCharacteristics.Key<Byte> fs_mode_support =
+ new CameraCharacteristics.Key<>("org.quic.camera.SensorModeFS.isFastShutterModeSupported", Byte.class);
+
private boolean mIsDepthFocus = false;
private boolean[] mTakingPicture = new boolean[MAX_NUM_CAM];
private int mControlAFMode = CameraMetadata.CONTROL_AF_MODE_CONTINUOUS_PICTURE;
@@ -1608,12 +1614,17 @@ public class CaptureModule implements CameraModule, PhotoController,
}
}
} else {
- if (mSettingsManager.getSavePictureFormat() == SettingsManager.HEIF_FORMAT &&
- outputConfigurations != null) {
- mCameraDevice[id].createCaptureSessionByOutputConfigurations(outputConfigurations,
- captureSessionCallback, null);
+ if (ApiHelper.isAndroidPOrHigher()) {
+ createCameraSessionWithSessionConfiguration(id, list, captureSessionCallback,
+ mCameraHandler, mPreviewRequestBuilder[id].build());
} else {
- mCameraDevice[id].createCaptureSession(list, captureSessionCallback, null);
+ if (mSettingsManager.getSavePictureFormat() == SettingsManager.HEIF_FORMAT &&
+ outputConfigurations != null) {
+ mCameraDevice[id].createCaptureSessionByOutputConfigurations(outputConfigurations,
+ captureSessionCallback, null);
+ } else {
+ mCameraDevice[id].createCaptureSession(list, captureSessionCallback, null);
+ }
}
}
} else {
@@ -2158,7 +2169,12 @@ public class CaptureModule implements CameraModule, PhotoController,
applyCaptureMFNR(captureBuilder);
}
applyCaptureBurstFps(captureBuilder);
- if (!(mIsSupportedQcfa || isDeepZoom())) {
+ String valueFS2 = mSettingsManager.getValue(SettingsManager.KEY_SENSOR_MODE_FS2_VALUE);
+ int fs2Value = 0;
+ if (valueFS2 != null) {
+ fs2Value = Integer.parseInt(valueFS2);
+ }
+ if (!(mIsSupportedQcfa || isDeepZoom() || (fs2Value ==1))) {
addPreviewSurface(captureBuilder, null, id);
}
if (mUI.getCurrentProMode() == ProMode.MANUAL_MODE) {
@@ -2990,6 +3006,7 @@ public class CaptureModule implements CameraModule, PhotoController,
applyJpegQuality(builder);
applyFlash(builder, id);
applyCommonSettings(builder, id);
+ applySensorModeFS2(builder);
}
private void applySettingsForPrecapture(CaptureRequest.Builder builder, int id) {
@@ -4324,6 +4341,45 @@ public class CaptureModule implements CameraModule, PhotoController,
}
};
+
+ private void createCameraSessionWithSessionConfiguration(int cameraId,
+ List<Surface> outputSurfaces, CameraCaptureSession.StateCallback listener,
+ Handler handler, CaptureRequest initialRequest) {
+ List<OutputConfiguration> outConfigurations = new ArrayList<>(outputSurfaces.size());
+ for (Surface surface : outputSurfaces) {
+ outConfigurations.add(new OutputConfiguration(surface));
+ }
+ int opMode = SESSION_REGULAR;
+ String valueFS2 = mSettingsManager.getValue(SettingsManager.KEY_SENSOR_MODE_FS2_VALUE);
+ if (valueFS2 != null) {
+ int intValue = Integer.parseInt(valueFS2);
+ if (intValue == 1) {
+ opMode |= STREAM_CONFIG_MODE_FS2;
+ }
+ }
+ Log.v(TAG, " createCameraSessionWithSessionConfiguration opMode: " + opMode);
+ Method method_setSessionParameters = null;
+ Method method_createCaptureSession = null;
+ Object sessionConfig = null;
+ try {
+ Class clazz = Class.forName("android.hardware.camera2.params.SessionConfiguration");
+ sessionConfig = clazz.getConstructors()[0].newInstance(
+ opMode, outConfigurations,
+ new HandlerExecutor(handler), listener);
+ if (method_setSessionParameters == null) {
+ method_setSessionParameters = clazz.getDeclaredMethod(
+ "setSessionParameters", CaptureRequest.class);
+ }
+ method_setSessionParameters.invoke(sessionConfig, initialRequest);
+ method_createCaptureSession = CameraDevice.class.getDeclaredMethod(
+ "createCaptureSession", clazz);
+ method_createCaptureSession.invoke(mCameraDevice[cameraId], sessionConfig);
+ } catch (Exception exception) {
+ Log.w(TAG, "createCameraSessionWithSessionConfiguration method is not exist");
+ exception.printStackTrace();
+ }
+ }
+
private void configureCameraSessionWithParameters(int cameraId,
List<Surface> outputSurfaces, CameraCaptureSession.StateCallback listener,
Handler handler, CaptureRequest initialRequest) throws CameraAccessException {
@@ -5696,6 +5752,20 @@ public class CaptureModule implements CameraModule, PhotoController,
}
}
+ private void applySensorModeFS2(CaptureRequest.Builder request) {
+ String value = mSettingsManager.getValue(SettingsManager.KEY_SENSOR_MODE_FS2_VALUE);
+ if (value != null) {
+ int intValue = Integer.parseInt(value);
+ byte fs2 =(byte)((intValue == 0) ? 0x00 : 0x01);
+ Log.v(TAG, "applySensorModeFS2 intValue : " + intValue + ", fs2 :" + fs2);
+ try {
+ request.set(CaptureModule.sensor_mode_fs, fs2);
+ } catch (IllegalArgumentException e) {
+ Log.w(TAG, "hal no vendorTag : " + sensor_mode_fs);
+ }
+ }
+ }
+
private void applyExposureMeteringModes(CaptureRequest.Builder request) {
String value = mSettingsManager.getValue(SettingsManager.KEY_EXPOSURE_METERING_MODE);
if (value != null) {
diff --git a/src/com/android/camera/SettingsManager.java b/src/com/android/camera/SettingsManager.java
index edf176ce9..cb434f1ba 100755
--- a/src/com/android/camera/SettingsManager.java
+++ b/src/com/android/camera/SettingsManager.java
@@ -161,6 +161,7 @@ public class SettingsManager implements ListMenu.SettingsListener {
public static final String KEY_HDR = "pref_camera2_hdr_key";
public static final String KEY_VIDEO_HDR_VALUE = "pref_camera2_video_hdr_key";
public static final String KEY_CAPTURE_MFNR_VALUE = "pref_camera2_capture_mfnr_key";
+ public static final String KEY_SENSOR_MODE_FS2_VALUE = "pref_camera2_fs2_key";
public static final String KEY_SAVERAW = "pref_camera2_saveraw_key";
public static final String KEY_ZOOM = "pref_camera2_zoom_key";
public static final String KEY_SHARPNESS_CONTROL_MODE = "pref_camera2_sharpness_control_key";
@@ -749,6 +750,7 @@ public class SettingsManager implements ListMenu.SettingsListener {
ListPreference zoom = mPreferenceGroup.findPreference(KEY_ZOOM);
ListPreference qcfa = mPreferenceGroup.findPreference(KEY_QCFA);
ListPreference bsgc = mPreferenceGroup.findPreference(KEY_BSGC_DETECTION);
+ ListPreference fsMode = mPreferenceGroup.findPreference(KEY_SENSOR_MODE_FS2_VALUE);
if (whiteBalance != null) {
if (filterUnsupportedOptions(whiteBalance, getSupportedWhiteBalanceModes(cameraId))) {
@@ -900,6 +902,11 @@ public class SettingsManager implements ListMenu.SettingsListener {
}
}
+ if (fsMode != null) {
+ if (!isFastShutterModeSupported(cameraId)) {
+ removePreference(mPreferenceGroup, KEY_SENSOR_MODE_FS2_VALUE);
+ }
+ }
}
@@ -1346,6 +1353,17 @@ public class SettingsManager implements ListMenu.SettingsListener {
return ret;
}
+ private boolean isFastShutterModeSupported(int id) {
+ boolean result = false;
+ try {
+ byte fastModeSupport = mCharacteristics.get(id).get(CaptureModule.fs_mode_support);
+ result = (fastModeSupport == 1);
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ }
+ return result;
+ }
+
public boolean isFacingFront(int id) {
int facing = mCharacteristics.get(id).get(CameraCharacteristics.LENS_FACING);
return facing == CameraCharacteristics.LENS_FACING_FRONT;