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.
Closes M66B#1778
- Loading branch information
Showing
6 changed files
with
82 additions
and
6 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
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,66 @@ | ||
package biz.bokhorst.xprivacy; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import android.os.Binder; | ||
import android.util.Log; | ||
|
||
public class XAppIndexApi extends XHook { | ||
private Methods mMethod; | ||
private String mClassName; | ||
|
||
private XAppIndexApi(Methods method, String restrictionName, String className) { | ||
super(restrictionName, method.name(), "GMS5." + method.name()); | ||
mMethod = method; | ||
mClassName = className; | ||
} | ||
|
||
public String getClassName() { | ||
return mClassName; | ||
} | ||
|
||
// @formatter:off | ||
|
||
// abstract PendingResult<Status> view(GoogleApiClient apiClient, Activity activity, Intent viewIntent, String title, Uri webUrl, List<AppIndexApi.AppIndexingLink> outLinks) | ||
// abstract PendingResult<Status> view(GoogleApiClient apiClient, Activity activity, Uri appIndexingUrl, String title, Uri webUrl, List<AppIndexApi.AppIndexingLink> outLinks) | ||
// abstract PendingResult<Status> viewEnd(GoogleApiClient apiClient, Activity activity, Uri appIndexingUrl) | ||
// abstract PendingResult<Status> viewEnd(GoogleApiClient apiClient, Activity activity, Intent viewIntent) | ||
// https://developer.android.com/reference/com/google/android/gms/appindexing/AppIndexApi.html | ||
|
||
// @formatter:on | ||
|
||
private enum Methods { | ||
view, viewEnd | ||
}; | ||
|
||
public static List<XHook> getInstances(Object instance) { | ||
String className = instance.getClass().getName(); | ||
Util.log(null, Log.WARN, "Hooking class=" + className + " uid=" + Binder.getCallingUid()); | ||
|
||
List<XHook> listHook = new ArrayList<XHook>(); | ||
listHook.add(new XAppIndexApi(Methods.viewEnd, null, className)); | ||
listHook.add(new XAppIndexApi(Methods.view, PrivacyManager.cView, className)); | ||
return listHook; | ||
} | ||
|
||
@Override | ||
protected void before(XParam param) throws Throwable { | ||
switch (mMethod) { | ||
case viewEnd: | ||
if (isRestricted(param, PrivacyManager.cView, "GMS5.view")) | ||
param.setResult(null); | ||
break; | ||
|
||
case view: | ||
if (isRestricted(param)) | ||
param.setResult(null); | ||
break; | ||
} | ||
} | ||
|
||
@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