Exemplo n.º 1
0
    public void runInternal() {
      ContentProviderClient client = null;
      try {
        client =
            DocumentsApplication.acquireUnstableProviderOrThrow(
                getContext().getContentResolver(), authority);

        final Uri uri = DocumentsContract.buildRecentDocumentsUri(authority, rootId);
        final Cursor cursor =
            client.query(uri, null, null, null, DirectoryLoader.getQuerySortOrder(mSortOrder));
        mWithRoot = new RootCursorWrapper(authority, rootId, cursor, MAX_DOCS_FROM_ROOT);

      } catch (Exception e) {
        Log.w(TAG, "Failed to load " + authority + ", " + rootId, e);
      } finally {
        ContentProviderClient.releaseQuietly(client);
      }

      set(mWithRoot);

      mFirstPassLatch.countDown();
      /// M: FOR ALPS01480274 @{
      if (mFirstPassDone && !mUiHandler.hasMessages(CONTENT_CHANGE)) {
        mUiHandler.sendEmptyMessage(CONTENT_CHANGE);
      }
      /// @}
    }
Exemplo n.º 2
0
    @Override
    protected Uri doInBackground(Void... params) {
      final ContentResolver resolver = getContentResolver();
      final DocumentInfo cwd = getCurrentDirectory();

      ContentProviderClient client = null;
      Uri childUri = null;
      try {
        client =
            DocumentsApplication.acquireUnstableProviderOrThrow(
                resolver, cwd.derivedUri.getAuthority());
        childUri =
            DocumentsContract.createDocument(client, cwd.derivedUri, mMimeType, mDisplayName);
      } catch (Exception e) {
        Log.w(TAG, "Failed to create document", e);
      } finally {
        ContentProviderClient.releaseQuietly(client);
      }

      if (childUri != null) {
        saveStackBlocking();
      }

      return childUri;
    }