Returning to wizard, enable migration.

Bring primary storage migration back into the adoption flow, and
provide a path for long-lived notifications to re-launch into the
Settings app.  Also provide option to initiate migration if skipped
during wizard.  For now, estmiate migration size and time based on
a Class 10 card.

Follow other callback refactoring.

Bug: 19993667
Change-Id: Ia0c28eb114bc6c8066c17b3142ed74f962140c91
This commit is contained in:
Jeff Sharkey
2015-04-29 11:24:57 -07:00
parent a03f330af3
commit e77f0687dd
17 changed files with 295 additions and 80 deletions

View File

@@ -34,6 +34,7 @@ import android.os.Bundle;
import android.os.Environment;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.storage.DiskInfo;
import android.os.storage.StorageEventListener;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
@@ -271,6 +272,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
final MenuItem mount = menu.findItem(R.id.storage_mount);
final MenuItem unmount = menu.findItem(R.id.storage_unmount);
final MenuItem format = menu.findItem(R.id.storage_format);
final MenuItem migrate = menu.findItem(R.id.storage_migrate);
final MenuItem usb = menu.findItem(R.id.storage_usb);
// Actions live in menu for non-internal private volumes; they're shown
@@ -287,6 +289,11 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
format.setVisible(true);
}
// Only offer to migrate when not current storage
final VolumeInfo privateVol = getActivity().getPackageManager()
.getPrimaryStorageCurrentVolume();
migrate.setVisible(!Objects.equals(mVolume, privateVol));
// TODO: show usb if we jumped past first screen
usb.setVisible(false);
}
@@ -312,6 +319,11 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
startFragment(this, PrivateVolumeFormat.class.getCanonicalName(),
R.string.storage_menu_format, 0, args);
return true;
case R.id.storage_migrate:
final Intent intent = new Intent(context, StorageWizardMigrateConfirm.class);
intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, mVolume.getId());
startActivity(intent);
return true;
case R.id.storage_usb:
startFragment(this, UsbSettings.class.getCanonicalName(),
R.string.storage_title_usb, 0, null);
@@ -442,8 +454,8 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
}
@Override
public void onVolumeMetadataChanged(String fsUuid) {
if (Objects.equals(mVolume.getFsUuid(), fsUuid)) {
public void onVolumeRecordChanged(VolumeRecord rec) {
if (Objects.equals(mVolume.getFsUuid(), rec.getFsUuid())) {
mVolume = mStorageManager.findVolumeById(mVolumeId);
update();
}