Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6063299 authored by Dave Santoro's avatar Dave Santoro Committed by Android (Google) Code Review
Browse files

Merge "Add hidden API for pre-authorizing URIs." into ics-mr0

parents bcfe4152 e43185e2
Loading
Loading
Loading
Loading
+53 −0
Original line number Original line Diff line number Diff line
@@ -186,6 +186,59 @@ public final class ContactsContract {
     */
     */
    public static final String DEFERRED_SNIPPETING_QUERY = "deferred_snippeting_query";
    public static final String DEFERRED_SNIPPETING_QUERY = "deferred_snippeting_query";


    /**
     * <p>
     * API for obtaining a pre-authorized version of a URI that normally requires special
     * permission (beyond READ_CONTACTS) to read.  The caller obtaining the pre-authorized URI
     * must already have the necessary permissions to access the URI; otherwise a
     * {@link SecurityException} will be thrown.
     * </p>
     * <p>
     * The authorized URI returned in the bundle contains an expiring token that allows the
     * caller to execute the query without having the special permissions that would normally
     * be required.
     * </p>
     * <p>
     * This API does not access disk, and should be safe to invoke from the UI thread.
     * </p>
     * <p>
     * Example usage:
     * <pre>
     * Uri profileUri = ContactsContract.Profile.CONTENT_VCARD_URI;
     * Bundle uriBundle = new Bundle();
     * uriBundle.putParcelable(ContactsContract.Authorization.KEY_URI_TO_AUTHORIZE, uri);
     * Bundle authResponse = getContext().getContentResolver().call(
     *         ContactsContract.AUTHORITY_URI,
     *         ContactsContract.Authorization.AUTHORIZATION_METHOD,
     *         null, // String arg, not used.
     *         uriBundle);
     * if (authResponse != null) {
     *     Uri preauthorizedProfileUri = (Uri) authResponse.getParcelable(
     *             ContactsContract.Authorization.KEY_AUTHORIZED_URI);
     *     // This pre-authorized URI can be queried by a caller without READ_PROFILE
     *     // permission.
     * }
     * </pre>
     * </p>
     * @hide
     */
    public static final class Authorization {
        /**
         * The method to invoke to create a pre-authorized URI out of the input argument.
         */
        public static final String AUTHORIZATION_METHOD = "authorize";

        /**
         * The key to set in the outbound Bundle with the URI that should be authorized.
         */
        public static final String KEY_URI_TO_AUTHORIZE = "uri_to_authorize";

        /**
         * The key to retrieve from the returned Bundle to obtain the pre-authorized URI.
         */
        public static final String KEY_AUTHORIZED_URI = "authorized_uri";
    }

    /**
    /**
     * @hide
     * @hide
     */
     */
+8 −0
Original line number Original line Diff line number Diff line
@@ -4052,6 +4052,14 @@ public final class Settings {
        /** Timeout for package verification. {@hide} */
        /** Timeout for package verification. {@hide} */
        public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout";
        public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout";


        /**
         * Duration in milliseconds before pre-authorized URIs for the contacts
         * provider should expire.
         * @hide
         */
        public static final String CONTACTS_PREAUTH_URI_EXPIRATION =
                "contacts_preauth_uri_expiration";

        /**
        /**
         * This are the settings to be backed up.
         * This are the settings to be backed up.
         *
         *