summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlikaid <likaid@codeaurora.org>2015-09-06 16:28:18 +0800
committerlikaid <likaid@codeaurora.org>2015-09-06 16:28:18 +0800
commit32b1f21a367401f0fcffa45cc07dce73fd671d6b (patch)
tree7b23130009ce48eb859a3c4c875c01e16a2f0dcf /src
parent007b0d24e854630caa4fdf07899e3aa5f4ad301b (diff)
downloadandroid_packages_apps_Snap-32b1f21a367401f0fcffa45cc07dce73fd671d6b.tar.gz
android_packages_apps_Snap-32b1f21a367401f0fcffa45cc07dce73fd671d6b.tar.bz2
android_packages_apps_Snap-32b1f21a367401f0fcffa45cc07dce73fd671d6b.zip
SnapdragonCamera: Stop the longshot when the storage is full
The remainingPhotos was decreeased by 1 for each shot, when it came to 0, the longshot process was not stopped. When the remaining photos are less than 20, show "<20" for the remainingPhotos; When the storage is full, Stop the longshot process. Change-Id: Ifb1fb38f668132e1058f8a937afa9fa0b5afb5a7 CRs-Fixed: 893008
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/PhotoModule.java4
-rw-r--r--src/com/android/camera/ui/CameraControls.java18
2 files changed, 19 insertions, 3 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index cdeb490ed..2db71e3c9 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -915,6 +915,10 @@ public class PhotoModule
// TODO: need to check cached background apps memory and longshot ION memory
private boolean isLongshotNeedCancel() {
+ if (Storage.getAvailableSpace() <= Storage.LOW_STORAGE_THRESHOLD_BYTES) {
+ Log.w(TAG, "current storage is full");
+ return true;
+ }
if (SECONDARY_SERVER_MEM == 0) {
ActivityManager am = (ActivityManager) mActivity.getSystemService(
Context.ACTIVITY_SERVICE);
diff --git a/src/com/android/camera/ui/CameraControls.java b/src/com/android/camera/ui/CameraControls.java
index c0defea06..52750f32a 100644
--- a/src/com/android/camera/ui/CameraControls.java
+++ b/src/com/android/camera/ui/CameraControls.java
@@ -41,6 +41,7 @@ import org.codeaurora.snapcam.R;
import com.android.camera.ui.ModuleSwitcher;
import com.android.camera.ui.RotateImageView;
import com.android.camera.ShutterButton;
+import com.android.camera.Storage;
import com.android.camera.util.CameraUtil;
import com.android.camera.TsMakeupManager;
@@ -84,6 +85,7 @@ public class CameraControls extends RotatableLayout {
private LinearLayout mRemainingPhotos;
private TextView mRemainingPhotosText;
+ private int mCurrentRemaining = -1;
private int mOrientation;
private int mPreviewRatio;
@@ -92,6 +94,8 @@ public class CameraControls extends RotatableLayout {
private Paint mPaint;
+ private static final int LOW_REMAINING_PHOTOS = 20;
+
AnimatorListener outlistener = new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
@@ -868,14 +872,20 @@ public class CameraControls extends RotatableLayout {
}
public void updateRemainingPhotos(int remaining) {
- if (remaining < 0) {
+ long remainingStorage = Storage.getAvailableSpace() - Storage.LOW_STORAGE_THRESHOLD_BYTES;
+ if (remaining < 0 && remainingStorage <= 0) {
mRemainingPhotos.setVisibility(View.GONE);
} else {
for (int i = mRemainingPhotos.getChildCount() - 1; i >= 0; --i) {
mRemainingPhotos.getChildAt(i).setVisibility(View.VISIBLE);
}
- mRemainingPhotosText.setText(remaining + " ");
+ if (remaining < LOW_REMAINING_PHOTOS) {
+ mRemainingPhotosText.setText("<" + LOW_REMAINING_PHOTOS + " ");
+ } else {
+ mRemainingPhotosText.setText(remaining + " ");
+ }
}
+ mCurrentRemaining = remaining;
}
public void setMargins(int top, int bottom) {
@@ -900,7 +910,9 @@ public class CameraControls extends RotatableLayout {
public void showRefocusToast(boolean show) {
mRefocusToast.setVisibility(show ? View.VISIBLE : View.GONE);
- mRemainingPhotos.setVisibility(show ? View.GONE : View.VISIBLE);
+ if (mCurrentRemaining > 0 ) {
+ mRemainingPhotos.setVisibility(show ? View.GONE : View.VISIBLE);
+ }
}
public void setOrientation(int orientation, boolean animation) {