summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRay Chen <raychen@google.com>2009-11-16 23:34:18 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2009-11-16 23:34:18 -0800
commitedfc56310a0301c64201371b9e419ea1f5578c3b (patch)
tree02e61902e2843889bbb2a6f689519f9fe4e52fb7
parentd4492885772f6f7e1e962eeb098b2e84f69337f3 (diff)
parent92acbf6c5a5c654bfdaa871afc891a8723acebf8 (diff)
downloadLegacyCamera-edfc56310a0301c64201371b9e419ea1f5578c3b.zip
LegacyCamera-edfc56310a0301c64201371b9e419ea1f5578c3b.tar.gz
LegacyCamera-edfc56310a0301c64201371b9e419ea1f5578c3b.tar.bz2
am 92acbf6c: Merge change Ie07be885 into eclair
Merge commit '92acbf6c5a5c654bfdaa871afc891a8723acebf8' into eclair-plus-aosp * commit '92acbf6c5a5c654bfdaa871afc891a8723acebf8': Fix issue 2259506 and 2262817 by keeping a reference to MediaProvider when camera is active.
-rw-r--r--src/com/android/camera/Camera.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 22612ce..6fc0992 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -19,6 +19,7 @@ package com.android.camera;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
+import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
@@ -126,6 +127,7 @@ public class Camera extends Activity implements View.OnClickListener,
private static final String sTempCropFilename = "crop-temp";
private android.hardware.Camera mCameraDevice;
+ private ContentProviderClient mMediaProviderClient;
private SurfaceView mSurfaceView;
private SurfaceHolder mSurfaceHolder = null;
private ShutterButton mShutterButton;
@@ -239,6 +241,16 @@ public class Camera extends Activity implements View.OnClickListener,
}
}
+ private void keepMediaProviderInstance() {
+ // We want to keep a reference to MediaProvider in camera's lifecycle.
+ // TODO: Utilize mMediaProviderClient instance to replace
+ // ContentResolver calls.
+ if (mMediaProviderClient == null) {
+ mMediaProviderClient = getContentResolver()
+ .acquireContentProviderClient(MediaStore.AUTHORITY);
+ }
+ }
+
// Snapshots can only be taken after this is called. It should be called
// once only. We could have done these things in onCreate() but we want to
// make preview screen appear as soon as possible.
@@ -267,6 +279,7 @@ public class Camera extends Activity implements View.OnClickListener,
readPreference();
if (mRecordLocation) startReceivingLocationUpdates();
+ keepMediaProviderInstance();
checkStorage();
// Initialize last picture button.
@@ -328,6 +341,7 @@ public class Camera extends Activity implements View.OnClickListener,
initializeFocusTone();
+ keepMediaProviderInstance();
checkStorage();
if (mZoomButtons != null) {
@@ -990,6 +1004,15 @@ public class Camera extends Activity implements View.OnClickListener,
}
}
+ @Override
+ public void onStop() {
+ super.onStop();
+ if (mMediaProviderClient != null) {
+ mMediaProviderClient.release();
+ mMediaProviderClient = null;
+ }
+ }
+
private void checkStorage() {
if (ImageManager.isMediaScannerScanning(getContentResolver())) {
mPicturesRemaining = MenuHelper.NO_STORAGE_ERROR;