diff options
author | xianming wang <mingwax@codeaurora.org> | 2018-02-12 16:48:53 +0800 |
---|---|---|
committer | xianming wang <mingwax@codeaurora.org> | 2018-02-14 14:35:57 +0800 |
commit | 957d3c1fd307f68d55a4c724b19fd77bbf947649 (patch) | |
tree | a059da60c403afe77e26702a8139e70efcbbc353 | |
parent | 6867370538b66443b62f35aea7a030f313c3bb75 (diff) | |
download | android_packages_apps_Snap-957d3c1fd307f68d55a4c724b19fd77bbf947649.tar.gz android_packages_apps_Snap-957d3c1fd307f68d55a4c724b19fd77bbf947649.tar.bz2 android_packages_apps_Snap-957d3c1fd307f68d55a4c724b19fd77bbf947649.zip |
SnapdragonCamera: Complete the function of EIS and FOVC
Completed the function of EIS and FOVC, set the outConfigrations
for EIS and FOVC.
CRs-Fixed: 2189663
Change-Id: I64dea42bfcf879f01645ae9a7303a0fd60134843
-rwxr-xr-x | res/values/camera2arrays.xml | 16 | ||||
-rwxr-xr-x | res/values/qcomstrings.xml | 19 | ||||
-rwxr-xr-x | res/xml/capture_preferences.xml | 7 | ||||
-rwxr-xr-x | res/xml/setting_menu_preferences.xml | 9 | ||||
-rwxr-xr-x | src/com/android/camera/CaptureModule.java | 119 | ||||
-rwxr-xr-x | src/com/android/camera/SettingsManager.java | 1 | ||||
-rwxr-xr-x | version.mk | 2 |
7 files changed, 124 insertions, 49 deletions
diff --git a/res/values/camera2arrays.xml b/res/values/camera2arrays.xml index c3377d4b1..d7accc04f 100755 --- a/res/values/camera2arrays.xml +++ b/res/values/camera2arrays.xml @@ -1147,11 +1147,23 @@ for time lapse recording --> <string-array name="pref_camera2_eis_entries" translatable="false"> <item>@string/pref_camera2_eis_entry_disable</item> - <item>@string/pref_camera2_eis_entry_enable</item> + <item>@string/pref_camera2_eis_entry_v2enable</item> + <item>@string/pref_camera2_eis_entry_v3enable</item> </string-array> <string-array name="pref_camera2_eis_entryvalues" translatable="false"> <item>@string/pref_camera2_eis_entry_value_disable</item> - <item>@string/pref_camera2_eis_entry_value_enable</item> + <item>@string/pref_camera2_eis_entry_value_v2enable</item> + <item>@string/pref_camera2_eis_entry_value_v3enable</item> + </string-array> + + <string-array name="pref_camera2_fovc_entries" translatable="false"> + <item>@string/pref_camera2_fovc_entry_disable</item> + <item>@string/pref_camera2_fovc_entry_enable</item> + </string-array> + + <string-array name="pref_camera2_fovc_entryvalues" translatable="false"> + <item>@string/pref_camera2_fovc_entry_value_disable</item> + <item>@string/pref_camera2_fovc_entry_value_enable</item> </string-array> </resources> diff --git a/res/values/qcomstrings.xml b/res/values/qcomstrings.xml index 2374997dc..2fb1864eb 100755 --- a/res/values/qcomstrings.xml +++ b/res/values/qcomstrings.xml @@ -1232,10 +1232,19 @@ <string name="pref_camera_qcfa_value_enable">enable</string> <string name="pref_camera2_eis_title" translatable="true">Video EIS</string> - <string name="pref_camera2_eis_default" translatable="false">false</string> - <string name="pref_camera2_eis_entry_enable" translatable="true">Enable</string> - <string name="pref_camera2_eis_entry_disable" translatable="true">Disable</string> - <string name="pref_camera2_eis_entry_value_enable" translatable="false">true</string> - <string name="pref_camera2_eis_entry_value_disable" translatable="false">false</string> + <string name="pref_camera2_eis_default" translatable="false">disable</string> + <string name="pref_camera2_eis_entry_v2enable" translatable="false">V2</string> + <string name="pref_camera2_eis_entry_v3enable" translatable="false">V3</string> + <string name="pref_camera2_eis_entry_disable" translatable="false">disable</string> + <string name="pref_camera2_eis_entry_value_v2enable" translatable="false">V2</string> + <string name="pref_camera2_eis_entry_value_v3enable" translatable="false">V3</string> + <string name="pref_camera2_eis_entry_value_disable" translatable="false">disable</string> + + <string name="pref_camera2_fovc_title" translatable="true">Video FOVC</string> + <string name="pref_camera2_fovc_default" translatable="false">false</string> + <string name="pref_camera2_fovc_entry_enable" translatable="false">Enable</string> + <string name="pref_camera2_fovc_entry_disable" translatable="false">Disable</string> + <string name="pref_camera2_fovc_entry_value_enable" translatable="false">true</string> + <string name="pref_camera2_fovc_entry_value_disable" translatable="false">false</string> </resources> diff --git a/res/xml/capture_preferences.xml b/res/xml/capture_preferences.xml index 9bf560370..4cb1a7068 100755 --- a/res/xml/capture_preferences.xml +++ b/res/xml/capture_preferences.xml @@ -426,4 +426,11 @@ camera:title="@string/pref_camera2_eis_title" camera:entries="@array/pref_camera2_eis_entries" camera:entryValues="@array/pref_camera2_eis_entryvalues" /> + + <ListPreference + camera:key="pref_camera2_fovc_key" + camera:defaultValue="@string/pref_camera2_fovc_default" + camera:title="@string/pref_camera2_fovc_title" + camera:entries="@array/pref_camera2_fovc_entries" + camera:entryValues="@array/pref_camera2_fovc_entryvalues" /> </PreferenceGroup> diff --git a/res/xml/setting_menu_preferences.xml b/res/xml/setting_menu_preferences.xml index 4c7a6f861..313864279 100755 --- a/res/xml/setting_menu_preferences.xml +++ b/res/xml/setting_menu_preferences.xml @@ -435,5 +435,14 @@ android:entryValues="@array/pref_camera2_eis_entryvalues" android:layout="@layout/preference" android:summary="%s"/> + + <ListPreference + android:key="pref_camera2_fovc_key" + android:defaultValue="@string/pref_camera2_fovc_default" + android:title="@string/pref_camera2_fovc_title" + android:entries="@array/pref_camera2_fovc_entries" + android:entryValues="@array/pref_camera2_fovc_entryvalues" + android:layout="@layout/preference" + android:summary="%s"/> </PreferenceCategory> </PreferenceScreen> diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index 7fb6fe58b..9ee96d1a3 100755 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -52,6 +52,7 @@ import android.hardware.camera2.params.Face; import android.hardware.camera2.params.InputConfiguration; import android.hardware.camera2.params.MeteringRectangle; import android.hardware.camera2.params.StreamConfigurationMap; +import android.hardware.camera2.params.OutputConfiguration; import android.location.Location; import android.media.AudioManager; import android.media.CamcorderProfile; @@ -200,6 +201,12 @@ public class CaptureModule implements CameraModule, PhotoController, private static final int SCREEN_DELAY = 2 * 60 * 1000; + /** Add for EIS and FOVC Configuration */ + private int mStreamConfigOptMode = 0; + private static final int STREAM_CONFIG_MODE_QTIEIS_REALTIME = 0xF004; + private static final int STREAM_CONFIG_MODE_QTIEIS_LOOKAHEAD = 0xF008; + private static final int STREAM_CONFIG_MODE_FOVC = 0xF010; + public static final boolean DEBUG = (PersistUtil.getCamera2Debug() == PersistUtil.CAMERA2_DEBUG_DUMP_LOG) || (PersistUtil.getCamera2Debug() == PersistUtil.CAMERA2_DEBUG_DUMP_ALL); @@ -3487,6 +3494,47 @@ public class CaptureModule implements CameraModule, PhotoController, } } + private final CameraCaptureSession.StateCallback mCCSSateCallback = new CameraCaptureSession + .StateCallback() { + @Override + public void onConfigured(CameraCaptureSession cameraCaptureSession) { + Log.d(TAG, "StartRecordingVideo session onConfigured"); + int cameraId = getMainCameraId(); + mCurrentSession = cameraCaptureSession; + mCaptureSession[cameraId] = cameraCaptureSession; + try { + setUpVideoCaptureRequestBuilder(mVideoRequestBuilder, cameraId); + + mCurrentSession.setRepeatingRequest(mVideoRequestBuilder.build(), + mCaptureCallback, mCameraHandler); + } catch (CameraAccessException e) { + e.printStackTrace(); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + if (!startMediaRecorder()) { + mUI.showUIafterRecording(); + releaseMediaRecorder(); + mFrameProcessor.setVideoOutputSurface(null); + restartSession(true); + return; + } + + mUI.clearFocus(); + mUI.resetPauseButton(); + mRecordingTotalTime = 0L; + mRecordingStartTime = SystemClock.uptimeMillis(); + mUI.showRecordingUI(true, false); + updateRecordingTime(); + keepScreenOn(); + } + + @Override + public void onConfigureFailed(CameraCaptureSession cameraCaptureSession) { + Toast.makeText(mActivity, "Video Failed", Toast.LENGTH_SHORT).show(); + } + }; + private boolean startRecordingVideo(final int cameraId) { if (null == mCameraDevice[cameraId]) { return false; @@ -3610,46 +3658,25 @@ public class CaptureModule implements CameraModule, PhotoController, mCameraDevice[cameraId].setVendorStreamConfigMode(index); } surfaces.add(mVideoSnapshotImageReader.getSurface()); - mCameraDevice[cameraId].createCaptureSession(surfaces, new CameraCaptureSession - .StateCallback() { - - @Override - public void onConfigured(CameraCaptureSession cameraCaptureSession) { - Log.d(TAG, "StartRecordingVideo session onConfigured"); - mCurrentSession = cameraCaptureSession; - mCaptureSession[cameraId] = cameraCaptureSession; - try { - setUpVideoCaptureRequestBuilder(mVideoRequestBuilder, cameraId); - - mCurrentSession.setRepeatingRequest(mVideoRequestBuilder.build(), - mCaptureCallback, mCameraHandler); - } catch (CameraAccessException e) { - e.printStackTrace(); - } catch (IllegalStateException e) { - e.printStackTrace(); - } - if (!startMediaRecorder()) { - mUI.showUIafterRecording(); - releaseMediaRecorder(); - mFrameProcessor.setVideoOutputSurface(null); - restartSession(true); - return; - } - - mUI.clearFocus(); - mUI.resetPauseButton(); - mRecordingTotalTime = 0L; - mRecordingStartTime = SystemClock.uptimeMillis(); - mUI.showRecordingUI(true, false); - updateRecordingTime(); - keepScreenOn(); - } - @Override - public void onConfigureFailed(CameraCaptureSession cameraCaptureSession) { - Toast.makeText(mActivity, "Video Failed", Toast.LENGTH_SHORT).show(); + String value = mSettingsManager.getValue(SettingsManager.KEY_FOVC_VALUE); + if (value != null && Boolean.parseBoolean(value)) { + mStreamConfigOptMode = mStreamConfigOptMode | STREAM_CONFIG_MODE_FOVC; + } + if (DEBUG) { + Log.v(TAG, "createCustomCaptureSession mStreamConfigOptMode :" + + mStreamConfigOptMode); + } + if(mStreamConfigOptMode == 0) { + mCameraDevice[cameraId].createCaptureSession(surfaces, mCCSSateCallback, null); + } else { + List<OutputConfiguration> outConfigurations = new ArrayList<>(surfaces.size()); + for (Surface sface : surfaces) { + outConfigurations.add(new OutputConfiguration(sface)); } - }, null); + mCameraDevice[cameraId].createCustomCaptureSession(null, outConfigurations, + mStreamConfigOptMode, mCCSSateCallback, null); + } } } catch (CameraAccessException e) { e.printStackTrace(); @@ -3761,7 +3788,7 @@ public class CaptureModule implements CameraModule, PhotoController, applyFaceDetection(builder); applyZoom(builder, cameraId); applyVideoEncoderProfile(builder); - applyEIS(builder); + applyVideoEIS(builder); } private void updateVideoFlash() { @@ -4594,13 +4621,23 @@ public class CaptureModule implements CameraModule, PhotoController, } } - private void applyEIS(CaptureRequest.Builder request) { + private void applyVideoEIS(CaptureRequest.Builder request) { if (!mSettingsManager.isDeveloperEnabled()) { return;//don't apply if not in dev mode } String value = mSettingsManager.getValue(SettingsManager.KEY_EIS_VALUE); + + if (DEBUG) { + Log.d(TAG, "applyVideoEIS EISV select: " + value); + } + mStreamConfigOptMode = 0; if (value != null) { - byte byteValue = (byte) (Boolean.parseBoolean(value) ? 0x01 : 0x00); + if (value.equals("V2")) { + mStreamConfigOptMode = STREAM_CONFIG_MODE_QTIEIS_REALTIME; + } else if (value.equals("V3")) { + mStreamConfigOptMode = STREAM_CONFIG_MODE_QTIEIS_LOOKAHEAD; + } + byte byteValue = (byte) (value.equals("disable") ? 0x00 : 0x01); try { request.set(CaptureModule.eis_mode, byteValue); } catch (IllegalArgumentException e) { diff --git a/src/com/android/camera/SettingsManager.java b/src/com/android/camera/SettingsManager.java index b2a4a7b2c..303ea0395 100755 --- a/src/com/android/camera/SettingsManager.java +++ b/src/com/android/camera/SettingsManager.java @@ -158,6 +158,7 @@ public class SettingsManager implements ListMenu.SettingsListener { public static final String KEY_MANUAL_EXPOSURE_VALUE = "pref_camera2_manual_exposure_key"; public static final String KEY_QCFA = "pref_camera2_qcfa_key"; public static final String KEY_EIS_VALUE = "pref_camera2_eis_key"; + public static final String KEY_FOVC_VALUE = "pref_camera2_fovc_key"; public static final HashMap<String, Integer> KEY_ISO_INDEX = new HashMap<String, Integer>(); public static final String KEY_BSGC_DETECTION = "pref_camera2_bsgc_key"; diff --git a/version.mk b/version.mk index f896919ee..6a3713910 100755 --- a/version.mk +++ b/version.mk @@ -40,7 +40,7 @@ # base_version_build is 3 digits and auto-increment for fixing CR. base_version_major := 2 base_version_minor := 01 -base_version_build := 000 +base_version_build := 001 ##################################################### ##################################################### |