summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2011-07-19 03:57:31 +0800
committerWu-cheng Li <wuchengli@google.com>2011-07-20 02:50:54 +0800
commita9b3713b0e006d6cdcabd5e1b094f4a1aa3738fa (patch)
treee3d1f84422515df33e5831f704b375ac826f296b
parentb4aa4791c329cadc4df8edf3def5655cf4105f56 (diff)
downloadLegacyCamera-a9b3713b0e006d6cdcabd5e1b094f4a1aa3738fa.zip
LegacyCamera-a9b3713b0e006d6cdcabd5e1b094f4a1aa3738fa.tar.gz
LegacyCamera-a9b3713b0e006d6cdcabd5e1b094f4a1aa3738fa.tar.bz2
Broadcast new picture and new video intents.
bug:4964321 Change-Id: I94edce33bd18fc67ed8220d54b01c1af63963c5c
-rw-r--r--src/com/android/camera/Camera.java3
-rw-r--r--src/com/android/camera/VideoCamera.java12
2 files changed, 10 insertions, 5 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index d1315d4..f7ceb7c 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -868,6 +868,9 @@ public class Camera extends ActivityBase implements View.OnClickListener,
if (mThumbnail != null) {
mThumbnailView.setBitmap(mThumbnail.getBitmap());
}
+
+ sendBroadcast(new Intent(android.hardware.Camera.ACTION_NEW_PICTURE, uri));
+ // Keep compatibility
sendBroadcast(new Intent("com.android.camera.NEW_PICTURE", uri));
}
} else {
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index d0027f2..de82ef8 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -1281,7 +1281,7 @@ public class VideoCamera extends ActivityBase
Log.v(TAG, "New video filename: " + mVideoFilename);
}
- private void registerVideo() {
+ private void addVideoToMediaStore() {
if (mVideoFileDescriptor == null) {
Uri videoTable = Uri.parse("content://media/external/video/media");
mCurrentVideoValues.put(Video.Media.SIZE,
@@ -1298,6 +1298,8 @@ public class VideoCamera extends ActivityBase
try {
mCurrentVideoUri = mContentResolver.insert(videoTable,
mCurrentVideoValues);
+ sendBroadcast(new Intent(android.hardware.Camera.ACTION_NEW_VIDEO,
+ mCurrentVideoUri));
} catch (Exception e) {
// We failed to insert into the database. This can happen if
// the SD card is unmounted.
@@ -1570,7 +1572,7 @@ public class VideoCamera extends ActivityBase
private void stopVideoRecording() {
Log.v(TAG, "stopVideoRecording");
if (mMediaRecorderRecording) {
- boolean needToRegisterRecording = false;
+ boolean shouldAddToMediaStore = false;
mMediaRecorder.setOnErrorListener(null);
mMediaRecorder.setOnInfoListener(null);
try {
@@ -1578,7 +1580,7 @@ public class VideoCamera extends ActivityBase
mCurrentVideoFilename = mVideoFilename;
Log.v(TAG, "Setting current video filename: "
+ mCurrentVideoFilename);
- needToRegisterRecording = true;
+ shouldAddToMediaStore = true;
} catch (RuntimeException e) {
Log.e(TAG, "stop fail", e);
if (mVideoFilename != null) deleteVideoFile(mVideoFilename);
@@ -1589,8 +1591,8 @@ public class VideoCamera extends ActivityBase
enableCameraControls(true);
}
keepScreenOnAwhile();
- if (needToRegisterRecording && mStorageSpace >= LOW_STORAGE_THRESHOLD) {
- registerVideo();
+ if (shouldAddToMediaStore && mStorageSpace >= LOW_STORAGE_THRESHOLD) {
+ addVideoToMediaStore();
}
}
releaseMediaRecorder(); // always release media recorder