From ca2c61bab4a29c2b4cf7df650c02890e7a4ca0a3 Mon Sep 17 00:00:00 2001 From: Muntashir Al-Islam Date: Mon, 31 May 2021 05:36:20 +0600 Subject: [PATCH] [Installer] Fix extracting OBB in Android 11 Signed-off-by: Muntashir Al-Islam --- .../AppManager/apk/installer/PackageInstallerCompat.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/github/muntashirakon/AppManager/apk/installer/PackageInstallerCompat.java b/app/src/main/java/io/github/muntashirakon/AppManager/apk/installer/PackageInstallerCompat.java index 188bdcb37a3..0868c4add53 100644 --- a/app/src/main/java/io/github/muntashirakon/AppManager/apk/installer/PackageInstallerCompat.java +++ b/app/src/main/java/io/github/muntashirakon/AppManager/apk/installer/PackageInstallerCompat.java @@ -704,7 +704,7 @@ protected void copyObb(@NonNull ApkFile apkFile) { ProxyFile[] extDirs = ue.getExternalDirs(); ProxyFile writableExtDir = null; for (ProxyFile extDir : extDirs) { - if (extDir.canWrite()) { + if (extDir.canWrite() || extDir.getAbsolutePath().startsWith("/storage/emulated")) { writableExtDir = extDir; break; } @@ -726,6 +726,7 @@ protected void copyObb(@NonNull ApkFile apkFile) { apkFile.extractObb(writableObbDir); UiThreadHandler.run(() -> UIUtils.displayLongToast(R.string.obb_files_extracted_successfully)); } catch (Exception e) { + Log.e(TAG, e); UiThreadHandler.run(() -> UIUtils.displayLongToast(R.string.failed_to_extract_obb_files)); } finally { if (installWatcher.getCount() != 0) {