Search in sources :

Example 1 with IBulkCursor

use of android.database.IBulkCursor in project XobotOS by xamarin.

the class ContentProviderProxy method query.

public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs, String sortOrder) throws RemoteException {
    BulkCursorToCursorAdaptor adaptor = new BulkCursorToCursorAdaptor();
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IContentProvider.descriptor);
        url.writeToParcel(data, 0);
        int length = 0;
        if (projection != null) {
            length = projection.length;
        }
        data.writeInt(length);
        for (int i = 0; i < length; i++) {
            data.writeString(projection[i]);
        }
        data.writeString(selection);
        if (selectionArgs != null) {
            length = selectionArgs.length;
        } else {
            length = 0;
        }
        data.writeInt(length);
        for (int i = 0; i < length; i++) {
            data.writeString(selectionArgs[i]);
        }
        data.writeString(sortOrder);
        data.writeStrongBinder(adaptor.getObserver().asBinder());
        mRemote.transact(IContentProvider.QUERY_TRANSACTION, data, reply, 0);
        DatabaseUtils.readExceptionFromParcel(reply);
        IBulkCursor bulkCursor = BulkCursorNative.asInterface(reply.readStrongBinder());
        if (bulkCursor != null) {
            int rowCount = reply.readInt();
            int idColumnPosition = reply.readInt();
            boolean wantsAllOnMoveCalls = reply.readInt() != 0;
            adaptor.initialize(bulkCursor, rowCount, idColumnPosition, wantsAllOnMoveCalls);
        } else {
            adaptor.close();
            adaptor = null;
        }
        return adaptor;
    } catch (RemoteException ex) {
        adaptor.close();
        throw ex;
    } catch (RuntimeException ex) {
        adaptor.close();
        throw ex;
    } finally {
        data.recycle();
        reply.recycle();
    }
}
Also used : IBulkCursor(android.database.IBulkCursor) Parcel(android.os.Parcel) BulkCursorToCursorAdaptor(android.database.BulkCursorToCursorAdaptor) RemoteException(android.os.RemoteException)

Aggregations

BulkCursorToCursorAdaptor (android.database.BulkCursorToCursorAdaptor)1 IBulkCursor (android.database.IBulkCursor)1 Parcel (android.os.Parcel)1 RemoteException (android.os.RemoteException)1