Skip to content

Commit

Permalink
[AndroidQ]fix registerContentProvider temp
Browse files Browse the repository at this point in the history
  • Loading branch information
swift_gan committed Apr 11, 2019
1 parent 83eea19 commit 46618fb
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@

import com.lody.virtual.client.VClientImpl;
import com.lody.virtual.client.hook.base.MethodProxy;
import com.lody.virtual.helper.utils.OSUtils;

import java.lang.reflect.Method;

/**
* author: weishu on 18/3/13.
*/

class MethodProxies {

static class NotifyChange extends MethodProxy {
Expand Down Expand Up @@ -64,9 +63,52 @@ public boolean beforeCall(Object who, Method method, Object... args) {
return super.beforeCall(who, method, args);
}

@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
try {
return super.call(who, method, args);
} catch (Throwable se) {
if (se.getCause() instanceof SecurityException && OSUtils.getInstance().isAndroidQ()) {
se.printStackTrace();
} else {
throw se;
}
}
return null;
}

@Override
public boolean isEnable() {
return isAppProcess();
}
}


static class RegisterContentObserver extends MethodProxy {

@Override
public String getMethodName() {
return "registerContentObserver";
}

@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
try {
return super.call(who, method, args);
} catch (Throwable se) {
if (se.getCause() instanceof SecurityException) {
se.printStackTrace();
} else {
throw se;
}
}
return null;
}

@Override
public boolean isEnable() {
return isAppProcess() && OSUtils.getInstance().isAndroidQ();
}
}

}
2 changes: 2 additions & 0 deletions lib/src/main/jni/Foundation/IOUniformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,8 @@ void hook_dlopen(int api_level) {
(unsigned long *) &symbol) == 0) {
MSHookFunction(symbol, (void *) new_do_dlopen_V24,
(void **) &orig_do_dlopen_V24);
} else {
ALOGE("error hook dlopen");
}
} else if (api_level >= 19) {
if (findSymbol("__dl__Z9do_dlopenPKciPK17android_dlextinfo", "linker",
Expand Down

0 comments on commit 46618fb

Please sign in to comment.