List of usage examples for android.os.storage VolumeInfo getType
@UnsupportedAppUsage public int getType()
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 .ja v a2 s. com*/ 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); }
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; }/*ww w . j av a2 s . c o m*/ } return null; }
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); }// w w w . j a v a 2 s.c om } }
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 w ww. j a v a2 s . com 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(); } } }