From 43e057c1ae9201eabbcc05a330e85b66d0b16576 Mon Sep 17 00:00:00 2001 From: Svet Ganov Date: Mon, 22 Jun 2015 15:05:27 -0700 Subject: Remove read/write social stream permissions Change-Id: Ic51857dd196494168aebb66148a4dfe0533c6924 --- .../providers/contacts/ContactsProvider2.java | 41 ---------------------- 1 file changed, 41 deletions(-) diff --git a/src/com/android/providers/contacts/ContactsProvider2.java b/src/com/android/providers/contacts/ContactsProvider2.java index 7835589..a7595e4 100644 --- a/src/com/android/providers/contacts/ContactsProvider2.java +++ b/src/com/android/providers/contacts/ContactsProvider2.java @@ -2176,9 +2176,6 @@ public class ContactsProvider2 extends AbstractContactsProvider public Uri insert(Uri uri, ContentValues values) { waitForAccess(mWriteAccessLatch); - // Enforce stream items access check if applicable. - enforceSocialStreamWritePermission(uri); - if (mapsToProfileDbWithInsertedValues(uri, values)) { switchToProfileMode(); return mProfileProvider.insert(uri, values); @@ -2191,9 +2188,6 @@ public class ContactsProvider2 extends AbstractContactsProvider public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { waitForAccess(mWriteAccessLatch); - // Enforce stream items access check if applicable. - enforceSocialStreamWritePermission(uri); - if (mapsToProfileDb(uri)) { switchToProfileMode(); return mProfileProvider.update(uri, values, selection, selectionArgs); @@ -2206,9 +2200,6 @@ public class ContactsProvider2 extends AbstractContactsProvider public int delete(Uri uri, String selection, String[] selectionArgs) { waitForAccess(mWriteAccessLatch); - // Enforce stream items access check if applicable. - enforceSocialStreamWritePermission(uri); - if (mapsToProfileDb(uri)) { switchToProfileMode(); return mProfileProvider.delete(uri, selection, selectionArgs); @@ -2224,10 +2215,6 @@ public class ContactsProvider2 extends AbstractContactsProvider if (Authorization.AUTHORIZATION_METHOD.equals(method)) { Uri uri = extras.getParcelable(Authorization.KEY_URI_TO_AUTHORIZE); - // Check permissions on the caller. The URI can only be pre-authorized if the caller - // already has the necessary permissions. And, we can't rely on the ContentResolver to - // enforce permissions for the ContentProvider#call() method. - enforceSocialStreamReadPermission(uri); ContactsPermissions.enforceCallingOrSelfPermission(getContext(), READ_PERMISSION); // If there hasn't been a security violation yet, we're clear to pre-authorize the URI. @@ -2985,31 +2972,6 @@ public class ContactsProvider2 extends AbstractContactsProvider } /** - * If the given URI is reading stream items or stream photos, this will run a permission check - * for the android.permission.READ_SOCIAL_STREAM permission - otherwise it will do nothing. - * @param uri The URI to check. - */ - private void enforceSocialStreamReadPermission(Uri uri) { - if (SOCIAL_STREAM_URIS.contains(sUriMatcher.match(uri)) - && !isValidPreAuthorizedUri(uri)) { - ContactsPermissions.enforceCallingOrSelfPermission(getContext(), - "android.permission.READ_SOCIAL_STREAM"); - } - } - - /** - * If the given URI is modifying stream items or stream photos, this will run a permission check - * for the android.permission.WRITE_SOCIAL_STREAM permission - otherwise it will do nothing. - * @param uri The URI to check. - */ - private void enforceSocialStreamWritePermission(Uri uri) { - if (SOCIAL_STREAM_URIS.contains(sUriMatcher.match(uri))) { - ContactsPermissions.enforceCallingOrSelfPermission(getContext(), - "android.permission.WRITE_SOCIAL_STREAM"); - } - } - - /** * Queries the database for stream items under the given raw contact. If there are * more entries than {@link ContactsProvider2#MAX_STREAM_ITEMS_PER_RAW_CONTACT}, * the oldest entries (as determined by timestamp) will be deleted. @@ -5053,9 +5015,6 @@ public class ContactsProvider2 extends AbstractContactsProvider waitForAccess(mReadAccessLatch); - // Enforce stream items access check if applicable. - enforceSocialStreamReadPermission(uri); - // Query the profile DB if appropriate. if (mapsToProfileDb(uri)) { switchToProfileMode(); -- cgit v1.1