Fix ShouldUseInterpreterEntrypoint for pendding hook
This commit is contained in:
parent
3896a76373
commit
716dfae0f6
|
|
@ -125,21 +125,8 @@ public class App extends Application {
|
||||||
|
|
||||||
pref = PreferenceManager.getDefaultSharedPreferences(this);
|
pref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
|
||||||
master();
|
|
||||||
NotificationUtil.init();
|
NotificationUtil.init();
|
||||||
|
|
||||||
Shizuku.addRequestPermissionResultListener(REQUEST_PERMISSION_RESULT_LISTENER);
|
Shizuku.addRequestPermissionResultListener(REQUEST_PERMISSION_RESULT_LISTENER);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void master() {
|
|
||||||
// This will affect the fengshui of the whole app, don't remove this
|
|
||||||
Constants.getXposedVersionCode();
|
|
||||||
Constants.getXposedVersion();
|
|
||||||
Constants.getXposedApiVersion();
|
|
||||||
Constants.getXposedVariant();
|
|
||||||
Constants.getBaseDir();
|
|
||||||
Constants.getModulesListFile();
|
|
||||||
Constants.getEnabledModulesListFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,62 +4,34 @@ import android.util.Log;
|
||||||
|
|
||||||
public class Constants {
|
public class Constants {
|
||||||
public static int getXposedApiVersion() {
|
public static int getXposedApiVersion() {
|
||||||
try {
|
|
||||||
Log.e(App.TAG, "getXposedApiVersion: Xposed is not active");
|
Log.e(App.TAG, "getXposedApiVersion: Xposed is not active");
|
||||||
return -1;
|
return -1;
|
||||||
} catch (Exception e) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getXposedVersion() {
|
public static String getXposedVersion() {
|
||||||
try {
|
|
||||||
Log.e(App.TAG, "getXposedVersion: Xposed is not active");
|
Log.e(App.TAG, "getXposedVersion: Xposed is not active");
|
||||||
return null;
|
return null;
|
||||||
} catch (Exception e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getXposedVersionCode() {
|
public static int getXposedVersionCode() {
|
||||||
try {
|
|
||||||
Log.e(App.TAG, "getXposedVersionCode: Xposed is not active");
|
Log.e(App.TAG, "getXposedVersionCode: Xposed is not active");
|
||||||
return -1;
|
return -1;
|
||||||
} catch (Exception e) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getXposedVariant() {
|
public static String getXposedVariant() {
|
||||||
try {
|
|
||||||
Log.e(App.TAG, "getXposedVariant: Xposed is not active");
|
Log.e(App.TAG, "getXposedVariant: Xposed is not active");
|
||||||
return null;
|
return null;
|
||||||
} catch (Exception e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getEnabledModulesListFile() {
|
public static String getEnabledModulesListFile() {
|
||||||
try {
|
|
||||||
return getBaseDir() + "conf/enabled_modules.list";
|
return getBaseDir() + "conf/enabled_modules.list";
|
||||||
} catch (Exception e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getModulesListFile() {
|
public static String getModulesListFile() {
|
||||||
try {
|
|
||||||
return getBaseDir() + "conf/modules.list";
|
return getBaseDir() + "conf/modules.list";
|
||||||
} catch (Exception e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getBaseDir() {
|
public static String getBaseDir() {
|
||||||
try {
|
|
||||||
return App.getInstance().getApplicationInfo().deviceProtectedDataDir + "/";
|
return App.getInstance().getApplicationInfo().deviceProtectedDataDir + "/";
|
||||||
} catch (Exception e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
package io.github.lsposed.manager.ui.activity;
|
package io.github.lsposed.manager.ui.activity;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import androidx.appcompat.widget.PopupMenu;
|
import androidx.appcompat.widget.PopupMenu;
|
||||||
import androidx.appcompat.widget.TooltipCompat;
|
import androidx.appcompat.widget.TooltipCompat;
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,14 @@ namespace lspd {
|
||||||
return pending_classes_.count(clazz);
|
return pending_classes_.count(clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PendingHooks_recordPendingMethodNative(JNI_START, jclass class_ref) {
|
static void PendingHooks_recordPendingMethodNative(JNI_START, jobject method_ref, jclass class_ref) {
|
||||||
auto *class_ptr = art::Thread::Current().DecodeJObject(class_ref);
|
auto *class_ptr = art::Thread::Current().DecodeJObject(class_ref);
|
||||||
|
auto *method = getArtMethod(env, method_ref);
|
||||||
art::mirror::Class mirror_class(class_ptr);
|
art::mirror::Class mirror_class(class_ptr);
|
||||||
if (auto def = mirror_class.GetClassDef(); LIKELY(def)) {
|
if (auto def = mirror_class.GetClassDef(); LIKELY(def)) {
|
||||||
LOGD("record pending: %p (%s)", class_ptr, mirror_class.GetDescriptor().c_str());
|
LOGD("record pending: %p (%s) with %p", class_ptr, mirror_class.GetDescriptor().c_str(), method);
|
||||||
|
// Add it for ShouldUseInterpreterEntrypoint
|
||||||
|
recordHooked(method);
|
||||||
pending_classes_.insert(def);
|
pending_classes_.insert(def);
|
||||||
} else {
|
} else {
|
||||||
LOGW("fail to record pending for : %p (%s)", class_ptr,
|
LOGW("fail to record pending for : %p (%s)", class_ptr,
|
||||||
|
|
@ -32,7 +35,7 @@ namespace lspd {
|
||||||
}
|
}
|
||||||
|
|
||||||
static JNINativeMethod gMethods[] = {
|
static JNINativeMethod gMethods[] = {
|
||||||
NATIVE_METHOD(PendingHooks, recordPendingMethodNative, "(Ljava/lang/Class;)V"),
|
NATIVE_METHOD(PendingHooks, recordPendingMethodNative, "(Ljava/lang/reflect/Member;Ljava/lang/Class;)V"),
|
||||||
};
|
};
|
||||||
|
|
||||||
void RegisterPendingHooks(JNIEnv *env) {
|
void RegisterPendingHooks(JNIEnv *env) {
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,12 @@ public final class PendingHooks {
|
||||||
});
|
});
|
||||||
|
|
||||||
pending.put(hookMethod, additionalInfo);
|
pending.put(hookMethod, additionalInfo);
|
||||||
recordPendingMethodNative(hookMethod.getDeclaringClass());
|
recordPendingMethodNative(hookMethod, hookMethod.getDeclaringClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void cleanUp() {
|
public synchronized void cleanUp() {
|
||||||
sPendingHooks.clear();
|
sPendingHooks.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static native void recordPendingMethodNative(Class clazz);
|
private static native void recordPendingMethodNative(Member hookMethod, Class clazz);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue