diff options
author | xianming wang <mingwax@codeaurora.org> | 2018-09-28 17:48:58 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-10-19 00:16:55 -0700 |
commit | 25056018dc026dc42bfcd002475374439063753c (patch) | |
tree | 2cd9b00a3bb6315256a4db6968799f9b308a0ab5 | |
parent | c270e957c3aa214cb833c453a059d5a035670cfe (diff) | |
download | android_packages_apps_Snap-25056018dc026dc42bfcd002475374439063753c.tar.gz android_packages_apps_Snap-25056018dc026dc42bfcd002475374439063753c.tar.bz2 android_packages_apps_Snap-25056018dc026dc42bfcd002475374439063753c.zip |
SnapdragonCamera: Revert the original design of ISO
Revert the original design of ISO in ProMode, add 3200ISO
like the original design.
CRs-Fixed: 2328914
Change-Id: I4ec658f2cc451a5515c50861d590e831ca10ad52
-rwxr-xr-x | res/values/camera2arrays.xml | 2 | ||||
-rwxr-xr-x | res/values/qcomstrings.xml | 4 | ||||
-rwxr-xr-x | res/xml/capture_preferences.xml | 2 | ||||
-rwxr-xr-x | src/com/android/camera/CaptureModule.java | 16 | ||||
-rwxr-xr-x | src/com/android/camera/SettingsManager.java | 63 | ||||
-rwxr-xr-x | src/com/android/camera/ui/ProMode.java | 77 |
6 files changed, 35 insertions, 129 deletions
diff --git a/res/values/camera2arrays.xml b/res/values/camera2arrays.xml index 6d03c50f5..c995841b4 100755 --- a/res/values/camera2arrays.xml +++ b/res/values/camera2arrays.xml @@ -644,6 +644,7 @@ <item>@string/pref_camera_iso_entry_iso400</item> <item>@string/pref_camera_iso_entry_iso800</item> <item>@string/pref_camera_iso_entry_iso1600</item> + <item>@string/pref_camera_iso_entry_iso3200</item> </string-array> <!-- Do not localize entryvalues --> @@ -654,6 +655,7 @@ <item>400</item> <item>800</item> <item>1600</item> + <item>3200</item> </string-array> <!-- Camera Preferences Auto Exposure dialog box entries --> diff --git a/res/values/qcomstrings.xml b/res/values/qcomstrings.xml index 403fc8b7b..e987e6bf1 100755 --- a/res/values/qcomstrings.xml +++ b/res/values/qcomstrings.xml @@ -465,7 +465,7 @@ <string name="pref_camera_denoise_entry_on">On</string> <!-- Default iso setting. Do not translate. --> - <string name="pref_camera_iso_default">100</string> + <string name="pref_camera_iso_default">auto</string> <!-- Settings screen, Select Iso title --> <string name="pref_camera_iso_title">ISO</string> @@ -478,6 +478,7 @@ <string name="pref_camera_iso_entry_iso400">ISO400</string> <string name="pref_camera_iso_entry_iso800">ISO800</string> <string name="pref_camera_iso_entry_iso1600">ISO1600</string> + <string name="pref_camera_iso_entry_iso3200">ISO3200</string> <!-- ISO entry values. Do not translate. --> <string name="pref_camera_iso_value_auto">auto</string> @@ -487,6 +488,7 @@ <string name="pref_camera_iso_value_iso400">ISO400</string> <string name="pref_camera_iso_value_iso800">ISO800</string> <string name="pref_camera_iso_value_iso1600">ISO1600</string> + <string name="pref_camera_iso_value_iso3200">ISO3200</string> <!-- Settings screen, Anti Banding title --> <string name="pref_camera_antibanding_title">Anti Banding</string> diff --git a/res/xml/capture_preferences.xml b/res/xml/capture_preferences.xml index 6aa159555..fb233d3c6 100755 --- a/res/xml/capture_preferences.xml +++ b/res/xml/capture_preferences.xml @@ -174,7 +174,7 @@ camera:defaultValue="@string/pref_camera_iso_default" camera:entries="@array/pref_camera2_iso_entries" camera:entryValues="@array/pref_camera2_iso_entryvalues" - camera:key="pref_camera2_manual_iso_key" + camera:key="pref_camera2_iso_key" camera:singleIcon="@drawable/ic_settings_iso" camera:title="@string/pref_camera_iso_title"/> diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index 0b8646784..3b0e1fb45 100755 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -5627,7 +5627,7 @@ public class CaptureModule implements CameraModule, PhotoController, updatePreview = true; applyExposure(mPreviewRequestBuilder[cameraId]); break; - case SettingsManager.KEY_MANUAL_ISO_VALUE: + case SettingsManager.KEY_ISO: updatePreview = true; applyIso(mPreviewRequestBuilder[cameraId]); break; @@ -5732,11 +5732,9 @@ public class CaptureModule implements CameraModule, PhotoController, } private void applyIso(CaptureRequest.Builder request) { + String value = mSettingsManager.getValue(SettingsManager.KEY_ISO); if (applyManualIsoExposure(request)) return; - final SharedPreferences sharedPref = mActivity.getSharedPreferences( - ComboPreferences.getLocalSharedPreferencesName(mActivity, getMainCameraId()), - Context.MODE_PRIVATE); - String value = sharedPref.getString(SettingsManager.KEY_MANUAL_ISO_VALUE, "100"); + if (value == null) return; String scene = mSettingsManager.getValue(SettingsManager.KEY_SCENE_MODE); boolean promode = false; if (scene != null) { @@ -5755,15 +5753,9 @@ public class CaptureModule implements CameraModule, PhotoController, request.set(CaptureRequest.SENSOR_SENSITIVITY, mIsoSensitivity); } } else { - int isoValue = Integer.parseInt(value); + long intValue = SettingsManager.KEY_ISO_INDEX.get(value); VendorTagUtil.setIsoExpPrioritySelectPriority(request, 0); - long intValue = SettingsManager.KEY_ISO_INDEX.get( - SettingsManager.MAUNAL_ABSOLUTE_ISO_VALUE); VendorTagUtil.setIsoExpPriority(request, intValue); - VendorTagUtil.setUseIsoValues(request, isoValue); - if (DEBUG) { - Log.v(TAG, "applyIso ISO value :" + isoValue); - } if (request.get(CaptureRequest.SENSOR_EXPOSURE_TIME) != null) { mIsoExposureTime = request.get(CaptureRequest.SENSOR_EXPOSURE_TIME); } diff --git a/src/com/android/camera/SettingsManager.java b/src/com/android/camera/SettingsManager.java index bf48399d3..475360635 100755 --- a/src/com/android/camera/SettingsManager.java +++ b/src/com/android/camera/SettingsManager.java @@ -606,23 +606,6 @@ public class SettingsManager implements ListMenu.SettingsListener { return sharedPreferences.getFloat(key, 0.5f); } - private boolean setIsoPref(String key, int value) { - boolean result = false; - final SharedPreferences sharedPref = mContext.getSharedPreferences( - ComboPreferences.getLocalSharedPreferencesName(mContext, getCurrentCameraId()), - Context.MODE_PRIVATE); - int prefValue = Integer.parseInt(sharedPref.getString(key, "100")); - if (prefValue != value) { - ListPreference pref = mPreferenceGroup.findPreference(key); - SharedPreferences.Editor editor = sharedPref.edit(); - editor.putString(key, String.valueOf(value)); - editor.apply(); - updateMapAndNotify(pref); - result = true; - } - return result; - } - public boolean isOverriden(String key) { Values values = mValuesMap.get(key); return values.overriddenValue != null; @@ -676,20 +659,6 @@ public class SettingsManager implements ListMenu.SettingsListener { } } - public void setIsoValue(String key, boolean forceNotify, float value, int maxIso) { - boolean isSuccess = false; - if (value >= 0) { - isSuccess = setIsoPref(key, (int)(value * maxIso)); - } - if (isSuccess || forceNotify) { - List<SettingState> list = new ArrayList<>(); - Values values = new Values("" + value * maxIso, null); - SettingState ss = new SettingState(KEY_MANUAL_ISO_VALUE, values); - list.add(ss); - notifyListeners(list); - } - } - private void updateMapAndNotify(ListPreference pref) { String key = pref.getKey(); List changed = checkDependencyAndUpdate(key); @@ -1533,23 +1502,29 @@ public class SettingsManager implements ListMenu.SettingsListener { } private List<String> getSupportedIso(int cameraId) { - Range<Integer> range = mCharacteristics.get(cameraId).get(CameraCharacteristics - .SENSOR_INFO_SENSITIVITY_RANGE); List<String> supportedIso = new ArrayList<>(); - supportedIso.add("auto"); - - if (range != null) { - int max = range.getUpper(); - int value = 50; - while (value <= max) { - if (range.contains(value)) { - supportedIso.add("" + value); + try { + int[] range = mCharacteristics.get(cameraId).get( + CaptureModule.ISO_AVAILABLE_MODES); + supportedIso.add("auto"); + + if (range != null) { + for (int iso : range) { + for (String key : KEY_ISO_INDEX.keySet()) { + if (KEY_ISO_INDEX.get(key).equals(iso)) { + supportedIso.add(key); + } + } } - value += 50; + } else { + Log.w(TAG, "Supported ISO range is null."); } - } else { - Log.w(TAG, "Supported ISO range is null."); + } catch (NullPointerException e) { + Log.w(TAG, "Supported ISO_AVAILABLE_MODES is null."); + } catch (IllegalArgumentException e) { + Log.w(TAG, "IllegalArgumentException Supported ISO_AVAILABLE_MODES is wrong."); } + return supportedIso; } diff --git a/src/com/android/camera/ui/ProMode.java b/src/com/android/camera/ui/ProMode.java index 97c9cdb83..00c755ac7 100755 --- a/src/com/android/camera/ui/ProMode.java +++ b/src/com/android/camera/ui/ProMode.java @@ -30,7 +30,6 @@ package com.android.camera.ui; import android.content.Context; -import android.content.SharedPreferences; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; @@ -46,14 +45,12 @@ import android.widget.ImageView; import android.widget.TextView; import com.android.camera.SettingsManager; -import com.android.camera.ComboPreferences; import org.codeaurora.snapcam.R; import java.util.ArrayList; public class ProMode extends View { - private static final String TAG = "ProMode"; public static final int NO_MODE = -1; public static final int EXPOSURE_MODE = 0; public static final int MANUAL_MODE = 1; @@ -73,7 +70,6 @@ public class ProMode extends View { private int mCurveLeft; private int mCurveRight; private float mSlider = -1; - private float mIsoSlider = -1; private Paint mPaint = new Paint(); private int mNums; private int mIndex; @@ -110,19 +106,11 @@ public class ProMode extends View { } private void init(int mode) { - if (mode == ISO_MODE) { - final SharedPreferences sharedPref = mContext.getSharedPreferences( - ComboPreferences.getLocalSharedPreferencesName(mContext, mSettingsManager.getCurrentCameraId()), - Context.MODE_PRIVATE); - String value = sharedPref.getString(SettingsManager.KEY_MANUAL_ISO_VALUE, "100"); - mUI.updateProModeText(mode, "Iso" + value); - } else { - String key = getKey(mode); - if (key == null) return; - int index = mSettingsManager.getValueIndex(key); - CharSequence[] cc = mSettingsManager.getEntries(key); - mUI.updateProModeText(mode, cc[index].toString()); - } + String key = getKey(mode); + if (key == null) return; + int index = mSettingsManager.getValueIndex(key); + CharSequence[] cc = mSettingsManager.getEntries(key); + mUI.updateProModeText(mode, cc[index].toString()); } @Override @@ -145,16 +133,6 @@ public class ProMode extends View { canvas.drawCircle(curveCoordinate[0], curveCoordinate[1], SELECTED_DOT_SIZE, mPaint); } - } else if (mMode == ISO_MODE) { - mPaint.setColor(Color.WHITE); - canvas.drawCircle(mCurveLeft, mCurveY, DOT_SIZE, mPaint); - canvas.drawCircle(mCurveRight, mCurveY, DOT_SIZE, mPaint); - mPaint.setColor(BLUE); - if (mIsoSlider >= 0) { - mCurveMeasure.getPosTan(mCurveMeasure.getLength() * mIsoSlider, curveCoordinate, null); - canvas.drawCircle(curveCoordinate[0], curveCoordinate[1], SELECTED_DOT_SIZE, - mPaint); - } } else { for (int i = 0; i < mNums; i++) { if (i == mIndex) { @@ -250,37 +228,12 @@ public class ProMode extends View { mParent.addView(v); mAddedViews.add(v); } - } else if (mMode == ISO_MODE) { - int[] isoRange = mSettingsManager.getIsoRangeValues(mSettingsManager.getCurrentCameraId()); - int value = Integer.parseInt(mSettingsManager.getValue(SettingsManager.KEY_MANUAL_ISO_VALUE)); - if (isoRange == null) { - Log.v(TAG, "getIsoRangeValues is NULL"); - return; - } - setIsoSlider((float)value/isoRange[1],true); - int stride = mCurveRight - mCurveLeft; - for (int i = 0; i < 2; i++) { - TextView v = new TextView(mContext); - String s = "" + isoRange[0]; - if (i == 1) s = "" + isoRange[1]; - v.setText(s); - v.setTextColor(Color.WHITE); - v.measure(0, 0); - ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(v.getMeasuredWidth(), - v.getMeasuredHeight()); - v.setLayoutParams(lp); - v.setX(mCurveLeft + i * stride - v.getMeasuredWidth() / 2); - v.setY(mCurveY - 2 * v.getMeasuredHeight()); - mParent.addView(v); - mAddedViews.add(v); - } } else { if (key == null) return; CharSequence[] cc = mSettingsManager.getEntries(key); int length = mSettingsManager.getEntryValues(key).length; int index = mSettingsManager.getValueIndex(key); updateSlider(length); - for (int i = 0; i < length; i++) { View v; if (mMode == WHITE_BALANCE_MODE) { @@ -319,7 +272,7 @@ public class ProMode extends View { case WHITE_BALANCE_MODE: return SettingsManager.KEY_WHITE_BALANCE; case ISO_MODE: - return SettingsManager.KEY_MANUAL_ISO_VALUE; + return SettingsManager.KEY_ISO; } return null; } @@ -351,19 +304,6 @@ public class ProMode extends View { invalidate(); } - public void setIsoSlider(float slider, boolean forceNotify) { - mIsoSlider = slider; - int[] isoRange = mSettingsManager.getIsoRangeValues(mSettingsManager.getCurrentCameraId()); - int maxIso = 1600; - if (isoRange != null) { - maxIso = isoRange[1]; - } - mSettingsManager.setIsoValue(SettingsManager.KEY_MANUAL_ISO_VALUE, forceNotify, - mIsoSlider, maxIso); - mUI.updateProModeText(mMode, "Iso" + (int)(mIsoSlider * maxIso)); - invalidate(); - } - private void setIndex(int index, boolean force) { if (mIndex == index && !force) return; if (mIndex != -1) { @@ -410,11 +350,6 @@ public class ProMode extends View { if (slider >= 0) { setSlider(slider,false); } - } else if (mMode == ISO_MODE) { - float slider = getSlider(event.getX(), event.getY()); - if (slider >= 0) { - setIsoSlider(slider,false); - } } else { int idx = findButton(event.getX(), event.getY()); if (idx != -1) { |