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

Commit

Permalink
Add debug logging for content providers
Browse files Browse the repository at this point in the history
Refs #1367
  • Loading branch information
M66B committed Feb 17, 2014
1 parent 5e8c13a commit fe015ca
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Changelog
* Fixed function name overlapping information icon
* Clear all data will also clear local caches
* Show parameters in usage data
* Added restriction for deprecated *contacts/people*

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

Expand Down
1 change: 1 addition & 0 deletions src/biz/bokhorst/xprivacy/Meta.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public static List<Hook> get() {

mListHook.add(new Hook("contacts", "contacts/contacts", "READ_CONTACTS,WRITE_CONTACTS", 1, null, null));
mListHook.add(new Hook("contacts", "contacts/data", "READ_CONTACTS,WRITE_CONTACTS", 1, null, null));
mListHook.add(new Hook("contacts", "contacts/people", "READ_CONTACTS,WRITE_CONTACTS", 1, "1.99.46", null));
mListHook.add(new Hook("contacts", "contacts/phone_lookup", "READ_CONTACTS,WRITE_CONTACTS", 1, null, null));
mListHook.add(new Hook("contacts", "contacts/profile", "READ_PROFILE,WRITE_PROFILE", 1, "1.99.38", null).dangerous());
mListHook.add(new Hook("contacts", "contacts/raw_contacts", "READ_CONTACTS,WRITE_CONTACTS", 1, null, null));
Expand Down
8 changes: 8 additions & 0 deletions src/biz/bokhorst/xprivacy/XContentResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public String getClassName() {
// http://developer.android.com/reference/android/content/ContentResolver.html
// http://developer.android.com/reference/android/content/ContentProviderClient.html

// http://developer.android.com/reference/android/provider/Contacts.People.html
// http://developer.android.com/reference/android/provider/ContactsContract.Contacts.html
// http://developer.android.com/reference/android/provider/ContactsContract.Data.html
// http://developer.android.com/reference/android/provider/ContactsContract.PhoneLookup.html
Expand Down Expand Up @@ -113,6 +114,7 @@ private void handleUriBefore(MethodHookParam param) throws Throwable {
if (param.args.length > 1 && param.args[0] instanceof Uri) {
String uri = ((Uri) param.args[0]).toString().toLowerCase();
String[] projection = (param.args[1] instanceof String[] ? (String[]) param.args[1] : null);
Util.log(this, Log.INFO, "Before uri=" + uri);

if (uri.startsWith("content://com.android.contacts/contacts")
|| uri.startsWith("content://com.android.contacts/data")
Expand Down Expand Up @@ -147,6 +149,7 @@ private void handleUriAfter(MethodHookParam param) throws Throwable {
if (param.args.length > 1 && param.args[0] instanceof Uri && param.getResult() != null) {
String uri = ((Uri) param.args[0]).toString().toLowerCase();
Cursor cursor = (Cursor) param.getResult();
Util.log(this, Log.INFO, "After uri=" + uri);

if (uri.startsWith("content://applications")) {
// Applications provider: allow selected applications
Expand Down Expand Up @@ -238,6 +241,11 @@ else if (uri.startsWith("content://call_log")) {
methodName = "CallLogProvider";
}

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

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

0 comments on commit fe015ca

Please sign in to comment.