summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRuben Brunk <rubenbrunk@google.com>2013-09-24 18:35:22 -0700
committerRuben Brunk <rubenbrunk@google.com>2013-09-24 18:35:22 -0700
commit4601f5d987ad2f57db6b1b65a716f00308e5ae99 (patch)
treee9fb58b7a79a57c8c391f2c1f2ff446568f62f51
parente0bf566d4ab2c45e05635397bdfd6c9f9a92a356 (diff)
downloadandroid_packages_apps_Snap-4601f5d987ad2f57db6b1b65a716f00308e5ae99.tar.gz
android_packages_apps_Snap-4601f5d987ad2f57db6b1b65a716f00308e5ae99.tar.bz2
android_packages_apps_Snap-4601f5d987ad2f57db6b1b65a716f00308e5ae99.zip
Enable gcam as HDR pie menu option.
Bug: 10430748 Change-Id: I0f589126bac895b31ef7475afd093680766de39e
-rw-r--r--src/com/android/camera/CameraSettings.java5
-rw-r--r--src/com/android/camera/PhotoModule.java33
-rw-r--r--src/com/android/camera/ui/ModuleSwitcher.java9
-rw-r--r--src_pd_gcam/com/android/camera/util/GcamHelper.java4
4 files changed, 40 insertions, 11 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index 2ae2353af..19d0fda56 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -30,6 +30,7 @@ import android.util.Log;
import com.android.camera.util.ApiHelper;
import com.android.camera.util.CameraUtil;
+import com.android.camera.util.GcamHelper;
import com.android.camera2.R;
import java.util.ArrayList;
@@ -215,8 +216,8 @@ public class CameraSettings {
if (videoEffect != null) {
filterUnsupportedOptions(group, videoEffect, null);
}
- if (cameraHdr != null && (!ApiHelper.HAS_CAMERA_HDR
- || !CameraUtil.isCameraHdrSupported(mParameters))) {
+ if (cameraHdr != null && !GcamHelper.hasGcamAsHDRMode()
+ && (!ApiHelper.HAS_CAMERA_HDR || !CameraUtil.isCameraHdrSupported(mParameters))) {
removePreference(group, cameraHdr.getKey());
}
}
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 938a0766f..915cbc8a5 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -62,10 +62,12 @@ import com.android.camera.exif.ExifInterface;
import com.android.camera.exif.ExifTag;
import com.android.camera.exif.Rational;
import com.android.camera.ui.CountDownView.OnCountDownFinishedListener;
+import com.android.camera.ui.ModuleSwitcher;
import com.android.camera.ui.PopupManager;
import com.android.camera.ui.RotateTextToast;
import com.android.camera.util.ApiHelper;
import com.android.camera.util.CameraUtil;
+import com.android.camera.util.GcamHelper;
import com.android.camera.util.UsageStatistics;
import com.android.camera2.R;
@@ -1575,7 +1577,7 @@ public class PhotoModule
}
}
- private void updateCameraParametersPreference() {
+ private boolean updateCameraParametersPreference() {
setAutoExposureLockIfSupported();
setAutoWhiteBalanceLockIfSupported();
setFocusAreasIfSupported();
@@ -1619,12 +1621,20 @@ public class PhotoModule
// separate preference.
String hdr = mPreferences.getString(CameraSettings.KEY_CAMERA_HDR,
mActivity.getString(R.string.pref_camera_hdr_default));
- if (mActivity.getString(R.string.setting_on_value).equals(hdr)) {
- mSceneMode = CameraUtil.SCENE_MODE_HDR;
+ boolean doGcamModeSwitch = false;
+ String onValue = mActivity.getString(R.string.setting_on_value);
+ boolean hdrOn = onValue.equals(hdr);
+ if ( hdrOn && GcamHelper.hasGcamAsHDRMode()) {
+ // Kick off mode switch to gcam.
+ doGcamModeSwitch = true;
} else {
- mSceneMode = mPreferences.getString(
- CameraSettings.KEY_SCENE_MODE,
- mActivity.getString(R.string.pref_camera_scenemode_default));
+ if (hdrOn) {
+ mSceneMode = CameraUtil.SCENE_MODE_HDR;
+ } else {
+ mSceneMode = mPreferences.getString(
+ CameraSettings.KEY_SCENE_MODE,
+ mActivity.getString(R.string.pref_camera_scenemode_default));
+ }
}
if (CameraUtil.isSupported(mSceneMode, mParameters.getSupportedSceneModes())) {
if (!mParameters.getSceneMode().equals(mSceneMode)) {
@@ -1701,6 +1711,8 @@ public class PhotoModule
if (mContinuousFocusSupported && ApiHelper.HAS_AUTO_FOCUS_MOVE_CALLBACK) {
updateAutoFocusMoveCallback();
}
+
+ return doGcamModeSwitch;
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@@ -1717,6 +1729,8 @@ public class PhotoModule
// the subsets actually need updating. The PREFERENCE set needs extra
// locking because the preference can be changed from GLThread as well.
private void setCameraParameters(int updateSet) {
+ boolean doModeSwitch = false;
+
if ((updateSet & UPDATE_PARAM_INITIALIZE) != 0) {
updateCameraParametersInitialize();
}
@@ -1726,10 +1740,15 @@ public class PhotoModule
}
if ((updateSet & UPDATE_PARAM_PREFERENCE) != 0) {
- updateCameraParametersPreference();
+ doModeSwitch = updateCameraParametersPreference();
}
mCameraDevice.setParameters(mParameters);
+
+ // Switch to gcam module if HDR was selected
+ if (doModeSwitch) {
+ mActivity.onModuleSelected(ModuleSwitcher.GCAM_MODULE_INDEX);
+ }
}
// If the Camera is idle, update the parameters immediately, otherwise
diff --git a/src/com/android/camera/ui/ModuleSwitcher.java b/src/com/android/camera/ui/ModuleSwitcher.java
index 882f6c931..7c74651f6 100644
--- a/src/com/android/camera/ui/ModuleSwitcher.java
+++ b/src/com/android/camera/ui/ModuleSwitcher.java
@@ -108,7 +108,7 @@ public class ModuleSwitcher extends RotateImageView
--numDrawIds;
}
- if (!GcamHelper.hasGcamCapture(context)) {
+ if (!GcamHelper.hasGcamCapture(context) || GcamHelper.hasGcamAsHDRMode()) {
--numDrawIds;
}
@@ -119,7 +119,8 @@ public class ModuleSwitcher extends RotateImageView
if (i == LIGHTCYCLE_MODULE_INDEX && !PhotoSphereHelper.hasLightCycleCapture(context)) {
continue; // not enabled, so don't add to UI
}
- if (i == GCAM_MODULE_INDEX && !GcamHelper.hasGcamCapture(context)) {
+ if (i == GCAM_MODULE_INDEX
+ && (!GcamHelper.hasGcamCapture(context) || GcamHelper.hasGcamAsHDRMode())) {
continue; // not enabled, so don't add to UI
}
moduleids[ix] = i;
@@ -135,6 +136,10 @@ public class ModuleSwitcher extends RotateImageView
public void setCurrentIndex(int i) {
mCurrentIndex = i;
+ if (i == GCAM_MODULE_INDEX && GcamHelper.hasGcamAsHDRMode()) {
+ setImageResource(R.drawable.ic_switch_camera);
+ return;
+ }
setImageResource(mDrawIds[i]);
}
diff --git a/src_pd_gcam/com/android/camera/util/GcamHelper.java b/src_pd_gcam/com/android/camera/util/GcamHelper.java
index 0611955f7..387bfd6eb 100644
--- a/src_pd_gcam/com/android/camera/util/GcamHelper.java
+++ b/src_pd_gcam/com/android/camera/util/GcamHelper.java
@@ -29,4 +29,8 @@ public class GcamHelper {
return false;
}
+ public static boolean hasGcamAsHDRMode() {
+ return false;
+ }
+
}