summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2010-05-28 19:57:36 +0800
committerWu-cheng Li <wuchengli@google.com>2010-05-28 20:04:23 +0800
commit0ab73a87e749477080c566cb9612cd3f25dc7574 (patch)
treec7ebf74bef221813b8ce33bb4b86dc98090d88f7 /src
parent4ad1c1729d0ba95b5e96081759a96072e611df1f (diff)
downloadLegacyCamera-0ab73a87e749477080c566cb9612cd3f25dc7574.zip
LegacyCamera-0ab73a87e749477080c566cb9612cd3f25dc7574.tar.gz
LegacyCamera-0ab73a87e749477080c566cb9612cd3f25dc7574.tar.bz2
Show better message to users if camera fails to access sdcard.
Also print the exception if sdcard access fails. bug:2713104 Change-Id: I35a553ee75a49398582b587755d097b02b144015
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/Camera.java2
-rw-r--r--src/com/android/camera/MenuHelper.java1
-rw-r--r--src/com/android/camera/VideoCamera.java10
3 files changed, 12 insertions, 1 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 052d16c..1f18dd6 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -1208,6 +1208,8 @@ public class Camera extends NoSearchActivity implements View.OnClickListener,
} else {
noStorageText = getString(R.string.no_storage);
}
+ } else if (remaining == MenuHelper.CANNOT_STAT_ERROR) {
+ noStorageText = getString(R.string.access_sd_fail);
} else if (remaining < 1) {
noStorageText = getString(R.string.not_enough_space);
}
diff --git a/src/com/android/camera/MenuHelper.java b/src/com/android/camera/MenuHelper.java
index 1c8f0fa..e07f4f0 100644
--- a/src/com/android/camera/MenuHelper.java
+++ b/src/com/android/camera/MenuHelper.java
@@ -201,6 +201,7 @@ public class MenuHelper {
// if we can't stat the filesystem then we don't know how many
// pictures are remaining. it might be zero but just leave it
// blank since we really don't know.
+ Log.e(TAG, "Fail to access sdcard", ex);
return CANNOT_STAT_ERROR;
}
}
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 958f19e..5ee144a 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -108,6 +108,7 @@ public class VideoCamera extends NoSearchActivity
private static final int STORAGE_STATUS_OK = 0;
private static final int STORAGE_STATUS_LOW = 1;
private static final int STORAGE_STATUS_NONE = 2;
+ private static final int STORAGE_STATUS_FAIL = 3;
private static final boolean SWITCH_CAMERA = true;
private static final boolean SWITCH_VIDEO = false;
@@ -496,6 +497,10 @@ public class VideoCamera extends NoSearchActivity
break;
case STORAGE_STATUS_LOW:
errorMessage = getString(R.string.spaceIsLow_content);
+ break;
+ case STORAGE_STATUS_FAIL:
+ errorMessage = getString(R.string.access_sd_fail);
+ break;
}
if (errorMessage != null) {
if (mStorageHint == null) {
@@ -514,6 +519,8 @@ public class VideoCamera extends NoSearchActivity
long remaining = mayHaveSd ? getAvailableStorage() : NO_STORAGE_ERROR;
if (remaining == NO_STORAGE_ERROR) {
return STORAGE_STATUS_NONE;
+ } else if (remaining == CANNOT_STAT_ERROR) {
+ return STORAGE_STATUS_FAIL;
}
return remaining < LOW_STORAGE_THRESHOLD
? STORAGE_STATUS_LOW
@@ -848,10 +855,11 @@ public class VideoCamera extends NoSearchActivity
return (long) stat.getAvailableBlocks()
* (long) stat.getBlockSize();
}
- } catch (RuntimeException ex) {
+ } catch (Exception ex) {
// if we can't stat the filesystem then we don't know how many
// free bytes exist. It might be zero but just leave it
// blank since we really don't know.
+ Log.e(TAG, "Fail to access sdcard", ex);
return CANNOT_STAT_ERROR;
}
}