diff options
Diffstat (limited to 'src/com/android/camera/SettingsManager.java')
-rwxr-xr-x | src/com/android/camera/SettingsManager.java | 60 |
1 files changed, 45 insertions, 15 deletions
diff --git a/src/com/android/camera/SettingsManager.java b/src/com/android/camera/SettingsManager.java index b62573b76..dd798bc68 100755 --- a/src/com/android/camera/SettingsManager.java +++ b/src/com/android/camera/SettingsManager.java @@ -328,14 +328,11 @@ public class SettingsManager implements ListMenu.SettingsListener { } public void updateQcfaPictureSize() { - ListPreference picturePref = mPreferenceGroup.findPreference(KEY_PICTURE_SIZE); - if (picturePref != null) { - picturePref.setEntries(mContext.getResources().getStringArray( - R.array.pref_camera2_picturesize_entries)); - picturePref.setEntryValues(mContext.getResources().getStringArray( - R.array.pref_camera2_picturesize_entryvalues)); - filterUnsupportedOptions(picturePref, getSupportedPictureSize( - getCurrentCameraId())); + ListPreference pictureSize = mPreferenceGroup.findPreference(KEY_PICTURE_SIZE); + if (pictureSize != null) { + CameraSettings.formatPictureSizes(pictureSize, + getSupportedPictureSizeList(getCurrentCameraId()), mContext); + CameraSettings.resetIfInvalid(pictureSize); } } @@ -808,13 +805,9 @@ public class SettingsManager implements ListMenu.SettingsListener { if (cameraIdPref != null) buildCameraId(); if (pictureSize != null) { - if (filterUnsupportedOptions(pictureSize, getSupportedPictureSize(cameraId))) { - mFilteredKeys.add(pictureSize.getKey()); - } else { - if (filterSimilarPictureSize(mPreferenceGroup, pictureSize)) { - mFilteredKeys.add(pictureSize.getKey()); - } - } + CameraSettings.formatPictureSizes(pictureSize, + getSupportedPictureSizeList(cameraId), mContext); + CameraSettings.resetIfInvalid(pictureSize); } if (exposure != null) buildExposureCompensation(cameraId); @@ -1308,6 +1301,43 @@ public class SettingsManager implements ListMenu.SettingsListener { mValuesMap.get(KEY_FLASH_MODE) != null; } + public boolean isZslSupported(int id) { + boolean zslSupported = false; + int [] capabilities = mCharacteristics.get(id) + .get(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES); + for (int capability : capabilities) { + if (capability == CameraCharacteristics + .REQUEST_AVAILABLE_CAPABILITIES_YUV_REPROCESSING || + capability == CameraCharacteristics + .REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING) { + zslSupported = true; + } + } + Log.d(TAG, "isZslSupported=" + zslSupported); + return zslSupported; + } + + private List<Size> getSupportedPictureSizeList(int cameraId) { + StreamConfigurationMap map = mCharacteristics.get(cameraId).get( + CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP); + Size[] sizes = map.getOutputSizes(ImageFormat.JPEG); + List<Size> res = new ArrayList<>(); + if (sizes != null) { + for (int i = 0; i < sizes.length; i++) { + res.add(sizes[i]); + } + } + + Size[] highResSizes = map.getHighResolutionOutputSizes(ImageFormat.JPEG); + if (highResSizes != null) { + for (int i = 0; i < highResSizes.length; i++) { + res.add(highResSizes[i]); + } + } + + return res; + } + private List<String> getSupportedPictureSize(int cameraId) { StreamConfigurationMap map = mCharacteristics.get(cameraId).get( CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP); |