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

Commit f8d89859 authored by Steve McKay's avatar Steve McKay
Browse files

Honor javadocs, call super first in DocumentsProvider.call handling.

Change-Id: Ic7d8d629c4c7df39ce3e2524670169752bab899b
parent 5f5d707b
Loading
Loading
Loading
Loading
+11 −8
Original line number Original line Diff line number Diff line
@@ -16,10 +16,6 @@


package com.android.documentsui;
package com.android.documentsui;


import static com.android.documentsui.Shared.TAG;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences;
import android.content.pm.ProviderInfo;
import android.content.pm.ProviderInfo;
@@ -471,6 +467,14 @@ public class StubProvider extends DocumentsProvider {


    @Override
    @Override
    public Bundle call(String method, String arg, Bundle extras) {
    public Bundle call(String method, String arg, Bundle extras) {
        // We're not supposed to override any of the default DocumentsProvider
        // methods that are supported by "call", so javadoc asks that we
        // always call super.call first and return if response is not null.
        Bundle result = super.call(method, arg, extras);
        if (result != null) {
            return result;
        }

        switch (method) {
        switch (method) {
            case "clear":
            case "clear":
                clearCacheAndBuildRoots();
                clearCacheAndBuildRoots();
@@ -484,11 +488,10 @@ public class StubProvider extends DocumentsProvider {
                simulateReadErrorsForFile(arg);
                simulateReadErrorsForFile(arg);
                return null;
                return null;
            case "createDocumentWithFlags":
            case "createDocumentWithFlags":
                Bundle bundle = dispatchCreateDocumentWithFlags(extras);
                return dispatchCreateDocumentWithFlags(extras);
                return bundle;
            default:
                return super.call(method, arg, extras);
        }
        }

        return null;
    }
    }


    private Bundle createVirtualFileFromBundle(Bundle extras) {
    private Bundle createVirtualFileFromBundle(Bundle extras) {