Follow storage refactoring in system.

Also add entry point for SystemUI unmounting, and require permissions
when launching into those flows.

Bug: 19993667
Change-Id: I703d2e5f118848a2e2e96ce1d7f970e5705a288a
This commit is contained in:
Jeff Sharkey
2015-04-14 16:44:34 -07:00
parent e29dae683e
commit 2949a4ab4d
16 changed files with 104 additions and 89 deletions

View File

@@ -1494,7 +1494,8 @@
<activity android:name=".deviceinfo.StorageWizardInit" <activity android:name=".deviceinfo.StorageWizardInit"
android:theme="@style/SuwThemeMaterial.Light" android:theme="@style/SuwThemeMaterial.Light"
android:taskAffinity="com.android.settings.storage_wizard" android:taskAffinity="com.android.settings.storage_wizard"
android:exported="true" /> android:exported="true"
android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<activity android:name=".deviceinfo.StorageWizardFormatConfirm" <activity android:name=".deviceinfo.StorageWizardFormatConfirm"
android:taskAffinity="com.android.settings.storage_wizard" android:taskAffinity="com.android.settings.storage_wizard"
android:exported="false" /> android:exported="false" />
@@ -1521,6 +1522,11 @@
android:taskAffinity="com.android.settings.storage_wizard" android:taskAffinity="com.android.settings.storage_wizard"
android:exported="false" /> android:exported="false" />
<!-- Exported for SystemUI to trigger -->
<receiver android:name=".deviceinfo.StorageUnmountReceiver"
android:exported="true"
android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<activity android:name="ApnEditor" <activity android:name="ApnEditor"
android:label="@string/apn_edit"> android:label="@string/apn_edit">
<intent-filter> <intent-filter>

View File

@@ -46,9 +46,9 @@ public class PrivateVolumeFormatConfirm extends InstrumentedFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
final StorageManager storage = getActivity().getSystemService(StorageManager.class); final StorageManager storage = getActivity().getSystemService(StorageManager.class);
final String volumeId = getArguments().getString(StorageSettings.EXTRA_VOLUME_ID); final String volumeId = getArguments().getString(VolumeInfo.EXTRA_VOLUME_ID);
mVolume = storage.findVolumeById(volumeId); mVolume = storage.findVolumeById(volumeId);
mDisk = storage.findDiskByVolumeId(volumeId); mDisk = storage.findDiskById(mVolume.diskId);
final View view = inflater.inflate(R.layout.storage_internal_format, container, false); final View view = inflater.inflate(R.layout.storage_internal_format, container, false);
final TextView body = (TextView) view.findViewById(R.id.body); final TextView body = (TextView) view.findViewById(R.id.body);
@@ -65,7 +65,7 @@ public class PrivateVolumeFormatConfirm extends InstrumentedFragment {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
final Intent intent = new Intent(getActivity(), StorageWizardFormatProgress.class); final Intent intent = new Intent(getActivity(), StorageWizardFormatProgress.class);
intent.putExtra(StorageWizardBase.EXTRA_DISK_ID, mDisk.id); intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
intent.putExtra(StorageWizardFormatProgress.EXTRA_FORMAT_PUBLIC, true); intent.putExtra(StorageWizardFormatProgress.EXTRA_FORMAT_PUBLIC, true);
startActivity(intent); startActivity(intent);
getActivity().finish(); getActivity().finish();

View File

@@ -16,7 +16,6 @@
package com.android.settings.deviceinfo; package com.android.settings.deviceinfo;
import static com.android.settings.deviceinfo.StorageSettings.EXTRA_VOLUME_ID;
import static com.android.settings.deviceinfo.StorageSettings.TAG; import static com.android.settings.deviceinfo.StorageSettings.TAG;
import android.app.AlertDialog; import android.app.AlertDialog;
@@ -118,7 +117,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
mUserManager = context.getSystemService(UserManager.class); mUserManager = context.getSystemService(UserManager.class);
mStorageManager = context.getSystemService(StorageManager.class); mStorageManager = context.getSystemService(StorageManager.class);
mVolumeId = getArguments().getString(EXTRA_VOLUME_ID); mVolumeId = getArguments().getString(VolumeInfo.EXTRA_VOLUME_ID);
mVolume = mStorageManager.findVolumeById(mVolumeId); mVolume = mStorageManager.findVolumeById(mVolumeId);
Preconditions.checkNotNull(mVolume); Preconditions.checkNotNull(mVolume);
@@ -159,7 +158,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
} }
public void refresh() { public void refresh() {
getActivity().setTitle(mStorageManager.getBestVolumeDescription(mVolume.id)); getActivity().setTitle(mStorageManager.getBestVolumeDescription(mVolume));
// Valid options may have changed // Valid options may have changed
getFragmentManager().invalidateOptionsMenu(); getFragmentManager().invalidateOptionsMenu();
@@ -298,15 +297,15 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
RenameFragment.show(this); RenameFragment.show(this);
return true; return true;
case R.id.storage_mount: case R.id.storage_mount:
new MountTask(context, mVolume.id).execute(); new MountTask(context, mVolume).execute();
return true; return true;
case R.id.storage_unmount: case R.id.storage_unmount:
args.putString(StorageSettings.EXTRA_VOLUME_ID, mVolume.id); args.putString(VolumeInfo.EXTRA_VOLUME_ID, mVolume.id);
startFragment(this, PrivateVolumeUnmountConfirm.class.getCanonicalName(), startFragment(this, PrivateVolumeUnmountConfirm.class.getCanonicalName(),
R.string.storage_menu_unmount, 0, args); R.string.storage_menu_unmount, 0, args);
return true; return true;
case R.id.storage_format: case R.id.storage_format:
args.putString(StorageSettings.EXTRA_VOLUME_ID, mVolume.id); args.putString(VolumeInfo.EXTRA_VOLUME_ID, mVolume.id);
startFragment(this, PrivateVolumeFormatConfirm.class.getCanonicalName(), startFragment(this, PrivateVolumeFormatConfirm.class.getCanonicalName(),
R.string.storage_menu_format, 0, args); R.string.storage_menu_format, 0, args);
return true; return true;
@@ -345,7 +344,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
return true; return true;
} else if (pref == mMisc) { } else if (pref == mMisc) {
intent = StorageSettings.buildBrowseIntent(mSharedVolume); intent = mSharedVolume.buildBrowseIntent();
} }
if (intent != null) { if (intent != null) {
@@ -454,7 +453,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
final Context context = getActivity(); final Context context = getActivity();
final StorageManager storageManager = context.getSystemService(StorageManager.class); final StorageManager storageManager = context.getSystemService(StorageManager.class);
final String volId = getArguments().getString(EXTRA_VOLUME_ID); final String volId = getArguments().getString(VolumeInfo.EXTRA_VOLUME_ID);
final VolumeInfo vol = storageManager.findVolumeById(volId); final VolumeInfo vol = storageManager.findVolumeById(volId);
final AlertDialog.Builder builder = new AlertDialog.Builder(context); final AlertDialog.Builder builder = new AlertDialog.Builder(context);
@@ -466,7 +465,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
if (!TextUtils.isEmpty(vol.nickname)) { if (!TextUtils.isEmpty(vol.nickname)) {
nickname.setText(vol.nickname); nickname.setText(vol.nickname);
} else { } else {
nickname.setText(storageManager.getBestVolumeDescription(volId)); nickname.setText(storageManager.getBestVolumeDescription(vol));
} }
builder.setTitle(R.string.storage_rename_title); builder.setTitle(R.string.storage_rename_title);

View File

@@ -46,9 +46,9 @@ public class PrivateVolumeUnmountConfirm extends InstrumentedFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
final StorageManager storage = getActivity().getSystemService(StorageManager.class); final StorageManager storage = getActivity().getSystemService(StorageManager.class);
final String volumeId = getArguments().getString(StorageSettings.EXTRA_VOLUME_ID); final String volumeId = getArguments().getString(VolumeInfo.EXTRA_VOLUME_ID);
mVolume = storage.findVolumeById(volumeId); mVolume = storage.findVolumeById(volumeId);
mDisk = storage.findDiskByVolumeId(volumeId); mDisk = storage.findDiskById(mVolume.id);
final View view = inflater.inflate(R.layout.storage_internal_unmount, container, false); final View view = inflater.inflate(R.layout.storage_internal_unmount, container, false);
final TextView body = (TextView) view.findViewById(R.id.body); final TextView body = (TextView) view.findViewById(R.id.body);
@@ -64,7 +64,7 @@ public class PrivateVolumeUnmountConfirm extends InstrumentedFragment {
private final OnClickListener mConfirmListener = new OnClickListener() { private final OnClickListener mConfirmListener = new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
new UnmountTask(getActivity(), mVolume.id).execute(); new UnmountTask(getActivity(), mVolume).execute();
getActivity().finish(); getActivity().finish();
} }
}; };

View File

@@ -16,8 +16,6 @@
package com.android.settings.deviceinfo; package com.android.settings.deviceinfo;
import static com.android.settings.deviceinfo.StorageSettings.EXTRA_VOLUME_ID;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
@@ -49,8 +47,6 @@ import java.util.Objects;
public class PublicVolumeSettings extends SettingsPreferenceFragment { public class PublicVolumeSettings extends SettingsPreferenceFragment {
// TODO: disable unmount when providing over MTP/PTP // TODO: disable unmount when providing over MTP/PTP
private static final String PREF_FORMAT_INTERNAL = "debug.format_internal";
private StorageManager mStorageManager; private StorageManager mStorageManager;
private String mVolumeId; private String mVolumeId;
@@ -90,14 +86,14 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
final String fsUuid = DocumentsContract.getRootId(rootUri); final String fsUuid = DocumentsContract.getRootId(rootUri);
mVolume = mStorageManager.findVolumeByUuid(fsUuid); mVolume = mStorageManager.findVolumeByUuid(fsUuid);
} else { } else {
final String volId = getArguments().getString(EXTRA_VOLUME_ID); final String volId = getArguments().getString(VolumeInfo.EXTRA_VOLUME_ID);
mVolume = mStorageManager.findVolumeById(volId); mVolume = mStorageManager.findVolumeById(volId);
} }
Preconditions.checkNotNull(mVolume); Preconditions.checkNotNull(mVolume);
Preconditions.checkState(mVolume.type == VolumeInfo.TYPE_PUBLIC); Preconditions.checkState(mVolume.type == VolumeInfo.TYPE_PUBLIC);
mDisk = mStorageManager.findDiskByVolumeId(mVolume.id); mDisk = mStorageManager.findDiskById(mVolume.diskId);
Preconditions.checkNotNull(mDisk); Preconditions.checkNotNull(mDisk);
mVolumeId = mVolume.id; mVolumeId = mVolume.id;
@@ -115,7 +111,7 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
} }
public void refresh() { public void refresh() {
getActivity().setTitle(mStorageManager.getBestVolumeDescription(mVolume.id)); getActivity().setTitle(mStorageManager.getBestVolumeDescription(mVolume));
final Context context = getActivity(); final Context context = getActivity();
final PreferenceScreen screen = getPreferenceScreen(); final PreferenceScreen screen = getPreferenceScreen();
@@ -197,14 +193,14 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference pref) { public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference pref) {
final Context context = getActivity(); final Context context = getActivity();
if (pref == mMount) { if (pref == mMount) {
new MountTask(context, mVolume.id).execute(); new MountTask(context, mVolume).execute();
} else if (pref == mUnmount) { } else if (pref == mUnmount) {
new UnmountTask(context, mVolume.id).execute(); new UnmountTask(context, mVolume).execute();
} else if (pref == mFormat) { } else if (pref == mFormat) {
new FormatTask(context, mVolume.id).execute(); new FormatTask(context, mVolume).execute();
} else if (pref == mFormatInternal) { } else if (pref == mFormatInternal) {
final Intent intent = new Intent(context, StorageWizardFormatConfirm.class); final Intent intent = new Intent(context, StorageWizardFormatConfirm.class);
intent.putExtra(StorageWizardBase.EXTRA_DISK_ID, mDisk.id); intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
startActivity(intent); startActivity(intent);
} }

View File

@@ -17,8 +17,6 @@
package com.android.settings.deviceinfo; package com.android.settings.deviceinfo;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.UserManager; import android.os.UserManager;
@@ -28,7 +26,6 @@ import android.os.storage.VolumeInfo;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceCategory; import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen; import android.preference.PreferenceScreen;
import android.provider.DocumentsContract;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
@@ -57,34 +54,6 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
// TODO: badging to indicate devices running low on storage // TODO: badging to indicate devices running low on storage
// TODO: show currently ejected private volumes // TODO: show currently ejected private volumes
public static final String EXTRA_VOLUME_ID = "volume_id";
private static final String DOCUMENT_AUTHORITY = "com.android.externalstorage.documents";
private static final String DOCUMENT_ROOT_PRIMARY_EMULATED = "primary";
/**
* Build an intent to browse the contents of given {@link VolumeInfo}.
*/
public static Intent buildBrowseIntent(VolumeInfo vol) {
final Uri uri;
if (vol.type == VolumeInfo.TYPE_PUBLIC) {
uri = DocumentsContract.buildRootUri(DOCUMENT_AUTHORITY, vol.fsUuid);
} else if (VolumeInfo.ID_EMULATED_INTERNAL.equals(vol.id)) {
uri = DocumentsContract.buildRootUri(DOCUMENT_AUTHORITY,
DOCUMENT_ROOT_PRIMARY_EMULATED);
} else if (vol.type == VolumeInfo.TYPE_EMULATED) {
// TODO: build intent once supported
uri = null;
} else {
throw new IllegalArgumentException();
}
final Intent intent = new Intent(DocumentsContract.ACTION_BROWSE_DOCUMENT_ROOT);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setData(uri);
return intent;
}
private UserManager mUserManager; private UserManager mUserManager;
private StorageManager mStorageManager; private StorageManager mStorageManager;
@@ -219,19 +188,18 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
} else if (vol.type == VolumeInfo.TYPE_PRIVATE) { } else if (vol.type == VolumeInfo.TYPE_PRIVATE) {
final Bundle args = new Bundle(); final Bundle args = new Bundle();
args.putString(EXTRA_VOLUME_ID, volId); args.putString(VolumeInfo.EXTRA_VOLUME_ID, volId);
startFragment(this, PrivateVolumeSettings.class.getCanonicalName(), startFragment(this, PrivateVolumeSettings.class.getCanonicalName(),
-1, 0, args); -1, 0, args);
return true; return true;
} else if (vol.type == VolumeInfo.TYPE_PUBLIC) { } else if (vol.type == VolumeInfo.TYPE_PUBLIC) {
if (vol.state == VolumeInfo.STATE_MOUNTED) { if (vol.state == VolumeInfo.STATE_MOUNTED) {
final Intent intent = buildBrowseIntent(vol); startActivity(vol.buildBrowseIntent());
startActivity(intent);
return true; return true;
} else { } else {
final Bundle args = new Bundle(); final Bundle args = new Bundle();
args.putString(EXTRA_VOLUME_ID, volId); args.putString(VolumeInfo.EXTRA_VOLUME_ID, volId);
startFragment(this, PublicVolumeSettings.class.getCanonicalName(), startFragment(this, PublicVolumeSettings.class.getCanonicalName(),
-1, 0, args); -1, 0, args);
return true; return true;
@@ -247,11 +215,11 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
private final String mVolumeId; private final String mVolumeId;
private final String mDescription; private final String mDescription;
public MountTask(Context context, String volumeId) { public MountTask(Context context, VolumeInfo volume) {
mContext = context.getApplicationContext(); mContext = context.getApplicationContext();
mStorageManager = mContext.getSystemService(StorageManager.class); mStorageManager = mContext.getSystemService(StorageManager.class);
mVolumeId = volumeId; mVolumeId = volume.id;
mDescription = mStorageManager.getBestVolumeDescription(mVolumeId); mDescription = mStorageManager.getBestVolumeDescription(volume);
} }
@Override @Override
@@ -283,11 +251,11 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
private final String mVolumeId; private final String mVolumeId;
private final String mDescription; private final String mDescription;
public UnmountTask(Context context, String volumeId) { public UnmountTask(Context context, VolumeInfo volume) {
mContext = context.getApplicationContext(); mContext = context.getApplicationContext();
mStorageManager = mContext.getSystemService(StorageManager.class); mStorageManager = mContext.getSystemService(StorageManager.class);
mVolumeId = volumeId; mVolumeId = volume.id;
mDescription = mStorageManager.getBestVolumeDescription(mVolumeId); mDescription = mStorageManager.getBestVolumeDescription(volume);
} }
@Override @Override
@@ -319,11 +287,11 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
private final String mVolumeId; private final String mVolumeId;
private final String mDescription; private final String mDescription;
public FormatTask(Context context, String volumeId) { public FormatTask(Context context, VolumeInfo volume) {
mContext = context.getApplicationContext(); mContext = context.getApplicationContext();
mStorageManager = mContext.getSystemService(StorageManager.class); mStorageManager = mContext.getSystemService(StorageManager.class);
mVolumeId = volumeId; mVolumeId = volume.id;
mDescription = mStorageManager.getBestVolumeDescription(mVolumeId); mDescription = mStorageManager.getBestVolumeDescription(volume);
} }
@Override @Override
@@ -374,7 +342,7 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
final List<VolumeInfo> vols = storage.getVolumes(); final List<VolumeInfo> vols = storage.getVolumes();
for (VolumeInfo vol : vols) { for (VolumeInfo vol : vols) {
if (isInteresting(vol)) { if (isInteresting(vol)) {
data.title = storage.getBestVolumeDescription(vol.id); data.title = storage.getBestVolumeDescription(vol);
data.screenTitle = context.getString(R.string.storage_settings); data.screenTitle = context.getString(R.string.storage_settings);
result.add(data); result.add(data);
} }

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.deviceinfo;
import static com.android.settings.deviceinfo.StorageSettings.TAG;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
import android.util.Log;
import com.android.settings.deviceinfo.StorageSettings.UnmountTask;
public class StorageUnmountReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
final StorageManager storage = context.getSystemService(StorageManager.class);
final String volId = intent.getStringExtra(VolumeInfo.EXTRA_VOLUME_ID);
final VolumeInfo vol = storage.findVolumeById(volId);
if (vol != null) {
new UnmountTask(context, vol).execute();
} else {
Log.w(TAG, "Missing volume " + volId);
}
}
}

View File

@@ -45,7 +45,7 @@ public class StorageVolumePreference extends Preference {
mVolume = volume; mVolume = volume;
setKey(volume.id); setKey(volume.id);
setTitle(mStorageManager.getBestVolumeDescription(volume.id)); setTitle(mStorageManager.getBestVolumeDescription(volume));
switch (volume.state) { switch (volume.state) {
case VolumeInfo.STATE_MOUNTED: case VolumeInfo.STATE_MOUNTED:
@@ -83,7 +83,7 @@ public class StorageVolumePreference extends Preference {
private final View.OnClickListener mUnmountListener = new OnClickListener() { private final View.OnClickListener mUnmountListener = new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
new UnmountTask(getContext(), mVolume.id).execute(); new UnmountTask(getContext(), mVolume).execute();
} }
}; };
} }

View File

@@ -37,9 +37,6 @@ import com.android.setupwizardlib.view.NavigationBar.NavigationBarListener;
import java.text.NumberFormat; import java.text.NumberFormat;
public abstract class StorageWizardBase extends Activity implements NavigationBarListener { public abstract class StorageWizardBase extends Activity implements NavigationBarListener {
protected static final String EXTRA_DISK_ID = "disk_id";
protected static final String EXTRA_VOLUME_ID = "volume_id";
protected StorageManager mStorage; protected StorageManager mStorage;
protected VolumeInfo mVolume; protected VolumeInfo mVolume;
@@ -51,16 +48,16 @@ public abstract class StorageWizardBase extends Activity implements NavigationBa
mStorage = getSystemService(StorageManager.class); mStorage = getSystemService(StorageManager.class);
final String volumeId = getIntent().getStringExtra(EXTRA_VOLUME_ID); final String volumeId = getIntent().getStringExtra(VolumeInfo.EXTRA_VOLUME_ID);
if (!TextUtils.isEmpty(volumeId)) { if (!TextUtils.isEmpty(volumeId)) {
mVolume = mStorage.findVolumeById(volumeId); mVolume = mStorage.findVolumeById(volumeId);
} }
final String diskId = getIntent().getStringExtra(EXTRA_DISK_ID); final String diskId = getIntent().getStringExtra(DiskInfo.EXTRA_DISK_ID);
if (!TextUtils.isEmpty(diskId)) { if (!TextUtils.isEmpty(diskId)) {
mDisk = mStorage.findDiskById(diskId); mDisk = mStorage.findDiskById(diskId);
} else { } else {
mDisk = mStorage.findDiskByVolumeId(volumeId); mDisk = mStorage.findDiskById(mVolume.diskId);
} }
setTheme(R.style.SuwThemeMaterial_Light); setTheme(R.style.SuwThemeMaterial_Light);

View File

@@ -18,6 +18,7 @@ package com.android.settings.deviceinfo;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.storage.DiskInfo;
import com.android.internal.util.Preconditions; import com.android.internal.util.Preconditions;
import com.android.settings.R; import com.android.settings.R;
@@ -41,7 +42,7 @@ public class StorageWizardFormatConfirm extends StorageWizardBase {
@Override @Override
public void onNavigateNext() { public void onNavigateNext() {
final Intent intent = new Intent(this, StorageWizardFormatProgress.class); final Intent intent = new Intent(this, StorageWizardFormatProgress.class);
intent.putExtra(EXTRA_DISK_ID, mDisk.id); intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
startActivity(intent); startActivity(intent);
finishAffinity(); finishAffinity();
} }

View File

@@ -22,6 +22,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.storage.DiskInfo;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
@@ -74,7 +75,7 @@ public class StorageWizardFormatProgress extends StorageWizardBase {
if (e == null) { if (e == null) {
if (!mFormatPublic) { if (!mFormatPublic) {
final Intent intent = new Intent(context, StorageWizardMigrate.class); final Intent intent = new Intent(context, StorageWizardMigrate.class);
intent.putExtra(EXTRA_DISK_ID, mDisk.id); intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
startActivity(intent); startActivity(intent);
} }
finishAffinity(); finishAffinity();

View File

@@ -18,6 +18,7 @@ package com.android.settings.deviceinfo;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.storage.DiskInfo;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.RadioButton; import android.widget.RadioButton;
@@ -72,11 +73,11 @@ public class StorageWizardInit extends StorageWizardBase {
public void onNavigateNext() { public void onNavigateNext() {
if (mRadioExternal.isChecked()) { if (mRadioExternal.isChecked()) {
final Intent intent = new Intent(this, StorageWizardReady.class); final Intent intent = new Intent(this, StorageWizardReady.class);
intent.putExtra(EXTRA_DISK_ID, mDisk.id); intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
startActivity(intent); startActivity(intent);
} else if (mRadioInternal.isChecked()) { } else if (mRadioInternal.isChecked()) {
final Intent intent = new Intent(this, StorageWizardFormatConfirm.class); final Intent intent = new Intent(this, StorageWizardFormatConfirm.class);
intent.putExtra(EXTRA_DISK_ID, mDisk.id); intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
startActivity(intent); startActivity(intent);
} }
} }

View File

@@ -18,6 +18,7 @@ package com.android.settings.deviceinfo;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.storage.DiskInfo;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.text.format.Formatter; import android.text.format.Formatter;
import android.widget.CompoundButton; import android.widget.CompoundButton;
@@ -70,11 +71,11 @@ public class StorageWizardMigrate extends StorageWizardBase {
public void onNavigateNext() { public void onNavigateNext() {
if (mRadioNow.isChecked()) { if (mRadioNow.isChecked()) {
final Intent intent = new Intent(this, StorageWizardMigrateConfirm.class); final Intent intent = new Intent(this, StorageWizardMigrateConfirm.class);
intent.putExtra(EXTRA_DISK_ID, mDisk.id); intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
startActivity(intent); startActivity(intent);
} else if (mRadioLater.isChecked()) { } else if (mRadioLater.isChecked()) {
final Intent intent = new Intent(this, StorageWizardReady.class); final Intent intent = new Intent(this, StorageWizardReady.class);
intent.putExtra(EXTRA_DISK_ID, mDisk.id); intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
startActivity(intent); startActivity(intent);
} }
} }

View File

@@ -18,6 +18,7 @@ package com.android.settings.deviceinfo;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.storage.DiskInfo;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.text.format.Formatter; import android.text.format.Formatter;
@@ -45,7 +46,7 @@ public class StorageWizardMigrateConfirm extends StorageWizardBase {
@Override @Override
public void onNavigateNext() { public void onNavigateNext() {
final Intent intent = new Intent(this, StorageWizardMigrateProgress.class); final Intent intent = new Intent(this, StorageWizardMigrateProgress.class);
intent.putExtra(EXTRA_DISK_ID, mDisk.id); intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
startActivity(intent); startActivity(intent);
finishAffinity(); finishAffinity();
} }

View File

@@ -23,6 +23,7 @@ import android.content.Intent;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.SystemClock; import android.os.SystemClock;
import android.os.storage.DiskInfo;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
@@ -61,7 +62,7 @@ public class StorageWizardMigrateProgress extends StorageWizardBase {
final Context context = StorageWizardMigrateProgress.this; final Context context = StorageWizardMigrateProgress.this;
if (e == null) { if (e == null) {
final Intent intent = new Intent(context, StorageWizardReady.class); final Intent intent = new Intent(context, StorageWizardReady.class);
intent.putExtra(EXTRA_DISK_ID, mDisk.id); intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
startActivity(intent); startActivity(intent);
finishAffinity(); finishAffinity();

View File

@@ -34,7 +34,7 @@ public class StorageWizardReady extends StorageWizardBase {
// TODO: handle mixed partition cases instead of just guessing based on // TODO: handle mixed partition cases instead of just guessing based on
// first volume type we encounter // first volume type we encounter
for (String volId : mDisk.volumes) { for (String volId : mDisk.volumeIds) {
final VolumeInfo vol = mStorage.findVolumeById(volId); final VolumeInfo vol = mStorage.findVolumeById(volId);
if (vol == null) continue; if (vol == null) continue;