From 78f32cde3cc62da42d26cb0655796966bcc1ecbf Mon Sep 17 00:00:00 2001 From: Mygod Date: Thu, 9 Jul 2020 12:16:09 -0400 Subject: [PATCH] Revert "Use the same cacheDir to reuse cache" This reverts commit d2f9f592a568cfd634167056068bccbb7f56c12a. Fixes error like: Optimized data directory is not owned by the current user. Shared storage cannot protect your application from code injection attacks. --- .../main/java/be/mygod/vpnhotspot/net/TetheringManager.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/TetheringManager.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/TetheringManager.kt index 09e48711..29e9c4f4 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/TetheringManager.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/TetheringManager.kt @@ -336,8 +336,12 @@ object TetheringManager { } catch (e: InvocationTargetException) { if (e.targetException is SecurityException) GlobalScope.launch(Dispatchers.Unconfined) { val result = try { + val rootCache = File(cacheDir, "root") + rootCache.mkdirs() + check(rootCache.exists()) { "Creating root cache dir failed" } RootManager.use { - it.execute(be.mygod.vpnhotspot.root.StartTetheringLegacy(cacheDir, type, showProvisioningUi)) + it.execute(be.mygod.vpnhotspot.root.StartTetheringLegacy( + rootCache, type, showProvisioningUi)) }.value } catch (eRoot: Exception) { eRoot.addSuppressed(e)