Skip to content

Commit

Permalink
Disable Removable Devices Detection on SDK Lower Than 30
Browse files Browse the repository at this point in the history
  • Loading branch information
KreitinnSoftware committed Jan 6, 2025
1 parent bf16759 commit 1fb4f48
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app/src/main/java/com/micewine/emu/activities/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class MainActivity : AppCompatActivity() {
private val aboutFragment: AboutFragment = AboutFragment()
private var preferences: SharedPreferences? = null

@SuppressLint("UnspecifiedRegisterReceiverFlag", "NewApi")
@SuppressLint("UnspecifiedRegisterReceiverFlag")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

Expand Down Expand Up @@ -308,12 +308,14 @@ class MainActivity : AppCompatActivity() {

onNewIntent(intent)

if (winePrefix.exists()) {
WineWrapper.clearDrives()
if (Build.VERSION.SDK_INT > 30) {
if (winePrefix.exists()) {
WineWrapper.clearDrives()

(application.getSystemService(Context.STORAGE_SERVICE) as StorageManager).storageVolumes.forEach { volume ->
if (volume.isRemovable) {
WineWrapper.addDrive("${volume.directory}")
(application.getSystemService(Context.STORAGE_SERVICE) as StorageManager).storageVolumes.forEach { volume ->
if (volume.isRemovable) {
WineWrapper.addDrive("${volume.directory}")
}
}
}
}
Expand Down

0 comments on commit 1fb4f48

Please sign in to comment.