summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml8
-rw-r--r--res/values-ca/cm_strings.xml38
-rw-r--r--src/com/android/camera/ActivityBase.java50
-rw-r--r--src/com/android/camera/Camera.java29
-rwxr-xr-xsrc/com/android/camera/VideoCamera.java2
5 files changed, 124 insertions, 3 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ee57c31..c9023aa 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -45,6 +45,14 @@
<action android:name="android.media.action.STILL_IMAGE_CAMERA" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
+ <intent-filter>
+ <action android:name="android.media.action.IMAGE_CAPTURE_SECURE" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.media.action.STILL_IMAGE_CAMERA_SECURE" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
</activity>
<activity android:name="com.android.camera.VideoCamera"
android:label="@string/video_camera_label"
diff --git a/res/values-ca/cm_strings.xml b/res/values-ca/cm_strings.xml
new file mode 100644
index 0000000..f471365
--- /dev/null
+++ b/res/values-ca/cm_strings.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012-2013 The CyanogenMod Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <string name="pref_camera_picturesize_entry_4128x3096">13MP</string>
+ <string name="pref_camera_picturesize_entry_4000x3000">12MP</string>
+ <string name="pref_camera_picturesize_entry_4128x2322">10MP</string>
+ <string name="pref_camera_picturesize_entry_4000x2250">9MP</string>
+ <string name="pref_camera_picturesize_entry_3264x2448">8MP</string>
+ <string name="pref_camera_picturesize_entry_3264x1968">6.5MP (A)</string>
+ <string name="pref_camera_picturesize_entry_3264x1952">6MP (A)</string>
+ <string name="pref_camera_picturesize_entry_2592x1552">4MP (A)</string>
+ <string name="pref_camera_picturesize_entry_2560x1712">4MP</string>
+ <string name="pref_camera_picturesize_entry_2304x1728">4MP</string>
+ <string name="pref_camera_picturesize_entry_2048x1216">2.5MP (A)</string>
+ <string name="pref_camera_picturesize_entry_1920x1080">HD1080</string>
+ <string name="pref_camera_picturesize_entry_1600x960">1.5MP (A)</string>
+ <string name="pref_camera_picturesize_entry_1280x1024">SXGA</string>
+ <string name="pref_camera_picturesize_entry_1280x768">WXGA</string>
+ <string name="pref_camera_picturesize_entry_1280x720">HD720</string>
+ <string name="pref_camera_picturesize_entry_800x600">SVGA</string>
+ <string name="pref_camera_picturesize_entry_800x480">WVGA</string>
+ <string name="pref_camera_picturesize_entry_352x288">CIF</string>
+ <string name="pref_camera_picturesize_entry_176x144">QCIF</string>
+</resources>
diff --git a/src/com/android/camera/ActivityBase.java b/src/com/android/camera/ActivityBase.java
index e399421..4a29469 100644
--- a/src/com/android/camera/ActivityBase.java
+++ b/src/com/android/camera/ActivityBase.java
@@ -20,13 +20,16 @@ import com.android.camera.ui.PopupManager;
import android.app.Activity;
import android.app.KeyguardManager;
+import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.hardware.Camera;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
+import android.view.WindowManager;
/**
* Superclass of Camera and VideoCamera activities.
@@ -38,6 +41,11 @@ abstract public class ActivityBase extends Activity {
private boolean mOnResumePending;
private Intent mResultDataForTesting;
protected Camera mCameraDevice;
+ // settings for lock screen camera
+ protected static final String INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE =
+ "android.media.action.STILL_IMAGE_CAMERA_SECURE";
+ protected static final String ACTION_IMAGE_CAPTURE_SECURE =
+ "android.media.action.IMAGE_CAPTURE_SECURE";
@Override
public void onCreate(Bundle icicle) {
@@ -47,6 +55,18 @@ abstract public class ActivityBase extends Activity {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
super.onCreate(icicle);
+
+ if(isCameraSecure()){
+ Log.v(TAG, "Starting in secure camera mode.");
+
+ // show on lock screen
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
+
+ // Filter for screen off so that we can finish secure camera activity
+ // when screen is off.
+ IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_OFF);
+ registerReceiver(mScreenOffReceiver, filter);
+ }
}
@Override
@@ -62,6 +82,7 @@ abstract public class ActivityBase extends Activity {
@Override
protected void onResume() {
super.onResume();
+ onResumeAfterSuper();
// Don't grab the camera if in use by lockscreen. For example, face
// unlock may be using the camera. Camera may be already opened in
// onCreate. doOnResume should continue if mCameraDevice != null.
@@ -127,11 +148,14 @@ abstract public class ActivityBase extends Activity {
@Override
protected void onDestroy() {
+ if (isCameraSecure()) {
+ unregisterReceiver(mScreenOffReceiver);
+ }
PopupManager.removeInstance(this);
super.onDestroy();
}
- private boolean isKeyguardLocked() {
+ protected boolean isKeyguardLocked() {
KeyguardManager kgm = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
if (LOGV) {
if (kgm != null) {
@@ -142,4 +166,28 @@ abstract public class ActivityBase extends Activity {
// isKeyguardSecure excludes the slide lock case.
return (kgm != null) && kgm.isKeyguardLocked() && kgm.isKeyguardSecure();
}
+
+ protected boolean isCameraSecure() {
+ // Check if this is in the secure camera mode.
+ String action = getIntent().getAction();
+ if (INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE.equals(action)
+ || ACTION_IMAGE_CAPTURE_SECURE.equals(action)){
+ return true;
+ }
+ else{
+ return isKeyguardLocked();
+ }
+ }
+
+ // close activity when screen turns off
+ protected BroadcastReceiver mScreenOffReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.v(TAG, "Finishing because screen turned off.");
+ finish();
+ }
+ };
+
+ // implemented in class Camera, class Video needs empty one
+ public void onResumeAfterSuper() {};
}
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 2ca7944..f7de7f6 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -100,6 +100,10 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
private static final int SHOW_TAP_TO_FOCUS_TOAST = 6;
private static final int UPDATE_THUMBNAIL = 7;
+ // This is the delay before we execute onResume tasks when coming
+ // from the lock screen, to allow time for onPause to execute.
+ private static final int ON_RESUME_TASKS_DELAY_MSEC = 20;
+
// The subset of parameters we need to update in setCameraParameters().
private static final int UPDATE_PARAM_INITIALIZE = 1;
private static final int UPDATE_PARAM_ZOOM = 2;
@@ -1345,7 +1349,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
@OnClickAttr
public void onThumbnailClicked(View v) {
- if (isCameraIdle() && mThumbnail != null) {
+ if (isCameraIdle() && mThumbnail != null && !isCameraSecure()) {
showSharePopup();
}
}
@@ -2318,4 +2322,27 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
mAeLockSupported = mInitialParams.isAutoExposureLockSupported();
mAwbLockSupported = mInitialParams.isAutoWhiteBalanceLockSupported();
}
+
+ @Override
+ public void onResumeAfterSuper() {
+ // Add delay on resume from lock screen only, in order to to speed up
+ // the onResume --> onPause --> onResume cycle from lock screen.
+ // Don't do always because letting go of thread can cause delay.
+ String action = getIntent().getAction();
+ if (isCameraSecure()) {
+ Log.v(TAG, "On resume, from lock screen.");
+ // Note: onPauseAfterSuper() will delete this runnable, so we will
+ // at most have 1 copy queued up.
+ mHandler.postDelayed(new Runnable() {
+ public void run() {
+ doOnResume();
+ }
+ }, ON_RESUME_TASKS_DELAY_MSEC);
+ // show on lock screen
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
+ } else {
+ Log.v(TAG, "On resume.");
+ doOnResume();
+ }
+ }
}
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index b2626ed..2190c48 100755
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -608,7 +608,7 @@ public class VideoCamera extends ActivityBase
@OnClickAttr
public void onThumbnailClicked(View v) {
- if (!mMediaRecorderRecording && mThumbnail != null) {
+ if (!mMediaRecorderRecording && mThumbnail != null && !isCameraSecure()) {
showSharePopup();
}
}