summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2015-04-14 21:42:46 -0700
committerJeff Sharkey <jsharkey@android.com>2015-04-14 21:53:28 -0700
commit4366b565e150f3744dad66685806c55459d56c46 (patch)
treeffa428632a08b2d2ef9597dd1a987fccfd14574d /src/com/android/settings
parent2949a4ab4d342a315420ccda07c02075edccd4f0 (diff)
downloadpackages_apps_Settings-4366b565e150f3744dad66685806c55459d56c46.tar.gz
packages_apps_Settings-4366b565e150f3744dad66685806c55459d56c46.tar.bz2
packages_apps_Settings-4366b565e150f3744dad66685806c55459d56c46.zip
Storage accessors; persist nickname, flags.
Move to using new public accessors on DiskInfo and VolumeInfo. Persist nickname changes, and remember when user has initialized a public volume. Also skip the migration part of storage wizard until it's implemented. Bug: 19993667 Change-Id: I642fb43afb95380fddd48a1dad438e87b06454da
Diffstat (limited to 'src/com/android/settings')
-rw-r--r--src/com/android/settings/deviceinfo/PrivateVolumeFormatConfirm.java4
-rw-r--r--src/com/android/settings/deviceinfo/PrivateVolumeSettings.java29
-rw-r--r--src/com/android/settings/deviceinfo/PrivateVolumeUnmountConfirm.java2
-rw-r--r--src/com/android/settings/deviceinfo/PublicVolumeSettings.java20
-rw-r--r--src/com/android/settings/deviceinfo/StorageMeasurement.java8
-rw-r--r--src/com/android/settings/deviceinfo/StorageSettings.java28
-rw-r--r--src/com/android/settings/deviceinfo/StorageVolumePreference.java11
-rw-r--r--src/com/android/settings/deviceinfo/StorageWizardBase.java2
-rw-r--r--src/com/android/settings/deviceinfo/StorageWizardFormatConfirm.java2
-rw-r--r--src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java12
-rw-r--r--src/com/android/settings/deviceinfo/StorageWizardInit.java7
-rw-r--r--src/com/android/settings/deviceinfo/StorageWizardMigrate.java4
-rw-r--r--src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java2
-rw-r--r--src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java2
-rw-r--r--src/com/android/settings/deviceinfo/StorageWizardReady.java13
15 files changed, 83 insertions, 63 deletions
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeFormatConfirm.java b/src/com/android/settings/deviceinfo/PrivateVolumeFormatConfirm.java
index 1203cf314..666a91871 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeFormatConfirm.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeFormatConfirm.java
@@ -48,7 +48,7 @@ public class PrivateVolumeFormatConfirm extends InstrumentedFragment {
final StorageManager storage = getActivity().getSystemService(StorageManager.class);
final String volumeId = getArguments().getString(VolumeInfo.EXTRA_VOLUME_ID);
mVolume = storage.findVolumeById(volumeId);
- mDisk = storage.findDiskById(mVolume.diskId);
+ mDisk = storage.findDiskById(mVolume.getDiskId());
final View view = inflater.inflate(R.layout.storage_internal_format, container, false);
final TextView body = (TextView) view.findViewById(R.id.body);
@@ -65,7 +65,7 @@ public class PrivateVolumeFormatConfirm extends InstrumentedFragment {
@Override
public void onClick(View v) {
final Intent intent = new Intent(getActivity(), StorageWizardFormatProgress.class);
- intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
+ intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
intent.putExtra(StorageWizardFormatProgress.EXTRA_FORMAT_PUBLIC, true);
startActivity(intent);
getActivity().finish();
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
index 5674f4333..f2d9791b6 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
@@ -121,13 +121,13 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
mVolume = mStorageManager.findVolumeById(mVolumeId);
Preconditions.checkNotNull(mVolume);
- Preconditions.checkState(mVolume.type == VolumeInfo.TYPE_PRIVATE);
+ Preconditions.checkState(mVolume.getType() == VolumeInfo.TYPE_PRIVATE);
addPreferencesFromResource(R.xml.device_info_storage_volume);
// Find the emulated shared storage layered above this private volume
mSharedVolume = mStorageManager.findVolumeById(
- mVolume.id.replace("private", "emulated"));
+ mVolume.getId().replace("private", "emulated"));
mMeasure = new StorageMeasurement(context, mVolume, mSharedVolume);
mMeasure.setReceiver(mReceiver);
@@ -168,7 +168,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
screen.removeAll();
- if (mVolume.state != VolumeInfo.STATE_MOUNTED) {
+ if (mVolume.getState() != VolumeInfo.STATE_MOUNTED) {
return;
}
@@ -202,7 +202,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
}
}
- final File file = new File(mVolume.path);
+ final File file = mVolume.getPath();
mTotalSize = file.getTotalSpace();
mAvailSize = file.getFreeSpace();
@@ -272,15 +272,15 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
// Actions live in menu for non-internal private volumes; they're shown
// as preference items for public volumes.
- if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(mVolume.id)) {
+ if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(mVolume.getId())) {
rename.setVisible(false);
mount.setVisible(false);
unmount.setVisible(false);
format.setVisible(false);
} else {
- rename.setVisible(mVolume.type == VolumeInfo.TYPE_PRIVATE);
- mount.setVisible(mVolume.state == VolumeInfo.STATE_UNMOUNTED);
- unmount.setVisible(mVolume.state == VolumeInfo.STATE_MOUNTED);
+ rename.setVisible(mVolume.getType() == VolumeInfo.TYPE_PRIVATE);
+ mount.setVisible(mVolume.getState() == VolumeInfo.STATE_UNMOUNTED);
+ unmount.setVisible(mVolume.getState() == VolumeInfo.STATE_MOUNTED);
format.setVisible(true);
}
@@ -300,12 +300,12 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
new MountTask(context, mVolume).execute();
return true;
case R.id.storage_unmount:
- args.putString(VolumeInfo.EXTRA_VOLUME_ID, mVolume.id);
+ args.putString(VolumeInfo.EXTRA_VOLUME_ID, mVolume.getId());
startFragment(this, PrivateVolumeUnmountConfirm.class.getCanonicalName(),
R.string.storage_menu_unmount, 0, args);
return true;
case R.id.storage_format:
- args.putString(VolumeInfo.EXTRA_VOLUME_ID, mVolume.id);
+ args.putString(VolumeInfo.EXTRA_VOLUME_ID, mVolume.getId());
startFragment(this, PrivateVolumeFormatConfirm.class.getCanonicalName(),
R.string.storage_menu_format, 0, args);
return true;
@@ -428,7 +428,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
private final StorageEventListener mStorageListener = new StorageEventListener() {
@Override
public void onVolumeStateChanged(VolumeInfo vol, int oldState, int newState) {
- if (Objects.equals(mVolume.id, vol.id)) {
+ if (Objects.equals(mVolume.getId(), vol.getId())) {
mVolume = vol;
refresh();
}
@@ -462,8 +462,8 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
final View view = dialogInflater.inflate(R.layout.dialog_edittext, null, false);
final EditText nickname = (EditText) view.findViewById(R.id.edittext);
- if (!TextUtils.isEmpty(vol.nickname)) {
- nickname.setText(vol.nickname);
+ if (!TextUtils.isEmpty(vol.getNickname())) {
+ nickname.setText(vol.getNickname());
} else {
nickname.setText(storageManager.getBestVolumeDescription(vol));
}
@@ -475,7 +475,8 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- // TODO: persist the edited nickname!
+ // TODO: move to background thread
+ storageManager.setVolumeNickname(volId, nickname.getText().toString());
}
});
builder.setNegativeButton(R.string.cancel, null);
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeUnmountConfirm.java b/src/com/android/settings/deviceinfo/PrivateVolumeUnmountConfirm.java
index c592e9d7f..dd7f91cc1 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeUnmountConfirm.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeUnmountConfirm.java
@@ -48,7 +48,7 @@ public class PrivateVolumeUnmountConfirm extends InstrumentedFragment {
final StorageManager storage = getActivity().getSystemService(StorageManager.class);
final String volumeId = getArguments().getString(VolumeInfo.EXTRA_VOLUME_ID);
mVolume = storage.findVolumeById(volumeId);
- mDisk = storage.findDiskById(mVolume.id);
+ mDisk = storage.findDiskById(mVolume.getId());
final View view = inflater.inflate(R.layout.storage_internal_unmount, container, false);
final TextView body = (TextView) view.findViewById(R.id.body);
diff --git a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
index 75e040f80..71fe23dde 100644
--- a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
@@ -91,12 +91,12 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
}
Preconditions.checkNotNull(mVolume);
- Preconditions.checkState(mVolume.type == VolumeInfo.TYPE_PUBLIC);
+ Preconditions.checkState(mVolume.getType() == VolumeInfo.TYPE_PUBLIC);
- mDisk = mStorageManager.findDiskById(mVolume.diskId);
+ mDisk = mStorageManager.findDiskById(mVolume.getDiskId());
Preconditions.checkNotNull(mDisk);
- mVolumeId = mVolume.id;
+ mVolumeId = mVolume.getId();
addPreferencesFromResource(R.xml.device_info_storage_volume);
@@ -118,24 +118,24 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
screen.removeAll();
- if (mVolume.state == VolumeInfo.STATE_MOUNTED) {
+ if (mVolume.getState() == VolumeInfo.STATE_MOUNTED) {
screen.addPreference(mGraph);
screen.addPreference(mTotal);
screen.addPreference(mAvailable);
}
- if (mVolume.state == VolumeInfo.STATE_UNMOUNTED) {
+ if (mVolume.getState() == VolumeInfo.STATE_UNMOUNTED) {
screen.addPreference(mMount);
}
- if (mVolume.state == VolumeInfo.STATE_MOUNTED) {
+ if (mVolume.getState() == VolumeInfo.STATE_MOUNTED) {
screen.addPreference(mUnmount);
}
screen.addPreference(mFormat);
- if ((mDisk.flags & DiskInfo.FLAG_ADOPTABLE) != 0) {
+ if (mDisk.isAdoptable()) {
screen.addPreference(mFormatInternal);
}
- final File file = new File(mVolume.path);
+ final File file = mVolume.getPath();
mTotalSize = file.getTotalSpace();
mAvailSize = file.getFreeSpace();
@@ -200,7 +200,7 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
new FormatTask(context, mVolume).execute();
} else if (pref == mFormatInternal) {
final Intent intent = new Intent(context, StorageWizardFormatConfirm.class);
- intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
+ intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
startActivity(intent);
}
@@ -210,7 +210,7 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
private final StorageEventListener mStorageListener = new StorageEventListener() {
@Override
public void onVolumeStateChanged(VolumeInfo vol, int oldState, int newState) {
- if (Objects.equals(mVolume.id, vol.id)) {
+ if (Objects.equals(mVolume.getId(), vol.getId())) {
mVolume = vol;
refresh();
}
diff --git a/src/com/android/settings/deviceinfo/StorageMeasurement.java b/src/com/android/settings/deviceinfo/StorageMeasurement.java
index db91fdb1d..a3c4aeca7 100644
--- a/src/com/android/settings/deviceinfo/StorageMeasurement.java
+++ b/src/com/android/settings/deviceinfo/StorageMeasurement.java
@@ -345,7 +345,7 @@ public class StorageMeasurement {
final Message finished = mMeasurementHandler.obtainMessage(MeasurementHandler.MSG_COMPLETED,
details);
- if (mSharedVolume != null && mSharedVolume.state == VolumeInfo.STATE_MOUNTED) {
+ if (mSharedVolume != null && mSharedVolume.getState() == VolumeInfo.STATE_MOUNTED) {
final File basePath = mSharedVolume.getPathForUser(currentUser);
// Measure media types for emulated storage, or for primary physical
@@ -359,7 +359,7 @@ public class StorageMeasurement {
// Measure misc files not counted under media
details.miscSize = measureMisc(imcs, basePath);
- if (mSharedVolume.type == VolumeInfo.TYPE_EMULATED) {
+ if (mSharedVolume.getType() == VolumeInfo.TYPE_EMULATED) {
// Measure total emulated storage of all users; internal apps data
// will be spliced in later
for (UserInfo user : users) {
@@ -371,14 +371,14 @@ public class StorageMeasurement {
}
// Measure all apps hosted on this volume for all users
- if (mVolume.type == VolumeInfo.TYPE_PRIVATE) {
+ if (mVolume.getType() == VolumeInfo.TYPE_PRIVATE) {
final List<ApplicationInfo> apps = packageManager.getInstalledApplications(
PackageManager.GET_UNINSTALLED_PACKAGES
| PackageManager.GET_DISABLED_COMPONENTS);
final List<ApplicationInfo> volumeApps = new ArrayList<>();
for (ApplicationInfo app : apps) {
- if (Objects.equals(app.volumeUuid, mVolume.fsUuid)) {
+ if (Objects.equals(app.volumeUuid, mVolume.getFsUuid())) {
volumeApps.add(app);
}
}
diff --git a/src/com/android/settings/deviceinfo/StorageSettings.java b/src/com/android/settings/deviceinfo/StorageSettings.java
index 255788d6e..1e33230df 100644
--- a/src/com/android/settings/deviceinfo/StorageSettings.java
+++ b/src/com/android/settings/deviceinfo/StorageSettings.java
@@ -94,10 +94,12 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
private static final Comparator<VolumeInfo> sVolumeComparator = new Comparator<VolumeInfo>() {
@Override
public int compare(VolumeInfo lhs, VolumeInfo rhs) {
- if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(lhs.id)) {
+ if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(lhs.getId())) {
return -1;
} else if (lhs.getDescription() == null) {
return 1;
+ } else if (rhs.getDescription() == null) {
+ return -1;
} else {
return lhs.getDescription().compareTo(rhs.getDescription());
}
@@ -114,7 +116,13 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
};
private static boolean isInteresting(VolumeInfo vol) {
- return vol.type == VolumeInfo.TYPE_PRIVATE || vol.type == VolumeInfo.TYPE_PUBLIC;
+ switch(vol.getType()) {
+ case VolumeInfo.TYPE_PRIVATE:
+ case VolumeInfo.TYPE_PUBLIC:
+ return true;
+ default:
+ return false;
+ }
}
private void refresh() {
@@ -128,9 +136,9 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
Collections.sort(volumes, sVolumeComparator);
for (VolumeInfo vol : volumes) {
- if (vol.type == VolumeInfo.TYPE_PRIVATE) {
+ if (vol.getType() == VolumeInfo.TYPE_PRIVATE) {
mInternalCategory.addPreference(new StorageVolumePreference(context, vol));
- } else if (vol.type == VolumeInfo.TYPE_PUBLIC) {
+ } else if (vol.getType() == VolumeInfo.TYPE_PUBLIC) {
mExternalCategory.addPreference(new StorageVolumePreference(context, vol));
}
}
@@ -186,15 +194,15 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
if (vol == null) {
return false;
- } else if (vol.type == VolumeInfo.TYPE_PRIVATE) {
+ } else if (vol.getType() == VolumeInfo.TYPE_PRIVATE) {
final Bundle args = new Bundle();
args.putString(VolumeInfo.EXTRA_VOLUME_ID, volId);
startFragment(this, PrivateVolumeSettings.class.getCanonicalName(),
-1, 0, args);
return true;
- } else if (vol.type == VolumeInfo.TYPE_PUBLIC) {
- if (vol.state == VolumeInfo.STATE_MOUNTED) {
+ } else if (vol.getType() == VolumeInfo.TYPE_PUBLIC) {
+ if (vol.getState() == VolumeInfo.STATE_MOUNTED) {
startActivity(vol.buildBrowseIntent());
return true;
} else {
@@ -218,7 +226,7 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
public MountTask(Context context, VolumeInfo volume) {
mContext = context.getApplicationContext();
mStorageManager = mContext.getSystemService(StorageManager.class);
- mVolumeId = volume.id;
+ mVolumeId = volume.getId();
mDescription = mStorageManager.getBestVolumeDescription(volume);
}
@@ -254,7 +262,7 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
public UnmountTask(Context context, VolumeInfo volume) {
mContext = context.getApplicationContext();
mStorageManager = mContext.getSystemService(StorageManager.class);
- mVolumeId = volume.id;
+ mVolumeId = volume.getId();
mDescription = mStorageManager.getBestVolumeDescription(volume);
}
@@ -290,7 +298,7 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
public FormatTask(Context context, VolumeInfo volume) {
mContext = context.getApplicationContext();
mStorageManager = mContext.getSystemService(StorageManager.class);
- mVolumeId = volume.id;
+ mVolumeId = volume.getId();
mDescription = mStorageManager.getBestVolumeDescription(volume);
}
diff --git a/src/com/android/settings/deviceinfo/StorageVolumePreference.java b/src/com/android/settings/deviceinfo/StorageVolumePreference.java
index a2136bd2d..f127dfb89 100644
--- a/src/com/android/settings/deviceinfo/StorageVolumePreference.java
+++ b/src/com/android/settings/deviceinfo/StorageVolumePreference.java
@@ -44,13 +44,13 @@ public class StorageVolumePreference extends Preference {
mStorageManager = context.getSystemService(StorageManager.class);
mVolume = volume;
- setKey(volume.id);
+ setKey(volume.getId());
setTitle(mStorageManager.getBestVolumeDescription(volume));
- switch (volume.state) {
+ switch (volume.getState()) {
case VolumeInfo.STATE_MOUNTED:
// TODO: move statfs() to background thread
- final File path = new File(volume.path);
+ final File path = volume.getPath();
final String free = Formatter.formatFileSize(context, path.getFreeSpace());
final String total = Formatter.formatFileSize(context, path.getTotalSpace());
setSummary(context.getString(R.string.storage_volume_summary, free, total));
@@ -58,13 +58,14 @@ public class StorageVolumePreference extends Preference {
}
// TODO: better icons
- if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(volume.id)) {
+ if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(volume.getId())) {
setIcon(context.getDrawable(R.drawable.ic_settings_storage));
} else {
setIcon(context.getDrawable(R.drawable.ic_sim_sd));
}
- if (volume.type == VolumeInfo.TYPE_PUBLIC && volume.state == VolumeInfo.STATE_MOUNTED) {
+ if (volume.getType() == VolumeInfo.TYPE_PUBLIC
+ && volume.getState() == VolumeInfo.STATE_MOUNTED) {
setWidgetLayoutResource(R.layout.preference_storage_action);
}
}
diff --git a/src/com/android/settings/deviceinfo/StorageWizardBase.java b/src/com/android/settings/deviceinfo/StorageWizardBase.java
index ceacff9b1..4cb48c55f 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardBase.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardBase.java
@@ -57,7 +57,7 @@ public abstract class StorageWizardBase extends Activity implements NavigationBa
if (!TextUtils.isEmpty(diskId)) {
mDisk = mStorage.findDiskById(diskId);
} else {
- mDisk = mStorage.findDiskById(mVolume.diskId);
+ mDisk = mStorage.findDiskById(mVolume.getDiskId());
}
setTheme(R.style.SuwThemeMaterial_Light);
diff --git a/src/com/android/settings/deviceinfo/StorageWizardFormatConfirm.java b/src/com/android/settings/deviceinfo/StorageWizardFormatConfirm.java
index b4c84265d..f4f475f5e 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardFormatConfirm.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardFormatConfirm.java
@@ -42,7 +42,7 @@ public class StorageWizardFormatConfirm extends StorageWizardBase {
@Override
public void onNavigateNext() {
final Intent intent = new Intent(this, StorageWizardFormatProgress.class);
- intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
+ intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
startActivity(intent);
finishAffinity();
}
diff --git a/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java b/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
index 7dd347f01..2996d4548 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
@@ -59,9 +59,9 @@ public class StorageWizardFormatProgress extends StorageWizardBase {
protected Exception doInBackground(Void... params) {
try {
if (mFormatPublic) {
- mStorage.partitionPublic(mDisk.id);
+ mStorage.partitionPublic(mDisk.getId());
} else {
- mStorage.partitionPrivate(mDisk.id);
+ mStorage.partitionPrivate(mDisk.getId());
}
return null;
} catch (Exception e) {
@@ -74,8 +74,12 @@ public class StorageWizardFormatProgress extends StorageWizardBase {
final Context context = StorageWizardFormatProgress.this;
if (e == null) {
if (!mFormatPublic) {
- final Intent intent = new Intent(context, StorageWizardMigrate.class);
- intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
+ // TODO: bring back migration once implemented
+// final Intent intent = new Intent(context, StorageWizardMigrate.class);
+// intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
+// startActivity(intent);
+ final Intent intent = new Intent(context, StorageWizardReady.class);
+ intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
startActivity(intent);
}
finishAffinity();
diff --git a/src/com/android/settings/deviceinfo/StorageWizardInit.java b/src/com/android/settings/deviceinfo/StorageWizardInit.java
index b4d1a51e0..9d59231e7 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardInit.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardInit.java
@@ -72,12 +72,15 @@ public class StorageWizardInit extends StorageWizardBase {
@Override
public void onNavigateNext() {
if (mRadioExternal.isChecked()) {
+ // Remember that user made decision
+ mStorage.setVolumeInited(mVolume.getId(), true);
+
final Intent intent = new Intent(this, StorageWizardReady.class);
- intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
+ intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
startActivity(intent);
} else if (mRadioInternal.isChecked()) {
final Intent intent = new Intent(this, StorageWizardFormatConfirm.class);
- intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
+ intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
startActivity(intent);
}
}
diff --git a/src/com/android/settings/deviceinfo/StorageWizardMigrate.java b/src/com/android/settings/deviceinfo/StorageWizardMigrate.java
index 82e32ba48..4d42613ca 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardMigrate.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardMigrate.java
@@ -71,11 +71,11 @@ public class StorageWizardMigrate extends StorageWizardBase {
public void onNavigateNext() {
if (mRadioNow.isChecked()) {
final Intent intent = new Intent(this, StorageWizardMigrateConfirm.class);
- intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
+ intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
startActivity(intent);
} else if (mRadioLater.isChecked()) {
final Intent intent = new Intent(this, StorageWizardReady.class);
- intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
+ intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
startActivity(intent);
}
}
diff --git a/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java b/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java
index 697203153..9aa1441f4 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java
@@ -46,7 +46,7 @@ public class StorageWizardMigrateConfirm extends StorageWizardBase {
@Override
public void onNavigateNext() {
final Intent intent = new Intent(this, StorageWizardMigrateProgress.class);
- intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
+ intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
startActivity(intent);
finishAffinity();
}
diff --git a/src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java b/src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java
index 9bf31f979..b53b25088 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java
@@ -62,7 +62,7 @@ public class StorageWizardMigrateProgress extends StorageWizardBase {
final Context context = StorageWizardMigrateProgress.this;
if (e == null) {
final Intent intent = new Intent(context, StorageWizardReady.class);
- intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
+ intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
startActivity(intent);
finishAffinity();
diff --git a/src/com/android/settings/deviceinfo/StorageWizardReady.java b/src/com/android/settings/deviceinfo/StorageWizardReady.java
index 76324a989..26038cee1 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardReady.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardReady.java
@@ -22,6 +22,9 @@ import android.os.storage.VolumeInfo;
import com.android.internal.util.Preconditions;
import com.android.settings.R;
+import java.util.List;
+import java.util.Objects;
+
public class StorageWizardReady extends StorageWizardBase {
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -34,15 +37,15 @@ public class StorageWizardReady extends StorageWizardBase {
// TODO: handle mixed partition cases instead of just guessing based on
// first volume type we encounter
- for (String volId : mDisk.volumeIds) {
- final VolumeInfo vol = mStorage.findVolumeById(volId);
- if (vol == null) continue;
+ final List<VolumeInfo> vols = mStorage.getVolumes();
+ for (VolumeInfo vol : vols) {
+ if (!Objects.equals(mDisk.getId(), vol.getDiskId())) continue;
- if (vol.type == VolumeInfo.TYPE_PUBLIC) {
+ if (vol.getType() == VolumeInfo.TYPE_PUBLIC) {
setBodyText(R.string.storage_wizard_ready_external_body,
mDisk.getDescription());
break;
- } else if (vol.type == VolumeInfo.TYPE_PRIVATE) {
+ } else if (vol.getType() == VolumeInfo.TYPE_PRIVATE) {
setBodyText(R.string.storage_wizard_ready_internal_body,
mDisk.getDescription());
break;