Don't complain about /proc usage in Settings killing animations.

Change-Id: If6c2b5dc2244ac4b921e45daeb8e0052306e2c54
This commit is contained in:
Brad Fitzpatrick
2010-11-11 08:48:43 -08:00
parent cc13e0b2e4
commit 76629102b9

View File

@@ -24,6 +24,7 @@ import android.app.Fragment;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.StrictMode;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.preference.PreferenceActivity;
@@ -335,6 +336,10 @@ public class RunningProcessesView extends FrameLayout
}
private long readAvailMem() {
// Permit disk reads here, as /proc/meminfo isn't really "on
// disk" and should be fast. TODO: make BlockGuard ignore
// /proc/ and /sys/ files perhaps?
StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskReads();
try {
long memFree = 0;
long memCached = 0;
@@ -357,6 +362,8 @@ public class RunningProcessesView extends FrameLayout
return memFree + memCached;
} catch (java.io.FileNotFoundException e) {
} catch (java.io.IOException e) {
} finally {
StrictMode.setThreadPolicy(savedPolicy);
}
return 0;
}