Skip to content

Commit e665342

Browse files
committed
Adjust for Nougat
1 parent b3ba245 commit e665342

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

ART.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ LOCAL_C_INCLUDES += \
2727
art/runtime \
2828
external/gtest/include
2929

30+
ifeq (1,$(strip $(shell expr $(PLATFORM_SDK_VERSION) \>= 24)))
31+
LOCAL_C_INCLUDES += bionic/libc/private
32+
endif
33+
3034
LOCAL_SHARED_LIBRARIES += \
3135
libart \
3236
liblog \

Android.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ ifeq (1,$(strip $(shell expr $(PLATFORM_SDK_VERSION) \>= 22)))
4242
LOCAL_LDFLAGS := -Wl,--version-script,art/sigchainlib/version-script.txt -Wl,--export-dynamic
4343
endif
4444

45+
ifeq (1,$(strip $(shell expr $(PLATFORM_SDK_VERSION) \>= 23)))
46+
LOCAL_SHARED_LIBRARIES += libwilhelm
47+
endif
48+
4549
LOCAL_MODULE := xposed
4650
LOCAL_MODULE_TAGS := optional
4751
LOCAL_STRIP_MODULE := keep_symbols

libxposed_art.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ bool onVmCreated(JNIEnv*) {
5656
////////////////////////////////////////////////////////////
5757
void logExceptionStackTrace() {
5858
Thread* self = Thread::Current();
59+
ScopedObjectAccess soa(self);
5960
#if PLATFORM_SDK_VERSION >= 23
6061
XLOG(ERROR) << self->GetException()->Dump();
6162
#else
@@ -80,6 +81,7 @@ void prepareSubclassReplacement(JNIEnv* env, jclass clazz) {
8081
void XposedBridge_hookMethodNative(JNIEnv* env, jclass, jobject javaReflectedMethod,
8182
jobject, jint, jobject javaAdditionalInfo) {
8283
// Detect usage errors.
84+
ScopedObjectAccess soa(env);
8385
if (javaReflectedMethod == nullptr) {
8486
#if PLATFORM_SDK_VERSION >= 23
8587
ThrowIllegalArgumentException("method must not be null");
@@ -90,7 +92,6 @@ void XposedBridge_hookMethodNative(JNIEnv* env, jclass, jobject javaReflectedMet
9092
}
9193

9294
// Get the ArtMethod of the method to be hooked.
93-
ScopedObjectAccess soa(env);
9495
ArtMethod* artMethod = ArtMethod::FromReflectedMethod(soa, javaReflectedMethod);
9596

9697
// Hook the method
@@ -103,7 +104,7 @@ jobject XposedBridge_invokeOriginalMethodNative(JNIEnv* env, jclass, jobject jav
103104
if (UNLIKELY(!isResolved)) {
104105
ArtMethod* artMethod = ArtMethod::FromReflectedMethod(soa, javaMethod);
105106
if (LIKELY(artMethod->IsXposedHookedMethod())) {
106-
javaMethod = artMethod->GetXposedHookInfo()->reflectedMethod;
107+
javaMethod = artMethod->GetXposedHookInfo()->reflected_method;
107108
}
108109
}
109110
#if PLATFORM_SDK_VERSION >= 23

xposed.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <dlfcn.h>
1717
#include <errno.h>
1818
#include <fcntl.h>
19+
#include <inttypes.h>
1920
#include <stdlib.h>
2021

2122
#if PLATFORM_SDK_VERSION >= 18
@@ -309,7 +310,7 @@ static bool addPathToEnv(const char* name, const char* path) {
309310
char newPath[4096];
310311
int neededLength = snprintf(newPath, sizeof(newPath), "%s:%s", path, oldPath);
311312
if (neededLength >= (int)sizeof(newPath)) {
312-
ALOGE("ERROR: %s would exceed %d characters", name, sizeof(newPath));
313+
ALOGE("ERROR: %s would exceed %" PRIuPTR " characters", name, sizeof(newPath));
313314
return false;
314315
}
315316
setenv(name, newPath, 1);

0 commit comments

Comments
 (0)