summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/camera/BitmapManager.java1
-rw-r--r--src/com/android/camera/ImageGallery.java2
-rw-r--r--src/com/android/camera/ImageLoader.java13
-rw-r--r--src/com/android/camera/ImageManager.java8
-rw-r--r--src/com/android/camera/MenuHelper.java53
-rw-r--r--src/com/android/camera/gallery/BaseImageList.java3
-rw-r--r--src/com/android/camera/gallery/DrmImageList.java2
-rw-r--r--src/com/android/camera/gallery/Image.java2
-rw-r--r--src/com/android/camera/gallery/ImageList.java3
-rw-r--r--src/com/android/camera/gallery/ImageListUber.java2
-rw-r--r--src/com/android/camera/gallery/MiniThumbFile.java3
11 files changed, 40 insertions, 52 deletions
diff --git a/src/com/android/camera/BitmapManager.java b/src/com/android/camera/BitmapManager.java
index c70db78..b6d660c 100644
--- a/src/com/android/camera/BitmapManager.java
+++ b/src/com/android/camera/BitmapManager.java
@@ -131,7 +131,6 @@ public class BitmapManager {
* Make sure "acquire/release" are pairing correctly
*/
public synchronized void releaseResourceLock() {
- Thread t = Thread.currentThread();
mLocked = false;
notifyAll();
}
diff --git a/src/com/android/camera/ImageGallery.java b/src/com/android/camera/ImageGallery.java
index cd7fb5e..3da229c 100644
--- a/src/com/android/camera/ImageGallery.java
+++ b/src/com/android/camera/ImageGallery.java
@@ -541,7 +541,7 @@ public class ImageGallery extends Activity implements
|| type.equals("video/*");
}
- private synchronized IImageList allImages(boolean assumeMounted) {
+ private IImageList allImages(boolean assumeMounted) {
if (mAllImages == null) {
mNoImagesView = findViewById(R.id.no_images);
diff --git a/src/com/android/camera/ImageLoader.java b/src/com/android/camera/ImageLoader.java
index 242aa8c..5d99ca4 100644
--- a/src/com/android/camera/ImageLoader.java
+++ b/src/com/android/camera/ImageLoader.java
@@ -39,7 +39,6 @@ public class ImageLoader {
// the worker thread and a done flag so we know when to exit
private boolean mDone;
private Thread mDecodeThread;
- private final Handler mHandler;
// Thumbnail checking will be done when there is no getBitmap requests
// need to be processed.
@@ -118,7 +117,6 @@ public class ImageLoader {
}
public ImageLoader(Handler handler) {
- mHandler = handler;
mThumbnailChecker = new ThumbnailChecker();
start();
}
@@ -128,9 +126,12 @@ public class ImageLoader {
// Place the resulting bitmap in the cache, then call back by executing
// the given runnable so things can get updated appropriately.
public void run() {
- while (!mDone) {
+ while (true) {
WorkItem workItem = null;
synchronized (mQueue) {
+ if (mDone) {
+ break;
+ }
if (!mQueue.isEmpty()) {
workItem = mQueue.remove(0);
} else {
@@ -162,7 +163,7 @@ public class ImageLoader {
}
}
- private synchronized void start() {
+ private void start() {
if (mDecodeThread != null) {
return;
}
@@ -174,9 +175,9 @@ public class ImageLoader {
t.start();
}
- public synchronized void stop() {
- mDone = true;
+ public void stop() {
synchronized (mQueue) {
+ mDone = true;
mQueue.notifyAll();
}
if (mDecodeThread != null) {
diff --git a/src/com/android/camera/ImageManager.java b/src/com/android/camera/ImageManager.java
index 80a7790..19113f1 100644
--- a/src/com/android/camera/ImageManager.java
+++ b/src/com/android/camera/ImageManager.java
@@ -183,14 +183,6 @@ public class ImageManager {
values.put(Images.Media.MIME_TYPE, "image/jpeg");
values.put(Images.Media.ORIENTATION, orientation);
- File parentFile = new File(directory);
-
- // Lowercase the path for hashing. This avoids duplicate buckets if the
- // filepath case is changed externally.
- // Keep the original case for display.
- String path = parentFile.toString().toLowerCase();
- String name = parentFile.getName();
-
if (location != null) {
values.put(Images.Media.LATITUDE, location.getLatitude());
values.put(Images.Media.LONGITUDE, location.getLongitude());
diff --git a/src/com/android/camera/MenuHelper.java b/src/com/android/camera/MenuHelper.java
index 8aad194..363b429 100644
--- a/src/com/android/camera/MenuHelper.java
+++ b/src/com/android/camera/MenuHelper.java
@@ -212,16 +212,13 @@ public class MenuHelper {
try {
Geocoder geocoder = new Geocoder(context);
- List<Address> address = geocoder.getFromLocation(
- lat, lng, 1);
- Iterator<Address> iterator = address.iterator();
-
- while (iterator.hasNext()) {
- Address addr = iterator.next();
- value += addr.getAddressLine(
- addr.getMaxAddressLineIndex());
- Log.v(TAG, addr.toString());
+ List<Address> address = geocoder.getFromLocation(lat, lng, 1);
+ StringBuilder sb = new StringBuilder();
+ for (Address addr : address) {
+ int index = addr.getMaxAddressLineIndex();
+ sb.append(addr.getAddressLine(index));
}
+ value = sb.toString();
} catch (IOException ex) {
// Ignore this exception.
value = EMPTY_STRING;
@@ -665,26 +662,24 @@ public class MenuHelper {
// is really a framework bug in that it shouldn't show the submenu
// if the submenu has no visible items.
requiresWriteAccessItems.add(rotateSubmenu.getItem());
- if (rotateSubmenu != null) {
- requiresWriteAccessItems.add(
- rotateSubmenu.add(0, MENU_IMAGE_ROTATE_LEFT, 50,
- R.string.rotate_left)
- .setOnMenuItemClickListener(
- new MenuItem.OnMenuItemClickListener() {
- public boolean onMenuItemClick(MenuItem item) {
- return onRotateClicked(onInvoke, -90);
- }
- }).setAlphabeticShortcut('l'));
- requiresWriteAccessItems.add(
- rotateSubmenu.add(0, MENU_IMAGE_ROTATE_RIGHT, 60,
- R.string.rotate_right)
- .setOnMenuItemClickListener(
- new MenuItem.OnMenuItemClickListener() {
- public boolean onMenuItemClick(MenuItem item) {
- return onRotateClicked(onInvoke, 90);
- }
- }).setAlphabeticShortcut('r'));
- }
+ requiresWriteAccessItems.add(
+ rotateSubmenu.add(0, MENU_IMAGE_ROTATE_LEFT, 50,
+ R.string.rotate_left)
+ .setOnMenuItemClickListener(
+ new MenuItem.OnMenuItemClickListener() {
+ public boolean onMenuItemClick(MenuItem item) {
+ return onRotateClicked(onInvoke, -90);
+ }
+ }).setAlphabeticShortcut('l'));
+ requiresWriteAccessItems.add(
+ rotateSubmenu.add(0, MENU_IMAGE_ROTATE_RIGHT, 60,
+ R.string.rotate_right)
+ .setOnMenuItemClickListener(
+ new MenuItem.OnMenuItemClickListener() {
+ public boolean onMenuItemClick(MenuItem item) {
+ return onRotateClicked(onInvoke, 90);
+ }
+ }).setAlphabeticShortcut('r'));
}
if (isImage && ((inclusions & INCLUDE_CROP_MENU) != 0)) {
diff --git a/src/com/android/camera/gallery/BaseImageList.java b/src/com/android/camera/gallery/BaseImageList.java
index 5a5f141..ee56f80 100644
--- a/src/com/android/camera/gallery/BaseImageList.java
+++ b/src/com/android/camera/gallery/BaseImageList.java
@@ -43,9 +43,6 @@ import java.util.HashMap;
public abstract class BaseImageList implements IImageList {
private static final String TAG = "BaseImageList";
- protected static final String[] ACCEPTABLE_IMAGE_TYPES =
- new String[] { "image/jpeg", "image/png", "image/gif" };
-
protected ContentResolver mContentResolver;
protected int mSort;
protected Uri mBaseUri;
diff --git a/src/com/android/camera/gallery/DrmImageList.java b/src/com/android/camera/gallery/DrmImageList.java
index 36fe4f8..383211a 100644
--- a/src/com/android/camera/gallery/DrmImageList.java
+++ b/src/com/android/camera/gallery/DrmImageList.java
@@ -50,7 +50,7 @@ public class DrmImageList extends ImageList implements IImageList {
public void checkThumbnail(int index) {
}
- private class DrmImage extends Image {
+ private static class DrmImage extends Image {
protected DrmImage(long id, ContentResolver cr,
BaseImageList container, int cursorRow) {
diff --git a/src/com/android/camera/gallery/Image.java b/src/com/android/camera/gallery/Image.java
index ca979d8..8c208e2 100644
--- a/src/com/android/camera/gallery/Image.java
+++ b/src/com/android/camera/gallery/Image.java
@@ -245,7 +245,7 @@ public class Image extends BaseImage implements IImage {
synchronized (c) {
filePath = c.getString(mContainer.indexData());
}
- ExifInterface mExif = new ExifInterface(filePath);
+ mExif = new ExifInterface(filePath);
if (mExifData == null) {
mExifData = mExif.getAttributes();
}
diff --git a/src/com/android/camera/gallery/ImageList.java b/src/com/android/camera/gallery/ImageList.java
index 36fea22..c39fe4d 100644
--- a/src/com/android/camera/gallery/ImageList.java
+++ b/src/com/android/camera/gallery/ImageList.java
@@ -38,6 +38,9 @@ public class ImageList extends BaseImageList implements IImageList {
private static final String TAG = "ImageList";
+ private static final String[] ACCEPTABLE_IMAGE_TYPES =
+ new String[] { "image/jpeg", "image/png", "image/gif" };
+
public HashMap<String, String> getBucketIds() {
Uri uri = mBaseUri.buildUpon()
.appendQueryParameter("distinct", "true").build();
diff --git a/src/com/android/camera/gallery/ImageListUber.java b/src/com/android/camera/gallery/ImageListUber.java
index 4cd1ba1..1ffd94b 100644
--- a/src/com/android/camera/gallery/ImageListUber.java
+++ b/src/com/android/camera/gallery/ImageListUber.java
@@ -100,7 +100,7 @@ public class ImageListUber implements IImageList {
// we don't have to allocate each time through. Otherwise
// it could just as easily be a local.
- public synchronized IImage getImageAt(int index) {
+ public IImage getImageAt(int index) {
if (index < 0 || index > getCount()) {
throw new IndexOutOfBoundsException(
"index " + index + " out of range max is " + getCount());
diff --git a/src/com/android/camera/gallery/MiniThumbFile.java b/src/com/android/camera/gallery/MiniThumbFile.java
index b5c271f..1a94486 100644
--- a/src/com/android/camera/gallery/MiniThumbFile.java
+++ b/src/com/android/camera/gallery/MiniThumbFile.java
@@ -183,7 +183,8 @@ class MiniThumbFile {
return null;
}
int length = r.readInt();
- r.read(data, 0, length);
+ int got = r.read(data, 0, length);
+ if (got != length) return null;
return data;
} else {
return null;