diff --git a/CHANGELOG.md b/CHANGELOG.md
index f117029e8..3b14c7489 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -46,6 +46,7 @@ Version 2.99.x and version 3.x will be available with a [pro license](http://www
**Next release**
* Added restriction *registerListener* to the *Sensors* category, which will limit the rate of the gyroscope to 100 Hz to prevent eavesdropping ([issue](/../../issues/1878))
+* Added restriction [GMS5.view](https://developer.android.com/reference/com/google/android/gms/appindexing/AppIndexApi.html) ([issue](/../../issues/1778))
* Updated Slovenian translation
[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)
diff --git a/res/values/functions.xml b/res/values/functions.xml
index 8fc5a8cfc..a8ca12351 100644
--- a/res/values/functions.xml
+++ b/res/values/functions.xml
@@ -165,8 +165,8 @@
Google documentation]]>
Google documentation]]>
Google documentation]]>
- Google documentation]]>
- Google documentation]]>
+ Google documentation]]>
+ Google documentation]]>
Google documentation]]>
Google documentation]]>
Google documentation]]>
@@ -396,5 +396,6 @@
Google documentation]]>
Google documentation]]>
Google documentation]]>
+ Google documentation]]>
\ No newline at end of file
diff --git a/src/biz/bokhorst/xprivacy/Meta.java b/src/biz/bokhorst/xprivacy/Meta.java
index 8eda592d9..f5ec7a0f7 100644
--- a/src/biz/bokhorst/xprivacy/Meta.java
+++ b/src/biz/bokhorst/xprivacy/Meta.java
@@ -473,6 +473,8 @@ public static List get() {
mListHook.add(new Hook("view", Intent.ACTION_VIEW, "", 1, null, null).notAOSP(19).doNotify().whitelist(cTypeUrl));
mListHook.add(new Hook("view", "Srv_" + Intent.ACTION_VIEW, "", 19, "2.99", Intent.ACTION_VIEW).AOSP(19).doNotify().whitelist(cTypeUrl));
+ mListHook.add(new Hook("view", "GMS5.view", "", 1, null, null).unsafe());
+
// AccountManager
mListHook.add(new Hook(null, "removeOnAccountsUpdatedListener", "", 5, null, null));
@@ -505,6 +507,9 @@ public static List get() {
mListHook.add(new Hook(null, "wakingUp", "", 16, null, null));
mListHook.add(new Hook(null, "shutdown", "", 15, null, null));
+ // AppIndexApi
+ mListHook.add(new Hook(null, "GMS5.viewEnd", "", 1, null, null));
+
// Application
mListHook.add(new Hook(null, "onCreate", "", 1, null, null));
diff --git a/src/biz/bokhorst/xprivacy/XActivityRecognitionApi.java b/src/biz/bokhorst/xprivacy/XActivityRecognitionApi.java
index 695d452ee..a80b74156 100644
--- a/src/biz/bokhorst/xprivacy/XActivityRecognitionApi.java
+++ b/src/biz/bokhorst/xprivacy/XActivityRecognitionApi.java
@@ -47,7 +47,7 @@ public static List getInstances(Object instance) {
protected void before(XParam param) throws Throwable {
switch (mMethod) {
case removeActivityUpdates:
- if (isRestricted(param, PrivacyManager.cLocation, "GMS.requestActivityUpdates"))
+ if (isRestricted(param, PrivacyManager.cLocation, "GMS5.requestActivityUpdates"))
param.setResult(null);
break;
diff --git a/src/biz/bokhorst/xprivacy/XAppIndexApi.java b/src/biz/bokhorst/xprivacy/XAppIndexApi.java
new file mode 100644
index 000000000..0d58fa7aa
--- /dev/null
+++ b/src/biz/bokhorst/xprivacy/XAppIndexApi.java
@@ -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 view(GoogleApiClient apiClient, Activity activity, Intent viewIntent, String title, Uri webUrl, List outLinks)
+ // abstract PendingResult view(GoogleApiClient apiClient, Activity activity, Uri appIndexingUrl, String title, Uri webUrl, List outLinks)
+ // abstract PendingResult viewEnd(GoogleApiClient apiClient, Activity activity, Uri appIndexingUrl)
+ // abstract PendingResult 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 getInstances(Object instance) {
+ String className = instance.getClass().getName();
+ Util.log(null, Log.WARN, "Hooking class=" + className + " uid=" + Binder.getCallingUid());
+
+ List listHook = new ArrayList();
+ 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
+ }
+}
diff --git a/src/biz/bokhorst/xprivacy/XConnectionCallbacks.java b/src/biz/bokhorst/xprivacy/XConnectionCallbacks.java
index 1ca016ecc..9586074ae 100644
--- a/src/biz/bokhorst/xprivacy/XConnectionCallbacks.java
+++ b/src/biz/bokhorst/xprivacy/XConnectionCallbacks.java
@@ -53,7 +53,8 @@ protected void before(XParam param) throws Throwable {
if (PrivacyManager.getTransient(fusedLocationApi.getClass().getName(), null) == null) {
PrivacyManager.setTransient(fusedLocationApi.getClass().getName(), Boolean.toString(true));
- XPrivacy.hookAll(XFusedLocationApi.getInstances(fusedLocationApi), loader, getSecret());
+ if (fusedLocationApi != null)
+ XPrivacy.hookAll(XFusedLocationApi.getInstances(fusedLocationApi), loader, getSecret());
}
// ActivityRecognitionApi
@@ -62,7 +63,8 @@ protected void before(XParam param) throws Throwable {
if (PrivacyManager.getTransient(activityRecognitionApi.getClass().getName(), null) == null) {
PrivacyManager.setTransient(activityRecognitionApi.getClass().getName(), Boolean.toString(true));
- XPrivacy.hookAll(XActivityRecognitionApi.getInstances(activityRecognitionApi), loader, getSecret());
+ if (activityRecognitionApi != null)
+ XPrivacy.hookAll(XActivityRecognitionApi.getInstances(activityRecognitionApi), loader, getSecret());
}
// AppIndexApi
@@ -71,7 +73,8 @@ protected void before(XParam param) throws Throwable {
if (PrivacyManager.getTransient(appIndexApi.getClass().getName(), null) == null) {
PrivacyManager.setTransient(appIndexApi.getClass().getName(), Boolean.toString(true));
- // TODO: AppIndexApi
+ if (appIndexApi != null)
+ XPrivacy.hookAll(XAppIndexApi.getInstances(appIndexApi), loader, getSecret());
}
break;