summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]AndroidManifest.xml1
-rwxr-xr-x[-rw-r--r--]src/com/android/camera/CameraActivity.java2
-rw-r--r--src/com/android/camera/PermissionsActivity.java12
-rwxr-xr-x[-rw-r--r--]src/com/android/camera/PhotoMenu.java20
-rw-r--r--src/com/android/camera/PhotoModule.java1
-rwxr-xr-x[-rw-r--r--]src/com/android/camera/SDCard.java47
-rwxr-xr-xsrc/com/android/camera/VideoModule.java17
-rw-r--r--src/com/android/camera/VideoUI.java9
-rw-r--r--src/com/android/camera/ui/CameraControls.java8
-rw-r--r--src/org/codeaurora/snapcam/filter/ClearSightNativeEngine.java14
-rwxr-xr-x[-rw-r--r--]src_pd/com/android/camera/util/IntentHelper.java23
11 files changed, 121 insertions, 33 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 53ebaa39d..37ce25f8b 100644..100755
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -121,6 +121,7 @@
android:label="@string/snapcam_app_name"
android:launchMode="singleInstance"
android:logo="@mipmap/ic_launcher_gallery"
+ android:screenOrientation="portrait"
android:taskAffinity="com.android.camera.SecureCameraActivity"
android:theme="@style/Theme.Camera"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan" >
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index e015d9c25..5666331fa 100644..100755
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -601,8 +601,8 @@ public class CameraActivity extends Activity
try {
Log.w(TAG, "Gallery not found");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
- startActivity(intent);
intent.putExtra(KEY_FROM_SNAPCAM, true);
+ startActivity(intent);
} catch (ActivityNotFoundException e) {
Log.w(TAG, "No Activity could be found to open image or video");
}
diff --git a/src/com/android/camera/PermissionsActivity.java b/src/com/android/camera/PermissionsActivity.java
index 2b5901a58..c5e43e56d 100644
--- a/src/com/android/camera/PermissionsActivity.java
+++ b/src/com/android/camera/PermissionsActivity.java
@@ -119,21 +119,24 @@ public class PermissionsActivity extends Activity {
String permissions[], int[] grantResults) {
if (mShouldRequestCameraPermission) {
- if (grantResults[mIndexPermissionRequestCamera] == PackageManager.PERMISSION_GRANTED) {
+ if ((grantResults.length >= mIndexPermissionRequestCamera + 1) &&
+ (grantResults[mIndexPermissionRequestCamera] == PackageManager.PERMISSION_GRANTED)) {
mFlagHasCameraPermission = true;
} else {
mCriticalPermissionDenied = true;
}
}
if (mShouldRequestMicrophonePermission) {
- if (grantResults[mIndexPermissionRequestMicrophone] == PackageManager.PERMISSION_GRANTED) {
+ if ((grantResults.length >= mIndexPermissionRequestMicrophone + 1) &&
+ (grantResults[mIndexPermissionRequestMicrophone] == PackageManager.PERMISSION_GRANTED)) {
mFlagHasMicrophonePermission = true;
} else {
mCriticalPermissionDenied = true;
}
}
if (mShouldRequestStoragePermission) {
- if (grantResults[mIndexPermissionRequestStorage] == PackageManager.PERMISSION_GRANTED) {
+ if ((grantResults.length >= mIndexPermissionRequestStorage + 1) &&
+ (grantResults[mIndexPermissionRequestStorage] == PackageManager.PERMISSION_GRANTED)) {
mFlagHasStoragePermission = true;
} else {
mCriticalPermissionDenied = true;
@@ -141,7 +144,8 @@ public class PermissionsActivity extends Activity {
}
if (mShouldRequestLocationPermission) {
- if (grantResults[mIndexPermissionRequestLocation] == PackageManager.PERMISSION_GRANTED) {
+ if ((grantResults.length >= mIndexPermissionRequestLocation + 1) &&
+ (grantResults[mIndexPermissionRequestLocation] == PackageManager.PERMISSION_GRANTED)) {
// Do nothing
} else {
// Do nothing
diff --git a/src/com/android/camera/PhotoMenu.java b/src/com/android/camera/PhotoMenu.java
index 8988e8e2a..c2f9a538b 100644..100755
--- a/src/com/android/camera/PhotoMenu.java
+++ b/src/com/android/camera/PhotoMenu.java
@@ -693,6 +693,7 @@ public class PhotoMenu extends MenuController
popup1.setPreferenceEnabled(CameraSettings.KEY_FLASH_MODE, false);
popup1.setPreferenceEnabled(CameraSettings.KEY_WHITE_BALANCE, false);
popup1.setPreferenceEnabled(CameraSettings.KEY_EXPOSURE, false);
+ popup1.setPreferenceEnabled(CameraSettings.KEY_QC_CHROMA_FLASH, false);
}
if ((autohdr != null) && autohdr.equals("enable")) {
popup1.setPreferenceEnabled(CameraSettings.KEY_SCENE_MODE, false);
@@ -788,7 +789,11 @@ public class PhotoMenu extends MenuController
|| (notSame(hdrPref, CameraSettings.KEY_CAMERA_HDR, mSettingOff))) {
buttonSetEnabled(mFilterModeSwitcher, false);
changeFilterModeControlIcon("none");
- } else {
+ } else if (same(scenePref, CameraSettings.KEY_SCENE_MODE, Parameters.SCENE_MODE_AUTO)
+ && (same(hdrPref, CameraSettings.KEY_CAMERA_HDR, mSettingOff)
+ || !hdrPref.getKey().equals(CameraSettings.KEY_CAMERA_HDR))) {
+ //mFilterModeSwitcher can be enabled only when scene mode is set to auto
+ // and HDR is set to off,
buttonSetEnabled(mFilterModeSwitcher, true);
}
}
@@ -820,7 +825,6 @@ public class PhotoMenu extends MenuController
.findPreference(prefKey);
if (pref == null)
return;
-
if (prefKey.equals(CameraSettings.KEY_CAMERA_ID)) {
// Hide the camera control while switching the camera.
// The camera control will be added back when
@@ -1457,6 +1461,18 @@ public class PhotoMenu extends MenuController
}
}
+ String chromaFlashOn = mActivity.getString(R.string.
+ pref_camera_advanced_feature_value_chromaflash_on);
+ if (notSame(pref, CameraSettings.KEY_SCENE_MODE, Parameters.SCENE_MODE_AUTO)) {
+ ListPreference lp = mPreferenceGroup
+ .findPreference(CameraSettings.KEY_ADVANCED_FEATURES);
+ if (lp != null && chromaFlashOn.equals(lp.getValue())) {
+ setPreference(CameraSettings.KEY_QC_CHROMA_FLASH, mSettingOff);
+ setPreference(CameraSettings.KEY_ADVANCED_FEATURES,
+ mActivity.getString(R.string.pref_camera_advanced_feature_default));
+ }
+ }
+
if (notSame(pref, CameraSettings.KEY_SCENE_MODE, "auto")) {
setPreference(CameraSettings.KEY_COLOR_EFFECT,
mActivity.getString(R.string.pref_camera_coloreffect_default));
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 0b8cee802..3a7e41976 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -2231,6 +2231,7 @@ public class PhotoModule
public synchronized void onShutterButtonClick() {
if ((mCameraDevice == null)
|| mPaused || mUI.collapseCameraControls()
+ || !mUI.mMenuInitialized
|| (mCameraState == SWITCHING_CAMERA)
|| (mCameraState == PREVIEW_STOPPED)
|| (mCameraState == LONGSHOT)
diff --git a/src/com/android/camera/SDCard.java b/src/com/android/camera/SDCard.java
index 8fda17c67..b88e32245 100644..100755
--- a/src/com/android/camera/SDCard.java
+++ b/src/com/android/camera/SDCard.java
@@ -28,8 +28,10 @@
package com.android.camera;
+import android.content.BroadcastReceiver;
import android.content.Context;
-import android.os.UserHandle;
+import android.content.Intent;
+import android.content.IntentFilter;
import android.os.Environment;
import android.os.storage.StorageVolume;
import android.os.storage.StorageManager;
@@ -42,8 +44,8 @@ public class SDCard {
private StorageManager mStorageManager = null;
private StorageVolume mVolume = null;
- private String path = null;
- private String rawpath = null;
+ private String mPath = null;
+ private String mRawpath = null;
private static SDCard sSDCard;
public boolean isWriteable() {
@@ -59,20 +61,20 @@ public class SDCard {
if (mVolume == null) {
return null;
}
- if (path == null) {
- path = mVolume.getPath() + "/DCIM/Camera";
+ if (mPath == null) {
+ mPath = mVolume.getPath() + "/DCIM/Camera";
}
- return path;
+ return mPath;
}
public String getRawDirectory() {
if (mVolume == null) {
return null;
}
- if (rawpath == null) {
- rawpath = mVolume.getPath() + "/DCIM/Camera/raw";
+ if (mRawpath == null) {
+ mRawpath = mVolume.getPath() + "/DCIM/Camera/raw";
}
- return rawpath;
+ return mRawpath;
}
public static void initialize(Context context) {
@@ -92,13 +94,32 @@ public class SDCard {
private SDCard(Context context) {
try {
mStorageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
- final StorageVolume[] volumes = mStorageManager.getVolumeList();
- if (volumes.length > VOLUME_SDCARD_INDEX) {
- mVolume = volumes[VOLUME_SDCARD_INDEX];
- }
+ initVolume();
+ registerMediaBroadcastreceiver(context);
} catch (Exception e) {
Log.e(TAG, "couldn't talk to MountService", e);
}
}
+ private void initVolume() {
+ final StorageVolume[] volumes = mStorageManager.getVolumeList();
+ mVolume = (volumes.length > VOLUME_SDCARD_INDEX) ?
+ volumes[VOLUME_SDCARD_INDEX] : null;
+ mPath = null;
+ mRawpath = null;
+ }
+
+ private void registerMediaBroadcastreceiver(Context context) {
+ IntentFilter filter = new IntentFilter(Intent.ACTION_MEDIA_MOUNTED);
+ filter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
+ filter.addDataScheme("file");
+ context.registerReceiver(mMediaBroadcastReceiver , filter);
+ }
+
+ private BroadcastReceiver mMediaBroadcastReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ initVolume();
+ }
+ };
}
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 6b26a9c88..a93cff611 100755
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -220,6 +220,9 @@ public class VideoModule implements CameraModule,
private static final boolean PERSIST_4K_NO_LIMIT =
android.os.SystemProperties.getBoolean("persist.camcorder.4k.nolimit", false);
+ private static final int PERSIST_EIS_MAX_FPS =
+ android.os.SystemProperties.getInt("persist.camcorder.eis.maxfps", 30);
+
private final MediaSaveService.OnMediaSavedListener mOnVideoSavedListener =
new MediaSaveService.OnMediaSavedListener() {
@Override
@@ -1807,7 +1810,11 @@ public class VideoModule implements CameraModule,
mUI.cancelAnimations();
mUI.setSwipingEnabled(false);
mUI.hideUIwhileRecording();
-
+ // When recording request is sent before starting preview, onPreviewFrame()
+ // callback doesn't happen so removing preview cover here, instead.
+ if (mUI.isPreviewCoverVisible()) {
+ mUI.hidePreviewCover();
+ }
mActivity.updateStorageSpaceAndHint();
if (mActivity.getStorageSpaceBytes() <= Storage.LOW_STORAGE_THRESHOLD_BYTES) {
Log.v(TAG, "Storage issue, ignore the start request");
@@ -2523,8 +2530,14 @@ public class VideoModule implements CameraModule,
CameraSettings.KEY_VIDEO_TIME_LAPSE_FRAME_INTERVAL,
mActivity.getString(R.string.pref_video_time_lapse_frame_interval_default));
int timeLapseInterval = Integer.parseInt(frameIntervalStr);
+ int rate = 0;
+ if (!hfr.equals("off"))
+ rate = Integer.parseInt(hfr);
+ else
+ rate = Integer.parseInt(hsr);
+ Log.v(TAG, "rate = "+rate);
if ( (timeLapseInterval != 0) ||
- (disMode.equals("enable")) ||
+ (disMode.equals("enable") && (rate > PERSIST_EIS_MAX_FPS)) ||
((hdr != null) && (!hdr.equals("off"))) ) {
Log.v(TAG,"HDR/DIS/Time Lapse ON for HFR/HSR selection, turning HFR/HSR off");
mParameters.setVideoHighFrameRate("off");
diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java
index 5203d9e35..cf93feeac 100644
--- a/src/com/android/camera/VideoUI.java
+++ b/src/com/android/camera/VideoUI.java
@@ -145,6 +145,15 @@ public class VideoUI implements PieRenderer.PieListener,
}
}
+ public boolean isPreviewCoverVisible() {
+ if ((mPreviewCover != null) &&
+ (mPreviewCover.getVisibility() == View.VISIBLE)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
private class SettingsPopup extends PopupWindow {
public SettingsPopup(View popup) {
super(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
diff --git a/src/com/android/camera/ui/CameraControls.java b/src/com/android/camera/ui/CameraControls.java
index 5de05dca9..48a5492e3 100644
--- a/src/com/android/camera/ui/CameraControls.java
+++ b/src/com/android/camera/ui/CameraControls.java
@@ -87,7 +87,6 @@ public class CameraControls extends RotatableLayout {
private static final int ANIME_DURATION = 300;
private float[][] mLocX = new float[4][11];
private float[][] mLocY = new float[4][11];
- private boolean[] mTempEnabled = new boolean[11];
private boolean mLocSet = false;
private boolean mHideRemainingPhoto = false;
private LinearLayout mRemainingPhotos;
@@ -223,10 +222,9 @@ public class CameraControls extends RotatableLayout {
mHdrSwitcher.setPressed(false);
}
mSceneModeSwitcher.setPressed(false);
- mFilterModeSwitcher.setPressed(false);
- } else {
- mTempEnabled[FILTER_MODE_INDEX] = mFilterModeSwitcher.isEnabled();
}
+
+
((ShutterButton) mShutter).enableTouch(enable);
mVideoShutter.setClickable(enable);
((ModuleSwitcher) mSwitcher).enableTouch(enable);
@@ -240,7 +238,7 @@ public class CameraControls extends RotatableLayout {
}
mSceneModeSwitcher.setEnabled(enable);
mPreview.setEnabled(enable);
- mFilterModeSwitcher.setEnabled(enable && mTempEnabled[FILTER_MODE_INDEX]);
+
}
private void markVisibility() {
diff --git a/src/org/codeaurora/snapcam/filter/ClearSightNativeEngine.java b/src/org/codeaurora/snapcam/filter/ClearSightNativeEngine.java
index f2793c822..18e7671b9 100644
--- a/src/org/codeaurora/snapcam/filter/ClearSightNativeEngine.java
+++ b/src/org/codeaurora/snapcam/filter/ClearSightNativeEngine.java
@@ -35,6 +35,7 @@ import java.util.ArrayList;
import java.util.List;
import android.graphics.Rect;
+import android.hardware.camera2.CaptureResult;
import android.hardware.camera2.TotalCaptureResult;
import android.media.Image;
import android.media.Image.Plane;
@@ -256,13 +257,20 @@ public class ClearSightNativeEngine {
Log.d(TAG, "processImage - dst size - y: "
+ dstY.capacity() + " vu: " + dstVU.capacity());
+ int iso = mRefMonoResult.get(CaptureResult.SENSOR_SENSITIVITY);
+ long exposure = mRefMonoResult.get(CaptureResult.SENSOR_EXPOSURE_TIME);
+ // capture result stores exposure time in NS and we need MS.
+ exposure /= 100000;
+
+ Log.d(TAG, "processImage - iso: " + iso + " exposure ms: " + exposure);
boolean result = nativeClearSightProcess(numImages, srcColorY, srcColorVU,
metadataColor, mRefColorImage.getWidth(),
mRefColorImage.getHeight(),
colorPlanes[Y_PLANE].getRowStride(),
colorPlanes[VU_PLANE].getRowStride(), srcMonoY, metadataMono,
mRefMonoImage.getWidth(), mRefMonoImage.getHeight(),
- monoPlanes[Y_PLANE].getRowStride(), mOtpCalibData, dstY, dstVU,
+ monoPlanes[Y_PLANE].getRowStride(), mOtpCalibData,
+ (int)exposure, iso, dstY, dstVU,
colorPlanes[Y_PLANE].getRowStride(),
colorPlanes[VU_PLANE].getRowStride(), roiRect);
@@ -287,8 +295,8 @@ public class ClearSightNativeEngine {
int[][] metadataColor, int srcColorWidth, int srcColorHeight,
int srcColorStrideY, int srcColorStrideVU, ByteBuffer[] srcMonoY,
int[][] metadataMono, int srcMonoWidth, int srcMonoHeight,
- int srcMonoStrideY, byte[] otp, ByteBuffer dstY, ByteBuffer dstVU,
- int dstStrideY, int dstStrideVU, int[] roiRect);
+ int srcMonoStrideY, byte[] otp, int exposureMs, int iso,
+ ByteBuffer dstY, ByteBuffer dstVU, int dstStrideY, int dstStrideVU, int[] roiRect);
private class SourceImage {
ByteBuffer mY;
diff --git a/src_pd/com/android/camera/util/IntentHelper.java b/src_pd/com/android/camera/util/IntentHelper.java
index 6f17a624b..7949eca2a 100644..100755
--- a/src_pd/com/android/camera/util/IntentHelper.java
+++ b/src_pd/com/android/camera/util/IntentHelper.java
@@ -17,21 +17,38 @@ package com.android.camera.util;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
import android.net.Uri;
public class IntentHelper {
private static final String GALLERY_PACKAGE_NAME = "com.android.gallery3d";
+ private static final String SNAPDRAGON_GALLERY_PACKAGE_NAME = "org.codeaurora.gallery";
private static final String GALLERY_ACTIVITY_CLASS =
- "com.android.gallery3d.app.GalleryActivity";
+ "com.android.gallery3d.app.GalleryActivity";
public static Intent getGalleryIntent(Context context) {
+ String packageName = packageExist(context, SNAPDRAGON_GALLERY_PACKAGE_NAME) ?
+ SNAPDRAGON_GALLERY_PACKAGE_NAME : GALLERY_PACKAGE_NAME;
return new Intent(Intent.ACTION_MAIN)
- .setClassName(GALLERY_PACKAGE_NAME, GALLERY_ACTIVITY_CLASS);
+ .setClassName(packageName, GALLERY_ACTIVITY_CLASS);
}
public static Intent getVideoPlayerIntent(Context context, Uri uri) {
return new Intent(Intent.ACTION_VIEW)
- .setDataAndType(uri, "video/*");
+ .setDataAndType(uri, "video/*");
+ }
+
+ private static boolean packageExist(Context context, String packageName) {
+ if (packageName == null || "".equals(packageName)) {
+ return false;
+ }
+ try {
+ context.getPackageManager().getApplicationInfo(packageName, 0);
+ return true;
+ } catch (PackageManager.NameNotFoundException e) {
+ return false;
+ }
}
}