From e0c030863b01a9daf258aa75db2190d0e9372ddf Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 27 Jan 2014 18:59:34 +0100 Subject: [PATCH] Added restriction for getExtraInfo Closes #1175 --- CHANGELOG.md | 1 + README.md | 1 + src/biz/bokhorst/xprivacy/Meta.java | 11 +++++++---- src/biz/bokhorst/xprivacy/PrivacyManager.java | 4 ++++ src/biz/bokhorst/xprivacy/XNetworkInfo.java | 6 +++++- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0706c490f..61c13dce4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Test and beta releases will have experimental functions enabled by default. **Next release** * Fixed empty settings values ([issue](https://github.com/M66B/XPrivacy/issues/1164)) +* Added restriction for *NetworkInfo.getExtraInfo* ([issue](https://github.com/M66B/XPrivacy/issues/1175)) * Updated German translation [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) diff --git a/README.md b/README.md index 1cd4d7da8..13fb1a541 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,7 @@ For easy usage, data is restricted by category: * Internet * revoke access to the internet + * return fake extra info * return fake disconnected state * return fake supplicant disconnected state diff --git a/src/biz/bokhorst/xprivacy/Meta.java b/src/biz/bokhorst/xprivacy/Meta.java index 44bc3181a..b09bcb21d 100644 --- a/src/biz/bokhorst/xprivacy/Meta.java +++ b/src/biz/bokhorst/xprivacy/Meta.java @@ -64,10 +64,13 @@ public static List get() { listHook.add(new Hook("internet", "getActiveNetworkInfo", true, false, null, 10, null, null)); listHook.add(new Hook("internet", "getAllNetworkInfo", false, false, null, 10, null, null)); listHook.add(new Hook("internet", "getNetworkInfo", true, false, null, 10, null, null)); - listHook.add(new Hook("internet", "getDetailedState", false, false, null, 10, null, null)); - listHook.add(new Hook("internet", "getState", false, false, null, 10, null, null)); - listHook.add(new Hook("internet", "isConnected", false, false, null, 10, null, null)); - listHook.add(new Hook("internet", "isConnectedOrConnecting", false, false, null, 10, null, null)); + + listHook.add(new Hook("internet", "getDetailedState", false, false, null, 1, null, null)); + listHook.add(new Hook("internet", "getExtraInfo", false, false, null, 1, null, null)); + listHook.add(new Hook("internet", "getState", false, false, null, 1, null, null)); + listHook.add(new Hook("internet", "isConnected", false, false, null, 1, null, null)); + listHook.add(new Hook("internet", "isConnectedOrConnecting", false, false, null, 1, null, null)); + listHook.add(new Hook("internet", "getConnectionInfo", false, false, null, 10, null, null)); listHook.add(new Hook("ipc", "android.accounts.IAccountManager", false, false, "", 1, "1.99.1", null)); listHook.add(new Hook("ipc", "android.app.IActivityManager", false, false, "", 1, "1.99.1", null)); diff --git a/src/biz/bokhorst/xprivacy/PrivacyManager.java b/src/biz/bokhorst/xprivacy/PrivacyManager.java index ddedf3cc0..bede6de92 100644 --- a/src/biz/bokhorst/xprivacy/PrivacyManager.java +++ b/src/biz/bokhorst/xprivacy/PrivacyManager.java @@ -706,6 +706,10 @@ public static Object getDefacedProp(int uid, String name) { if (name.equals("DeviceDescriptor")) return cDeface; + // getExtraInfo + if (name.equals("ExtraInfo")) + return cDeface; + // Fallback Util.log(null, Log.WARN, "Fallback value name=" + name); return cDeface; diff --git a/src/biz/bokhorst/xprivacy/XNetworkInfo.java b/src/biz/bokhorst/xprivacy/XNetworkInfo.java index 9eacb9cd1..41f8c42b9 100644 --- a/src/biz/bokhorst/xprivacy/XNetworkInfo.java +++ b/src/biz/bokhorst/xprivacy/XNetworkInfo.java @@ -4,6 +4,7 @@ import java.util.List; import android.net.NetworkInfo; +import android.os.Binder; import android.util.Log; import de.robv.android.xposed.XC_MethodHook.MethodHookParam; @@ -28,7 +29,7 @@ public String getClassName() { // http://developer.android.com/reference/android/net/NetworkInfo.html private enum Methods { - getDetailedState, getState, isConnected, isConnectedOrConnecting + getDetailedState, getExtraInfo, getState, isConnected, isConnectedOrConnecting }; public static List getInstances() { @@ -48,6 +49,9 @@ protected void after(MethodHookParam param) throws Throwable { if (mMethod == Methods.getDetailedState) { if (param.getResult() != null && isRestricted(param)) param.setResult(NetworkInfo.DetailedState.DISCONNECTED); + } else if (mMethod == Methods.getExtraInfo) { + if (param.getResult() != null && isRestricted(param)) + param.setResult(PrivacyManager.getDefacedProp(Binder.getCallingUid(), "ExtraInfo")); } else if (mMethod == Methods.getState) { if (param.getResult() != null && isRestricted(param)) param.setResult(NetworkInfo.State.DISCONNECTED);