Unshare `/data/resource-cache` (#1627)

to avoid overlay conflict
This commit is contained in:
LoveSy 2022-02-05 01:09:54 +08:00 committed by GitHub
parent dab4879176
commit d6dfc3ac0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 9 deletions

View File

@ -85,7 +85,7 @@ extract "$ZIPFILE" 'service.sh' "$MODPATH"
extract "$ZIPFILE" 'uninstall.sh' "$MODPATH"
extract "$ZIPFILE" 'framework/lspd.dex' "$MODPATH"
extract "$ZIPFILE" 'daemon.apk' "$MODPATH"
extract "$ZIPFILE" 'lspd' "$MODPATH"
extract "$ZIPFILE" 'daemon' "$MODPATH"
rm -f /data/adb/lspd/manager.apk
extract "$ZIPFILE" 'manager.apk' '/data/adb/lspd'
@ -162,7 +162,7 @@ elif [ "$FLAVOR" == "riru" ]; then
fi
set_perm_recursive "$MODPATH" 0 0 0755 0644
chmod 0744 "$MODPATH/lspd"
chmod 0744 "$MODPATH/daemon"
if [ "$(grep_prop ro.maple.enable)" == "1" ] && [ "$FLAVOR" == "zygisk" ]; then
ui_print "- Add ro.maple.enable=0"

View File

@ -24,5 +24,7 @@ if [ $debug = "true" ]; then
fi
fi
mount tmpfs -t tmpfs /data/resource-cache
# shellcheck disable=SC2086
exec /system/bin/app_process $java_options /system/bin --nice-name=lspd org.lsposed.lspd.Main "$@" >/dev/null 2>&1

View File

@ -20,4 +20,4 @@
MODDIR=${0%/*}
rm -f "/data/local/tmp/daemon.apk"
unshare -m sh -c "$MODDIR/lspd &"
unshare -m sh -c "$MODDIR/daemon &"

View File

@ -19,4 +19,4 @@
MODDIR=${0%/*}
# post-fs-data.sh may be blocked by other modules. retry to start this
unshare -m "$MODDIR/lspd" --from-service "$@"&
unshare -m "$MODDIR/daemon" --from-service "$@"&

@ -1 +1 @@
Subproject commit 236b1b03b4c6f9465faba94a0bae7ed8c99c6e67
Subproject commit 9d202f44c90489ef4759328a3f55a56effdc9105

View File

@ -194,10 +194,11 @@ namespace lspd {
kMid = JNI_GetMethodID(env, kInMemoryClassloader, "findClass",
"(Ljava/lang/String;)Ljava/lang/Class;");
}
auto target = JNI_CallObjectMethod(env, my_cl, kMid, env->NewStringUTF("LspHooker_"));
// LOGD("Created %zd", image.size());
if (target) {
return (jclass) target.release();
if (my_cl) {
auto target = JNI_CallObjectMethod(env, my_cl, kMid, env->NewStringUTF("LspHooker_"));
if (target) {
return (jclass) target.release();
}
}
return nullptr;
}

View File

@ -106,6 +106,7 @@ public class HookerDexMaker {
private void doMake(String methodName) throws Exception {
Class<?> hookClass = Yahfa.buildHooker(LspHooker.class.getClassLoader(), getDescriptor(mReturnType), getDescriptors(mActualParameterTypes), methodName);
if (hookClass == null) throw new IllegalStateException("Failed to hook " + methodName);
// Execute our newly-generated code in-process.
Method backupMethod = hookClass.getMethod(METHOD_NAME_BACKUP, mActualParameterTypes);
mHooker = new LspHooker(mHookInfo, mMember, backupMethod);