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

Commit 7bf4ac26 authored by Stanley Wang's avatar Stanley Wang Committed by Android (Google) Code Review
Browse files

Merge "Add error handling for SearchIndexablesProvider."

parents 1d573221 c3bdef09
Loading
Loading
Loading
Loading
+21 −13
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.content.UriMatcher;
import android.content.pm.ProviderInfo;
import android.database.Cursor;
import android.net.Uri;
import android.util.Log;

/**
 * Base class for a search indexable provider. Such provider offers data to be indexed either
@@ -112,6 +113,7 @@ public abstract class SearchIndexablesProvider extends ContentProvider {
    @Override
    public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
                        String sortOrder) {
        try {
            switch (mMatcher.match(uri)) {
                case MATCH_RES_CODE:
                    return queryXmlResources(null);
@@ -126,6 +128,12 @@ public abstract class SearchIndexablesProvider extends ContentProvider {
                default:
                    throw new UnsupportedOperationException("Unknown Uri " + uri);
            }
        } catch (UnsupportedOperationException e) {
            throw e;
        } catch (Exception e) {
            Log.e(TAG, "Provider querying exception:", e);
            return null;
        }
    }

    /**