You've already forked TrickyStore
mirror of
https://github.com/5ec1cff/TrickyStore.git
synced 2025-09-06 06:37:07 +00:00
fix config observer
This commit is contained in:
@@ -34,12 +34,12 @@ object Config {
|
||||
private const val KEYBOX_FILE = "keybox.xml"
|
||||
private val root = File(CONFIG_PATH)
|
||||
|
||||
object ConfigObserver : FileObserver(root, CLOSE_WRITE or DELETE) {
|
||||
object ConfigObserver : FileObserver(root, CLOSE_WRITE or DELETE or MOVED_FROM or MOVED_TO) {
|
||||
override fun onEvent(event: Int, path: String?) {
|
||||
path ?: return
|
||||
val f = when (event) {
|
||||
CLOSE_WRITE -> File(root, path)
|
||||
DELETE -> null
|
||||
CLOSE_WRITE, MOVED_TO -> File(root, path)
|
||||
DELETE, MOVED_FROM -> null
|
||||
else -> return
|
||||
}
|
||||
when (path) {
|
||||
|
||||
@@ -33,7 +33,7 @@ object KeystoreInterceptor : BinderInterceptor() {
|
||||
callingPid: Int,
|
||||
data: Parcel
|
||||
): Result {
|
||||
if (code == targetTransaction) {
|
||||
if (code == targetTransaction && CertHack.canHack() && Config.targetPackages.isNotEmpty()) {
|
||||
Logger.d("intercept pre $target uid=$callingUid pid=$callingPid dataSz=${data.dataSize()}")
|
||||
kotlin.runCatching {
|
||||
val ps = getPm()?.getPackagesForUid(callingUid)
|
||||
|
||||
@@ -55,6 +55,10 @@ public final class CertHack {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean canHack() {
|
||||
return !keyboxes.isEmpty();
|
||||
}
|
||||
|
||||
public static void readFromXml(String data) {
|
||||
keyboxes.clear();
|
||||
if (data == null) {
|
||||
@@ -91,7 +95,7 @@ public final class CertHack {
|
||||
}
|
||||
Logger.i("update " + numberOfKeyboxes + " keyboxes");
|
||||
} catch (Throwable t) {
|
||||
Logger.e("Error loading xml file: " + t);
|
||||
Logger.e("Error loading xml file (keyboxes cleared): " + t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user