From a91e47899de511b0ef6b7de6ed36c49ada1db9c5 Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Wed, 10 Aug 2022 13:51:30 -0400 Subject: [PATCH] Android: Prevent app lockup when revoking write access --- .../org/dolphinemu/dolphinemu/ui/main/MainPresenter.java | 6 ++++++ .../org/dolphinemu/dolphinemu/utils/StartupHandler.java | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainPresenter.java index 32d40234fe..e012cd84dc 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainPresenter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainPresenter.java @@ -26,7 +26,9 @@ import org.dolphinemu.dolphinemu.utils.AfterDirectoryInitializationRunner; import org.dolphinemu.dolphinemu.utils.BooleanSupplier; import org.dolphinemu.dolphinemu.utils.CompletableFuture; import org.dolphinemu.dolphinemu.utils.ContentHandler; +import org.dolphinemu.dolphinemu.utils.DirectoryInitialization; import org.dolphinemu.dolphinemu.utils.FileBrowserHelper; +import org.dolphinemu.dolphinemu.utils.PermissionsHandler; import org.dolphinemu.dolphinemu.utils.ThreadUtil; import org.dolphinemu.dolphinemu.utils.WiiUtils; @@ -56,6 +58,10 @@ public final class MainPresenter public void onCreate() { + // Ask the user to grant write permission if relevant and not already granted + if (DirectoryInitialization.isWaitingForWriteAccess(mActivity)) + PermissionsHandler.requestWritePermission(mActivity); + String versionName = BuildConfig.VERSION_NAME; mView.setVersionString(versionName); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java index 360ae1a030..ba4062bb88 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java @@ -26,10 +26,6 @@ public final class StartupHandler public static void HandleInit(FragmentActivity parent) { - // Ask the user to grant write permission if relevant and not already granted - if (DirectoryInitialization.isWaitingForWriteAccess(parent)) - PermissionsHandler.requestWritePermission(parent); - // Ask the user if he wants to enable analytics if we haven't yet. Analytics.checkAnalyticsInit(parent);