Merge "Special interval value to always run benchmarks." into mnc-dr-dev

This commit is contained in:
Jeff Sharkey
2015-09-10 00:18:43 +00:00
committed by Android (Google) Code Review

View File

@@ -368,11 +368,17 @@ class MountService extends IMountService.Stub
private boolean shouldBenchmark() { private boolean shouldBenchmark() {
final long benchInterval = Settings.Global.getLong(mContext.getContentResolver(), final long benchInterval = Settings.Global.getLong(mContext.getContentResolver(),
Settings.Global.STORAGE_BENCHMARK_INTERVAL, DateUtils.WEEK_IN_MILLIS); Settings.Global.STORAGE_BENCHMARK_INTERVAL, DateUtils.WEEK_IN_MILLIS);
if (benchInterval == -1) {
return false;
} else if (benchInterval == 0) {
return true;
}
synchronized (mLock) { synchronized (mLock) {
for (int i = 0; i < mVolumes.size(); i++) { for (int i = 0; i < mVolumes.size(); i++) {
final VolumeInfo vol = mVolumes.valueAt(i); final VolumeInfo vol = mVolumes.valueAt(i);
final VolumeRecord rec = mRecords.get(vol.fsUuid); final VolumeRecord rec = mRecords.get(vol.fsUuid);
if (vol.isMountedReadable() && rec != null) { if (vol.isMountedWritable() && rec != null) {
final long benchAge = System.currentTimeMillis() - rec.lastBenchMillis; final long benchAge = System.currentTimeMillis() - rec.lastBenchMillis;
if (benchAge >= benchInterval) { if (benchAge >= benchInterval) {
return true; return true;