Merge pull request #345 from kyelbek/dev

Fix crashes in root variant after device reboots.
This commit is contained in:
Tornike Khintibidze 2021-01-10 14:12:07 +04:00 committed by GitHub
commit 3a8722bdc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -88,10 +88,10 @@ object Extensions {
}
}
fun Context.writeServiceDScript(path: String, apkFPath: String, app: String) {
fun Context.writeServiceDScript(apkFPath: String, path: String, app: String) {
val shellFileZ = SuFile.open("/data/adb/service.d/$app.sh")
shellFileZ.createNewFile()
val code = """#!/system/bin/sh${"\n"}while [ "`getprop sys.boot_completed | tr -d '\r' `" != "1" ]; do sleep ${getDefaultPrefs().getInt("serviced_sleep_timer", 1)}; done${"\n"}mount -o bind $apkFPath $path"""
val code = """#!/system/bin/sh${"\n"}while [ "`getprop sys.boot_completed | tr -d '\r' `" != "1" ]; do sleep ${getDefaultPrefs().getInt("serviced_sleep_timer", 1)}; done${"\n"}chcon u:object_r:apk_data_file:s0 $apkFPath${"\n"}mount -o bind $apkFPath $path"""
SuFileOutputStream(shellFileZ).use { out -> out.write(code.toByteArray())}
}

View File

@ -524,8 +524,8 @@ object PackageHelper {
}
//set chcon to apk_data_file
private fun chConV(path: String, context: Context): Boolean {
val response = Shell.su("chcon u:object_r:apk_data_file:s0 $path").exec()
private fun chConV(apkFPath: String, context: Context): Boolean {
val response = Shell.su("chcon u:object_r:apk_data_file:s0 $apkFPath").exec()
//val response = Shell.su("chcon -R u:object_r:system_file:s0 $path").exec()
return if (response.isSuccess) {
true