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

Commit 4a2e2b37 authored by Momoko Hattori's avatar Momoko Hattori Committed by Android (Google) Code Review
Browse files

Merge "Add closeDatabase method to classes owning SQLiteOpenHelper instance" into main

parents a3fb680c 7f40699e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ public class LastAccessedProvider extends ContentProvider {

    private static final int URI_LAST_ACCESSED = 1;

    public static final String METHOD_CLOSE_DATABASE = "closeDatabase";
    public static final String METHOD_PURGE = "purge";
    public static final String METHOD_PURGE_PACKAGE = "purgePackage";

@@ -236,6 +237,9 @@ public class LastAccessedProvider extends ContentProvider {

            return null;

        } else if (METHOD_CLOSE_DATABASE.equals(method)) {
            mHelper.close();
            return null;
        } else {
            return super.call(method, arg, extras);
        }
+13 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;

public class PickCountRecordProvider extends ContentProvider {
@@ -40,6 +41,8 @@ public class PickCountRecordProvider extends ContentProvider {

    static final String AUTHORITY = "com.android.documentsui.pickCountRecord";

    public static final String METHOD_CLOSE_DATABASE = "closeDatabase";

    static {
        MATCHER.addURI(AUTHORITY, "pickCountRecord/*", URI_PICK_RECORD);
    }
@@ -148,4 +151,14 @@ public class PickCountRecordProvider extends ContentProvider {
    public String getType(Uri uri) {
        return null;
    }

    @Override
    public Bundle call(String method, String arg, Bundle extras) {
        if (METHOD_CLOSE_DATABASE.equals(method)) {
            mHelper.close();
            return null;
        } else {
            return super.call(method, arg, extras);
        }
    }
}
 No newline at end of file
+7 −0
Original line number Diff line number Diff line
@@ -175,6 +175,13 @@ public class SearchHistoryManager {
        }
    }

    /**
     * Closes the database.
     */
    public void closeDatabase() {
        mHelper.close();
    }

    private class DatabaseTask extends AsyncTask<Object, Void, Object> {
        private final String mKeyword;
        private final DATABASE_OPERATION mOperation;