summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2015-09-09 22:31:28 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2015-09-09 22:31:28 -0700
commita5a395697e8f3589c521a8d18e8cffbdfdf8453f (patch)
tree0006de498389c6546a48dd089a51f21c9ecff51a /src
parente7dbe37267ecbf8d0cbaad5e735e7873f1f22c9a (diff)
parent32b1f21a367401f0fcffa45cc07dce73fd671d6b (diff)
downloadandroid_packages_apps_Snap-a5a395697e8f3589c521a8d18e8cffbdfdf8453f.tar.gz
android_packages_apps_Snap-a5a395697e8f3589c521a8d18e8cffbdfdf8453f.tar.bz2
android_packages_apps_Snap-a5a395697e8f3589c521a8d18e8cffbdfdf8453f.zip
Merge "SnapdragonCamera: Stop the longshot when the storage is full"
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 940cab17e..fe6de5351 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) {