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

Commit

Permalink
Do not check selection to restrict GSF ID
Browse files Browse the repository at this point in the history
Refs #1374
  • Loading branch information
M66B committed Feb 17, 2014
1 parent 73c47eb commit 10f60cf
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 26 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Changelog

**Next release**

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

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)
Expand Down
2 changes: 1 addition & 1 deletion src/biz/bokhorst/xprivacy/Meta.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static List<Hook> get() {
mListHook.add(new Hook("identification", "AdvertisingId", "", 1, null, null));
mListHook.add(new Hook("identification", "getString", "", 1, null, null));
mListHook.add(new Hook("identification", "getDescriptor", "", 16, null, null));
mListHook.add(new Hook("identification", "GservicesProvider", "com.google.android.providers.gsf.permission.READ_GSERVICES", 1, null, null).dangerous());
mListHook.add(new Hook("identification", "GservicesProvider", "com.google.android.providers.gsf.permission.READ_GSERVICES,com.google.android.providers.gsf.permission.WRITE_GSERVICES", 1, null, null).dangerous());
mListHook.add(new Hook("identification", "SERIAL", "", 1, null, null).restart().noUsageData());

mListHook.add(new Hook("internet", "getAllByName", "INTERNET", 1, null, null));
Expand Down
3 changes: 2 additions & 1 deletion src/biz/bokhorst/xprivacy/PrivacyService.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,14 @@ public List<String> check() throws RemoteException {
synchronized (mListError) {
int c = 0;
int i = 0;
while (i++ < mListError.size()) {
while (i < mListError.size()) {
String msg = mListError.get(i);
c += msg.length();
if (c < 5000)
listError.add(msg);
else
break;
i++;
}
}

Expand Down
40 changes: 17 additions & 23 deletions src/biz/bokhorst/xprivacy/XContentResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,30 +168,24 @@ private void handleUriAfter(MethodHookParam param) throws Throwable {

} else if (uri.startsWith("content://com.google.android.gsf.gservices")) {
// 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 (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());
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")
|| uri.startsWith("content://com.android.contacts/data")
Expand Down

0 comments on commit 10f60cf

Please sign in to comment.