Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Fixed restricting GSF ID in some cases
Browse files Browse the repository at this point in the history
Refs #1374
  • Loading branch information
M66B committed Feb 17, 2014
1 parent 0edf684 commit 73c47eb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Changelog

**Next release**

* Fixed null pointer in storage/option
* Fixed restricting GSF ID in some cases ([issue](/../../issues/1374))

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)

**Version 1.99.46 TEST**
Expand Down
8 changes: 0 additions & 8 deletions src/biz/bokhorst/xprivacy/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
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;

Expand Down Expand Up @@ -469,13 +468,6 @@ public static boolean isDebuggable(Context context) {
return ((context.getApplicationContext().getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0);
}

public static boolean containsIgnoreCase(List<String> strings, String value) {
for (String string : strings)
if (string.equalsIgnoreCase(value))
return true;
return false;
}

public static boolean isIntentAvailable(Context context, Intent intent) {
PackageManager packageManager = context.getPackageManager();
return (packageManager.queryIntentActivities(intent, PackageManager.GET_ACTIVITIES).size() > 0);
Expand Down
30 changes: 21 additions & 9 deletions src/biz/bokhorst/xprivacy/XContentResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,27 @@ private void handleUriAfter(MethodHookParam param) throws Throwable {
// Google services provider: block only android_id
if (param.args.length > 3 && param.args[3] != null) {
List<String> selectionArgs = Arrays.asList((String[]) param.args[3]);
if (Util.containsIgnoreCase(selectionArgs, "android_id"))
if (isRestrictedExtra(param, PrivacyManager.cIdentification, "GservicesProvider", uri)) {
MatrixCursor gsfCursor = new MatrixCursor(cursor.getColumnNames());
gsfCursor.addRow(new Object[] { "android_id",
PrivacyManager.getDefacedProp(Binder.getCallingUid(), "GSF_ID") });
gsfCursor.respond(cursor.getExtras());
param.setResult(gsfCursor);
cursor.close();
}
if (selectionArgs.contains("android_id")) {
int ikey = cursor.getColumnIndex("key");
int ivalue = cursor.getColumnIndex("value");
if (ikey == 0 && ivalue == 1 && cursor.getColumnCount() == 2) {
if (isRestrictedExtra(param, PrivacyManager.cIdentification, "GservicesProvider", uri)) {
MatrixCursor result = new MatrixCursor(cursor.getColumnNames());
while (cursor.moveToNext()) {
if ("android_id".equals(cursor.getString(ikey)))
result.addRow(new Object[] { "android_id",
PrivacyManager.getDefacedProp(Binder.getCallingUid(), "GSF_ID") });
else
copyColumns(cursor, result);
}
result.respond(cursor.getExtras());
param.setResult(result);
cursor.close();
}
} else
Util.log(this, Log.ERROR,
"Unexpected result uri=" + uri + " columns=" + cursor.getColumnNames());
}
}

} else if (uri.startsWith("content://com.android.contacts/contacts")
Expand Down

0 comments on commit 73c47eb

Please sign in to comment.