am 11b29e76: Merge "Initial pass at storage benchmarks." into mnc-dev

* commit '11b29e7613a30610981d56786fd5d2e0b7494aab':
  Initial pass at storage benchmarks.
This commit is contained in:
Jeff Sharkey
2015-05-15 22:08:47 +00:00
committed by Android Git Automerger

View File

@@ -55,12 +55,23 @@ public class StorageWizardFormatProgress extends StorageWizardBase {
new PartitionTask().execute();
}
public class PartitionTask extends AsyncTask<Void, Void, Exception> {
public class PartitionTask extends AsyncTask<Void, Integer, Exception> {
@Override
protected Exception doInBackground(Void... params) {
try {
if (mFormatPrivate) {
mStorage.partitionPrivate(mDisk.getId());
publishProgress(40);
final long internalBench = mStorage.benchmark(null);
publishProgress(60);
final VolumeInfo privateVol = findFirstVolume(VolumeInfo.TYPE_PRIVATE);
final long privateBench = mStorage.benchmark(privateVol.id);
// TODO: plumb through to user when below threshold
final float pct = (float) internalBench / (float) privateBench;
Log.d(TAG, "New volume is " + pct + "x the speed of internal");
} else {
mStorage.partitionPublic(mDisk.getId());
}
@@ -70,6 +81,11 @@ public class StorageWizardFormatProgress extends StorageWizardBase {
}
}
@Override
protected void onProgressUpdate(Integer... progress) {
setCurrentProgress(progress[0]);
}
@Override
protected void onPostExecute(Exception e) {
final Context context = StorageWizardFormatProgress.this;