Java 类android.os.CancellationSignal 实例源码

项目:KBUnitTest    文件:ShadowSQLiteSession.java   
/**
 * Executes a statement that does not return a result.
 *
 * @param sql                The SQL statement to execute.
 * @param bindArgs           The arguments to bind, or null if none.
 * @param connectionFlags    The connection flags to use if a connection must be
 *                           acquired by this operation.  Refer to {@link SQLiteConnectionPool}.
 * @param cancellationSignal A signal to cancel the operation in progress, or null if none.
 * @throws SQLiteException            if an error occurs, such as a syntax error
 *                                    or invalid number of bind arguments.
 * @throws OperationCanceledException if the operation was canceled.
 */
public void execute(String sql, Object[] bindArgs, int connectionFlags,
                    CancellationSignal cancellationSignal) {
    if (sql == null) {
        throw new IllegalArgumentException("sql must not be null.");
    }

    if (executeSpecial(sql, bindArgs, connectionFlags, cancellationSignal)) {
        return;
    }

    acquireConnection(sql, connectionFlags, cancellationSignal); // might throw
    try {
        mConnection.execute(sql, bindArgs, cancellationSignal); // might throw
    } finally {
        releaseConnection(); // might throw
    }
}
项目:KBUnitTest    文件:ShadowSQLiteSession.java   
/**
 * Executes a statement that returns a single {@link String} result.
 *
 * @param sql                The SQL statement to execute.
 * @param bindArgs           The arguments to bind, or null if none.
 * @param connectionFlags    The connection flags to use if a connection must be
 *                           acquired by this operation.  Refer to {@link SQLiteConnectionPool}.
 * @param cancellationSignal A signal to cancel the operation in progress, or null if none.
 * @return The value of the first column in the first row of the result set
 * as a <code>String</code>, or null if none.
 * @throws SQLiteException            if an error occurs, such as a syntax error
 *                                    or invalid number of bind arguments.
 * @throws OperationCanceledException if the operation was canceled.
 */
public String executeForString(String sql, Object[] bindArgs, int connectionFlags,
                               CancellationSignal cancellationSignal) {
    if (sql == null) {
        throw new IllegalArgumentException("sql must not be null.");
    }

    if (executeSpecial(sql, bindArgs, connectionFlags, cancellationSignal)) {
        return null;
    }

    acquireConnection(sql, connectionFlags, cancellationSignal); // might throw
    try {
        return mConnection.executeForString(sql, bindArgs, cancellationSignal); // might throw
    } finally {
        releaseConnection(); // might throw
    }
}
项目:easyfilemanager    文件:UriDerivativeLoader.java   
@Override
public final R loadInBackground() {
    synchronized (this) {
        if (isLoadInBackgroundCanceled2()) {
            throw new OperationCanceledException();
        }
        mCancellationSignal = new CancellationSignal();
    }
    try {
        return loadInBackground(mParam, mCancellationSignal);
    } finally {
        synchronized (this) {
            mCancellationSignal = null;
        }
    }
}
项目:easyfilemanager    文件:NonMediaDocumentsProvider.java   
@Override
public ParcelFileDescriptor openDocument(String docId, String mode, CancellationSignal signal)
        throws FileNotFoundException {

    if (!"r".equals(mode)) {
        throw new IllegalArgumentException("Media is read-only");
    }

    final Uri target = getUriForDocumentId(docId);

    // Delegate to real provider
    final long token = Binder.clearCallingIdentity();
    try {
        return getContext().getContentResolver().openFileDescriptor(target, mode);
    } finally {
        Binder.restoreCallingIdentity(token);
    }
}
项目:easyfilemanager    文件:DocumentsProvider.java   
private final AssetFileDescriptor openTypedAssetFileImpl(
        Uri uri, String mimeTypeFilter, Bundle opts, CancellationSignal signal)
        throws FileNotFoundException {
    enforceTree(uri);
    final String documentId = getDocumentId(uri);
    if (opts != null && opts.containsKey(ContentResolver.EXTRA_SIZE)) {
        final Point sizeHint = opts.getParcelable(ContentResolver.EXTRA_SIZE);
        return openDocumentThumbnail(documentId, sizeHint, signal);
    }
    if ("*/*".equals(mimeTypeFilter)) {
         // If they can take anything, the untyped open call is good enough.
         return openAssetFile(uri, "r");
    }
    final String baseType = getType(uri);
    if (baseType != null && ClipDescription.compareMimeTypes(baseType, mimeTypeFilter)) {
        // Use old untyped open call if this provider has a type for this
        // URI and it matches the request.
        return openAssetFile(uri, "r");
    }
    // For any other yet unhandled case, let the provider subclass handle it.
    return openTypedDocument(documentId, mimeTypeFilter, opts, signal);
}
项目:easyfilemanager    文件:StorageProvider.java   
protected ParcelFileDescriptor openImageThumbnailCleared(long id, CancellationSignal signal)
        throws FileNotFoundException {
    final ContentResolver resolver = getContext().getContentResolver();

    Cursor cursor = null;
    try {
        cursor = resolver.query(Images.Thumbnails.EXTERNAL_CONTENT_URI,
                ImageThumbnailQuery.PROJECTION, Images.Thumbnails.IMAGE_ID + "=" + id, null,
                null);
        if (cursor.moveToFirst()) {
            final String data = cursor.getString(ImageThumbnailQuery._DATA);
            return ParcelFileDescriptor.open(
                    new File(data), ParcelFileDescriptor.MODE_READ_ONLY);
        }
    } finally {
        IoUtils.closeQuietly(cursor);
    }
    return null;
}
项目:easyfilemanager    文件:StorageProvider.java   
protected AssetFileDescriptor openOrCreateVideoThumbnailCleared(
        long id, CancellationSignal signal) throws FileNotFoundException {
    final ContentResolver resolver = getContext().getContentResolver();

    AssetFileDescriptor afd = openVideoThumbnailCleared(id, signal);
    if (afd == null) {
        // No thumbnail yet, so generate. This is messy, since we drop the
        // Bitmap on the floor, but its the least-complicated way.
        final BitmapFactory.Options opts = new BitmapFactory.Options();
        opts.inJustDecodeBounds = true;
        Video.Thumbnails.getThumbnail(resolver, id, Video.Thumbnails.MINI_KIND, opts);

        afd = openVideoThumbnailCleared(id, signal);
    }

    return afd;
}
项目:simple-share-android    文件:UriDerivativeLoader.java   
@Override
public final R loadInBackground() {
    synchronized (this) {
        if (isLoadInBackgroundCanceled2()) {
            throw new OperationCanceledException();
        }
        mCancellationSignal = new CancellationSignal();
    }
    try {
        return loadInBackground(mParam, mCancellationSignal);
    } finally {
        synchronized (this) {
            mCancellationSignal = null;
        }
    }
}
项目:FireFiles    文件:StorageProvider.java   
protected ParcelFileDescriptor openAudioThumbnailCleared(long id, CancellationSignal signal)
        throws FileNotFoundException {
    final ContentResolver resolver = getContext().getContentResolver();

    Cursor cursor = null;
    try {
        cursor = resolver.query(Audio.Albums.EXTERNAL_CONTENT_URI,
                AudioThumbnailQuery.PROJECTION, Audio.Albums._ID + "=" + id,
                null, null);
        if (cursor.moveToFirst()) {
            final String data = cursor.getString(AudioThumbnailQuery._DATA);
            return ParcelFileDescriptor.open(
                    new File(data), ParcelFileDescriptor.MODE_READ_ONLY);
        }
    } finally {
        IoUtils.closeQuietly(cursor);
    }
    return null;
}
项目:YuiHatano    文件:ShadowSQLiteSession.java   
/**
 * Executes a statement that does not return a result.
 *
 * @param sql                The SQL statement to execute.
 * @param bindArgs           The arguments to bind, or null if none.
 * @param connectionFlags    The connection flags to use if a connection must be
 *                           acquired by this operation.  Refer to {@link SQLiteConnectionPool}.
 * @param cancellationSignal A signal to cancel the operation in progress, or null if none.
 * @throws SQLiteException            if an error occurs, such as a syntax error
 *                                    or invalid number of bind arguments.
 * @throws OperationCanceledException if the operation was canceled.
 */
public void execute(String sql, Object[] bindArgs, int connectionFlags,
                    CancellationSignal cancellationSignal) {
    if (sql == null) {
        throw new IllegalArgumentException("sql must not be null.");
    }

    if (executeSpecial(sql, bindArgs, connectionFlags, cancellationSignal)) {
        return;
    }

    acquireConnection(sql, connectionFlags, cancellationSignal); // might throw
    try {
        mConnection.execute(sql, bindArgs, cancellationSignal); // might throw
    } finally {
        releaseConnection(); // might throw
    }
}
项目:YuiHatano    文件:ShadowSQLiteSession.java   
/**
 * Executes a statement that returns the row id of the last row inserted
 * by the statement.  Use for INSERT SQL statements.
 *
 * @param sql                The SQL statement to execute.
 * @param bindArgs           The arguments to bind, or null if none.
 * @param connectionFlags    The connection flags to use if a connection must be
 *                           acquired by this operation.  Refer to {@link SQLiteConnectionPool}.
 * @param cancellationSignal A signal to cancel the operation in progress, or null if none.
 * @return The row id of the last row that was inserted, or 0 if none.
 * @throws SQLiteException            if an error occurs, such as a syntax error
 *                                    or invalid number of bind arguments.
 * @throws OperationCanceledException if the operation was canceled.
 */
public long executeForLastInsertedRowId(String sql, Object[] bindArgs, int connectionFlags,
                                        CancellationSignal cancellationSignal) {
    if (sql == null) {
        throw new IllegalArgumentException("sql must not be null.");
    }

    if (executeSpecial(sql, bindArgs, connectionFlags, cancellationSignal)) {
        return 0;
    }

    acquireConnection(sql, connectionFlags, cancellationSignal); // might throw
    try {
        return mConnection.executeForLastInsertedRowId(sql, bindArgs,
                cancellationSignal); // might throw
    } finally {
        releaseConnection(); // might throw
    }
}
项目:KBUnitTest    文件:ShadowSQLiteSession.java   
/**
 * Executes a statement that returns a count of the number of rows
 * that were changed.  Use for UPDATE or DELETE SQL statements.
 *
 * @param sql                The SQL statement to execute.
 * @param bindArgs           The arguments to bind, or null if none.
 * @param connectionFlags    The connection flags to use if a connection must be
 *                           acquired by this operation.  Refer to {@link SQLiteConnectionPool}.
 * @param cancellationSignal A signal to cancel the operation in progress, or null if none.
 * @return The number of rows that were changed.
 * @throws SQLiteException            if an error occurs, such as a syntax error
 *                                    or invalid number of bind arguments.
 * @throws OperationCanceledException if the operation was canceled.
 */
public int executeForChangedRowCount(String sql, Object[] bindArgs, int connectionFlags,
                                     CancellationSignal cancellationSignal) {
    if (sql == null) {
        throw new IllegalArgumentException("sql must not be null.");
    }

    if (executeSpecial(sql, bindArgs, connectionFlags, cancellationSignal)) {
        return 0;
    }

    acquireConnection(sql, connectionFlags, cancellationSignal); // might throw
    try {
        return mConnection.executeForChangedRowCount(sql, bindArgs,
                cancellationSignal); // might throw
    } finally {
        releaseConnection(); // might throw
    }
}
项目:springreplugin    文件:PluginProviderClient.java   
/**
 * 调用插件里的Provider
 *
 * @see android.content.ContentResolver#query(Uri, String[], String, String[], String, CancellationSignal)
 */
@TargetApi(16)
public static Cursor query(Context c, Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder, CancellationSignal cancellationSignal) {
    if (c == null) {
        return null;
    }

    if (!RePluginFramework.mHostInitialized) {
        return c.getContentResolver().query(uri, projection, selection, selectionArgs, sortOrder, cancellationSignal);
    }

    try {
        return (Cursor) ProxyRePluginProviderClientVar.query2.call(null, c, uri, projection, selection, selectionArgs, sortOrder, cancellationSignal);
    } catch (Exception e) {
        if (LogDebug.LOG) {
            e.printStackTrace();
        }
    }

    return null;
}
项目:simple-share-android    文件:DocumentsContract.java   
/**
 * Return thumbnail representing the document at the given URI. Callers are
 * responsible for their own in-memory caching.
 *
 * @param documentUri document to return thumbnail for, which must have
 *            {@link Document#FLAG_SUPPORTS_THUMBNAIL} set.
 * @param size optimal thumbnail size desired. A provider may return a
 *            thumbnail of a different size, but never more than double the
 *            requested size.
 * @param signal signal used to indicate if caller is no longer interested
 *            in the thumbnail.
 * @return decoded thumbnail, or {@code null} if problem was encountered.
 * @see DocumentsProvider#openDocumentThumbnail(String, Point,
 *      CancellationSignal)
 */
public static Bitmap getDocumentThumbnail(
        ContentResolver resolver, Uri documentUri, Point size, CancellationSignal signal) {
    final ContentProviderClient client = ContentProviderClientCompat.acquireUnstableContentProviderClient(resolver, 
            documentUri.getAuthority());
    try {
        if(UsbStorageProvider.AUTHORITY.equals(documentUri.getAuthority())) {
            return ImageUtils.getThumbnail(resolver, documentUri, size.x, size.y);
        }
        return getDocumentThumbnails(client, documentUri, size, signal);
    } catch (Exception e) {
        if (!(e instanceof OperationCanceledException)) {
            Log.w(TAG, "Failed to load thumbnail for " + documentUri + ": " + e);
        }
        return null;
    } finally {
        ContentProviderClientCompat.releaseQuietly(client);
    }
}
项目:simple-share-android    文件:StorageProvider.java   
protected int queryOrientationForImage(long id, CancellationSignal signal) {
    final ContentResolver resolver = getContext().getContentResolver();

    Cursor cursor = null;
    try {
        cursor = resolver.query(Images.Media.EXTERNAL_CONTENT_URI,
                ImageOrientationQuery.PROJECTION, ImageColumns._ID + "=" + id, null, null);
        if (cursor.moveToFirst()) {
            return cursor.getInt(ImageOrientationQuery.ORIENTATION);
        } else {
            Log.w(TAG, "Missing orientation data for " + id);
            return 0;
        }
    } finally {
        IoUtils.closeQuietly(cursor);
    }
}
项目:simple-share-android    文件:DocumentsProvider.java   
private final AssetFileDescriptor openTypedAssetFileImpl(
        Uri uri, String mimeTypeFilter, Bundle opts, CancellationSignal signal)
        throws FileNotFoundException {
    enforceTree(uri);
    final String documentId = getDocumentId(uri);
    if (opts != null && opts.containsKey(ContentResolver.EXTRA_SIZE)) {
        final Point sizeHint = opts.getParcelable(ContentResolver.EXTRA_SIZE);
        return openDocumentThumbnail(documentId, sizeHint, signal);
    }
    if ("*/*".equals(mimeTypeFilter)) {
         // If they can take anything, the untyped open call is good enough.
         return openAssetFile(uri, "r");
    }
    final String baseType = getType(uri);
    if (baseType != null && ClipDescription.compareMimeTypes(baseType, mimeTypeFilter)) {
        // Use old untyped open call if this provider has a type for this
        // URI and it matches the request.
        return openAssetFile(uri, "r");
    }
    // For any other yet unhandled case, let the provider subclass handle it.
    return openTypedDocument(documentId, mimeTypeFilter, opts, signal);
}
项目:simple-share-android    文件:StorageProvider.java   
protected AssetFileDescriptor openVideoThumbnailCleared(long id, CancellationSignal signal)
        throws FileNotFoundException {
    final ContentResolver resolver = getContext().getContentResolver();
    Cursor cursor = null;
    try {
        cursor = resolver.query(Video.Thumbnails.EXTERNAL_CONTENT_URI,
                VideoThumbnailQuery.PROJECTION, Video.Thumbnails.VIDEO_ID + "=" + id, null,
                null);
        if (cursor.moveToFirst()) {
            final String data = cursor.getString(VideoThumbnailQuery._DATA);
            return new AssetFileDescriptor(ParcelFileDescriptor.open(
                    new File(data), ParcelFileDescriptor.MODE_READ_ONLY), 0,
                    AssetFileDescriptor.UNKNOWN_LENGTH);
        }
    } finally {
        IoUtils.closeQuietly(cursor);
    }
    return null;
}
项目:KBUnitTest    文件:ShadowSQLiteSession.java   
/**
 * Executes a statement that returns a single BLOB result as a
 * file descriptor to a shared memory region.
 *
 * @param sql                The SQL statement to execute.
 * @param bindArgs           The arguments to bind, or null if none.
 * @param connectionFlags    The connection flags to use if a connection must be
 *                           acquired by this operation.  Refer to {@link SQLiteConnectionPool}.
 * @param cancellationSignal A signal to cancel the operation in progress, or null if none.
 * @return The file descriptor for a shared memory region that contains
 * the value of the first column in the first row of the result set as a BLOB,
 * or null if none.
 * @throws SQLiteException            if an error occurs, such as a syntax error
 *                                    or invalid number of bind arguments.
 * @throws OperationCanceledException if the operation was canceled.
 */
public ParcelFileDescriptor executeForBlobFileDescriptor(String sql, Object[] bindArgs,
                                                         int connectionFlags, CancellationSignal cancellationSignal) {
    if (sql == null) {
        throw new IllegalArgumentException("sql must not be null.");
    }

    if (executeSpecial(sql, bindArgs, connectionFlags, cancellationSignal)) {
        return null;
    }

    acquireConnection(sql, connectionFlags, cancellationSignal); // might throw
    try {
        return mConnection.executeForBlobFileDescriptor(sql, bindArgs,
                cancellationSignal); // might throw
    } finally {
        releaseConnection(); // might throw
    }
}
项目:justintrain-client-android    文件:FrameworkSQLiteDatabase.java   
@Override
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public Cursor query(final SupportSQLiteQuery supportQuery,
                    CancellationSignal cancellationSignal) {
    return mDelegate.rawQueryWithFactory((db, masterQuery, editTable, query) -> {
        supportQuery.bindTo(new FrameworkSQLiteProgram(query));
        return new SQLiteCursor(masterQuery, editTable, query);
    }, supportQuery.getSql(), EMPTY_STRING_ARRAY, null, cancellationSignal);
}
项目:FingerprintDemo    文件:FingerprintHelper.java   
public void startAuth(FingerprintManager manager,
                      FingerprintManager.CryptoObject cryptoObject) {

    cancellationSignal = new CancellationSignal();

    if (ActivityCompat.checkSelfPermission(context,
            Manifest.permission.USE_FINGERPRINT) !=
            PackageManager.PERMISSION_GRANTED) {
        return;
    }
    manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
项目:FlickLauncher    文件:FingerprintHandlerSettings.java   
@TargetApi(23)
public void startAuth(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
    CancellationSignal cancellationSignal = new CancellationSignal();
    if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
        return;
    }
    manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
项目:FireFiles    文件:AppsProvider.java   
@Override
public AssetFileDescriptor openDocumentThumbnail(
        String docId, Point sizeHint, CancellationSignal signal) throws FileNotFoundException {
    // TODO: extend ExifInterface to support fds
    final ParcelFileDescriptor pfd = openDocument(docId, "r", signal);
    return new AssetFileDescriptor(pfd, 0, AssetFileDescriptor.UNKNOWN_LENGTH);
}
项目:Automata    文件:FingerprintHandler.java   
public void startAuth(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {

        cancellationSignal = new CancellationSignal();
        if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
            return;
        }
        manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
    }
项目:easyfilemanager    文件:DocumentArchiveHelper.java   
/**
 * Opens a file within an archive.
 *
 */
public ParcelFileDescriptor openDocument(
        String documentId, String mode, final CancellationSignal signal)
        throws FileNotFoundException {
    Loader loader = null;
    try {
        loader = obtainInstance(documentId);
        return loader.get().openDocument(documentId, mode, signal);
    } finally {
        releaseInstance(loader);
    }
}
项目:easyfilemanager    文件:DocumentArchiveHelper.java   
/**
 * Opens a thumbnail of a file within an archive.
 *
 */
public AssetFileDescriptor openDocumentThumbnail(
        String documentId, Point sizeHint, final CancellationSignal signal)
        throws FileNotFoundException {
    Loader loader = null;
    try {
        loader = obtainInstance(documentId);
        return loader.get().openDocumentThumbnail(documentId, sizeHint, signal);
    } finally {
        releaseInstance(loader);
    }
}
项目:easyfilemanager    文件:DirectoryFragment.java   
public ThumbnailAsyncTask(Uri uri, ImageView iconMime, ImageView iconThumb, View iconMimeBackground, Point thumbSize,
              String path, String mimeType, float targetAlpha) {
    mUri = uri;
    mIconMime = iconMime;
    mIconThumb = iconThumb;
          mIconMimeBackground = iconMimeBackground;
    mThumbSize = thumbSize;
          mTargetAlpha = targetAlpha;
    mSignal = new CancellationSignal();
    mPath = path;
    mMimeType = mimeType;
}
项目:easyfilemanager    文件:RecentsCreateFragment.java   
@Override
public List<DocumentStack> loadInBackground(Uri uri, CancellationSignal signal) {
    final Collection<RootInfo> matchingRoots = mRoots.getMatchingRootsBlocking(mState);
    final ArrayList<DocumentStack> result = new ArrayList<>();

    final ContentResolver resolver = getContext().getContentResolver();
    final Cursor cursor = resolver.query(
            uri, null, null, null, RecentColumns.TIMESTAMP + " DESC");
    try {
        while (cursor != null && cursor.moveToNext()) {
            final byte[] rawStack = cursor.getBlob(
                    cursor.getColumnIndex(RecentColumns.STACK));
            try {
                final DocumentStack stack = new DocumentStack();
                DurableUtils.readFromArray(rawStack, stack);

                // Only update root here to avoid spinning up all
                // providers; we update the stack during the actual
                // restore. This also filters away roots that don't
                // match current filter.
                stack.updateRoot(matchingRoots);
                result.add(stack);
            } catch (IOException e) {
                Log.w(TAG, "Failed to resolve stack: " + e);
                CrashReportingManager.logException(e);
            }
        }
    } finally {
        IoUtils.closeQuietly(cursor);
    }

    return result;
}
项目:simple-share-android    文件:DirectoryFragment.java   
public ThumbnailAsyncTask(Uri uri, ImageView iconMime, ImageView iconThumb, View iconMimeBackground, Point thumbSize,
              String path, String mimeType, float targetAlpha) {
    mUri = uri;
    mIconMime = iconMime;
    mIconThumb = iconThumb;
          mIconMimeBackground = iconMimeBackground;
    mThumbSize = thumbSize;
          mTargetAlpha = targetAlpha;
    mSignal = new CancellationSignal();
    mPath = path;
    mMimeType = mimeType;
}
项目:easyfilemanager    文件:NetworkStorageProvider.java   
@Override
public ParcelFileDescriptor openDocument(final String documentId, final String mode,
                                         CancellationSignal signal)
        throws FileNotFoundException {

    final NetworkFile file = getFileForDocId(documentId);
    final NetworkConnection connection = getNetworkConnection(documentId);

    try {
        final boolean isWrite = (mode.indexOf('w') != -1);
        if (isWrite) {
            return null;
        } else {
            Uri ftpUri = connection.toUri(file);
            URL url = new URL(ftpUri.toString());
            URLConnection conn = url.openConnection();
            InputStream inputStream = conn.getInputStream();
            if(null != inputStream){
                return ParcelFileDescriptorUtil.pipeFrom(inputStream);
            }
        }

        return null;
    } catch (Exception e) {
        CrashReportingManager.logException(e);
        throw new FileNotFoundException("Failed to open document with id " + documentId +
                " and mode " + mode);
    }
}
项目:easyfilemanager    文件:AppsProvider.java   
@Override
public ParcelFileDescriptor openDocument(String docId, String mode, CancellationSignal signal)
        throws FileNotFoundException {
    // Delegate to real provider
    final long token = Binder.clearCallingIdentity();
    try {
        //final long id = Long.parseLong(docId);
        //final ContentResolver resolver = getContext().getContentResolver();
        return null;//resolver.openFileDescriptor(mDm.getUriForDownloadedFile(id), mode);
    } finally {
        Binder.restoreCallingIdentity(token);
    }
}
项目:easyfilemanager    文件:AppsProvider.java   
@Override
public AssetFileDescriptor openDocumentThumbnail(
        String docId, Point sizeHint, CancellationSignal signal) throws FileNotFoundException {
    // TODO: extend ExifInterface to support fds
    final ParcelFileDescriptor pfd = openDocument(docId, "r", signal);
    return new AssetFileDescriptor(pfd, 0, AssetFileDescriptor.UNKNOWN_LENGTH);
}
项目:easyfilemanager    文件:HeatMapProvider.java   
@Override
public ParcelFileDescriptor openDocument(
        String documentId, String mode, CancellationSignal signal)
        throws FileNotFoundException {
    final File file = getFileForDocId(documentId);
    return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);//ParcelFileDescriptor.parseMode(mode));
}
项目:easyfilemanager    文件:DocumentsProvider.java   
/**
 * Implementation is provided by the parent class. Cannot be overriden.
 *
 * @see #openDocument(String, String, CancellationSignal)
 */
@Override
public final AssetFileDescriptor openAssetFile(Uri uri, String mode, CancellationSignal signal)
        throws FileNotFoundException {
    enforceTree(uri);
    final ParcelFileDescriptor fd = openDocument(getDocumentId(uri), mode, signal);
    return fd != null ? new AssetFileDescriptor(fd, 0, -1) : null;
}
项目:FireFiles    文件:AppsProvider.java   
@Override
public ParcelFileDescriptor openDocument(String docId, String mode, CancellationSignal signal)
        throws FileNotFoundException {
    // Delegate to real provider
    final long token = Binder.clearCallingIdentity();
    try {
        //final long id = Long.parseLong(docId);
        //final ContentResolver resolver = getContext().getContentResolver();
        return null;//resolver.openFileDescriptor(mDm.getUriForDownloadedFile(id), mode);
    } finally {
        Binder.restoreCallingIdentity(token);
    }
}
项目:FireFiles    文件:HeatMapProvider.java   
@Override
public ParcelFileDescriptor openDocument(
        String documentId, String mode, CancellationSignal signal)
        throws FileNotFoundException {
    final File file = getFileForDocId(documentId);
    return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);//ParcelFileDescriptor.parseMode(mode));
}
项目:easyfilemanager    文件:RootedStorageProvider.java   
@Override
public ParcelFileDescriptor openDocument(
        String documentId, String mode, CancellationSignal signal)
        throws FileNotFoundException {
    final RootFile file = getRootFileForDocId(documentId);
    InputStream is = RootCommands.getFile(file.getPath());

    try {
        return ParcelFileDescriptorUtil.pipeFrom(is);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return ParcelFileDescriptor.open(new File(file.getPath()), ParcelFileDescriptor.MODE_READ_ONLY);
}
项目:easyfilemanager    文件:ExternalStorageProvider.java   
@Override
public AssetFileDescriptor openDocumentThumbnail(
        String documentId, Point sizeHint, CancellationSignal signal)
        throws FileNotFoundException {
    if (mArchiveHelper.isArchivedDocument(documentId)) {
        return mArchiveHelper.openDocumentThumbnail(documentId, sizeHint, signal);
    }

    return openOrCreateDocumentThumbnail(documentId, sizeHint, signal);
}
项目:springreplugin    文件:PluginProviderClient.java   
public static void initLocked(final ClassLoader classLoader) {
    //
    String rePluginProviderClient = "com.qihoo360.loader.mgr.PluginProviderClient";
    query = new MethodInvoker(classLoader, rePluginProviderClient, "query", new Class<?>[]{Context.class, Uri.class, String[].class, String.class, String[].class, String.class});
    query2 = new MethodInvoker(classLoader, rePluginProviderClient, "query", new Class<?>[]{Context.class, Uri.class, String[].class, String.class, String[].class, String.class, CancellationSignal.class});
    insert = new MethodInvoker(classLoader, rePluginProviderClient, "insert", new Class<?>[]{Context.class, Uri.class, ContentValues.class});
    bulkInsert = new MethodInvoker(classLoader, rePluginProviderClient, "bulkInsert", new Class<?>[]{Context.class, Uri.class, ContentValues[].class});
    delete = new MethodInvoker(classLoader, rePluginProviderClient, "delete", new Class<?>[]{Context.class, Uri.class, String.class, String[].class});
    update = new MethodInvoker(classLoader, rePluginProviderClient, "update", new Class<?>[]{Context.class, Uri.class, ContentValues.class, String.class, String[].class});
}
项目:DizzyPassword    文件:RxFingerPrinter.java   
@TargetApi(Build.VERSION_CODES.M)
private void initManager() {
    mCancellationSignal = new CancellationSignal();
    manager = (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
    mKeyManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    mSelfCancelled = new FingerprintManager.AuthenticationCallback() {
        @Override
        public void onAuthenticationError(int errorCode, CharSequence errString) {
            //多次指纹密码验证错误后,进入此方法;并且,不能短时间内调用指纹验证
            publishSubject.onError(new FPerException(FINGERPRINTERS_FAILED_ERROR));
            mCancellationSignal.cancel();
        }

        @Override
        public void onAuthenticationHelp(int helpCode, CharSequence helpString) {

        }

        @Override
        public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) {
            publishSubject.onNext(true);

        }

        @Override
        public void onAuthenticationFailed() {
            publishSubject.onNext(false);
        }
    };
}
项目:FireFiles    文件:RootedStorageProvider.java   
@Override
public ParcelFileDescriptor openDocument(
        String documentId, String mode, CancellationSignal signal)
        throws FileNotFoundException {
    final RootFile file = getRootFileForDocId(documentId);
    InputStream is = RootCommands.getFile(file.getPath());

    try {
        return ParcelFileDescriptorUtil.pipeFrom(is);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return ParcelFileDescriptor.open(new File(file.getPath()), ParcelFileDescriptor.MODE_READ_ONLY);
}