summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-11-16 23:31:12 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-11-16 23:31:12 -0800
commit92acbf6c5a5c654bfdaa871afc891a8723acebf8 (patch)
tree02e61902e2843889bbb2a6f689519f9fe4e52fb7 /src/com/android/camera
parent56e1db465a1726f2dd0e0b4ad0624c14b797d313 (diff)
parent6d68a36b5da24f70e1a8d5e9529720eeb8ce6d86 (diff)
downloadLegacyCamera-92acbf6c5a5c654bfdaa871afc891a8723acebf8.zip
LegacyCamera-92acbf6c5a5c654bfdaa871afc891a8723acebf8.tar.gz
LegacyCamera-92acbf6c5a5c654bfdaa871afc891a8723acebf8.tar.bz2
Merge change Ie07be885 into eclair
* changes: Fix issue 2259506 and 2262817 by keeping a reference to MediaProvider when camera is active.
Diffstat (limited to 'src/com/android/camera')
-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;