Revamp SD card UX

Improve the SD card setup flow so that each formatting option is provided in a separate screen with clear description and illustration.Also make sure that guest users do not have any access to formatting options.

Test: Manual testing on Pixel Device
Screenshot1: https://screenshot.googleplex.com/WJwyxFkBtbSfZmN.png
Screenshot2: https://screenshot.googleplex.com/3oBcrrgRsKTxNPC.png

Bug: 201252175
Change-Id: I77df55c40fd99cabcfc6128084be035bb5b19531

Change-Id: I757abc6076fcc8f467d8faed9f090bcdd5774ff3
This commit is contained in:
sayakiitg
2022-01-12 10:45:33 +00:00
committed by Sayak Dutta
parent a9bc498a11
commit 9b432d54a6
22 changed files with 658 additions and 489 deletions

View File

@@ -19,6 +19,7 @@ package com.android.settings.deviceinfo;
import android.app.ActivityManager;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.UserManager;
@@ -57,15 +58,34 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
private String mVolumeId;
private VolumeInfo mVolume;
private final View.OnClickListener mUnmountListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
new UnmountTask(getActivity(), mVolume).execute();
}
};
private DiskInfo mDisk;
private UsageProgressBarPreference mSummary;
private Preference mMount;
private Preference mFormatPublic;
private Preference mFormatPrivate;
private Button mUnmount;
private final StorageEventListener mStorageListener = new StorageEventListener() {
@Override
public void onVolumeStateChanged(VolumeInfo vol, int oldState, int newState) {
if (Objects.equals(mVolume.getId(), vol.getId())) {
mVolume = vol;
update();
}
}
@Override
public void onVolumeRecordChanged(VolumeRecord rec) {
if (Objects.equals(mVolume.getFsUuid(), rec.getFsUuid())) {
mVolume = mStorageManager.findVolumeById(mVolumeId);
update();
}
}
};
private boolean mIsPermittedToAdopt;
private boolean isVolumeValid() {
@@ -120,10 +140,7 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
mUnmount = new Button(getActivity());
mUnmount.setText(R.string.storage_menu_unmount);
mUnmount.setOnClickListener(mUnmountListener);
mFormatPublic = buildAction(R.string.storage_menu_format);
if (mIsPermittedToAdopt) {
mFormatPrivate = buildAction(R.string.storage_menu_format_private);
}
mFormatPublic = buildAction(R.string.storage_menu_format_option);
}
@Override
@@ -176,9 +193,6 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
mUnmount.setVisibility(View.GONE);
}
addPreference(mFormatPublic);
if (mDisk.isAdoptable() && mIsPermittedToAdopt) {
addPreference(mFormatPrivate);
}
}
private void addPreference(Preference pref) {
@@ -215,39 +229,14 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
@Override
public boolean onPreferenceTreeClick(Preference pref) {
final Intent intent = new Intent(getActivity(), StorageWizardInit.class);
intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, mVolume.getId());
if (pref == mMount) {
new MountTask(getActivity(), mVolume).execute();
} else if (pref == mFormatPublic) {
StorageWizardFormatConfirm.showPublic(getActivity(), mDisk.getId());
} else if (pref == mFormatPrivate) {
StorageWizardFormatConfirm.showPrivate(getActivity(), mDisk.getId());
startActivity(intent);
}
return super.onPreferenceTreeClick(pref);
}
private final View.OnClickListener mUnmountListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
new UnmountTask(getActivity(), mVolume).execute();
}
};
private final StorageEventListener mStorageListener = new StorageEventListener() {
@Override
public void onVolumeStateChanged(VolumeInfo vol, int oldState, int newState) {
if (Objects.equals(mVolume.getId(), vol.getId())) {
mVolume = vol;
update();
}
}
@Override
public void onVolumeRecordChanged(VolumeRecord rec) {
if (Objects.equals(mVolume.getFsUuid(), rec.getFsUuid())) {
mVolume = mStorageManager.findVolumeById(mVolumeId);
update();
}
}
};
}
}