forked from M66B/XPrivacy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added restriction for activity recognition
Closes M66B#1608
- Loading branch information
M66B
authored and
Phylon
committed
Mar 31, 2014
1 parent
140de52
commit 1b3eb71
Showing
5 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,63 @@ | ||
package biz.bokhorst.xprivacy; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import android.util.Log; | ||
|
||
public class XActivityRecognitionClient extends XHook { | ||
private Methods mMethod; | ||
|
||
private XActivityRecognitionClient(Methods method, String restrictionName) { | ||
super(restrictionName, "GMS." + method.name(), null); | ||
mMethod = method; | ||
} | ||
|
||
private XActivityRecognitionClient(Methods method, String restrictionName, int sdk) { | ||
super(restrictionName, "GMS." + method.name(), null, sdk); | ||
mMethod = method; | ||
} | ||
|
||
public String getClassName() { | ||
return "com.google.android.gms.location.ActivityRecognitionClient"; | ||
} | ||
|
||
// @formatter:off | ||
|
||
// public void removeActivityUpdates(PendingIntent callbackIntent) | ||
// public void requestActivityUpdates(long detectionIntervalMillis, PendingIntent callbackIntent) | ||
// http://developer.android.com/reference/com/google/android/gms/location/ActivityRecognitionClient.html | ||
|
||
// @formatter:on | ||
|
||
private enum Methods { | ||
removeActivityUpdates, requestActivityUpdates | ||
}; | ||
|
||
public static List<XHook> getInstances() { | ||
List<XHook> listHook = new ArrayList<XHook>(); | ||
listHook.add(new XActivityRecognitionClient(Methods.removeActivityUpdates, null, 1)); | ||
listHook.add(new XActivityRecognitionClient(Methods.requestActivityUpdates, PrivacyManager.cLocation)); | ||
return listHook; | ||
} | ||
|
||
@Override | ||
protected void before(XParam param) throws Throwable { | ||
if (mMethod == Methods.removeActivityUpdates) { | ||
if (isRestricted(param, "GMS.requestActivityUpdates")) | ||
param.setResult(null); | ||
|
||
} else if (mMethod == Methods.requestActivityUpdates) { | ||
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 | ||
} | ||
} |
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