Skip to content
This repository was archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Hook setUserAgent too
Browse files Browse the repository at this point in the history
Refs #825
  • Loading branch information
M66B committed Nov 26, 2013
1 parent 46e3808 commit b6b5712
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/biz/bokhorst/xprivacy/XWebView.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ protected void after(MethodHookParam param) throws Throwable {
mWebSettings.add(clazzWebSettings.getName());
Util.log(this, Log.INFO, "Hooking " + clazzWebSettings.getName());

// getUserAgentString
// setUserAgent
try {
Method getUserAgentString = clazzWebSettings.getDeclaredMethod("getUserAgentString");
Util.log(this, Log.INFO, "Hooking " + getUserAgentString.getName());
XposedBridge.hookMethod(getUserAgentString, new XC_MethodHook() {
Method setUserAgent = clazzWebSettings.getDeclaredMethod("setUserAgent", String.class);
Util.log(this, Log.INFO, "Hooking " + setUserAgent.getName());
XposedBridge.hookMethod(setUserAgent, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (isRestricted(param))
param.setResult(PrivacyManager.getDefacedProp(Binder.getCallingUid(), "UA"));
param.setResult(null);
}
});
} catch (NoSuchFieldError ex) {
Expand Down

0 comments on commit b6b5712

Please sign in to comment.