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

The following examples show how to use android.database.DatabaseUtils#readExceptionWithFileNotFoundExceptionFromParcel() . 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 AssetFileDescriptor openAssetFile(
        String callingPkg, Uri url, String mode, ICancellationSignal signal)
        throws RemoteException, FileNotFoundException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IContentProvider.descriptor);

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

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

        DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(reply);
        int has = reply.readInt();
        AssetFileDescriptor fd = has != 0
                ? AssetFileDescriptor.CREATOR.createFromParcel(reply) : null;
        return fd;
    } 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 AssetFileDescriptor openTypedAssetFile(String callingPkg, Uri url, String mimeType,
        Bundle opts, ICancellationSignal signal) throws RemoteException, FileNotFoundException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IContentProvider.descriptor);

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

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

        DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(reply);
        int has = reply.readInt();
        AssetFileDescriptor fd = has != 0
                ? AssetFileDescriptor.CREATOR.createFromParcel(reply) : null;
        return fd;
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
Example 3
Source File: ContentProviderNative.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public ParcelFileDescriptor openFile(
        String callingPkg, Uri url, String mode, ICancellationSignal signal, IBinder token)
        throws RemoteException, FileNotFoundException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(IContentProvider.descriptor);

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

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

        DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(reply);
        int has = reply.readInt();
        ParcelFileDescriptor fd = has != 0 ? ParcelFileDescriptor.CREATOR
                .createFromParcel(reply) : null;
        return fd;
    } finally {
        data.recycle();
        reply.recycle();
    }
}