am 5bba632d: - hide Entity and all its references - remove updateEntity and insertEntity, since they are not used - add the RawContacts.Entity class, which is used in lieu of the android.content.Entity

Merge commit '5bba632d877c2878384ff21566c8eb6a1a22f37b' into eclair-mr2

* commit '5bba632d877c2878384ff21566c8eb6a1a22f37b':
  - hide Entity and all its references
This commit is contained in:
Fred Quintana
2009-10-06 12:04:41 -07:00
committed by Android Git Automerger
12 changed files with 182 additions and 519 deletions

View File

@@ -27216,88 +27216,6 @@
</package> </package>
<package name="android.content" <package name="android.content"
> >
<class name="AbstractCursorEntityIterator"
extends="java.lang.Object"
abstract="true"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<implements name="android.content.EntityIterator">
</implements>
<constructor name="AbstractCursorEntityIterator"
type="android.content.AbstractCursorEntityIterator"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="db" type="android.database.sqlite.SQLiteDatabase">
</parameter>
<parameter name="entityCursor" type="android.database.Cursor">
</parameter>
</constructor>
<method name="close"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="hasNext"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="newEntityFromCursorLocked"
return="android.content.Entity"
abstract="true"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="cursor" type="android.database.Cursor">
</parameter>
</method>
<method name="next"
return="android.content.Entity"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="reset"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<exception name="RemoteException" type="android.os.RemoteException">
</exception>
</method>
</class>
<class name="ActivityNotFoundException" <class name="ActivityNotFoundException"
extends="java.lang.RuntimeException" extends="java.lang.RuntimeException"
abstract="false" abstract="false"
@@ -27420,23 +27338,6 @@
<parameter name="cursor" type="android.database.Cursor"> <parameter name="cursor" type="android.database.Cursor">
</parameter> </parameter>
</method> </method>
<method name="onQueryEntitiesComplete"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="protected"
>
<parameter name="token" type="int">
</parameter>
<parameter name="cookie" type="java.lang.Object">
</parameter>
<parameter name="iterator" type="android.content.EntityIterator">
</parameter>
</method>
<method name="onUpdateComplete" <method name="onUpdateComplete"
return="void" return="void"
abstract="false" abstract="false"
@@ -28323,21 +28224,6 @@
<parameter name="values" type="android.content.ContentValues"> <parameter name="values" type="android.content.ContentValues">
</parameter> </parameter>
</method> </method>
<method name="insertEntity"
return="android.net.Uri"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="uri" type="android.net.Uri">
</parameter>
<parameter name="entity" type="android.content.Entity">
</parameter>
</method>
<method name="isTemporary" <method name="isTemporary"
return="boolean" return="boolean"
abstract="false" abstract="false"
@@ -28456,25 +28342,6 @@
<parameter name="sortOrder" type="java.lang.String"> <parameter name="sortOrder" type="java.lang.String">
</parameter> </parameter>
</method> </method>
<method name="queryEntities"
return="android.content.EntityIterator"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="uri" type="android.net.Uri">
</parameter>
<parameter name="selection" type="java.lang.String">
</parameter>
<parameter name="selectionArgs" type="java.lang.String[]">
</parameter>
<parameter name="sortOrder" type="java.lang.String">
</parameter>
</method>
<method name="setPathPermissions" <method name="setPathPermissions"
return="void" return="void"
abstract="false" abstract="false"
@@ -28533,21 +28400,6 @@
<parameter name="selectionArgs" type="java.lang.String[]"> <parameter name="selectionArgs" type="java.lang.String[]">
</parameter> </parameter>
</method> </method>
<method name="updateEntity"
return="int"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="uri" type="android.net.Uri">
</parameter>
<parameter name="entity" type="android.content.Entity">
</parameter>
</method>
</class> </class>
<class name="ContentProviderClient" <class name="ContentProviderClient"
extends="java.lang.Object" extends="java.lang.Object"
@@ -28653,23 +28505,6 @@
<exception name="RemoteException" type="android.os.RemoteException"> <exception name="RemoteException" type="android.os.RemoteException">
</exception> </exception>
</method> </method>
<method name="insertEntity"
return="android.net.Uri"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="uri" type="android.net.Uri">
</parameter>
<parameter name="entity" type="android.content.Entity">
</parameter>
<exception name="RemoteException" type="android.os.RemoteException">
</exception>
</method>
<method name="openAssetFile" <method name="openAssetFile"
return="android.content.res.AssetFileDescriptor" return="android.content.res.AssetFileDescriptor"
abstract="false" abstract="false"
@@ -28731,27 +28566,6 @@
<exception name="RemoteException" type="android.os.RemoteException"> <exception name="RemoteException" type="android.os.RemoteException">
</exception> </exception>
</method> </method>
<method name="queryEntities"
return="android.content.EntityIterator"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="uri" type="android.net.Uri">
</parameter>
<parameter name="selection" type="java.lang.String">
</parameter>
<parameter name="selectionArgs" type="java.lang.String[]">
</parameter>
<parameter name="sortOrder" type="java.lang.String">
</parameter>
<exception name="RemoteException" type="android.os.RemoteException">
</exception>
</method>
<method name="release" <method name="release"
return="boolean" return="boolean"
abstract="false" abstract="false"
@@ -28784,23 +28598,6 @@
<exception name="RemoteException" type="android.os.RemoteException"> <exception name="RemoteException" type="android.os.RemoteException">
</exception> </exception>
</method> </method>
<method name="updateEntity"
return="int"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="uri" type="android.net.Uri">
</parameter>
<parameter name="entity" type="android.content.Entity">
</parameter>
<exception name="RemoteException" type="android.os.RemoteException">
</exception>
</method>
</class> </class>
<class name="ContentProviderOperation" <class name="ContentProviderOperation"
extends="java.lang.Object" extends="java.lang.Object"
@@ -29689,27 +29486,6 @@
<parameter name="sortOrder" type="java.lang.String"> <parameter name="sortOrder" type="java.lang.String">
</parameter> </parameter>
</method> </method>
<method name="queryEntities"
return="android.content.EntityIterator"
abstract="false"
native="false"
synchronized="false"
static="false"
final="true"
deprecated="not deprecated"
visibility="public"
>
<parameter name="uri" type="android.net.Uri">
</parameter>
<parameter name="selection" type="java.lang.String">
</parameter>
<parameter name="selectionArgs" type="java.lang.String[]">
</parameter>
<parameter name="sortOrder" type="java.lang.String">
</parameter>
<exception name="RemoteException" type="android.os.RemoteException">
</exception>
</method>
<method name="registerContentObserver" <method name="registerContentObserver"
return="void" return="void"
abstract="false" abstract="false"
@@ -33171,199 +32947,6 @@
</parameter> </parameter>
</method> </method>
</interface> </interface>
<class name="Entity"
extends="java.lang.Object"
abstract="false"
static="false"
final="true"
deprecated="not deprecated"
visibility="public"
>
<implements name="android.os.Parcelable">
</implements>
<constructor name="Entity"
type="android.content.Entity"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="values" type="android.content.ContentValues">
</parameter>
</constructor>
<method name="addSubValue"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="uri" type="android.net.Uri">
</parameter>
<parameter name="values" type="android.content.ContentValues">
</parameter>
</method>
<method name="describeContents"
return="int"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getEntityValues"
return="android.content.ContentValues"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getSubValues"
return="java.util.ArrayList&lt;android.content.Entity.NamedContentValues&gt;"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="writeToParcel"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="dest" type="android.os.Parcel">
</parameter>
<parameter name="flags" type="int">
</parameter>
</method>
<field name="CREATOR"
type="android.os.Parcelable.Creator"
transient="false"
volatile="false"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
</class>
<class name="Entity.NamedContentValues"
extends="java.lang.Object"
abstract="false"
static="true"
final="false"
deprecated="not deprecated"
visibility="public"
>
<constructor name="Entity.NamedContentValues"
type="android.content.Entity.NamedContentValues"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="uri" type="android.net.Uri">
</parameter>
<parameter name="values" type="android.content.ContentValues">
</parameter>
</constructor>
<field name="uri"
type="android.net.Uri"
transient="false"
volatile="false"
static="false"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="values"
type="android.content.ContentValues"
transient="false"
volatile="false"
static="false"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
</class>
<interface name="EntityIterator"
abstract="true"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<method name="close"
return="void"
abstract="true"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="hasNext"
return="boolean"
abstract="true"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<exception name="RemoteException" type="android.os.RemoteException">
</exception>
</method>
<method name="next"
return="android.content.Entity"
abstract="true"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<exception name="RemoteException" type="android.os.RemoteException">
</exception>
</method>
<method name="reset"
return="void"
abstract="true"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<exception name="RemoteException" type="android.os.RemoteException">
</exception>
</method>
</interface>
<class name="Intent" <class name="Intent"
extends="java.lang.Object" extends="java.lang.Object"
abstract="false" abstract="false"
@@ -115542,6 +115125,82 @@
> >
</field> </field>
</class> </class>
<class name="ContactsContract.RawContacts.Entity"
extends="java.lang.Object"
abstract="false"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
<implements name="android.provider.BaseColumns">
</implements>
<field name="CONTENT_DIRECTORY"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;entity&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="DATA_ID"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;data_id&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
</class>
<class name="ContactsContract.RawContactsEntity"
extends="java.lang.Object"
abstract="false"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
<implements name="android.provider.BaseColumns">
</implements>
<field name="CONTENT_TYPE"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;vnd.android.cursor.dir/raw_contact_entity&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="CONTENT_URI"
type="android.net.Uri"
transient="false"
volatile="false"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="DATA_ID"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;data_id&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
</class>
<class name="ContactsContract.Settings" <class name="ContactsContract.Settings"
extends="java.lang.Object" extends="java.lang.Object"
abstract="false" abstract="false"

View File

@@ -8,6 +8,7 @@ import android.os.RemoteException;
* An abstract class that makes it easy to implement an EntityIterator over a cursor. * An abstract class that makes it easy to implement an EntityIterator over a cursor.
* The user must implement {@link #newEntityFromCursorLocked}, which runs inside of a * The user must implement {@link #newEntityFromCursorLocked}, which runs inside of a
* database transaction. * database transaction.
* @hide
*/ */
public abstract class AbstractCursorEntityIterator implements EntityIterator { public abstract class AbstractCursorEntityIterator implements EntityIterator {
private final Cursor mEntityCursor; private final Cursor mEntityCursor;

View File

@@ -344,6 +344,7 @@ public abstract class AsyncQueryHandler extends Handler {
* @param token The token to identify the query. * @param token The token to identify the query.
* @param cookie The cookie object. * @param cookie The cookie object.
* @param iterator The iterator holding the query results. * @param iterator The iterator holding the query results.
* @hide
*/ */
protected void onQueryEntitiesComplete(int token, Object cookie, EntityIterator iterator) { protected void onQueryEntitiesComplete(int token, Object cookie, EntityIterator iterator) {
// Empty // Empty

View File

@@ -131,6 +131,9 @@ public abstract class ContentProvider implements ComponentCallbacks {
selectionArgs, sortOrder); selectionArgs, sortOrder);
} }
/**
* @hide
*/
public EntityIterator queryEntities(Uri uri, String selection, String[] selectionArgs, public EntityIterator queryEntities(Uri uri, String selection, String[] selectionArgs,
String sortOrder) { String sortOrder) {
enforceReadPermission(uri); enforceReadPermission(uri);
@@ -152,11 +155,6 @@ public abstract class ContentProvider implements ComponentCallbacks {
return ContentProvider.this.bulkInsert(uri, initialValues); return ContentProvider.this.bulkInsert(uri, initialValues);
} }
public Uri insertEntity(Uri uri, Entity entities) {
enforceWritePermission(uri);
return ContentProvider.this.insertEntity(uri, entities);
}
public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations) public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations)
throws OperationApplicationException { throws OperationApplicationException {
for (ContentProviderOperation operation : operations) { for (ContentProviderOperation operation : operations) {
@@ -182,11 +180,6 @@ public abstract class ContentProvider implements ComponentCallbacks {
return ContentProvider.this.update(uri, values, selection, selectionArgs); return ContentProvider.this.update(uri, values, selection, selectionArgs);
} }
public int updateEntity(Uri uri, Entity entity) {
enforceWritePermission(uri);
return ContentProvider.this.updateEntity(uri, entity);
}
public ParcelFileDescriptor openFile(Uri uri, String mode) public ParcelFileDescriptor openFile(Uri uri, String mode)
throws FileNotFoundException { throws FileNotFoundException {
if (mode != null && mode.startsWith("rw")) enforceWritePermission(uri); if (mode != null && mode.startsWith("rw")) enforceWritePermission(uri);
@@ -451,6 +444,9 @@ public abstract class ContentProvider implements ComponentCallbacks {
public abstract Cursor query(Uri uri, String[] projection, public abstract Cursor query(Uri uri, String[] projection,
String selection, String[] selectionArgs, String sortOrder); String selection, String[] selectionArgs, String sortOrder);
/**
* @hide
*/
public EntityIterator queryEntities(Uri uri, String selection, String[] selectionArgs, public EntityIterator queryEntities(Uri uri, String selection, String[] selectionArgs,
String sortOrder) { String sortOrder) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
@@ -506,10 +502,6 @@ public abstract class ContentProvider implements ComponentCallbacks {
return numValues; return numValues;
} }
public Uri insertEntity(Uri uri, Entity entity) {
throw new UnsupportedOperationException();
}
/** /**
* A request to delete one or more rows. The selection clause is applied when performing * A request to delete one or more rows. The selection clause is applied when performing
* the deletion, allowing the operation to affect multiple rows in a * the deletion, allowing the operation to affect multiple rows in a
@@ -554,14 +546,10 @@ public abstract class ContentProvider implements ComponentCallbacks {
public abstract int update(Uri uri, ContentValues values, String selection, public abstract int update(Uri uri, ContentValues values, String selection,
String[] selectionArgs); String[] selectionArgs);
public int updateEntity(Uri uri, Entity entity) {
throw new UnsupportedOperationException();
}
/** /**
* Open a file blob associated with a content URI. * Open a file blob associated with a content URI.
* This method can be called from multiple * This method can be called from multiple
* threads, as described in * threads, as described inentity
* <a href="{@docRoot}guide/topics/fundamentals.html#procthread">Application Fundamentals: * <a href="{@docRoot}guide/topics/fundamentals.html#procthread">Application Fundamentals:
* Processes and Threads</a>. * Processes and Threads</a>.
* *

View File

@@ -89,22 +89,15 @@ public class ContentProviderClient {
return mContentProvider.openAssetFile(url, mode); return mContentProvider.openAssetFile(url, mode);
} }
/** see {@link ContentProvider#queryEntities} */ /**
* see {@link ContentProvider#queryEntities}
* @hide
*/
public EntityIterator queryEntities(Uri uri, String selection, String[] selectionArgs, public EntityIterator queryEntities(Uri uri, String selection, String[] selectionArgs,
String sortOrder) throws RemoteException { String sortOrder) throws RemoteException {
return mContentProvider.queryEntities(uri, selection, selectionArgs, sortOrder); return mContentProvider.queryEntities(uri, selection, selectionArgs, sortOrder);
} }
/** see {@link ContentProvider#insertEntity} */
public Uri insertEntity(Uri uri, Entity entity) throws RemoteException {
return mContentProvider.insertEntity(uri, entity);
}
/** see {@link ContentProvider#updateEntity} */
public int updateEntity(Uri uri, Entity entity) throws RemoteException {
return mContentProvider.updateEntity(uri, entity);
}
/** see {@link ContentProvider#applyBatch} */ /** see {@link ContentProvider#applyBatch} */
public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations) public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations)
throws RemoteException, OperationApplicationException { throws RemoteException, OperationApplicationException {

View File

@@ -155,28 +155,6 @@ abstract public class ContentProviderNative extends Binder implements IContentPr
return true; return true;
} }
case INSERT_ENTITIES_TRANSACTION:
{
data.enforceInterface(IContentProvider.descriptor);
Uri uri = Uri.CREATOR.createFromParcel(data);
Entity entity = (Entity) data.readParcelable(null);
Uri newUri = insertEntity(uri, entity);
reply.writeNoException();
Uri.writeToParcel(reply, newUri);
return true;
}
case UPDATE_ENTITIES_TRANSACTION:
{
data.enforceInterface(IContentProvider.descriptor);
Uri uri = Uri.CREATOR.createFromParcel(data);
Entity entity = (Entity) data.readParcelable(null);
int count = updateEntity(uri, entity);
reply.writeNoException();
reply.writeInt(count);
return true;
}
case APPLY_BATCH_TRANSACTION: case APPLY_BATCH_TRANSACTION:
{ {
data.enforceInterface(IContentProvider.descriptor); data.enforceInterface(IContentProvider.descriptor);
@@ -267,6 +245,9 @@ abstract public class ContentProviderNative extends Binder implements IContentPr
return super.onTransact(code, data, reply, flags); return super.onTransact(code, data, reply, flags);
} }
/**
* @hide
*/
private class IEntityIteratorImpl extends IEntityIterator.Stub { private class IEntityIteratorImpl extends IEntityIterator.Stub {
private final EntityIterator mEntityIterator; private final EntityIterator mEntityIterator;
@@ -371,6 +352,9 @@ final class ContentProviderProxy implements IContentProvider
return adaptor; return adaptor;
} }
/**
* @hide
*/
public EntityIterator queryEntities(Uri url, String selection, String[] selectionArgs, public EntityIterator queryEntities(Uri url, String selection, String[] selectionArgs,
String sortOrder) String sortOrder)
throws RemoteException { throws RemoteException {
@@ -396,6 +380,9 @@ final class ContentProviderProxy implements IContentProvider
return new RemoteEntityIterator(IEntityIterator.Stub.asInterface(entityIteratorBinder)); return new RemoteEntityIterator(IEntityIterator.Stub.asInterface(entityIteratorBinder));
} }
/**
* @hide
*/
static class RemoteEntityIterator implements EntityIterator { static class RemoteEntityIterator implements EntityIterator {
private final IEntityIterator mEntityIterator; private final IEntityIterator mEntityIterator;
RemoteEntityIterator(IEntityIterator entityIterator) { RemoteEntityIterator(IEntityIterator entityIterator) {
@@ -506,44 +493,6 @@ final class ContentProviderProxy implements IContentProvider
return results; return results;
} }
public Uri insertEntity(Uri uri, Entity entity) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(IContentProvider.descriptor);
uri.writeToParcel(data, 0);
data.writeParcelable(entity, 0);
mRemote.transact(IContentProvider.INSERT_ENTITIES_TRANSACTION, data, reply, 0);
DatabaseUtils.readExceptionFromParcel(reply);
return Uri.CREATOR.createFromParcel(reply);
} finally {
data.recycle();
reply.recycle();
}
}
public int updateEntity(Uri uri, Entity entity) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(IContentProvider.descriptor);
uri.writeToParcel(data, 0);
data.writeParcelable(entity, 0);
mRemote.transact(IContentProvider.UPDATE_ENTITIES_TRANSACTION, data, reply, 0);
DatabaseUtils.readExceptionFromParcel(reply);
return reply.readInt();
} finally {
data.recycle();
reply.recycle();
}
}
public int delete(Uri url, String selection, String[] selectionArgs) public int delete(Uri url, String selection, String[] selectionArgs)
throws RemoteException { throws RemoteException {
Parcel data = Parcel.obtain(); Parcel data = Parcel.obtain();

View File

@@ -218,6 +218,7 @@ public abstract class ContentResolver {
/** /**
* EntityIterator wrapper that releases the associated ContentProviderClient when the * EntityIterator wrapper that releases the associated ContentProviderClient when the
* iterator is closed. * iterator is closed.
* @hide
*/ */
private class EntityIteratorWrapper implements EntityIterator { private class EntityIteratorWrapper implements EntityIterator {
private final EntityIterator mInner; private final EntityIterator mInner;
@@ -283,6 +284,7 @@ public abstract class ContentResolver {
* @throws RemoteException thrown if a RemoteException is encountered while attempting * @throws RemoteException thrown if a RemoteException is encountered while attempting
* to communicate with a remote provider. * to communicate with a remote provider.
* @throws IllegalArgumentException thrown if there is no provider that matches the uri * @throws IllegalArgumentException thrown if there is no provider that matches the uri
* @hide
*/ */
public final EntityIterator queryEntities(Uri uri, public final EntityIterator queryEntities(Uri uri,
String selection, String[] selectionArgs, String sortOrder) throws RemoteException { String selection, String[] selectionArgs, String sortOrder) throws RemoteException {

View File

@@ -26,6 +26,7 @@ import java.util.ArrayList;
/** /**
* Objects that pass through the ContentProvider and ContentResolver's methods that deal with * Objects that pass through the ContentProvider and ContentResolver's methods that deal with
* Entities must implement this abstract base class and thus themselves be Parcelable. * Entities must implement this abstract base class and thus themselves be Parcelable.
* @hide
*/ */
public final class Entity implements Parcelable { public final class Entity implements Parcelable {
final private ContentValues mValues; final private ContentValues mValues;

View File

@@ -18,6 +18,9 @@ package android.content;
import android.os.RemoteException; import android.os.RemoteException;
/**
* @hide
*/
public interface EntityIterator { public interface EntityIterator {
/** /**
* Returns whether there are more elements to iterate, i.e. whether the * Returns whether there are more elements to iterate, i.e. whether the

View File

@@ -44,6 +44,9 @@ public interface IContentProvider extends IInterface {
CursorWindow window) throws RemoteException; CursorWindow window) throws RemoteException;
public Cursor query(Uri url, String[] projection, String selection, public Cursor query(Uri url, String[] projection, String selection,
String[] selectionArgs, String sortOrder) throws RemoteException; String[] selectionArgs, String sortOrder) throws RemoteException;
/**
* @hide
*/
public EntityIterator queryEntities(Uri url, String selection, public EntityIterator queryEntities(Uri url, String selection,
String[] selectionArgs, String sortOrder) String[] selectionArgs, String sortOrder)
throws RemoteException; throws RemoteException;
@@ -51,12 +54,10 @@ public interface IContentProvider extends IInterface {
public Uri insert(Uri url, ContentValues initialValues) public Uri insert(Uri url, ContentValues initialValues)
throws RemoteException; throws RemoteException;
public int bulkInsert(Uri url, ContentValues[] initialValues) throws RemoteException; public int bulkInsert(Uri url, ContentValues[] initialValues) throws RemoteException;
public Uri insertEntity(Uri uri, Entity entities) throws RemoteException;
public int delete(Uri url, String selection, String[] selectionArgs) public int delete(Uri url, String selection, String[] selectionArgs)
throws RemoteException; throws RemoteException;
public int update(Uri url, ContentValues values, String selection, public int update(Uri url, ContentValues values, String selection,
String[] selectionArgs) throws RemoteException; String[] selectionArgs) throws RemoteException;
public int updateEntity(Uri uri, Entity entity) throws RemoteException;
public ParcelFileDescriptor openFile(Uri url, String mode) public ParcelFileDescriptor openFile(Uri url, String mode)
throws RemoteException, FileNotFoundException; throws RemoteException, FileNotFoundException;
public AssetFileDescriptor openAssetFile(Uri url, String mode) public AssetFileDescriptor openAssetFile(Uri url, String mode)
@@ -75,8 +76,9 @@ public interface IContentProvider extends IInterface {
static final int BULK_INSERT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 12; static final int BULK_INSERT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 12;
static final int OPEN_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 13; static final int OPEN_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 13;
static final int OPEN_ASSET_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 14; static final int OPEN_ASSET_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 14;
static final int INSERT_ENTITIES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 16; /**
static final int UPDATE_ENTITIES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 17; * @hide
*/
static final int QUERY_ENTITIES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 18; static final int QUERY_ENTITIES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 18;
static final int APPLY_BATCH_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 19; static final int APPLY_BATCH_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 19;
} }

View File

@@ -673,6 +673,30 @@ public final class ContactsContract {
*/ */
public static final String CONTENT_DIRECTORY = "data"; public static final String CONTENT_DIRECTORY = "data";
} }
/**
* A sub-directory of a single raw contact that contains all of their {@link Data} rows.
* To access this directory append {@link Entity#CONTENT_DIRECTORY} to the contact URI.
*/
public static final class Entity implements BaseColumns, DataColumns {
/**
* no public constructor since this is a utility class
*/
private Entity() {
}
/**
* The directory twig for this sub-table
*/
public static final String CONTENT_DIRECTORY = "entity";
/**
* The ID of the data column. The value will be null if this raw contact has no
* data rows.
* <P>Type: INTEGER</P>
*/
public static final String DATA_ID = "data_id";
}
} }
private interface StatusColumns extends Im.CommonPresenceColumns { private interface StatusColumns extends Im.CommonPresenceColumns {
@@ -869,6 +893,51 @@ public final class ContactsContract {
} }
} }
/**
* Constants for the raw contacts entities table, which can be though of as an outer join
* of the raw_contacts table with the data table.
*/
public final static class RawContactsEntity
implements BaseColumns, DataColumns, RawContactsColumns {
/**
* This utility class cannot be instantiated
*/
private RawContactsEntity() {}
/**
* The content:// style URI for this table
*/
public static final Uri CONTENT_URI =
Uri.withAppendedPath(AUTHORITY_URI, "raw_contact_entities");
/**
* The MIME type of {@link #CONTENT_URI} providing a directory of raw contact entities.
*/
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/raw_contact_entity";
/**
* If {@link #FOR_EXPORT_ONLY} is explicitly set to "1", returned Cursor toward
* Data.CONTENT_URI contains only exportable data.
*
* This flag is useful (currently) only for vCard exporter in Contacts app, which
* needs to exclude "un-exportable" data from available data to export, while
* Contacts app itself has priviledge to access all data including "un-expotable"
* ones and providers return all of them regardless of the callers' intention.
* <P>Type: INTEGER</p>
*
* @hide Maybe available only in Eclair and not really ready for public use.
* TODO: remove, or implement this feature completely. As of now (Eclair),
* we only use this flag in queryEntities(), not query().
*/
public static final String FOR_EXPORT_ONLY = "for_export_only";
/**
* The ID of the data column. The value will be null if this raw contact has no data rows.
* <P>Type: INTEGER</P>
*/
public static final String DATA_ID = "data_id";
}
private interface PhoneLookupColumns { private interface PhoneLookupColumns {
/** /**
* The phone number as the user entered it. * The phone number as the user entered it.

View File

@@ -53,10 +53,6 @@ public class MockContentProvider implements IContentProvider {
return 0; return 0;
} }
public Uri insertEntity(Uri uri, Entity entities) throws RemoteException {
throw new UnsupportedOperationException("unimplemented mock method");
}
@SuppressWarnings("unused") @SuppressWarnings("unused")
public IBulkCursor bulkQuery(Uri url, String[] projection, String selection, public IBulkCursor bulkQuery(Uri url, String[] projection, String selection,
String[] selectionArgs, String sortOrder, IContentObserver observer, String[] selectionArgs, String sortOrder, IContentObserver observer,
@@ -103,6 +99,9 @@ public class MockContentProvider implements IContentProvider {
throw new UnsupportedOperationException("unimplemented mock method"); throw new UnsupportedOperationException("unimplemented mock method");
} }
/**
* @hide
*/
public EntityIterator queryEntities(Uri url, String selection, String[] selectionArgs, public EntityIterator queryEntities(Uri url, String selection, String[] selectionArgs,
String sortOrder) throws RemoteException { String sortOrder) throws RemoteException {
throw new UnsupportedOperationException("unimplemented mock method"); throw new UnsupportedOperationException("unimplemented mock method");
@@ -114,10 +113,6 @@ public class MockContentProvider implements IContentProvider {
throw new UnsupportedOperationException("unimplemented mock method"); throw new UnsupportedOperationException("unimplemented mock method");
} }
public int updateEntity(Uri uri, Entity entity) throws RemoteException {
throw new UnsupportedOperationException("unimplemented mock method");
}
public IBinder asBinder() { public IBinder asBinder() {
throw new UnsupportedOperationException("unimplemented mock method"); throw new UnsupportedOperationException("unimplemented mock method");
} }