From 28b68e5a59289f6947dc799b66a3b503571f876e Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Wed, 10 Jun 2009 15:26:58 -0700 Subject: [PATCH] Added data restriction constants to ContactsContract. Each data item can now be flagged as IS_RESTRICTED by the package that owns it. Restricted data items will only be visible to the owning package, unless the owner creates RestrictionExceptions for other packages. Currently @hide, so no current.xml needed. --- .../android/provider/ContactsContract.java | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index 75ca5afc4f8f6..4ed322359d25d 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -310,6 +310,12 @@ public final class ContactsContract { */ public static final String IS_SUPER_PRIMARY = "is_super_primary"; + /** + * Flag indicating that this data entry has been restricted by the owner + * {@link #PACKAGE}. + */ + public static final String IS_RESTRICTED = "is_restricted"; + /** Generic data column, the meaning is {@link #MIMETYPE} specific */ public static final String DATA1 = "data1"; /** Generic data column, the meaning is {@link #MIMETYPE} specific */ @@ -904,4 +910,51 @@ public final class ContactsContract { */ public static final String CONTACT_ID2 = "contact_id2"; } + + private interface RestrictionExceptionsColumns { + /** + * Package name of a specific data provider, which will be matched + * against {@link Data#PACKAGE}. + *

+ * Type: STRING + */ + public static final String PACKAGE_PROVIDER = "package_provider"; + + /** + * Package name of a specific data client, which will be matched against + * the incoming {@link android.os.Binder#getCallingUid()} to decide if + * the caller can access values with {@link Data#IS_RESTRICTED} flags. + *

+ * Type: STRING + */ + public static final String PACKAGE_CLIENT = "package_client"; + + /** + * Flag indicating if {@link #PACKAGE_PROVIDER} allows + * {@link #PACKAGE_CLIENT} to access restricted {@link Data} rows. + *

+ * Type: INTEGER + */ + public static final String ALLOW_ACCESS = "allow_access"; + } + + /** + * Constants for {@link Data} restriction exceptions. Sync adapters who + * insert restricted data can use this table to specify exceptions about + * which additional packages can access that restricted data.You can only + * modify rules for a {@link RestrictionExceptionsColumns#PACKAGE_PROVIDER} + * that your {@link android.os.Binder#getCallingUid()} owns. + */ + public static final class RestrictionExceptions implements RestrictionExceptionsColumns { + /** + * This utility class cannot be instantiated + */ + private RestrictionExceptions() {} + + /** + * The content:// style URI for this table + */ + public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, + "restriction_exceptions"); + } }