diff --git a/CHANGELOG.md b/CHANGELOG.md index 0363275d9..5018dd859 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ Changelog **Next release** +* Added restrictions for [SIP](http://en.wikipedia.org/wiki/Session_Initiation_Protocol) calling ([issue](/../../issues/1739)) + [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) **Version 2.1.4 STABLE** diff --git a/src/biz/bokhorst/xprivacy/Meta.java b/src/biz/bokhorst/xprivacy/Meta.java index 22c6ab0c4..d0d4f68bb 100644 --- a/src/biz/bokhorst/xprivacy/Meta.java +++ b/src/biz/bokhorst/xprivacy/Meta.java @@ -62,6 +62,10 @@ public static List get() { mListHook.add(new Hook("calling", "android.intent.action.RESPOND_VIA_MESSAGE", "SEND_RESPOND_VIA_MESSAGE", 18, null, null).doNotify()); mListHook.add(new Hook("calling", "android.intent.action.CALL", "CALL_PHONE", 10, null, null).doNotify()); + mListHook.add(new Hook("calling", "SIP.isApiSupported", "USE_SIP", 9, null, null).doNotify()); + mListHook.add(new Hook("calling", "SIP.isVoipSupported", "USE_SIP", 9, null, null).doNotify()); + mListHook.add(new Hook("calling", "SIP.newInstance", "USE_SIP", 9, null, null).doNotify()); + mListHook.add(new Hook("clipboard", "addPrimaryClipChangedListener", "", 11, null, null)); mListHook.add(new Hook("clipboard", "getPrimaryClip", "", 11, null, null).doNotify()); mListHook.add(new Hook("clipboard", "getPrimaryClipDescription", "", 11, null, null).doNotify()); diff --git a/src/biz/bokhorst/xprivacy/XPrivacy.java b/src/biz/bokhorst/xprivacy/XPrivacy.java index a11514d3f..a31f39ae2 100644 --- a/src/biz/bokhorst/xprivacy/XPrivacy.java +++ b/src/biz/bokhorst/xprivacy/XPrivacy.java @@ -139,6 +139,9 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { // Settings secure hookAll(XSettingsSecure.getInstances(), mSecret); + // SIP manager + hookAll(XSipManager.getInstances(), mSecret); + // SMS manager hookAll(XSmsManager.getInstances(), mSecret); diff --git a/src/biz/bokhorst/xprivacy/XSipManager.java b/src/biz/bokhorst/xprivacy/XSipManager.java new file mode 100644 index 000000000..04128a552 --- /dev/null +++ b/src/biz/bokhorst/xprivacy/XSipManager.java @@ -0,0 +1,64 @@ +package biz.bokhorst.xprivacy; + +import java.util.ArrayList; +import java.util.List; + +import android.util.Log; + +public class XSipManager extends XHook { + private Methods mMethod; + + private XSipManager(Methods method, String restrictionName) { + super(restrictionName, method.name(), "SIP." + method.name()); + mMethod = method; + } + + private XSipManager(Methods method, String restrictionName, int sdk) { + super(restrictionName, method.name(), "SIP." + method.name(), sdk); + mMethod = method; + } + + public String getClassName() { + return "android.net.sip.SipManager"; + } + + // @formatter:off + + // static boolean isApiSupported(Context context) + // static boolean isVoipSupported(Context context) + // public static SipManager newInstance (Context context) + // http://developer.android.com/reference/android/net/sip/SipManager.html + + // @formatter:on + + private enum Methods { + isApiSupported, isVoipSupported, newInstance + }; + + public static List getInstances() { + List listHook = new ArrayList(); + listHook.add(new XSipManager(Methods.isApiSupported, PrivacyManager.cCalling)); + listHook.add(new XSipManager(Methods.isVoipSupported, PrivacyManager.cCalling)); + listHook.add(new XSipManager(Methods.newInstance, PrivacyManager.cCalling)); + return listHook; + } + + @Override + protected void before(XParam param) throws Throwable { + if (mMethod == Methods.isApiSupported || mMethod == Methods.isVoipSupported) { + if (isRestricted(param)) + param.setResult(false); + + } else if (mMethod == Methods.newInstance) { + if (isRestricted(param)) + param.setResult(null); + + } else + Util.log(this, Log.WARN, "Unknown method=" + param.method.getName()); + } + + @Override + protected void after(XParam param) throws Throwable { + // Do nothing + } +}