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:
@@ -1494,7 +1494,8 @@
|
||||
<activity android:name=".deviceinfo.StorageWizardInit"
|
||||
android:theme="@style/SuwThemeMaterial.Light"
|
||||
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"
|
||||
android:taskAffinity="com.android.settings.storage_wizard"
|
||||
android:exported="false" />
|
||||
@@ -1521,6 +1522,11 @@
|
||||
android:taskAffinity="com.android.settings.storage_wizard"
|
||||
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"
|
||||
android:label="@string/apn_edit">
|
||||
<intent-filter>
|
||||
|
@@ -46,9 +46,9 @@ public class PrivateVolumeFormatConfirm extends InstrumentedFragment {
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
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);
|
||||
mDisk = storage.findDiskByVolumeId(volumeId);
|
||||
mDisk = storage.findDiskById(mVolume.diskId);
|
||||
|
||||
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(StorageWizardBase.EXTRA_DISK_ID, mDisk.id);
|
||||
intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
|
||||
intent.putExtra(StorageWizardFormatProgress.EXTRA_FORMAT_PUBLIC, true);
|
||||
startActivity(intent);
|
||||
getActivity().finish();
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.deviceinfo;
|
||||
|
||||
import static com.android.settings.deviceinfo.StorageSettings.EXTRA_VOLUME_ID;
|
||||
import static com.android.settings.deviceinfo.StorageSettings.TAG;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
@@ -118,7 +117,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
|
||||
mUserManager = context.getSystemService(UserManager.class);
|
||||
mStorageManager = context.getSystemService(StorageManager.class);
|
||||
|
||||
mVolumeId = getArguments().getString(EXTRA_VOLUME_ID);
|
||||
mVolumeId = getArguments().getString(VolumeInfo.EXTRA_VOLUME_ID);
|
||||
mVolume = mStorageManager.findVolumeById(mVolumeId);
|
||||
|
||||
Preconditions.checkNotNull(mVolume);
|
||||
@@ -159,7 +158,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
getActivity().setTitle(mStorageManager.getBestVolumeDescription(mVolume.id));
|
||||
getActivity().setTitle(mStorageManager.getBestVolumeDescription(mVolume));
|
||||
|
||||
// Valid options may have changed
|
||||
getFragmentManager().invalidateOptionsMenu();
|
||||
@@ -298,15 +297,15 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
|
||||
RenameFragment.show(this);
|
||||
return true;
|
||||
case R.id.storage_mount:
|
||||
new MountTask(context, mVolume.id).execute();
|
||||
new MountTask(context, mVolume).execute();
|
||||
return true;
|
||||
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(),
|
||||
R.string.storage_menu_unmount, 0, args);
|
||||
return true;
|
||||
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(),
|
||||
R.string.storage_menu_format, 0, args);
|
||||
return true;
|
||||
@@ -345,7 +344,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
|
||||
return true;
|
||||
|
||||
} else if (pref == mMisc) {
|
||||
intent = StorageSettings.buildBrowseIntent(mSharedVolume);
|
||||
intent = mSharedVolume.buildBrowseIntent();
|
||||
}
|
||||
|
||||
if (intent != null) {
|
||||
@@ -454,7 +453,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
|
||||
final Context context = getActivity();
|
||||
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 AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
@@ -466,7 +465,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
|
||||
if (!TextUtils.isEmpty(vol.nickname)) {
|
||||
nickname.setText(vol.nickname);
|
||||
} else {
|
||||
nickname.setText(storageManager.getBestVolumeDescription(volId));
|
||||
nickname.setText(storageManager.getBestVolumeDescription(vol));
|
||||
}
|
||||
|
||||
builder.setTitle(R.string.storage_rename_title);
|
||||
|
@@ -46,9 +46,9 @@ public class PrivateVolumeUnmountConfirm extends InstrumentedFragment {
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
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);
|
||||
mDisk = storage.findDiskByVolumeId(volumeId);
|
||||
mDisk = storage.findDiskById(mVolume.id);
|
||||
|
||||
final View view = inflater.inflate(R.layout.storage_internal_unmount, container, false);
|
||||
final TextView body = (TextView) view.findViewById(R.id.body);
|
||||
@@ -64,7 +64,7 @@ public class PrivateVolumeUnmountConfirm extends InstrumentedFragment {
|
||||
private final OnClickListener mConfirmListener = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new UnmountTask(getActivity(), mVolume.id).execute();
|
||||
new UnmountTask(getActivity(), mVolume).execute();
|
||||
getActivity().finish();
|
||||
}
|
||||
};
|
||||
|
@@ -16,8 +16,6 @@
|
||||
|
||||
package com.android.settings.deviceinfo;
|
||||
|
||||
import static com.android.settings.deviceinfo.StorageSettings.EXTRA_VOLUME_ID;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
@@ -49,8 +47,6 @@ import java.util.Objects;
|
||||
public class PublicVolumeSettings extends SettingsPreferenceFragment {
|
||||
// TODO: disable unmount when providing over MTP/PTP
|
||||
|
||||
private static final String PREF_FORMAT_INTERNAL = "debug.format_internal";
|
||||
|
||||
private StorageManager mStorageManager;
|
||||
|
||||
private String mVolumeId;
|
||||
@@ -90,14 +86,14 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
|
||||
final String fsUuid = DocumentsContract.getRootId(rootUri);
|
||||
mVolume = mStorageManager.findVolumeByUuid(fsUuid);
|
||||
} else {
|
||||
final String volId = getArguments().getString(EXTRA_VOLUME_ID);
|
||||
final String volId = getArguments().getString(VolumeInfo.EXTRA_VOLUME_ID);
|
||||
mVolume = mStorageManager.findVolumeById(volId);
|
||||
}
|
||||
|
||||
Preconditions.checkNotNull(mVolume);
|
||||
Preconditions.checkState(mVolume.type == VolumeInfo.TYPE_PUBLIC);
|
||||
|
||||
mDisk = mStorageManager.findDiskByVolumeId(mVolume.id);
|
||||
mDisk = mStorageManager.findDiskById(mVolume.diskId);
|
||||
Preconditions.checkNotNull(mDisk);
|
||||
|
||||
mVolumeId = mVolume.id;
|
||||
@@ -115,7 +111,7 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
getActivity().setTitle(mStorageManager.getBestVolumeDescription(mVolume.id));
|
||||
getActivity().setTitle(mStorageManager.getBestVolumeDescription(mVolume));
|
||||
|
||||
final Context context = getActivity();
|
||||
final PreferenceScreen screen = getPreferenceScreen();
|
||||
@@ -197,14 +193,14 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
|
||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference pref) {
|
||||
final Context context = getActivity();
|
||||
if (pref == mMount) {
|
||||
new MountTask(context, mVolume.id).execute();
|
||||
new MountTask(context, mVolume).execute();
|
||||
} else if (pref == mUnmount) {
|
||||
new UnmountTask(context, mVolume.id).execute();
|
||||
new UnmountTask(context, mVolume).execute();
|
||||
} else if (pref == mFormat) {
|
||||
new FormatTask(context, mVolume.id).execute();
|
||||
new FormatTask(context, mVolume).execute();
|
||||
} else if (pref == mFormatInternal) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@@ -17,8 +17,6 @@
|
||||
package com.android.settings.deviceinfo;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserManager;
|
||||
@@ -28,7 +26,6 @@ import android.os.storage.VolumeInfo;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
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: 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 StorageManager mStorageManager;
|
||||
|
||||
@@ -219,19 +188,18 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
|
||||
|
||||
} else if (vol.type == VolumeInfo.TYPE_PRIVATE) {
|
||||
final Bundle args = new Bundle();
|
||||
args.putString(EXTRA_VOLUME_ID, volId);
|
||||
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) {
|
||||
final Intent intent = buildBrowseIntent(vol);
|
||||
startActivity(intent);
|
||||
startActivity(vol.buildBrowseIntent());
|
||||
return true;
|
||||
} else {
|
||||
final Bundle args = new Bundle();
|
||||
args.putString(EXTRA_VOLUME_ID, volId);
|
||||
args.putString(VolumeInfo.EXTRA_VOLUME_ID, volId);
|
||||
startFragment(this, PublicVolumeSettings.class.getCanonicalName(),
|
||||
-1, 0, args);
|
||||
return true;
|
||||
@@ -247,11 +215,11 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
|
||||
private final String mVolumeId;
|
||||
private final String mDescription;
|
||||
|
||||
public MountTask(Context context, String volumeId) {
|
||||
public MountTask(Context context, VolumeInfo volume) {
|
||||
mContext = context.getApplicationContext();
|
||||
mStorageManager = mContext.getSystemService(StorageManager.class);
|
||||
mVolumeId = volumeId;
|
||||
mDescription = mStorageManager.getBestVolumeDescription(mVolumeId);
|
||||
mVolumeId = volume.id;
|
||||
mDescription = mStorageManager.getBestVolumeDescription(volume);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -283,11 +251,11 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
|
||||
private final String mVolumeId;
|
||||
private final String mDescription;
|
||||
|
||||
public UnmountTask(Context context, String volumeId) {
|
||||
public UnmountTask(Context context, VolumeInfo volume) {
|
||||
mContext = context.getApplicationContext();
|
||||
mStorageManager = mContext.getSystemService(StorageManager.class);
|
||||
mVolumeId = volumeId;
|
||||
mDescription = mStorageManager.getBestVolumeDescription(mVolumeId);
|
||||
mVolumeId = volume.id;
|
||||
mDescription = mStorageManager.getBestVolumeDescription(volume);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -319,11 +287,11 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
|
||||
private final String mVolumeId;
|
||||
private final String mDescription;
|
||||
|
||||
public FormatTask(Context context, String volumeId) {
|
||||
public FormatTask(Context context, VolumeInfo volume) {
|
||||
mContext = context.getApplicationContext();
|
||||
mStorageManager = mContext.getSystemService(StorageManager.class);
|
||||
mVolumeId = volumeId;
|
||||
mDescription = mStorageManager.getBestVolumeDescription(mVolumeId);
|
||||
mVolumeId = volume.id;
|
||||
mDescription = mStorageManager.getBestVolumeDescription(volume);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -374,7 +342,7 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
|
||||
final List<VolumeInfo> vols = storage.getVolumes();
|
||||
for (VolumeInfo vol : vols) {
|
||||
if (isInteresting(vol)) {
|
||||
data.title = storage.getBestVolumeDescription(vol.id);
|
||||
data.title = storage.getBestVolumeDescription(vol);
|
||||
data.screenTitle = context.getString(R.string.storage_settings);
|
||||
result.add(data);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -45,7 +45,7 @@ public class StorageVolumePreference extends Preference {
|
||||
mVolume = volume;
|
||||
|
||||
setKey(volume.id);
|
||||
setTitle(mStorageManager.getBestVolumeDescription(volume.id));
|
||||
setTitle(mStorageManager.getBestVolumeDescription(volume));
|
||||
|
||||
switch (volume.state) {
|
||||
case VolumeInfo.STATE_MOUNTED:
|
||||
@@ -83,7 +83,7 @@ public class StorageVolumePreference extends Preference {
|
||||
private final View.OnClickListener mUnmountListener = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new UnmountTask(getContext(), mVolume.id).execute();
|
||||
new UnmountTask(getContext(), mVolume).execute();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -37,9 +37,6 @@ import com.android.setupwizardlib.view.NavigationBar.NavigationBarListener;
|
||||
import java.text.NumberFormat;
|
||||
|
||||
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 VolumeInfo mVolume;
|
||||
@@ -51,16 +48,16 @@ public abstract class StorageWizardBase extends Activity implements NavigationBa
|
||||
|
||||
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)) {
|
||||
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)) {
|
||||
mDisk = mStorage.findDiskById(diskId);
|
||||
} else {
|
||||
mDisk = mStorage.findDiskByVolumeId(volumeId);
|
||||
mDisk = mStorage.findDiskById(mVolume.diskId);
|
||||
}
|
||||
|
||||
setTheme(R.style.SuwThemeMaterial_Light);
|
||||
|
@@ -18,6 +18,7 @@ package com.android.settings.deviceinfo;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.storage.DiskInfo;
|
||||
|
||||
import com.android.internal.util.Preconditions;
|
||||
import com.android.settings.R;
|
||||
@@ -41,7 +42,7 @@ public class StorageWizardFormatConfirm extends StorageWizardBase {
|
||||
@Override
|
||||
public void onNavigateNext() {
|
||||
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);
|
||||
finishAffinity();
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.storage.DiskInfo;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
@@ -74,7 +75,7 @@ public class StorageWizardFormatProgress extends StorageWizardBase {
|
||||
if (e == null) {
|
||||
if (!mFormatPublic) {
|
||||
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);
|
||||
}
|
||||
finishAffinity();
|
||||
|
@@ -18,6 +18,7 @@ package com.android.settings.deviceinfo;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.storage.DiskInfo;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.RadioButton;
|
||||
@@ -72,11 +73,11 @@ public class StorageWizardInit extends StorageWizardBase {
|
||||
public void onNavigateNext() {
|
||||
if (mRadioExternal.isChecked()) {
|
||||
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);
|
||||
} else if (mRadioInternal.isChecked()) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ package com.android.settings.deviceinfo;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.storage.DiskInfo;
|
||||
import android.text.format.DateUtils;
|
||||
import android.text.format.Formatter;
|
||||
import android.widget.CompoundButton;
|
||||
@@ -70,11 +71,11 @@ public class StorageWizardMigrate extends StorageWizardBase {
|
||||
public void onNavigateNext() {
|
||||
if (mRadioNow.isChecked()) {
|
||||
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);
|
||||
} else if (mRadioLater.isChecked()) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ package com.android.settings.deviceinfo;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.storage.DiskInfo;
|
||||
import android.text.format.DateUtils;
|
||||
import android.text.format.Formatter;
|
||||
|
||||
@@ -45,7 +46,7 @@ public class StorageWizardMigrateConfirm extends StorageWizardBase {
|
||||
@Override
|
||||
public void onNavigateNext() {
|
||||
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);
|
||||
finishAffinity();
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@ import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.os.storage.DiskInfo;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
@@ -61,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(EXTRA_DISK_ID, mDisk.id);
|
||||
intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.id);
|
||||
startActivity(intent);
|
||||
finishAffinity();
|
||||
|
||||
|
@@ -34,7 +34,7 @@ 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.volumes) {
|
||||
for (String volId : mDisk.volumeIds) {
|
||||
final VolumeInfo vol = mStorage.findVolumeById(volId);
|
||||
if (vol == null) continue;
|
||||
|
||||
|
Reference in New Issue
Block a user