内置T卡格式化过程:
com.android.settings.deviceinfo.PrivateVolumeFormat
final StorageManager storage = getActivity().getSystemService(StorageManager.class);
final String volumeId = getArguments().getString(VolumeInfo.EXTRA_VOLUME_ID);
final View view = inflater.inflate(R.layout.storage_internal_format, container, false);
final TextView body = (TextView) view.findViewById(R.id.body);
final Button confirm = (Button) view.findViewById(R.id.confirm);
/* SPRD modified for Bug724968, crash after unmount sdcard and rotate the screen {@ */
mVolume = storage.findVolumeById(volumeId);
if (mVolume == null) {
getActivity().finish();
} else {
mDisk = storage.findDiskById(mVolume.getDiskId());
body.setText(TextUtils.expandTemplate(getText(R.string.storage_internal_format_details),
mDisk.getDescription()));
}
/* @} */
confirm.setOnClickListener(mConfirmListener);
private final OnClickListener mConfirmListener = new OnClickListener() {
@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());
startActivity(intent);
getActivity().finish();
}
};
外部T卡格式化
om.android.settings.Settings$StorageDashboardActivity
com.android.documentsui.files.FilesActivity
com.android.settings/com.android.settings.Settings$PublicVolumeSettingsActivity
com.android.settings.deviceinfo.StorageWizardFormatConfirm
} else if (pref == mFormatPublic) {//外部T卡
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);
} else if (pref == mFormatPrivate) {//内部T卡
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);
}
storage.partitionPublic(activity.mDisk.getId());格式化接口