Fix direct boot
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package be.mygod.vpnhotspot.util
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.annotation.TargetApi
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
|
||||
@SuppressLint("Registered")
|
||||
@TargetApi(24)
|
||||
class DeviceStorageApp(context: Context) : Application() {
|
||||
init {
|
||||
attachBaseContext(context.createDeviceProtectedStorageContext())
|
||||
}
|
||||
|
||||
/**
|
||||
* Thou shalt not get the REAL underlying application context which would no longer be operating under device
|
||||
* protected storage.
|
||||
*/
|
||||
override fun getApplicationContext(): Context = this
|
||||
}
|
||||
@@ -14,7 +14,7 @@ private class SuFailure : RuntimeException()
|
||||
fun loggerSuStream(command: String): InputStream? {
|
||||
val process = try {
|
||||
ProcessBuilder("su", "-c", command)
|
||||
.directory(app.deviceContext.cacheDir)
|
||||
.directory(app.deviceStorage.cacheDir)
|
||||
.redirectErrorStream(true)
|
||||
.start()
|
||||
} catch (e: IOException) {
|
||||
|
||||
Reference in New Issue
Block a user