Java Code Examples for android.database.DatabaseUtils#readExceptionFromParcel()

The following examples show how to use android.database.DatabaseUtils#readExceptionFromParcel() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContentProviderNative.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public String getType(Uri url) throws RemoteException
{
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IContentProvider.descriptor);

        url.writeToParcel(data, 0);

        mRemote.transact(IContentProvider.GET_TYPE_TRANSACTION, data, reply, 0);

        DatabaseUtils.readExceptionFromParcel(reply);
        String out = reply.readString();
        return out;
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
Example 2
Source File: ContentProviderNative.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public Uri insert(String callingPkg, Uri url, ContentValues values) throws RemoteException
{
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IContentProvider.descriptor);

        data.writeString(callingPkg);
        url.writeToParcel(data, 0);
        values.writeToParcel(data, 0);

        mRemote.transact(IContentProvider.INSERT_TRANSACTION, data, reply, 0);

        DatabaseUtils.readExceptionFromParcel(reply);
        Uri out = Uri.CREATOR.createFromParcel(reply);
        return out;
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
Example 3
Source File: ContentProviderNative.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public int bulkInsert(String callingPkg, Uri url, ContentValues[] values) throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IContentProvider.descriptor);

        data.writeString(callingPkg);
        url.writeToParcel(data, 0);
        data.writeTypedArray(values, 0);

        mRemote.transact(IContentProvider.BULK_INSERT_TRANSACTION, data, reply, 0);

        DatabaseUtils.readExceptionFromParcel(reply);
        int count = reply.readInt();
        return count;
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
Example 4
Source File: ContentProviderNative.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public int delete(String callingPkg, Uri url, String selection, String[] selectionArgs)
        throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IContentProvider.descriptor);

        data.writeString(callingPkg);
        url.writeToParcel(data, 0);
        data.writeString(selection);
        data.writeStringArray(selectionArgs);

        mRemote.transact(IContentProvider.DELETE_TRANSACTION, data, reply, 0);

        DatabaseUtils.readExceptionFromParcel(reply);
        int count = reply.readInt();
        return count;
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
Example 5
Source File: ContentProviderNative.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public int update(String callingPkg, Uri url, ContentValues values, String selection,
        String[] selectionArgs) throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IContentProvider.descriptor);

        data.writeString(callingPkg);
        url.writeToParcel(data, 0);
        values.writeToParcel(data, 0);
        data.writeString(selection);
        data.writeStringArray(selectionArgs);

        mRemote.transact(IContentProvider.UPDATE_TRANSACTION, data, reply, 0);

        DatabaseUtils.readExceptionFromParcel(reply);
        int count = reply.readInt();
        return count;
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
Example 6
Source File: ContentProviderNative.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public Bundle call(String callingPkg, String method, String request, Bundle args)
        throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IContentProvider.descriptor);

        data.writeString(callingPkg);
        data.writeString(method);
        data.writeString(request);
        data.writeBundle(args);

        mRemote.transact(IContentProvider.CALL_TRANSACTION, data, reply, 0);

        DatabaseUtils.readExceptionFromParcel(reply);
        Bundle bundle = reply.readBundle();
        return bundle;
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
Example 7
Source File: ContentProviderNative.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public String[] getStreamTypes(Uri url, String mimeTypeFilter) throws RemoteException
{
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IContentProvider.descriptor);

        url.writeToParcel(data, 0);
        data.writeString(mimeTypeFilter);

        mRemote.transact(IContentProvider.GET_STREAM_TYPES_TRANSACTION, data, reply, 0);

        DatabaseUtils.readExceptionFromParcel(reply);
        String[] out = reply.createStringArray();
        return out;
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
Example 8
Source File: ContentProviderNative.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public ICancellationSignal createCancellationSignal() throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IContentProvider.descriptor);

        mRemote.transact(IContentProvider.CREATE_CANCELATION_SIGNAL_TRANSACTION,
                data, reply, 0);

        DatabaseUtils.readExceptionFromParcel(reply);
        ICancellationSignal cancellationSignal = ICancellationSignal.Stub.asInterface(
                reply.readStrongBinder());
        return cancellationSignal;
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
Example 9
Source File: ContentProviderNative.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public Uri canonicalize(String callingPkg, Uri url) throws RemoteException
{
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IContentProvider.descriptor);

        data.writeString(callingPkg);
        url.writeToParcel(data, 0);

        mRemote.transact(IContentProvider.CANONICALIZE_TRANSACTION, data, reply, 0);

        DatabaseUtils.readExceptionFromParcel(reply);
        Uri out = Uri.CREATOR.createFromParcel(reply);
        return out;
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
Example 10
Source File: ContentProviderNative.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public Uri uncanonicalize(String callingPkg, Uri url) throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IContentProvider.descriptor);

        data.writeString(callingPkg);
        url.writeToParcel(data, 0);

        mRemote.transact(IContentProvider.UNCANONICALIZE_TRANSACTION, data, reply, 0);

        DatabaseUtils.readExceptionFromParcel(reply);
        Uri out = Uri.CREATOR.createFromParcel(reply);
        return out;
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
Example 11
Source File: ContentProviderNative.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public boolean refresh(String callingPkg, Uri url, Bundle args, ICancellationSignal signal)
        throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IContentProvider.descriptor);

        data.writeString(callingPkg);
        url.writeToParcel(data, 0);
        data.writeBundle(args);
        data.writeStrongBinder(signal != null ? signal.asBinder() : null);

        mRemote.transact(IContentProvider.REFRESH_TRANSACTION, data, reply, 0);

        DatabaseUtils.readExceptionFromParcel(reply);
        int success = reply.readInt();
        return (success == 0);
    } finally {
        data.recycle();
        reply.recycle();
    }
}