Example usage for android.provider DocumentsContract EXTRA_INFO

List of usage examples for android.provider DocumentsContract EXTRA_INFO

Introduction

In this page you can find the example usage for android.provider DocumentsContract EXTRA_INFO.

Prototype

String EXTRA_INFO

To view the source code for android.provider DocumentsContract EXTRA_INFO.

Click Source Link

Document

Optional string included in a directory Cursor#getExtras() providing an informational message that should be shown to a user.

Usage

From source file:com.example.android.vault.VaultProvider.java

@Override
public Cursor queryChildDocuments(String parentDocumentId, String[] projection, String sortOrder)
        throws FileNotFoundException {
    final ExtrasMatrixCursor result = new ExtrasMatrixCursor(resolveDocumentProjection(projection));
    result.setNotificationUri(getContext().getContentResolver(),
            DocumentsContract.buildChildDocumentsUri(AUTHORITY, parentDocumentId));

    // Notify user in storage UI when key isn't hardware-backed
    if (!mHardwareBacked) {
        result.putString(DocumentsContract.EXTRA_INFO, getContext().getString(R.string.info_software_detail));
    }// ww w  .j  a va2s.  c o m

    try {
        final EncryptedDocument doc = getDocument(Long.parseLong(parentDocumentId));
        final JSONObject meta = doc.readMetadata();
        final JSONArray children = meta.getJSONArray(KEY_CHILDREN);
        for (int i = 0; i < children.length(); i++) {
            final long docId = children.getLong(i);
            includeDocument(result, docId);
        }

    } catch (IOException e) {
        throw new IllegalStateException(e);
    } catch (GeneralSecurityException e) {
        throw new IllegalStateException(e);
    } catch (JSONException e) {
        throw new IllegalStateException(e);
    }

    return result;
}