private static final Log.Tag TAG = new Log.Tag("Storage");
private static final String GOOGLE_COM = "google.com";
private static HashMap<Uri, Uri> sSessionsToContentUris = new HashMap<Uri, Uri>();
+ private static HashMap<Uri, Uri> sContentUrisToSessions = new HashMap<Uri, Uri>();
private static HashMap<Uri, byte[]> sSessionsToPlaceholderBytes = new HashMap<Uri, byte[]>();
private static HashMap<Uri, Point> sSessionsToSizes= new HashMap<Uri, Point>();
resultUri = addImage(resolver, title, date, location, orientation, jpegLength, path,
width, height, mimeType);
sSessionsToContentUris.put(imageUri, resultUri);
+ sContentUrisToSessions.put(resultUri, imageUri);
} else {
// Update the MediaStore
resolver.update(imageUri, values, null, null);
}
/**
+ * Takes a content URI and returns the original Session Uri if any
+ *
+ * @param contentUri the uri of the media store content
+ * @return The session uri of the original session, if it exists, or null.
+ */
+ public static Uri getSessionUriFromContentUri(Uri contentUri) {
+ return sContentUrisToSessions.get(contentUri);
+ }
+
+ /**
* Determines if a URI points to a camera session
*
* @param uri the uri to check
import android.os.AsyncTask;
import android.view.View;
+import com.android.camera.Storage;
import com.android.camera.debug.Log;
import com.android.camera.filmstrip.ImageData;
import com.android.camera.util.Callback;
mLastPhotoId = Math.max(mLastPhotoId, newestPhoto.getContentId());
}
// We may add data that is already present, but if we do, it will be deduped in addData.
+ // addData does not dedupe session items, so we ignore them here
for (LocalData localData : newPhotoData) {
- addData(localData);
+ Uri sessionUri = Storage.getSessionUriFromContentUri(localData.getUri());
+ if (sessionUri == null) {
+ addData(localData);
+ }
}
}
}