diff --git a/src/biz/bokhorst/xprivacy/PrivacyManager.java b/src/biz/bokhorst/xprivacy/PrivacyManager.java index d165644d4..a45ccb685 100644 --- a/src/biz/bokhorst/xprivacy/PrivacyManager.java +++ b/src/biz/bokhorst/xprivacy/PrivacyManager.java @@ -97,6 +97,7 @@ public class PrivacyManager { mPermissions.get(cCalling).add("CALL_PHONE"); mPermissions.get(cContacts).add("READ_CONTACTS"); mPermissions.get(cDictionary).add("READ_USER_DICTIONARY"); + mPermissions.get(cIdentification).add("READ_GSERVICES"); mPermissions.get(cInternet).add("INTERNET"); mPermissions.get(cInternet).add("ACCESS_NETWORK_STATE"); mPermissions.get(cLocation).add("ACCESS_COARSE_LOCATION"); @@ -250,6 +251,7 @@ public class PrivacyManager { mMethods.get(cMessages).add("MmsProvider"); mMethods.get(cMessages).add("MmsSmsProvider"); mMethods.get(cPhone).add("TelephonyProvider"); + mMethods.get(cIdentification).add("GservicesProvider"); } // Data diff --git a/src/biz/bokhorst/xprivacy/Util.java b/src/biz/bokhorst/xprivacy/Util.java index dfac5431e..668226196 100644 --- a/src/biz/bokhorst/xprivacy/Util.java +++ b/src/biz/bokhorst/xprivacy/Util.java @@ -9,6 +9,7 @@ import java.security.PublicKey; import java.security.Signature; import java.security.spec.X509EncodedKeySpec; +import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -193,4 +194,13 @@ public static Resources getXResources(Context context) throws Throwable { public static String getXString(Context context, int id) throws Throwable { return getXResources(context).getString(id); } + + public static boolean containsIgnoreCase(List strings, String value) { + for (String s : strings) { + if (s.equalsIgnoreCase(value)) + return true; + } + + return false; + } } diff --git a/src/biz/bokhorst/xprivacy/XContentProvider.java b/src/biz/bokhorst/xprivacy/XContentProvider.java index 5b4e16537..b5b647e2b 100644 --- a/src/biz/bokhorst/xprivacy/XContentProvider.java +++ b/src/biz/bokhorst/xprivacy/XContentProvider.java @@ -1,5 +1,8 @@ package biz.bokhorst.xprivacy; +import java.util.Arrays; +import java.util.List; + import android.content.ContentProvider; import android.content.ContentResolver; import android.content.Context; @@ -54,6 +57,16 @@ protected void after(MethodHookParam param) throws Throwable { // Check uri Uri uri = (Uri) param.args[0]; if (mUriStart == null || uri.toString().startsWith(mUriStart)) { + + // If that's the Google services provider, block only the android_id + if (uri.toString().toLowerCase().startsWith("content://com.google.android.gsf.gservices")) { + List selectionArgs = Arrays.asList((String[]) param.args[3]); + + // checking just selectionArgs might not be enough but should suffice for now + if (!Util.containsIgnoreCase(selectionArgs, "android_id")) + return; + } + // Return empty cursor Cursor cursor = (Cursor) param.getResult(); if (cursor != null) diff --git a/src/biz/bokhorst/xprivacy/XPrivacy.java b/src/biz/bokhorst/xprivacy/XPrivacy.java index 96c6ad352..8963fa83b 100644 --- a/src/biz/bokhorst/xprivacy/XPrivacy.java +++ b/src/biz/bokhorst/xprivacy/XPrivacy.java @@ -236,6 +236,14 @@ public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable { false)) XposedHelpers.setStaticObjectField(Build.class, "SERIAL", PrivacyManager.getDefacedProp("SERIAL")); + + // Google services provider + if (lpparam.packageName.equals("com.google.android.gsf")) { + hook(new XContentProvider(PrivacyManager.cIdentification, + new String[] { "READ_GSERVICES" }, "GservicesProvider"), + lpparam.classLoader, "com.google.android.gsf.gservices.GservicesProvider"); + } + // Browser provider if (lpparam.packageName.equals("com.android.browser")) { hook(new XContentProvider(PrivacyManager.cBrowser,