From f8d0e4492d0fc352c8c3d24f5187f19fe04ffc67 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 26 Nov 2013 18:41:21 +0100 Subject: [PATCH] WebClient: more logging Refs #825 --- src/biz/bokhorst/xprivacy/XWebView.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/biz/bokhorst/xprivacy/XWebView.java b/src/biz/bokhorst/xprivacy/XWebView.java index 63d94206b..aaf2ce763 100644 --- a/src/biz/bokhorst/xprivacy/XWebView.java +++ b/src/biz/bokhorst/xprivacy/XWebView.java @@ -65,33 +65,36 @@ protected void after(MethodHookParam param) throws Throwable { Class clazzWebSettings = param.getResultOrThrowable().getClass(); if (!mWebSettings.contains(clazzWebSettings.getName())) { mWebSettings.add(clazzWebSettings.getName()); - Util.log(this, Log.INFO, "Hooking " + clazzWebSettings.getName()); - // setUserAgent + // Hook setUserAgent try { - Util.log(this, Log.INFO, "Hooking setUserAgent"); + Util.log(this, Log.INFO, "Hooking " + clazzWebSettings.getName() + ".setUserAgent"); Method setUserAgent = clazzWebSettings.getDeclaredMethod("setUserAgent", int.class); XposedBridge.hookMethod(setUserAgent, new XC_MethodHook() { @Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable { - if (isRestricted(param)) + if (isRestricted(param)) { + Util.log(XWebView.this, Log.INFO, "Restricting setUserAgent"); param.setResult(null); + } } }); } catch (NoSuchFieldError ex) { Util.bug(this, ex); } - // setUserAgentString + // Hook setUserAgentString try { - Util.log(this, Log.INFO, "Hooking setUserAgentString"); + Util.log(this, Log.INFO, "Hooking " + clazzWebSettings.getName() + ".setUserAgentString"); Method setUserAgentString = clazzWebSettings.getDeclaredMethod("setUserAgentString", String.class); XposedBridge.hookMethod(setUserAgentString, new XC_MethodHook() { @Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable { - if (isRestricted(param)) + if (isRestricted(param)) { + Util.log(XWebView.this, Log.INFO, "Restricting setUserAgentString"); param.args[0] = PrivacyManager.getDefacedProp(Binder.getCallingUid(), "UA"); + } } }); } catch (NoSuchFieldError ex) {