final VolumeInfo privateVol = mContext.getPackageManager().getPrimaryStorageCurrentVolume();
final VolumeInfo emulatedVol = mStorage.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);
package com.android.settings.deviceinfo;
+import static com.android.settings.deviceinfo.StorageSettings.TAG;
+
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.storage.VolumeInfo;
+import android.util.Log;
import com.android.settings.R;
mVolume = findFirstVolume(VolumeInfo.TYPE_PRIVATE);
}
- if (mVolume == null) {
+ final VolumeInfo sourceVol = getPackageManager().getPrimaryStorageCurrentVolume();
+ if (sourceVol == null || mVolume == null) {
+ Log.d(TAG, "Missing either source or target volume");
finish();
return;
}
- final VolumeInfo sourceVol = getPackageManager().getPrimaryStorageCurrentVolume();
final String sourceDescrip = mStorage.getBestVolumeDescription(sourceVol);
final String targetDescrip = mStorage.getBestVolumeDescription(mVolume);