mirror of
				https://github.com/SimpleMobileTools/Simple-File-Manager.git
				synced 2025-06-05 22:09:15 +02:00 
			
		
		
		
	Prevent crashes on devices before Oreo version
This commit is contained in:
		| @@ -286,10 +286,15 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage | ||||
|             if (storageVolume.isPrimary) { | ||||
|                 // internal storage | ||||
|                 volumeName = PRIMARY_VOLUME_NAME | ||||
|                 val storageStatsManager = context.getSystemService(AppCompatActivity.STORAGE_STATS_SERVICE) as StorageStatsManager | ||||
|                 val uuid = StorageManager.UUID_DEFAULT | ||||
|                 totalStorageSpace = storageStatsManager.getTotalBytes(uuid) | ||||
|                 freeStorageSpace = storageStatsManager.getFreeBytes(uuid) | ||||
|                 if (isOreoPlus()) { | ||||
|                     val storageStatsManager = context.getSystemService(AppCompatActivity.STORAGE_STATS_SERVICE) as StorageStatsManager | ||||
|                     val uuid = StorageManager.UUID_DEFAULT | ||||
|                     totalStorageSpace = storageStatsManager.getTotalBytes(uuid) | ||||
|                     freeStorageSpace = storageStatsManager.getFreeBytes(uuid) | ||||
|                 } else { | ||||
|                     totalStorageSpace = file.totalSpace | ||||
|                     freeStorageSpace = file.freeSpace | ||||
|                 } | ||||
|             } else { | ||||
|                 volumeName = storageVolume.uuid!!.lowercase(Locale.US) | ||||
|                 totalStorageSpace = file.totalSpace | ||||
|   | ||||
		Reference in New Issue
	
	Block a user