/** * <get all external devices> <Functional Details> * * @return external devices collection. * @see [Class,Class#Method,Class#Member] */ private List<MountInfoBean> getAllMountDevices() { List<MountInfoBean> list = new ArrayList<MountInfoBean>(); MountInfoBean bean = null; String path = null; StorageVolume[] storageVolumes = mStorageManager.getVolumeList(); if (null != storageVolumes) { for (int i = 0; i < storageVolumes.length; i++) { bean = new MountInfoBean(); path = storageVolumes[i].getPath(); bean.setPath(path); bean.setType(getPathType(path)); list.add(bean); } } return list; }
/** **************************************************************** about DeviceStorage() */ private void InitStorage() { Log.v(TAG, ">>>>>>>>> InitStorage : "); if (mStorageManager == null) { mStorageManager = (StorageManager) getSystemService(Context.STORAGE_SERVICE); mStorageManager.registerListener(mStorageListener); storageVolumes = mStorageManager.getVolumeList(); Log.v(TAG, ">>>>>>>>> InitStorage storageVolumes : " + storageVolumes); if (storageVolumes.length >= 3) { flash_path = storageVolumes[flash_pit].getPath(); sdcard_path = storageVolumes[sdcard_pit].getPath(); usb_path = storageVolumes[usb_pit].getPath(); Log.d(TAG, " >>>>>>> _____ " + flash_path + " " + sdcard_path + " " + usb_path); } else if (storageVolumes.length == 2) { sdcard_path = storageVolumes[flash_pit].getPath(); usb_path = storageVolumes[sdcard_pit].getPath(); } } }