Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ef07d92 authored by Garfield Tan's avatar Garfield Tan
Browse files

Eject throws when it failed.

Test: Builds.
Bug: 36483910
Change-Id: I1c4d4d622cf68fc51e88bb08ac190fcfaed10c7f
(cherry picked from commit bb1d2816)
parent 7d5f2b9c
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -29,14 +29,14 @@ import com.android.documentsui.base.Shared;

public final class EjectRootTask extends AsyncTask<Void, Void, Boolean> {

    private final String TAG = "EjectRootTask";

    private final ContentResolver mResolver;
    private final String mAuthority;
    private final String mRootId;
    private final BooleanConsumer mCallback;

    /**
     * @param ejectCanceledCheck The method reference we use to see whether eject should be stopped
     * at any point
     * @param finishCallback The end callback necessary when the eject task finishes
     */
    public EjectRootTask(
@@ -57,9 +57,12 @@ public final class EjectRootTask extends AsyncTask<Void, Void, Boolean> {
        try {
            client = DocumentsApplication.acquireUnstableProviderOrThrow(
                    mResolver, mAuthority);
            return DocumentsContract.ejectRoot(client, rootUri);
            DocumentsContract.ejectRoot(client, rootUri);
            return true;
        } catch (IllegalStateException e) {
            Log.w(TAG, "Failed to eject root.", e);
        } catch (Exception e) {
            Log.w(Shared.TAG, "Failed to eject root", e);
            Log.w(TAG, "Binder call failed.", e);
        } finally {
            ContentProviderClient.releaseQuietly(client);
        }