Skip to content

Commit 603af61

Browse files
Subir JhanbAndroid (Google) Code Review
authored andcommitted
Add a new permission to have access to Gal Provider
BUG:6897999 Change-Id: Ie60963b7f3911b402b971e794178754e1b4f0a43
1 parent 9951b7c commit 603af61

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

core/java/android/provider/ContactsContract.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,10 @@ public static final class Preferences {
345345
* directory provider URIs by themselves. This level of indirection allows
346346
* Contacts Provider to implement additional system-level features and
347347
* optimizations. Access to Contacts Provider is protected by the
348-
* READ_CONTACTS permission, but access to the directory provider is not.
349-
* Therefore directory providers must reject requests coming from clients
350-
* other than the Contacts Provider itself. An easy way to prevent such
351-
* unauthorized access is to check the name of the calling package:
348+
* READ_CONTACTS permission, but access to the directory provider is protected by
349+
* BIND_DIRECTORY_SEARCH. This permission was introduced at the API level 17, for previous
350+
* platform versions the provider should perform the following check to make sure the call
351+
* is coming from the ContactsProvider:
352352
* <pre>
353353
* private boolean isCallerAllowed() {
354354
* PackageManager pm = getContext().getPackageManager();

core/res/AndroidManifest.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,13 @@
278278
android:label="@string/permlab_writeContacts"
279279
android:description="@string/permdesc_writeContacts" />
280280

281+
<!-- Allows an application to execute contacts directory search.
282+
This should only be used by ContactsProvider. -->
283+
<!-- @hide -->
284+
<permission android:name="android.permission.BIND_DIRECTORY_SEARCH"
285+
android:permissionGroup="android.permission-group.PERSONAL_INFO"
286+
android:protectionLevel="signature" />
287+
281288
<!-- Allows an application to read the user's call log. -->
282289
<permission android:name="android.permission.READ_CALL_LOG"
283290
android:permissionGroup="android.permission-group.PERSONAL_INFO"

0 commit comments

Comments
 (0)