Revert "Use the same cacheDir to reuse cache"

This reverts commit d2f9f592a5.

Fixes error like: Optimized data directory <dir> is not owned by the current user. Shared storage cannot protect your application from code injection attacks.
This commit is contained in:
Mygod
2020-07-09 12:16:09 -04:00
parent 8674369b5b
commit 78f32cde3c

View File

@@ -336,8 +336,12 @@ object TetheringManager {
} catch (e: InvocationTargetException) { } catch (e: InvocationTargetException) {
if (e.targetException is SecurityException) GlobalScope.launch(Dispatchers.Unconfined) { if (e.targetException is SecurityException) GlobalScope.launch(Dispatchers.Unconfined) {
val result = try { val result = try {
val rootCache = File(cacheDir, "root")
rootCache.mkdirs()
check(rootCache.exists()) { "Creating root cache dir failed" }
RootManager.use { RootManager.use {
it.execute(be.mygod.vpnhotspot.root.StartTetheringLegacy(cacheDir, type, showProvisioningUi)) it.execute(be.mygod.vpnhotspot.root.StartTetheringLegacy(
rootCache, type, showProvisioningUi))
}.value }.value
} catch (eRoot: Exception) { } catch (eRoot: Exception) {
eRoot.addSuppressed(e) eRoot.addSuppressed(e)