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

Commit 46891a8f authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Update streamitems javadoc

ACCOUNT_TYPE and ACCOUNT_NAME query parameters were required in API level 15.
We've removed the check for JB, but in order to keep compatibility with HC
apps still need to add those parameters.

Bug 5135278

Change-Id: Ib9b9751c9017c53905047045816a44c5a279fa64
parent 002f5377
Loading
Loading
Loading
Loading
+58 −25
Original line number Original line Diff line number Diff line
@@ -3049,6 +3049,13 @@ public final class ContactsContract {
     * requires android.permission.READ_SOCIAL_STREAM permission, and inserting or updating social
     * requires android.permission.READ_SOCIAL_STREAM permission, and inserting or updating social
     * stream items requires android.permission.WRITE_SOCIAL_STREAM permission.
     * stream items requires android.permission.WRITE_SOCIAL_STREAM permission.
     * </p>
     * </p>
     * <h3>Account check</h3>
     * <p>
     * The content URIs to the insert, update and delete operations are required to have the account
     * information matching that of the owning raw contact as query parameters, namely
     * {@link RawContacts#ACCOUNT_TYPE} and {@link RawContacts#ACCOUNT_NAME}.
     * {@link RawContacts#DATA_SET} isn't required.
     * </p>
     * <h3>Operations</h3>
     * <h3>Operations</h3>
     * <dl>
     * <dl>
     * <dt><b>Insert</b></dt>
     * <dt><b>Insert</b></dt>
@@ -3063,9 +3070,12 @@ public final class ContactsContract {
     * values.put(StreamItems.TEXT, "Breakfasted at Tiffanys");
     * values.put(StreamItems.TEXT, "Breakfasted at Tiffanys");
     * values.put(StreamItems.TIMESTAMP, timestamp);
     * values.put(StreamItems.TIMESTAMP, timestamp);
     * values.put(StreamItems.COMMENTS, "3 people reshared this");
     * values.put(StreamItems.COMMENTS, "3 people reshared this");
     * Uri streamItemUri = getContentResolver().insert(
     * Uri.Builder builder = RawContacts.CONTENT_URI.buildUpon();
     *     Uri.withAppendedPath(ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId),
     * ContentUris.appendId(builder, rawContactId);
     *         RawContacts.StreamItems.CONTENT_DIRECTORY), values);
     * builder.appendEncodedPath(RawContacts.StreamItems.CONTENT_DIRECTORY);
     * builder.appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName);
     * builder.appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType);
     * Uri streamItemUri = getContentResolver().insert(builder.build(), values);
     * long streamItemId = ContentUris.parseId(streamItemUri);
     * long streamItemId = ContentUris.parseId(streamItemUri);
     * </pre>
     * </pre>
     * </dd>
     * </dd>
@@ -3077,7 +3087,10 @@ public final class ContactsContract {
     * values.put(StreamItems.TEXT, "Breakfasted at Tiffanys");
     * values.put(StreamItems.TEXT, "Breakfasted at Tiffanys");
     * values.put(StreamItems.TIMESTAMP, timestamp);
     * values.put(StreamItems.TIMESTAMP, timestamp);
     * values.put(StreamItems.COMMENTS, "3 people reshared this");
     * values.put(StreamItems.COMMENTS, "3 people reshared this");
     * Uri streamItemUri = getContentResolver().insert(StreamItems.CONTENT_URI, values);
     * Uri.Builder builder = StreamItems.CONTENT_URI.buildUpon();
     * builder.appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName);
     * builder.appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType);
     * Uri streamItemUri = getContentResolver().insert(builder.build(), values);
     * long streamItemId = ContentUris.parseId(streamItemUri);
     * long streamItemId = ContentUris.parseId(streamItemUri);
     *</pre>
     *</pre>
     * </dd>
     * </dd>
@@ -3410,6 +3423,13 @@ public final class ContactsContract {
     * requires android.permission.READ_SOCIAL_STREAM permission, and inserting or updating
     * requires android.permission.READ_SOCIAL_STREAM permission, and inserting or updating
     * social stream photos requires android.permission.WRITE_SOCIAL_STREAM permission.
     * social stream photos requires android.permission.WRITE_SOCIAL_STREAM permission.
     * </p>
     * </p>
     * <h3>Account check</h3>
     * <p>
     * The content URIs to the insert, update and delete operations are required to have the account
     * information matching that of the owning raw contact as query parameters, namely
     * {@link RawContacts#ACCOUNT_TYPE} and {@link RawContacts#ACCOUNT_NAME}.
     * {@link RawContacts#DATA_SET} isn't required.
     * </p>
     * <h3>Operations</h3>
     * <h3>Operations</h3>
     * <dl>
     * <dl>
     * <dt><b>Insert</b></dt>
     * <dt><b>Insert</b></dt>
@@ -3426,9 +3446,12 @@ public final class ContactsContract {
     * ContentValues values = new ContentValues();
     * ContentValues values = new ContentValues();
     * values.put(StreamItemPhotos.SORT_INDEX, 1);
     * values.put(StreamItemPhotos.SORT_INDEX, 1);
     * values.put(StreamItemPhotos.PHOTO, photoData);
     * values.put(StreamItemPhotos.PHOTO, photoData);
     * Uri photoUri = getContentResolver().insert(Uri.withAppendedPath(
     * Uri.Builder builder = StreamItems.CONTENT_URI.buildUpon();
     *     ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
     * ContentUris.appendId(builder, streamItemId);
     *     StreamItems.StreamItemPhotos#CONTENT_DIRECTORY), values);
     * builder.appendEncodedPath(StreamItems.StreamItemPhotos.CONTENT_DIRECTORY);
     * builder.appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName);
     * builder.appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType);
     * Uri photoUri = getContentResolver().insert(builder.build(), values);
     * long photoId = ContentUris.parseId(photoUri);
     * long photoId = ContentUris.parseId(photoUri);
     * </pre>
     * </pre>
     * </dd>
     * </dd>
@@ -3439,7 +3462,10 @@ public final class ContactsContract {
     * values.put(StreamItemPhotos.STREAM_ITEM_ID, streamItemId);
     * values.put(StreamItemPhotos.STREAM_ITEM_ID, streamItemId);
     * values.put(StreamItemPhotos.SORT_INDEX, 1);
     * values.put(StreamItemPhotos.SORT_INDEX, 1);
     * values.put(StreamItemPhotos.PHOTO, photoData);
     * values.put(StreamItemPhotos.PHOTO, photoData);
     * Uri photoUri = getContentResolver().insert(StreamItems.CONTENT_PHOTO_URI, values);
     * Uri.Builder builder = StreamItems.CONTENT_PHOTO_URI.buildUpon();
     * builder.appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName);
     * builder.appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType);
     * Uri photoUri = getContentResolver().insert(builder.build(), values);
     * long photoId = ContentUris.parseId(photoUri);
     * long photoId = ContentUris.parseId(photoUri);
     * </pre>
     * </pre>
     * </dd>
     * </dd>
@@ -3459,12 +3485,13 @@ public final class ContactsContract {
     * <pre>
     * <pre>
     * ContentValues values = new ContentValues();
     * ContentValues values = new ContentValues();
     * values.put(StreamItemPhotos.PHOTO, newPhotoData);
     * values.put(StreamItemPhotos.PHOTO, newPhotoData);
     * getContentResolver().update(
     * Uri.Builder builder = StreamItems.CONTENT_URI.buildUpon();
     *     ContentUris.withAppendedId(
     * ContentUris.appendId(builder, streamItemId);
     *         Uri.withAppendedPath(
     * builder.appendEncodedPath(StreamItems.StreamItemPhotos.CONTENT_DIRECTORY);
     *             ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
     * ContentUris.appendId(builder, streamItemPhotoId);
     *             StreamItems.StreamItemPhotos#CONTENT_DIRECTORY),
     * builder.appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName);
     *         streamItemPhotoId), values, null, null);
     * builder.appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType);
     * getContentResolver().update(builder.build(), values, null, null);
     * </pre>
     * </pre>
     * </dd>
     * </dd>
     * <dt>Via the {@link ContactsContract.StreamItems#CONTENT_PHOTO_URI} URI:</dt>
     * <dt>Via the {@link ContactsContract.StreamItems#CONTENT_PHOTO_URI} URI:</dt>
@@ -3473,7 +3500,10 @@ public final class ContactsContract {
     * ContentValues values = new ContentValues();
     * ContentValues values = new ContentValues();
     * values.put(StreamItemPhotos.STREAM_ITEM_ID, streamItemId);
     * values.put(StreamItemPhotos.STREAM_ITEM_ID, streamItemId);
     * values.put(StreamItemPhotos.PHOTO, newPhotoData);
     * values.put(StreamItemPhotos.PHOTO, newPhotoData);
     * getContentResolver().update(StreamItems.CONTENT_PHOTO_URI, values);
     * Uri.Builder builder = StreamItems.CONTENT_PHOTO_URI.buildUpon();
     * builder.appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName);
     * builder.appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType);
     * getContentResolver().update(builder.build(), values);
     * </pre>
     * </pre>
     * </dd>
     * </dd>
     * </dl>
     * </dl>
@@ -3489,21 +3519,24 @@ public final class ContactsContract {
     * </dt>
     * </dt>
     * <dd>
     * <dd>
     * <pre>
     * <pre>
     * getContentResolver().delete(
     * Uri.Builder builder = StreamItems.CONTENT_URI.buildUpon();
     *     ContentUris.withAppendedId(
     * ContentUris.appendId(builder, streamItemId);
     *         Uri.withAppendedPath(
     * builder.appendEncodedPath(StreamItems.StreamItemPhotos.CONTENT_DIRECTORY);
     *             ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
     * ContentUris.appendId(builder, streamItemPhotoId);
     *             StreamItems.StreamItemPhotos#CONTENT_DIRECTORY),
     * builder.appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName);
     *         streamItemPhotoId), null, null);
     * builder.appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType);
     * getContentResolver().delete(builder.build(), null, null);
     * </pre>
     * </pre>
     * </dd>
     * </dd>
     * <dt>Deleting all photos under a stream item</dt>
     * <dt>Deleting all photos under a stream item</dt>
     * <dd>
     * <dd>
     * <pre>
     * <pre>
     * getContentResolver().delete(
     * Uri.Builder builder = StreamItems.CONTENT_URI.buildUpon();
     *     Uri.withAppendedPath(
     * ContentUris.appendId(builder, streamItemId);
     *         ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
     * builder.appendEncodedPath(StreamItems.StreamItemPhotos.CONTENT_DIRECTORY);
     *         StreamItems.StreamItemPhotos#CONTENT_DIRECTORY), null, null);
     * builder.appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName);
     * builder.appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType);
     * getContentResolver().delete(builder.build(), null, null);
     * </pre>
     * </pre>
     * </dd>
     * </dd>
     * </dl>
     * </dl>