Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11b29e76 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Initial pass at storage benchmarks." into mnc-dev

parents cb5444ad 58003515
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -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;