summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/PhotoModule.java
diff options
context:
space:
mode:
authorJay Wang <jaywang@codeaurora.org>2016-02-17 11:43:16 -0800
committerCamera Software Integration <camswint@localhost>2016-02-27 05:15:09 -0700
commitf7c61885a2197cc55a46ecb145a1814c42048027 (patch)
tree7a4eb55653a0145728c280297ea58f165e93c86d /src/com/android/camera/PhotoModule.java
parent065445dfd5348cf2c3a50565a82339bb69bc4ab8 (diff)
downloadandroid_packages_apps_Snap-f7c61885a2197cc55a46ecb145a1814c42048027.tar.gz
android_packages_apps_Snap-f7c61885a2197cc55a46ecb145a1814c42048027.tar.bz2
android_packages_apps_Snap-f7c61885a2197cc55a46ecb145a1814c42048027.zip
Revert "SnapdragonCamera: Checking memory and storage once a while only."
This reverts commit bb4f9d9aaf595ca698946a9c6ab7ce747060367d. CRs-Fixed: 978195 Change-Id: Iac7da127db7bb15bfd5607609c4c2be47a638aa7
Diffstat (limited to 'src/com/android/camera/PhotoModule.java')
-rw-r--r--src/com/android/camera/PhotoModule.java22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index b4b8d33d1..e77d2c171 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -240,10 +240,8 @@ public class PhotoModule
// Used for check memory status for longshot mode
// Currently, this cancel threshold selection is based on test experiments,
// we can change it based on memory status or other requirements.
- private static final int CHECKING_INTERVAL = 10;
- private static final int LONGSHOT_CANCEL_THRESHOLD = CHECKING_INTERVAL * 40 * 1024 * 1024;
- private int mRemainedMemCheckingCount;
- private long mSecondaryServerMem;
+ private static final int LONGSHOT_CANCEL_THRESHOLD = 40 * 1024 * 1024;
+ private long SECONDARY_SERVER_MEM;
private boolean mLongshotActive = false;
// We use a queue to generated names of the images to be used later
@@ -981,21 +979,16 @@ public class PhotoModule
// TODO: need to check cached background apps memory and longshot ION memory
private boolean isLongshotNeedCancel() {
- if(mRemainedMemCheckingCount < CHECKING_INTERVAL) {
- mRemainedMemCheckingCount++;
- return false;
- }
- mRemainedMemCheckingCount = 0;
- if (Storage.getAvailableSpace() <= Storage.LOW_STORAGE_THRESHOLD_BYTES * CHECKING_INTERVAL) {
+ if (Storage.getAvailableSpace() <= Storage.LOW_STORAGE_THRESHOLD_BYTES) {
Log.w(TAG, "current storage is full");
return true;
}
- if (mSecondaryServerMem == 0) {
+ if (SECONDARY_SERVER_MEM == 0) {
ActivityManager am = (ActivityManager) mActivity.getSystemService(
Context.ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
am.getMemoryInfo(memInfo);
- mSecondaryServerMem = memInfo.secondaryServerThreshold;
+ SECONDARY_SERVER_MEM = memInfo.secondaryServerThreshold;
}
long totalMemory = Runtime.getRuntime().totalMemory();
@@ -1007,10 +1000,10 @@ public class PhotoModule
long[] info = reader.getRawInfo();
long availMem = (info[Debug.MEMINFO_FREE] + info[Debug.MEMINFO_CACHED]) * 1024;
- if (availMem <= mSecondaryServerMem || remainMemory <= LONGSHOT_CANCEL_THRESHOLD) {
+ if (availMem <= SECONDARY_SERVER_MEM || remainMemory <= LONGSHOT_CANCEL_THRESHOLD) {
Log.e(TAG, "cancel longshot: free=" + info[Debug.MEMINFO_FREE] * 1024
+ " cached=" + info[Debug.MEMINFO_CACHED] * 1024
- + " threshold=" + mSecondaryServerMem);
+ + " threshold=" + SECONDARY_SERVER_MEM);
mLongshotActive = false;
RotateTextToast.makeText(mActivity,R.string.msg_cancel_longshot_for_limited_memory,
Toast.LENGTH_SHORT).show();
@@ -2284,7 +2277,6 @@ public class PhotoModule
mUI.cancelCountDown();
}
//check whether current memory is enough for longshot.
- mRemainedMemCheckingCount = 0;
if(isLongshotNeedCancel()) {
return;
}