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) { |             if (storageVolume.isPrimary) { | ||||||
|                 // internal storage |                 // internal storage | ||||||
|                 volumeName = PRIMARY_VOLUME_NAME |                 volumeName = PRIMARY_VOLUME_NAME | ||||||
|                 val storageStatsManager = context.getSystemService(AppCompatActivity.STORAGE_STATS_SERVICE) as StorageStatsManager |                 if (isOreoPlus()) { | ||||||
|                 val uuid = StorageManager.UUID_DEFAULT |                     val storageStatsManager = context.getSystemService(AppCompatActivity.STORAGE_STATS_SERVICE) as StorageStatsManager | ||||||
|                 totalStorageSpace = storageStatsManager.getTotalBytes(uuid) |                     val uuid = StorageManager.UUID_DEFAULT | ||||||
|                 freeStorageSpace = storageStatsManager.getFreeBytes(uuid) |                     totalStorageSpace = storageStatsManager.getTotalBytes(uuid) | ||||||
|  |                     freeStorageSpace = storageStatsManager.getFreeBytes(uuid) | ||||||
|  |                 } else { | ||||||
|  |                     totalStorageSpace = file.totalSpace | ||||||
|  |                     freeStorageSpace = file.freeSpace | ||||||
|  |                 } | ||||||
|             } else { |             } else { | ||||||
|                 volumeName = storageVolume.uuid!!.lowercase(Locale.US) |                 volumeName = storageVolume.uuid!!.lowercase(Locale.US) | ||||||
|                 totalStorageSpace = file.totalSpace |                 totalStorageSpace = file.totalSpace | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user