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

Commit 630f6b1c authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Add AbstractCursor.setExtras()

This allows providers to return SQLiteCursor with a bundle, without wrapping
it in a CursorWrapper, which has performance penalty on cross-process
queries.

Bug 5220669

Change-Id: I46b9dfb3d8e01e9caf080bb24acfd97551441e25
parent 528e382f
Loading
Loading
Loading
Loading
+25 −12
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ public abstract class AbstractCursor implements CrossProcessCursor {
    DataSetObservable mDataSetObservable = new DataSetObservable();
    ContentObservable mContentObservable = new ContentObservable();

    Bundle mExtras = Bundle.EMPTY;

    /* -------------------------------------------------------- */
    /* These need to be implemented by subclasses */
    abstract public int getCount();
@@ -383,8 +385,19 @@ public abstract class AbstractCursor implements CrossProcessCursor {
        return false;
    }

    /**
     * Sets a {@link Bundle} that will be returned by {@link #getExtras()}.  <code>null</code> will
     * be converted into {@link Bundle#EMPTY}.
     *
     * @param extras {@link Bundle} to set.
     * @hide
     */
    public void setExtras(Bundle extras) {
        mExtras = (extras == null) ? Bundle.EMPTY : extras;
    }

    public Bundle getExtras() {
        return Bundle.EMPTY;
        return mExtras;
    }

    public Bundle respond(Bundle extras) {