List of usage examples for android.os.storage VolumeInfo TYPE_PRIVATE
int TYPE_PRIVATE
To view the source code for android.os.storage VolumeInfo TYPE_PRIVATE.
Click Source Link
From source file:com.android.tv.settings.device.storage.UnmountActivity.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mUnmountVolumeId = getIntent().getStringExtra(VolumeInfo.EXTRA_VOLUME_ID); mUnmountVolumeDesc = getIntent().getStringExtra(EXTRA_VOLUME_DESC); LocalBroadcastManager.getInstance(this).registerReceiver(mUnmountReceiver, new IntentFilter(SettingsStorageService.ACTION_UNMOUNT)); if (savedInstanceState == null) { final StorageManager storageManager = getSystemService(StorageManager.class); final VolumeInfo volumeInfo = storageManager.findVolumeById(mUnmountVolumeId); if (volumeInfo == null) { // Unmounted already, just bail finish();/*from www . j a v a 2s. c o m*/ return; } if (volumeInfo.getType() == VolumeInfo.TYPE_PRIVATE) { final Fragment fragment = UnmountPrivateStepFragment.newInstance(mUnmountVolumeId); getFragmentManager().beginTransaction().replace(android.R.id.content, fragment).commit(); } else { // Jump straight to unmounting onRequestUnmount(); } } }
From source file:com.android.tv.settings.device.storage.FormatActivity.java
@Override protected void onResume() { super.onResume(); if (!TextUtils.isEmpty(mFormatAsPrivateDiskId)) { final VolumeInfo volumeInfo = findVolume(mFormatAsPrivateDiskId); if (volumeInfo != null && volumeInfo.getType() == VolumeInfo.TYPE_PRIVATE) { // Formatting must have completed while we were paused // We've lost the benchmark data, so just assume the drive is fast enough handleFormatAsPrivateComplete(-1, -1); }//from ww w.ja v a 2s.c o m } }
From source file:com.android.tv.settings.device.storage.FormatActivity.java
private VolumeInfo findVolume(String diskId) { final List<VolumeInfo> vols = mStorageManager.getVolumes(); for (final VolumeInfo vol : vols) { if (TextUtils.equals(diskId, vol.getDiskId()) && (vol.getType() == VolumeInfo.TYPE_PRIVATE)) { return vol; }//from ww w .j ava2s. co m } return null; }
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 ww . j av a 2s . co m 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); }