-
Notifications
You must be signed in to change notification settings - Fork 97
Description
Hi. Since November is the deadline for all the apps to start using targetSdkVersion 29, This library doesn't work. Here are the logs that i faced when i upgraded my sdk version.
W/System.err: java.io.IOException: Cannot run program "/data/user/0/<app-id>/app_torfiles/tor" (in directory "/data/user/0/<app-id>/app_torfiles"): error=13, Permission denied W/System.err: at java.lang.ProcessBuilder.start(ProcessBuilder.java:1050) W/System.err: at com.msopentech.thali.toronionproxy.OnionProxyManager.installAndStartTorOp(OnionProxyManager.java:366) W/System.err: at com.msopentech.thali.android.toronionproxy.AndroidOnionProxyManager.installAndStartTorOp(AndroidOnionProxyManager.java:66) W/System.err: at com.msopentech.thali.toronionproxy.OnionProxyManager.startWithRepeat(OnionProxyManager.java:106) W/System.err: at <app-id>.shared.tor.TorProxyService.onHandleIntent(TorProxyService.kt:24) W/System.err: at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:78) W/System.err: at android.os.Handler.dispatchMessage(Handler.java:107) W/System.err: at android.os.Looper.loop(Looper.java:214) W/System.err: at android.os.HandlerThread.run(HandlerThread.java:67) W/System.err: Caused by: java.io.IOException: error=13, Permission denied W/System.err: at java.lang.UNIXProcess.forkAndExec(Native Method) W/System.err: at java.lang.UNIXProcess.<init>(UNIXProcess.java:133) W/System.err: at java.lang.ProcessImpl.start(ProcessImpl.java:141) W/System.err: at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) W/System.err: ... 8 more
And here is my implementation for TorProxyService
package mypackage.shared.tor
import android.app.IntentService
import android.content.Intent
import com.msopentech.thali.android.toronionproxy.AndroidOnionProxyManager
import com.msopentech.thali.toronionproxy.OnionProxyManager
import mypackage.ObserverUtils
import mypackage.shared.utils.Logger
class TorProxyService : IntentService("TorProxyIntentService") {
override fun onHandleIntent(p0: Intent?) {
return try {
ObserverUtils.torObserver.post(TorStatus.CONNECTING)
Logger.showDebugLog(TorConstants.TAG, "Starting TOR \uD83D\uDEA7 \uD83D\uDEA7 \uD83D\uDEA7 \uD83D\uDEA7")
val fileStorageLocation = "torfiles"
val proxyManager: OnionProxyManager = AndroidOnionProxyManager(applicationContext, fileStorageLocation)
val totalSecondsPerTorStartup = 4 * 60
val totalTriesPerTorStartup = 5
val torStarted = proxyManager.startWithRepeat(totalSecondsPerTorStartup, totalTriesPerTorStartup)
if (!torStarted) {
Logger.showDebugLog(TorConstants.TAG, "Couldn't start TOR ❌❌❌❌")
ObserverUtils.torObserver.post(TorStatus.DISCONNECTED)
} else {
while (!proxyManager.isRunning) {
Thread.sleep(90)
}
TorConstants.TOR_SOCK_PORT = proxyManager.iPv4LocalHostSocksPort
Logger.showDebugLog(TorConstants.TAG, "TOR Started ✅✅✅✅")
ObserverUtils.torObserver.post(TorStatus.CONNECTED)
}
} catch (e: Exception) {
e.printStackTrace()
Logger.showDebugLog(TorConstants.TAG, "Couldn't start TOR ❌❌❌❌")
ObserverUtils.torObserver.post(TorStatus.DISCONNECTED)
}
}
}