Merge "Update storage wizard to latest UX mocks." into pi-dev am: e9b6d482cb
am: 2388fe48b5
Change-Id: If85d1fadad2ed6bce18e3d4e0949c5fc5c65508c
This commit is contained in:
@@ -16,6 +16,11 @@
|
||||
|
||||
package com.android.settings.deviceinfo;
|
||||
|
||||
import static android.os.storage.DiskInfo.EXTRA_DISK_ID;
|
||||
|
||||
import static com.android.settings.deviceinfo.StorageWizardBase.EXTRA_FORMAT_FORGET_UUID;
|
||||
import static com.android.settings.deviceinfo.StorageWizardBase.EXTRA_FORMAT_PRIVATE;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.storage.DiskInfo;
|
||||
@@ -30,8 +35,8 @@ import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.core.InstrumentedPreferenceFragment;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.InstrumentedPreferenceFragment;
|
||||
|
||||
public class PrivateVolumeFormat extends InstrumentedPreferenceFragment {
|
||||
private VolumeInfo mVolume;
|
||||
@@ -65,9 +70,9 @@ public class PrivateVolumeFormat extends InstrumentedPreferenceFragment {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final Intent intent = new Intent(getActivity(), StorageWizardFormatProgress.class);
|
||||
intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
|
||||
intent.putExtra(StorageWizardFormatConfirm.EXTRA_FORMAT_PRIVATE, false);
|
||||
intent.putExtra(StorageWizardFormatConfirm.EXTRA_FORGET_UUID, mVolume.getFsUuid());
|
||||
intent.putExtra(EXTRA_DISK_ID, mDisk.getId());
|
||||
intent.putExtra(EXTRA_FORMAT_PRIVATE, false);
|
||||
intent.putExtra(EXTRA_FORMAT_FORGET_UUID, mVolume.getFsUuid());
|
||||
startActivity(intent);
|
||||
getActivity().finish();
|
||||
}
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings.deviceinfo;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
@@ -223,19 +222,12 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(Preference pref) {
|
||||
final Context context = getActivity();
|
||||
if (pref == mMount) {
|
||||
new MountTask(context, mVolume).execute();
|
||||
new MountTask(getActivity(), mVolume).execute();
|
||||
} else if (pref == mFormatPublic) {
|
||||
final Intent intent = new Intent(context, StorageWizardFormatConfirm.class);
|
||||
intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
|
||||
intent.putExtra(StorageWizardFormatConfirm.EXTRA_FORMAT_PRIVATE, false);
|
||||
startActivity(intent);
|
||||
StorageWizardFormatConfirm.showPublic(getActivity(), mDisk.getId());
|
||||
} else if (pref == mFormatPrivate) {
|
||||
final Intent intent = new Intent(context, StorageWizardFormatConfirm.class);
|
||||
intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
|
||||
intent.putExtra(StorageWizardFormatConfirm.EXTRA_FORMAT_PRIVATE, true);
|
||||
startActivity(intent);
|
||||
StorageWizardFormatConfirm.showPrivate(getActivity(), mDisk.getId());
|
||||
}
|
||||
|
||||
return super.onPreferenceTreeClick(pref);
|
||||
|
@@ -16,12 +16,14 @@
|
||||
|
||||
package com.android.settings.deviceinfo;
|
||||
|
||||
import static android.os.storage.DiskInfo.EXTRA_DISK_ID;
|
||||
import static android.os.storage.VolumeInfo.EXTRA_VOLUME_ID;
|
||||
|
||||
import static com.android.settings.deviceinfo.StorageSettings.TAG;
|
||||
|
||||
import android.annotation.LayoutRes;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
@@ -31,12 +33,15 @@ import android.os.storage.StorageManager;
|
||||
import android.os.storage.VolumeInfo;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.setupwizardlib.GlifLayout;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
@@ -44,11 +49,17 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public abstract class StorageWizardBase extends Activity {
|
||||
protected static final String EXTRA_FORMAT_FORGET_UUID = "format_forget_uuid";
|
||||
protected static final String EXTRA_FORMAT_PRIVATE = "format_private";
|
||||
protected static final String EXTRA_FORMAT_SLOW = "format_slow";
|
||||
protected static final String EXTRA_MIGRATE_SKIP = "migrate_skip";
|
||||
|
||||
protected StorageManager mStorage;
|
||||
|
||||
protected VolumeInfo mVolume;
|
||||
protected DiskInfo mDisk;
|
||||
|
||||
private Button mBack;
|
||||
private Button mNext;
|
||||
|
||||
@Override
|
||||
@@ -57,12 +68,12 @@ public abstract class StorageWizardBase extends Activity {
|
||||
|
||||
mStorage = getSystemService(StorageManager.class);
|
||||
|
||||
final String volumeId = getIntent().getStringExtra(VolumeInfo.EXTRA_VOLUME_ID);
|
||||
final String volumeId = getIntent().getStringExtra(EXTRA_VOLUME_ID);
|
||||
if (!TextUtils.isEmpty(volumeId)) {
|
||||
mVolume = mStorage.findVolumeById(volumeId);
|
||||
}
|
||||
|
||||
final String diskId = getIntent().getStringExtra(DiskInfo.EXTRA_DISK_ID);
|
||||
final String diskId = getIntent().getStringExtra(EXTRA_DISK_ID);
|
||||
if (!TextUtils.isEmpty(diskId)) {
|
||||
mDisk = mStorage.findDiskById(diskId);
|
||||
} else if (mVolume != null) {
|
||||
@@ -78,13 +89,10 @@ public abstract class StorageWizardBase extends Activity {
|
||||
public void setContentView(@LayoutRes int layoutResID) {
|
||||
super.setContentView(layoutResID);
|
||||
|
||||
mNext = (Button) findViewById(R.id.storage_next_button);
|
||||
mNext.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onNavigateNext();
|
||||
}
|
||||
});
|
||||
mBack = requireViewById(R.id.storage_back_button);
|
||||
mNext = requireViewById(R.id.storage_next_button);
|
||||
|
||||
setIcon(com.android.internal.R.drawable.ic_sd_card_48dp);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,62 +101,109 @@ public abstract class StorageWizardBase extends Activity {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
protected Button getBackButton() {
|
||||
return mBack;
|
||||
}
|
||||
|
||||
protected Button getNextButton() {
|
||||
return mNext;
|
||||
}
|
||||
|
||||
protected GlifLayout getGlifLayout() {
|
||||
return (GlifLayout) findViewById(R.id.setup_wizard_layout);
|
||||
return requireViewById(R.id.setup_wizard_layout);
|
||||
}
|
||||
|
||||
protected ProgressBar getProgressBar() {
|
||||
return (ProgressBar) findViewById(R.id.storage_wizard_progress);
|
||||
return requireViewById(R.id.storage_wizard_progress);
|
||||
}
|
||||
|
||||
protected void setCurrentProgress(int progress) {
|
||||
getProgressBar().setProgress(progress);
|
||||
((TextView) findViewById(R.id.storage_wizard_progress_summary)).setText(
|
||||
((TextView) requireViewById(R.id.storage_wizard_progress_summary)).setText(
|
||||
NumberFormat.getPercentInstance().format((double) progress / 100));
|
||||
}
|
||||
|
||||
protected void setHeaderText(int resId, String... args) {
|
||||
protected void setHeaderText(int resId, CharSequence... args) {
|
||||
final CharSequence headerText = TextUtils.expandTemplate(getText(resId), args);
|
||||
getGlifLayout().setHeaderText(headerText);
|
||||
setTitle(headerText);
|
||||
}
|
||||
|
||||
protected void setBodyText(int resId, String... args) {
|
||||
((TextView) findViewById(R.id.storage_wizard_body)).setText(
|
||||
TextUtils.expandTemplate(getText(resId), args));
|
||||
protected void setBodyText(int resId, CharSequence... args) {
|
||||
final TextView body = requireViewById(R.id.storage_wizard_body);
|
||||
body.setText(TextUtils.expandTemplate(getText(resId), args));
|
||||
body.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
protected void setSecondaryBodyText(int resId, String... args) {
|
||||
final TextView secondBody = ((TextView) findViewById(R.id.storage_wizard_second_body));
|
||||
secondBody.setText(TextUtils.expandTemplate(getText(resId), args));
|
||||
secondBody.setVisibility(View.VISIBLE);
|
||||
protected void setAuxChecklist() {
|
||||
final FrameLayout aux = requireViewById(R.id.storage_wizard_aux);
|
||||
aux.addView(LayoutInflater.from(aux.getContext())
|
||||
.inflate(R.layout.storage_wizard_checklist, aux, false));
|
||||
aux.setVisibility(View.VISIBLE);
|
||||
|
||||
// Customize string based on disk
|
||||
((TextView) aux.requireViewById(R.id.storage_wizard_migrate_v2_checklist_media))
|
||||
.setText(TextUtils.expandTemplate(
|
||||
getText(R.string.storage_wizard_migrate_v2_checklist_media),
|
||||
mDisk.getShortDescription()));
|
||||
}
|
||||
|
||||
protected static final int ILLUSTRATION_SETUP = 0;
|
||||
protected static final int ILLUSTRATION_INTERNAL = 1;
|
||||
protected static final int ILLUSTRATION_PORTABLE = 2;
|
||||
protected void setBackButtonText(int resId, CharSequence... args) {
|
||||
mBack.setText(TextUtils.expandTemplate(getText(resId), args));
|
||||
mBack.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
protected void setIllustrationType(int type) {
|
||||
// TODO: map type to updated icons once provided by UX
|
||||
TypedArray array = obtainStyledAttributes(new int[] {android.R.attr.colorAccent});
|
||||
Drawable icon = getDrawable(com.android.internal.R.drawable.ic_sd_card_48dp).mutate();
|
||||
icon.setTint(array.getColor(0, 0));
|
||||
array.recycle();
|
||||
getGlifLayout().setIcon(icon);
|
||||
protected void setNextButtonText(int resId, CharSequence... args) {
|
||||
mNext.setText(TextUtils.expandTemplate(getText(resId), args));
|
||||
mNext.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
protected void setIcon(int resId) {
|
||||
final GlifLayout layout = getGlifLayout();
|
||||
final Drawable icon = getDrawable(resId).mutate();
|
||||
icon.setTint(Utils.getColorAccent(layout.getContext()));
|
||||
layout.setIcon(icon);
|
||||
}
|
||||
|
||||
protected void setKeepScreenOn(boolean keepScreenOn) {
|
||||
getGlifLayout().setKeepScreenOn(keepScreenOn);
|
||||
}
|
||||
|
||||
public void onNavigateNext() {
|
||||
public void onNavigateBack(View view) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void onNavigateNext(View view) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private void copyStringExtra(Intent from, Intent to, String key) {
|
||||
if (from.hasExtra(key) && !to.hasExtra(key)) {
|
||||
to.putExtra(key, from.getStringExtra(key));
|
||||
}
|
||||
}
|
||||
|
||||
private void copyBooleanExtra(Intent from, Intent to, String key) {
|
||||
if (from.hasExtra(key) && !to.hasExtra(key)) {
|
||||
to.putExtra(key, from.getBooleanExtra(key, false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startActivity(Intent intent) {
|
||||
final Intent from = getIntent();
|
||||
final Intent to = intent;
|
||||
|
||||
copyStringExtra(from, to, EXTRA_DISK_ID);
|
||||
copyStringExtra(from, to, EXTRA_VOLUME_ID);
|
||||
copyStringExtra(from, to, EXTRA_FORMAT_FORGET_UUID);
|
||||
copyBooleanExtra(from, to, EXTRA_FORMAT_PRIVATE);
|
||||
copyBooleanExtra(from, to, EXTRA_FORMAT_SLOW);
|
||||
copyBooleanExtra(from, to, EXTRA_MIGRATE_SKIP);
|
||||
|
||||
super.startActivity(intent);
|
||||
}
|
||||
|
||||
protected VolumeInfo findFirstVolume(int type) {
|
||||
return findFirstVolume(type, 1);
|
||||
}
|
||||
|
@@ -16,52 +16,91 @@
|
||||
|
||||
package com.android.settings.deviceinfo;
|
||||
|
||||
import static android.os.storage.DiskInfo.EXTRA_DISK_ID;
|
||||
|
||||
import static com.android.settings.deviceinfo.StorageWizardBase.EXTRA_FORMAT_FORGET_UUID;
|
||||
import static com.android.settings.deviceinfo.StorageWizardBase.EXTRA_FORMAT_PRIVATE;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.storage.DiskInfo;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||
|
||||
public class StorageWizardFormatConfirm extends StorageWizardBase {
|
||||
public static final String EXTRA_FORMAT_PRIVATE = "format_private";
|
||||
public static final String EXTRA_FORGET_UUID = "forget_uuid";
|
||||
public class StorageWizardFormatConfirm extends InstrumentedDialogFragment {
|
||||
private static final String TAG_FORMAT_WARNING = "format_warning";
|
||||
|
||||
private boolean mFormatPrivate;
|
||||
public static void showPublic(Activity activity, String diskId) {
|
||||
show(activity, diskId, null, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mDisk == null) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
setContentView(R.layout.storage_wizard_generic);
|
||||
public static void showPublic(Activity activity, String diskId, String forgetUuid) {
|
||||
show(activity, diskId, forgetUuid, false);
|
||||
}
|
||||
|
||||
mFormatPrivate = getIntent().getBooleanExtra(EXTRA_FORMAT_PRIVATE, false);
|
||||
setIllustrationType(
|
||||
mFormatPrivate ? ILLUSTRATION_INTERNAL : ILLUSTRATION_PORTABLE);
|
||||
public static void showPrivate(Activity activity, String diskId) {
|
||||
show(activity, diskId, null, true);
|
||||
}
|
||||
|
||||
if (mFormatPrivate) {
|
||||
setHeaderText(R.string.storage_wizard_format_confirm_title);
|
||||
setBodyText(R.string.storage_wizard_format_confirm_body,
|
||||
mDisk.getDescription());
|
||||
} else {
|
||||
setHeaderText(R.string.storage_wizard_format_confirm_public_title);
|
||||
setBodyText(R.string.storage_wizard_format_confirm_public_body,
|
||||
mDisk.getDescription());
|
||||
}
|
||||
private static void show(Activity activity, String diskId, String formatForgetUuid,
|
||||
boolean formatPrivate) {
|
||||
final Bundle args = new Bundle();
|
||||
args.putString(EXTRA_DISK_ID, diskId);
|
||||
args.putString(EXTRA_FORMAT_FORGET_UUID, formatForgetUuid);
|
||||
args.putBoolean(EXTRA_FORMAT_PRIVATE, formatPrivate);
|
||||
|
||||
getNextButton().setText(R.string.storage_wizard_format_confirm_next);
|
||||
getNextButton().setBackgroundTintList(getColorStateList(R.color.storage_wizard_button_red));
|
||||
final StorageWizardFormatConfirm fragment = new StorageWizardFormatConfirm();
|
||||
fragment.setArguments(args);
|
||||
fragment.showAllowingStateLoss(activity.getFragmentManager(), TAG_FORMAT_WARNING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateNext() {
|
||||
final Intent intent = new Intent(this, StorageWizardFormatProgress.class);
|
||||
intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
|
||||
intent.putExtra(EXTRA_FORMAT_PRIVATE, mFormatPrivate);
|
||||
intent.putExtra(EXTRA_FORGET_UUID, getIntent().getStringExtra(EXTRA_FORGET_UUID));
|
||||
startActivity(intent);
|
||||
finishAffinity();
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.DIALOG_VOLUME_FORMAT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final Context context = getContext();
|
||||
|
||||
final Bundle args = getArguments();
|
||||
final String diskId = args.getString(EXTRA_DISK_ID);
|
||||
final String formatForgetUuid = args.getString(EXTRA_FORMAT_FORGET_UUID);
|
||||
final boolean formatPrivate = args.getBoolean(EXTRA_FORMAT_PRIVATE, false);
|
||||
|
||||
final DiskInfo disk = context.getSystemService(StorageManager.class)
|
||||
.findDiskById(diskId);
|
||||
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(TextUtils.expandTemplate(
|
||||
getText(R.string.storage_wizard_format_confirm_v2_title),
|
||||
disk.getShortDescription()));
|
||||
builder.setMessage(TextUtils.expandTemplate(
|
||||
getText(R.string.storage_wizard_format_confirm_v2_body),
|
||||
disk.getDescription(),
|
||||
disk.getShortDescription(),
|
||||
disk.getShortDescription()));
|
||||
|
||||
builder.setNegativeButton(android.R.string.cancel, null);
|
||||
builder.setPositiveButton(
|
||||
TextUtils.expandTemplate(getText(R.string.storage_wizard_format_confirm_v2_action),
|
||||
disk.getShortDescription()),
|
||||
(dialog, which) -> {
|
||||
final Intent intent = new Intent(context, StorageWizardFormatProgress.class);
|
||||
intent.putExtra(EXTRA_DISK_ID, diskId);
|
||||
intent.putExtra(EXTRA_FORMAT_FORGET_UUID, formatForgetUuid);
|
||||
intent.putExtra(EXTRA_FORMAT_PRIVATE, formatPrivate);
|
||||
context.startActivity(intent);
|
||||
});
|
||||
|
||||
return builder.create();
|
||||
}
|
||||
}
|
||||
|
@@ -20,34 +20,26 @@ import static android.os.storage.VolumeInfo.TYPE_PRIVATE;
|
||||
|
||||
import static com.android.settings.deviceinfo.StorageSettings.TAG;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.IPackageMoveObserver;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.IVoldTaskListener;
|
||||
import android.os.PersistableBundle;
|
||||
import android.os.storage.DiskInfo;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.os.storage.VolumeInfo;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class StorageWizardFormatProgress extends StorageWizardBase {
|
||||
private static final String TAG_SLOW_WARNING = "slow_warning";
|
||||
private static final String PROP_DEBUG_STORAGE_SLOW = "sys.debug.storage_slow";
|
||||
|
||||
private boolean mFormatPrivate;
|
||||
|
||||
@@ -63,16 +55,11 @@ public class StorageWizardFormatProgress extends StorageWizardBase {
|
||||
setContentView(R.layout.storage_wizard_progress);
|
||||
setKeepScreenOn(true);
|
||||
|
||||
mFormatPrivate = getIntent().getBooleanExtra(
|
||||
StorageWizardFormatConfirm.EXTRA_FORMAT_PRIVATE, false);
|
||||
setIllustrationType(
|
||||
mFormatPrivate ? ILLUSTRATION_INTERNAL : ILLUSTRATION_PORTABLE);
|
||||
mFormatPrivate = getIntent().getBooleanExtra(EXTRA_FORMAT_PRIVATE, false);
|
||||
|
||||
setHeaderText(R.string.storage_wizard_format_progress_title, mDisk.getDescription());
|
||||
setHeaderText(R.string.storage_wizard_format_progress_title, mDisk.getShortDescription());
|
||||
setBodyText(R.string.storage_wizard_format_progress_body, mDisk.getDescription());
|
||||
|
||||
getNextButton().setVisibility(View.GONE);
|
||||
|
||||
mTask = (PartitionTask) getLastNonConfigurationInstance();
|
||||
if (mTask == null) {
|
||||
mTask = new PartitionTask();
|
||||
@@ -198,93 +185,29 @@ public class StorageWizardFormatProgress extends StorageWizardBase {
|
||||
// changes.
|
||||
|
||||
Log.d(TAG, "New volume took " + mPrivateBench + "ms to run benchmark");
|
||||
if (mPrivateBench > 2000) {
|
||||
final SlowWarningFragment dialog = new SlowWarningFragment();
|
||||
dialog.showAllowingStateLoss(activity.getFragmentManager(), TAG_SLOW_WARNING);
|
||||
if (mPrivateBench > 2000
|
||||
|| SystemProperties.getBoolean(PROP_DEBUG_STORAGE_SLOW, false)) {
|
||||
mActivity.onFormatFinishedSlow();
|
||||
} else {
|
||||
activity.onFormatFinished();
|
||||
mActivity.onFormatFinished();
|
||||
}
|
||||
} else {
|
||||
activity.onFormatFinished();
|
||||
mActivity.onFormatFinished();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class SlowWarningFragment extends InstrumentedDialogFragment {
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.DIALOG_VOLUME_SLOW_WARNING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final Context context = getActivity();
|
||||
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
|
||||
final StorageWizardFormatProgress target =
|
||||
(StorageWizardFormatProgress) getActivity();
|
||||
final String descrip = target.getDiskDescription();
|
||||
final String genericDescip = target.getGenericDiskDescription();
|
||||
builder.setMessage(TextUtils.expandTemplate(getText(R.string.storage_wizard_slow_body),
|
||||
descrip, genericDescip));
|
||||
|
||||
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
final StorageWizardFormatProgress target =
|
||||
(StorageWizardFormatProgress) getActivity();
|
||||
target.onFormatFinished();
|
||||
}
|
||||
});
|
||||
|
||||
return builder.create();
|
||||
}
|
||||
public void onFormatFinished() {
|
||||
final Intent intent = new Intent(this, StorageWizardFormatSlow.class);
|
||||
intent.putExtra(EXTRA_FORMAT_SLOW, false);
|
||||
startActivity(intent);
|
||||
finishAffinity();
|
||||
}
|
||||
|
||||
private String getDiskDescription() {
|
||||
return mDisk.getDescription();
|
||||
}
|
||||
|
||||
private String getGenericDiskDescription() {
|
||||
// TODO: move this directly to DiskInfo
|
||||
if (mDisk.isSd()) {
|
||||
return getString(com.android.internal.R.string.storage_sd_card);
|
||||
} else if (mDisk.isUsb()) {
|
||||
return getString(com.android.internal.R.string.storage_usb_drive);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void onFormatFinished() {
|
||||
final String forgetUuid = getIntent().getStringExtra(
|
||||
StorageWizardFormatConfirm.EXTRA_FORGET_UUID);
|
||||
if (!TextUtils.isEmpty(forgetUuid)) {
|
||||
mStorage.forgetVolume(forgetUuid);
|
||||
}
|
||||
|
||||
final boolean offerMigrate;
|
||||
if (mFormatPrivate) {
|
||||
// Offer to migrate only if storage is currently internal
|
||||
final VolumeInfo privateVol = getPackageManager()
|
||||
.getPrimaryStorageCurrentVolume();
|
||||
offerMigrate = (privateVol != null
|
||||
&& VolumeInfo.ID_PRIVATE_INTERNAL.equals(privateVol.getId()));
|
||||
} else {
|
||||
offerMigrate = false;
|
||||
}
|
||||
|
||||
if (offerMigrate) {
|
||||
final Intent intent = new Intent(this, StorageWizardMigrate.class);
|
||||
intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
|
||||
startActivity(intent);
|
||||
} else {
|
||||
final Intent intent = new Intent(this, StorageWizardReady.class);
|
||||
intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
|
||||
startActivity(intent);
|
||||
}
|
||||
public void onFormatFinishedSlow() {
|
||||
final Intent intent = new Intent(this, StorageWizardFormatSlow.class);
|
||||
intent.putExtra(EXTRA_FORMAT_SLOW, true);
|
||||
startActivity(intent);
|
||||
finishAffinity();
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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 android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.storage.DiskInfo;
|
||||
import android.os.storage.VolumeInfo;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
public class StorageWizardFormatSlow extends StorageWizardBase {
|
||||
private boolean mFormatPrivate;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mDisk == null) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
setContentView(R.layout.storage_wizard_generic);
|
||||
|
||||
mFormatPrivate = getIntent().getBooleanExtra(EXTRA_FORMAT_PRIVATE, false);
|
||||
|
||||
setHeaderText(R.string.storage_wizard_slow_v2_title, mDisk.getShortDescription());
|
||||
setBodyText(R.string.storage_wizard_slow_v2_body, mDisk.getDescription(),
|
||||
mDisk.getShortDescription(), mDisk.getShortDescription(),
|
||||
mDisk.getShortDescription());
|
||||
|
||||
setBackButtonText(R.string.storage_wizard_slow_v2_start_over);
|
||||
setNextButtonText(R.string.storage_wizard_slow_v2_continue);
|
||||
|
||||
// If benchmark wasn't actually slow, skip this warning
|
||||
if (!getIntent().getBooleanExtra(EXTRA_FORMAT_SLOW, false)) {
|
||||
onNavigateNext(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateBack(View view) {
|
||||
final Intent intent = new Intent(this, StorageWizardInit.class);
|
||||
startActivity(intent);
|
||||
finishAffinity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateNext(View view) {
|
||||
final String forgetUuid = getIntent().getStringExtra(EXTRA_FORMAT_FORGET_UUID);
|
||||
if (!TextUtils.isEmpty(forgetUuid)) {
|
||||
mStorage.forgetVolume(forgetUuid);
|
||||
}
|
||||
|
||||
final boolean offerMigrate;
|
||||
if (mFormatPrivate) {
|
||||
// Offer to migrate only if storage is currently internal
|
||||
final VolumeInfo privateVol = getPackageManager()
|
||||
.getPrimaryStorageCurrentVolume();
|
||||
offerMigrate = (privateVol != null
|
||||
&& VolumeInfo.ID_PRIVATE_INTERNAL.equals(privateVol.getId()));
|
||||
} else {
|
||||
offerMigrate = false;
|
||||
}
|
||||
|
||||
if (offerMigrate) {
|
||||
final Intent intent = new Intent(this, StorageWizardMigrateConfirm.class);
|
||||
intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
|
||||
startActivity(intent);
|
||||
} else {
|
||||
final Intent intent = new Intent(this, StorageWizardReady.class);
|
||||
intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
|
||||
startActivity(intent);
|
||||
}
|
||||
finishAffinity();
|
||||
}
|
||||
}
|
@@ -16,29 +16,20 @@
|
||||
|
||||
package com.android.settings.deviceinfo;
|
||||
|
||||
import static com.android.settings.deviceinfo.StorageSettings.TAG;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.UserManager;
|
||||
import android.os.storage.DiskInfo;
|
||||
import android.os.storage.VolumeInfo;
|
||||
import android.util.DebugUtils;
|
||||
import android.util.Log;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.RadioButton;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class StorageWizardInit extends StorageWizardBase {
|
||||
private RadioButton mRadioExternal;
|
||||
private RadioButton mRadioInternal;
|
||||
private Button mExternal;
|
||||
private Button mInternal;
|
||||
|
||||
private boolean mIsPermittedToAdopt;
|
||||
|
||||
@@ -54,107 +45,46 @@ public class StorageWizardInit extends StorageWizardBase {
|
||||
mIsPermittedToAdopt = UserManager.get(this).isAdminUser()
|
||||
&& !ActivityManager.isUserAMonkey();
|
||||
|
||||
setIllustrationType(ILLUSTRATION_SETUP);
|
||||
setHeaderText(R.string.storage_wizard_init_title, mDisk.getDescription());
|
||||
setHeaderText(R.string.storage_wizard_init_v2_title, mDisk.getShortDescription());
|
||||
|
||||
mRadioExternal = (RadioButton) findViewById(R.id.storage_wizard_init_external_title);
|
||||
mRadioInternal = (RadioButton) findViewById(R.id.storage_wizard_init_internal_title);
|
||||
mExternal = requireViewById(R.id.storage_wizard_init_external);
|
||||
mInternal = requireViewById(R.id.storage_wizard_init_internal);
|
||||
|
||||
mRadioExternal.setOnCheckedChangeListener(mRadioListener);
|
||||
mRadioInternal.setOnCheckedChangeListener(mRadioListener);
|
||||
|
||||
findViewById(R.id.storage_wizard_init_external_summary).setPadding(
|
||||
mRadioExternal.getCompoundPaddingLeft(), 0,
|
||||
mRadioExternal.getCompoundPaddingRight(), 0);
|
||||
findViewById(R.id.storage_wizard_init_internal_summary).setPadding(
|
||||
mRadioExternal.getCompoundPaddingLeft(), 0,
|
||||
mRadioExternal.getCompoundPaddingRight(), 0);
|
||||
|
||||
getNextButton().setEnabled(false);
|
||||
setBackButtonText(R.string.storage_wizard_init_v2_later);
|
||||
|
||||
if (!mDisk.isAdoptable()) {
|
||||
// If not adoptable, we only have one choice
|
||||
mRadioExternal.setChecked(true);
|
||||
onNavigateNext();
|
||||
onNavigateExternal(null);
|
||||
finish();
|
||||
} else if (!mIsPermittedToAdopt) {
|
||||
// TODO: Show a message about why this is disabled for guest and
|
||||
// that only an admin user can adopt an sd card.
|
||||
mRadioInternal.setEnabled(false);
|
||||
} else if (mVolume != null && mVolume.getType() == VolumeInfo.TYPE_PUBLIC
|
||||
&& mVolume.isMountedReadable()) {
|
||||
// Device is mounted, so classify contents to possibly pick a
|
||||
// recommended default operation.
|
||||
new ClassifyTask().execute(mVolume.getPath());
|
||||
mInternal.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
private final OnCheckedChangeListener mRadioListener = new OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
if (buttonView == mRadioExternal) {
|
||||
mRadioInternal.setChecked(false);
|
||||
setIllustrationType(ILLUSTRATION_PORTABLE);
|
||||
} else if (buttonView == mRadioInternal) {
|
||||
mRadioExternal.setChecked(false);
|
||||
setIllustrationType(ILLUSTRATION_INTERNAL);
|
||||
}
|
||||
getNextButton().setEnabled(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onNavigateNext() {
|
||||
if (mRadioExternal.isChecked()) {
|
||||
if (mVolume != null && mVolume.getType() == VolumeInfo.TYPE_PUBLIC
|
||||
&& mVolume.getState() != VolumeInfo.STATE_UNMOUNTABLE) {
|
||||
// Remember that user made decision
|
||||
mStorage.setVolumeInited(mVolume.getFsUuid(), true);
|
||||
public void onNavigateBack(View view) {
|
||||
finish();
|
||||
}
|
||||
|
||||
final Intent intent = new Intent(this, StorageWizardReady.class);
|
||||
intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
|
||||
startActivity(intent);
|
||||
public void onNavigateExternal(View view) {
|
||||
if (mVolume != null && mVolume.getType() == VolumeInfo.TYPE_PUBLIC
|
||||
&& mVolume.getState() != VolumeInfo.STATE_UNMOUNTABLE) {
|
||||
// Remember that user made decision
|
||||
mStorage.setVolumeInited(mVolume.getFsUuid(), true);
|
||||
|
||||
} else {
|
||||
// Gotta format to get there
|
||||
final Intent intent = new Intent(this, StorageWizardFormatConfirm.class);
|
||||
intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
|
||||
intent.putExtra(StorageWizardFormatConfirm.EXTRA_FORMAT_PRIVATE, false);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
} else if (mRadioInternal.isChecked()) {
|
||||
final Intent intent = new Intent(this, StorageWizardFormatConfirm.class);
|
||||
final Intent intent = new Intent(this, StorageWizardReady.class);
|
||||
intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
|
||||
intent.putExtra(StorageWizardFormatConfirm.EXTRA_FORMAT_PRIVATE, true);
|
||||
startActivity(intent);
|
||||
|
||||
} else {
|
||||
// Gotta format to get there
|
||||
StorageWizardFormatConfirm.showPublic(this, mDisk.getId());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Task that classifies the contents of a mounted storage device, and sets a
|
||||
* recommended default operation based on result.
|
||||
*/
|
||||
public class ClassifyTask extends AsyncTask<File, Void, Integer> {
|
||||
@Override
|
||||
protected Integer doInBackground(File... params) {
|
||||
int classes = Environment.classifyExternalStorageDirectory(params[0]);
|
||||
Log.v(TAG, "Classified " + params[0] + " as "
|
||||
+ DebugUtils.flagsToString(Environment.class, "HAS_", classes));
|
||||
return classes;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Integer classes) {
|
||||
if (classes == 0) {
|
||||
// Empty is strong signal for adopt
|
||||
mRadioInternal.setChecked(true);
|
||||
} else if ((classes & (Environment.HAS_PICTURES | Environment.HAS_DCIM)) != 0) {
|
||||
// Photos is strong signal for portable
|
||||
mRadioExternal.setChecked(true);
|
||||
}
|
||||
}
|
||||
public void onNavigateInternal(View view) {
|
||||
StorageWizardFormatConfirm.showPrivate(this, mDisk.getId());
|
||||
}
|
||||
}
|
||||
|
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
* 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 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;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
public class StorageWizardMigrate extends StorageWizardBase {
|
||||
private MigrateEstimateTask mEstimate;
|
||||
|
||||
private RadioButton mRadioNow;
|
||||
private RadioButton mRadioLater;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mDisk == null) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
setContentView(R.layout.storage_wizard_migrate);
|
||||
|
||||
setIllustrationType(ILLUSTRATION_INTERNAL);
|
||||
setHeaderText(R.string.storage_wizard_migrate_title, mDisk.getDescription());
|
||||
setBodyText(R.string.memory_calculating_size);
|
||||
|
||||
mRadioNow = (RadioButton) findViewById(R.id.storage_wizard_migrate_now);
|
||||
mRadioLater = (RadioButton) findViewById(R.id.storage_wizard_migrate_later);
|
||||
|
||||
mRadioNow.setOnCheckedChangeListener(mRadioListener);
|
||||
mRadioLater.setOnCheckedChangeListener(mRadioListener);
|
||||
|
||||
getNextButton().setEnabled(false);
|
||||
|
||||
mEstimate = new MigrateEstimateTask(this) {
|
||||
@Override
|
||||
public void onPostExecute(String size, String time) {
|
||||
setBodyText(R.string.storage_wizard_migrate_body,
|
||||
mDisk.getDescription(), time, size);
|
||||
}
|
||||
};
|
||||
|
||||
mEstimate.copyFrom(getIntent());
|
||||
mEstimate.execute();
|
||||
}
|
||||
|
||||
private final OnCheckedChangeListener mRadioListener = new OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
if (buttonView == mRadioNow) {
|
||||
mRadioLater.setChecked(false);
|
||||
} else if (buttonView == mRadioLater) {
|
||||
mRadioNow.setChecked(false);
|
||||
}
|
||||
getNextButton().setEnabled(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onNavigateNext() {
|
||||
if (mRadioNow.isChecked()) {
|
||||
final Intent intent = new Intent(this, StorageWizardMigrateConfirm.class);
|
||||
intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
|
||||
mEstimate.copyTo(intent);
|
||||
startActivity(intent);
|
||||
} else if (mRadioLater.isChecked()) {
|
||||
final Intent intent = new Intent(this, StorageWizardReady.class);
|
||||
intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
@@ -28,6 +28,7 @@ import android.os.storage.StorageManager;
|
||||
import android.os.storage.VolumeInfo;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -57,30 +58,35 @@ public class StorageWizardMigrateConfirm extends StorageWizardBase {
|
||||
return;
|
||||
}
|
||||
|
||||
final String sourceDescrip = mStorage.getBestVolumeDescription(sourceVol);
|
||||
final String targetDescrip = mStorage.getBestVolumeDescription(mVolume);
|
||||
|
||||
setIllustrationType(ILLUSTRATION_INTERNAL);
|
||||
setHeaderText(R.string.storage_wizard_migrate_confirm_title, targetDescrip);
|
||||
setIcon(R.drawable.ic_swap_horiz);
|
||||
setHeaderText(R.string.storage_wizard_migrate_v2_title, mDisk.getShortDescription());
|
||||
setBodyText(R.string.memory_calculating_size);
|
||||
setSecondaryBodyText(R.string.storage_wizard_migrate_details, targetDescrip);
|
||||
setAuxChecklist();
|
||||
|
||||
mEstimate = new MigrateEstimateTask(this) {
|
||||
@Override
|
||||
public void onPostExecute(String size, String time) {
|
||||
setBodyText(R.string.storage_wizard_migrate_confirm_body, time, size,
|
||||
sourceDescrip);
|
||||
setBodyText(R.string.storage_wizard_migrate_v2_body,
|
||||
mDisk.getDescription(), size, time);
|
||||
}
|
||||
};
|
||||
|
||||
mEstimate.copyFrom(getIntent());
|
||||
mEstimate.execute();
|
||||
|
||||
getNextButton().setText(R.string.storage_wizard_migrate_confirm_next);
|
||||
setBackButtonText(R.string.storage_wizard_migrate_v2_later);
|
||||
setNextButtonText(R.string.storage_wizard_migrate_v2_now);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateNext() {
|
||||
public void onNavigateBack(View view) {
|
||||
final Intent intent = new Intent(this, StorageWizardReady.class);
|
||||
intent.putExtra(EXTRA_MIGRATE_SKIP, true);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateNext(View view) {
|
||||
// Ensure that all users are unlocked so that we can move their data
|
||||
if (StorageManager.isFileEncryptedNativeOrEmulated()) {
|
||||
for (UserInfo user : getSystemService(UserManager.class).getUsers()) {
|
||||
@@ -134,7 +140,7 @@ public class StorageWizardMigrateConfirm extends StorageWizardBase {
|
||||
if (resultCode == RESULT_OK) {
|
||||
// Credentials confirmed, so storage should be unlocked; let's
|
||||
// go look for the next locked user.
|
||||
onNavigateNext();
|
||||
onNavigateNext(null);
|
||||
} else {
|
||||
// User wasn't able to confirm credentials, so we're okay
|
||||
// landing back at the wizard page again, where they read
|
||||
|
@@ -16,6 +16,10 @@
|
||||
|
||||
package com.android.settings.deviceinfo;
|
||||
|
||||
import static android.content.pm.PackageManager.EXTRA_MOVE_ID;
|
||||
|
||||
import static com.android.settings.deviceinfo.StorageSettings.TAG;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -24,14 +28,10 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.storage.DiskInfo;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
import static android.content.pm.PackageManager.EXTRA_MOVE_ID;
|
||||
import static com.android.settings.deviceinfo.StorageSettings.TAG;
|
||||
|
||||
public class StorageWizardMigrateProgress extends StorageWizardBase {
|
||||
private static final String ACTION_FINISH_WIZARD = "com.android.systemui.action.FINISH_WIZARD";
|
||||
|
||||
@@ -48,12 +48,9 @@ public class StorageWizardMigrateProgress extends StorageWizardBase {
|
||||
|
||||
mMoveId = getIntent().getIntExtra(EXTRA_MOVE_ID, -1);
|
||||
|
||||
final String descrip = mStorage.getBestVolumeDescription(mVolume);
|
||||
setIllustrationType(ILLUSTRATION_INTERNAL);
|
||||
setHeaderText(R.string.storage_wizard_migrate_progress_title, descrip);
|
||||
setBodyText(R.string.storage_wizard_migrate_details, descrip);
|
||||
|
||||
getNextButton().setVisibility(View.GONE);
|
||||
setIcon(R.drawable.ic_swap_horiz);
|
||||
setHeaderText(R.string.storage_wizard_migrate_progress_v2_title);
|
||||
setAuxChecklist();
|
||||
|
||||
// Register for updates and push through current status
|
||||
getPackageManager().registerMoveCallback(mCallback, new Handler());
|
||||
|
@@ -32,6 +32,7 @@ import android.os.UserManager;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.internal.util.Preconditions;
|
||||
import com.android.settings.R;
|
||||
@@ -67,15 +68,15 @@ public class StorageWizardMoveConfirm extends StorageWizardBase {
|
||||
final String appName = getPackageManager().getApplicationLabel(mApp).toString();
|
||||
final String volumeName = mStorage.getBestVolumeDescription(mVolume);
|
||||
|
||||
setIllustrationType(ILLUSTRATION_INTERNAL);
|
||||
setIcon(R.drawable.ic_swap_horiz);
|
||||
setHeaderText(R.string.storage_wizard_move_confirm_title, appName);
|
||||
setBodyText(R.string.storage_wizard_move_confirm_body, appName, volumeName);
|
||||
|
||||
getNextButton().setText(R.string.move_app);
|
||||
setNextButtonText(R.string.move_app);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateNext() {
|
||||
public void onNavigateNext(View view) {
|
||||
// Ensure that all users are unlocked so that we can move their data
|
||||
if (StorageManager.isFileEncryptedNativeOrEmulated()) {
|
||||
for (UserInfo user : getSystemService(UserManager.class).getUsers()) {
|
||||
@@ -108,7 +109,7 @@ public class StorageWizardMoveConfirm extends StorageWizardBase {
|
||||
if (resultCode == RESULT_OK) {
|
||||
// Credentials confirmed, so storage should be unlocked; let's
|
||||
// go look for the next locked user.
|
||||
onNavigateNext();
|
||||
onNavigateNext(null);
|
||||
} else {
|
||||
// User wasn't able to confirm credentials, so we're okay
|
||||
// landing back at the wizard page again, where they read
|
||||
|
@@ -46,12 +46,10 @@ public class StorageWizardMoveProgress extends StorageWizardBase {
|
||||
final String appName = getIntent().getStringExtra(EXTRA_TITLE);
|
||||
final String volumeName = mStorage.getBestVolumeDescription(mVolume);
|
||||
|
||||
setIllustrationType(ILLUSTRATION_INTERNAL);
|
||||
setIcon(R.drawable.ic_swap_horiz);
|
||||
setHeaderText(R.string.storage_wizard_move_progress_title, appName);
|
||||
setBodyText(R.string.storage_wizard_move_progress_body, volumeName, appName);
|
||||
|
||||
getNextButton().setVisibility(View.GONE);
|
||||
|
||||
// Register for updates and push through current status
|
||||
getPackageManager().registerMoveCallback(mCallback, new Handler());
|
||||
mCallback.onStatusChanged(mMoveId, getPackageManager().getMoveStatus(mMoveId), -1);
|
||||
|
@@ -18,10 +18,12 @@ package com.android.settings.deviceinfo;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.storage.VolumeInfo;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
public class StorageWizardReady extends StorageWizardBase {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -31,27 +33,23 @@ public class StorageWizardReady extends StorageWizardBase {
|
||||
}
|
||||
setContentView(R.layout.storage_wizard_generic);
|
||||
|
||||
setHeaderText(R.string.storage_wizard_ready_title, mDisk.getDescription());
|
||||
setHeaderText(R.string.storage_wizard_ready_title, mDisk.getShortDescription());
|
||||
|
||||
// TODO: handle mixed partition cases instead of just guessing based on
|
||||
// first volume type we encounter
|
||||
final VolumeInfo publicVol = findFirstVolume(VolumeInfo.TYPE_PUBLIC);
|
||||
final VolumeInfo privateVol = findFirstVolume(VolumeInfo.TYPE_PRIVATE);
|
||||
if (publicVol != null) {
|
||||
setIllustrationType(ILLUSTRATION_PORTABLE);
|
||||
setBodyText(R.string.storage_wizard_ready_external_body,
|
||||
mDisk.getDescription());
|
||||
} else if (privateVol != null) {
|
||||
setIllustrationType(ILLUSTRATION_INTERNAL);
|
||||
setBodyText(R.string.storage_wizard_ready_internal_body,
|
||||
final boolean migrateSkip = getIntent().getBooleanExtra(EXTRA_MIGRATE_SKIP, false);
|
||||
if (privateVol != null && !migrateSkip) {
|
||||
setBodyText(R.string.storage_wizard_ready_v2_internal_body,
|
||||
mDisk.getDescription(), mDisk.getShortDescription());
|
||||
} else {
|
||||
setBodyText(R.string.storage_wizard_ready_v2_external_body,
|
||||
mDisk.getDescription());
|
||||
}
|
||||
|
||||
getNextButton().setText(R.string.done);
|
||||
setNextButtonText(R.string.done);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateNext() {
|
||||
public void onNavigateNext(View view) {
|
||||
finishAffinity();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user