Example usage for android.os.storage VolumeInfo TYPE_PUBLIC

List of usage examples for android.os.storage VolumeInfo TYPE_PUBLIC

Introduction

In this page you can find the example usage for android.os.storage VolumeInfo TYPE_PUBLIC.

Prototype

int TYPE_PUBLIC

To view the source code for android.os.storage VolumeInfo TYPE_PUBLIC.

Click Source Link

Usage

From source file:com.android.tv.settings.device.storage.FormatActivity.java

@Override
public void onRequestFormatAsPrivate(String diskId) {
    final FormattingProgressFragment fragment = FormattingProgressFragment.newInstance();
    getFragmentManager().beginTransaction().replace(android.R.id.content, fragment).commit();

    mFormatAsPrivateDiskId = diskId;/*from   w w w . jav a2  s.  c  om*/
    final List<VolumeInfo> volumes = mStorageManager.getVolumes();
    for (final VolumeInfo volume : volumes) {
        if ((volume.getType() == VolumeInfo.TYPE_PRIVATE || volume.getType() == VolumeInfo.TYPE_PUBLIC)
                && TextUtils.equals(volume.getDiskId(), diskId)) {
            mFormatDiskDesc = mStorageManager.getBestVolumeDescription(volume);
        }
    }
    if (TextUtils.isEmpty(mFormatDiskDesc)) {
        final DiskInfo info = mStorageManager.findDiskById(diskId);
        if (info != null) {
            mFormatDiskDesc = info.getDescription();
        }
    }
    SettingsStorageService.formatAsPrivate(this, diskId);
}