diff --git a/src/com/android/settings/deviceinfo/MigrateEstimateTask.java b/src/com/android/settings/deviceinfo/MigrateEstimateTask.java
index 395b6a2..c41ebe0 100644
--- a/src/com/android/settings/deviceinfo/MigrateEstimateTask.java
+++ b/src/com/android/settings/deviceinfo/MigrateEstimateTask.java
@@ -16,51 +16,40 @@
 
 package com.android.settings.deviceinfo;
 
-import android.content.ComponentName;
+import static com.android.settings.deviceinfo.StorageSettings.TAG;
+
+import android.app.usage.ExternalStorageStats;
+import android.app.usage.StorageStatsManager;
 import android.content.Context;
 import android.content.Intent;
-import android.content.ServiceConnection;
+import android.content.pm.UserInfo;
 import android.net.TrafficStats;
 import android.os.AsyncTask;
-import android.os.IBinder;
-import android.os.RemoteException;
 import android.os.UserHandle;
+import android.os.UserManager;
 import android.os.storage.StorageManager;
 import android.os.storage.VolumeInfo;
 import android.telecom.Log;
 import android.text.format.DateUtils;
 import android.text.format.Formatter;
 
-import com.android.internal.app.IMediaContainerService;
+import java.io.IOException;
+import java.util.UUID;
 
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import static com.android.settings.deviceinfo.StorageSettings.TAG;
-
-public abstract class MigrateEstimateTask extends AsyncTask<Void, Void, Long> implements
-        ServiceConnection {
+public abstract class MigrateEstimateTask extends AsyncTask<Void, Void, Long> {
     private static final String EXTRA_SIZE_BYTES = "size_bytes";
 
-    private static final ComponentName DEFAULT_CONTAINER_COMPONENT = new ComponentName(
-            "com.android.defcontainer", "com.android.defcontainer.DefaultContainerService");
-
     /**
      * Assume roughly a Class 10 card.
      */
     private static final long SPEED_ESTIMATE_BPS = 10 * TrafficStats.MB_IN_BYTES;
 
     private final Context mContext;
-    private final StorageManager mStorage;
-
-    private final CountDownLatch mConnected = new CountDownLatch(1);
-    private IMediaContainerService mService;
 
     private long mSizeBytes = -1;
 
     public MigrateEstimateTask(Context context) {
         mContext = context;
-        mStorage = context.getSystemService(StorageManager.class);
     }
 
     public void copyFrom(Intent intent) {
@@ -77,31 +66,36 @@
             return mSizeBytes;
         }
 
+        final UserManager user = mContext.getSystemService(UserManager.class);
+        final StorageManager storage = mContext.getSystemService(StorageManager.class);
+        final StorageStatsManager stats = mContext.getSystemService(StorageStatsManager.class);
+
         final VolumeInfo privateVol = mContext.getPackageManager().getPrimaryStorageCurrentVolume();
-        final VolumeInfo emulatedVol = mStorage.findEmulatedForPrivate(privateVol);
+        final VolumeInfo emulatedVol = storage.findEmulatedForPrivate(privateVol);
 
         if (emulatedVol == null) {
             Log.w(TAG, "Failed to find current primary storage");
             return -1L;
         }
 
-        final String path = emulatedVol.getPath().getAbsolutePath();
-        Log.d(TAG, "Estimating for current path " + path);
-
-        final Intent intent = new Intent().setComponent(DEFAULT_CONTAINER_COMPONENT);
-        mContext.bindServiceAsUser(intent, this, Context.BIND_AUTO_CREATE, UserHandle.SYSTEM);
-
         try {
-            if (mConnected.await(15, TimeUnit.SECONDS)) {
-                return mService.calculateDirectorySize(path);
-            }
-        } catch (InterruptedException | RemoteException e) {
-            Log.w(TAG, "Failed to measure " + path);
-        } finally {
-            mContext.unbindService(this);
-        }
+            final UUID emulatedUuid = storage.getUuidForPath(emulatedVol.getPath());
+            Log.d(TAG, "Measuring size of " + emulatedUuid);
 
-        return -1L;
+            long size = 0;
+            for (UserInfo u : user.getUsers()) {
+                final ExternalStorageStats s = stats.queryExternalStatsForUser(emulatedUuid,
+                        UserHandle.of(u.id));
+                size += s.getTotalBytes();
+                if (u.id == UserHandle.USER_SYSTEM) {
+                    size += s.getObbBytes();
+                }
+            }
+            return size;
+        } catch (IOException e) {
+            Log.w(TAG, "Failed to measure", e);
+            return -1L;
+        }
     }
 
     @Override
@@ -116,16 +110,4 @@
     }
 
     public abstract void onPostExecute(String size, String time);
-
-    @Override
-    public void onServiceConnected(ComponentName name, IBinder service) {
-        mService = IMediaContainerService.Stub.asInterface(service);
-        mConnected.countDown();
-    }
-
-    @Override
-    public void onServiceDisconnected(ComponentName name) {
-        // Ignored; we leave service in place for the background thread to
-        // run into DeadObjectException
-    }
 }
