Skip to content

Commit

Permalink
Fixed restricting profile
Browse files Browse the repository at this point in the history
Closes M66B#1610
  • Loading branch information
M66B authored and Phylon committed Mar 31, 2014
1 parent 426aad7 commit 0b7c73b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Changelog

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

* Fixed restricting profile (owner name, etc) ([issue](/../../issues/1610))

**Version 2.0.13 TEST**

* Fixed error message for Android versions below JellyBean MR1 (SDK 17) ([issue](/../../issues/1602))
Expand Down
28 changes: 17 additions & 11 deletions src/biz/bokhorst/xprivacy/XContentResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private void handleUriAfter(XParam param) throws Throwable {
String[] components = uri.replace("content://com.android.", "").split("/");
String methodName = components[0] + "/" + components[1].split("\\?")[0];
if (methodName.equals("contacts/contacts") || methodName.equals("contacts/data")
|| methodName.equals("contacts/phone_lookup") || methodName.equals("contacts/raw_contacts"))
|| methodName.equals("contacts/phone_lookup") || methodName.equals("contacts/raw_contacts")) {
if (isRestrictedExtra(param, PrivacyManager.cContacts, methodName, uri)) {
// Get ID from URL if any
int urlid = -1;
Expand Down Expand Up @@ -254,6 +254,22 @@ private void handleUriAfter(XParam param) throws Throwable {
param.setResult(result);
cursor.close();
}
} else {
methodName = null;
if (uri.startsWith("content://com.android.contacts/profile"))
methodName = "contacts/profile";
else
methodName = "ContactsProvider2"; // fall-back

if (methodName != null)
if (isRestrictedExtra(param, PrivacyManager.cContacts, methodName, uri)) {
// Return empty cursor
MatrixCursor result = new MatrixCursor(cursor.getColumnNames());
result.respond(cursor.getExtras());
param.setResult(result);
cursor.close();
}
}

} else {
// Other uri restrictions
Expand All @@ -279,16 +295,6 @@ else if (uri.startsWith("content://contacts/people")) {
methodName = "contacts/people";
}

else if (uri.startsWith("content://com.android.contacts/profile")) {
restrictionName = PrivacyManager.cContacts;
methodName = "contacts/profile";
}

else if (uri.startsWith("content://com.android.contacts")) {
restrictionName = PrivacyManager.cContacts;
methodName = "ContactsProvider2"; // fall-back
}

else if (uri.startsWith("content://downloads")) {
restrictionName = PrivacyManager.cBrowser;
methodName = "Downloads";
Expand Down

0 comments on commit 0b7c73b

Please sign in to comment.