This repository has been archived by the owner on Sep 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #1739
- Loading branch information
Showing
4 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<XHook> getInstances() { | ||
List<XHook> listHook = new ArrayList<XHook>(); | ||
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 | ||
} | ||
} |