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

Commit b15186c3 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Deprecate SQLite connection timeout

Fix: 121151846
Test: build
Change-Id: I85766d90857f2f9c2459a60d6ba714e39ce12bda
parent e8d1eaa1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -12971,7 +12971,7 @@ package android.database.sqlite {
    method @NonNull public android.database.sqlite.SQLiteDatabase.OpenParams.Builder removeOpenFlags(int);
    method @NonNull public android.database.sqlite.SQLiteDatabase.OpenParams.Builder setCursorFactory(@Nullable android.database.sqlite.SQLiteDatabase.CursorFactory);
    method @NonNull public android.database.sqlite.SQLiteDatabase.OpenParams.Builder setErrorHandler(@Nullable android.database.DatabaseErrorHandler);
    method @NonNull public android.database.sqlite.SQLiteDatabase.OpenParams.Builder setIdleConnectionTimeout(@IntRange(from=0) long);
    method @Deprecated @NonNull public android.database.sqlite.SQLiteDatabase.OpenParams.Builder setIdleConnectionTimeout(@IntRange(from=0) long);
    method @NonNull public android.database.sqlite.SQLiteDatabase.OpenParams.Builder setJournalMode(@NonNull String);
    method public android.database.sqlite.SQLiteDatabase.OpenParams.Builder setLookasideConfig(@IntRange(from=0) int, @IntRange(from=0) int);
    method @NonNull public android.database.sqlite.SQLiteDatabase.OpenParams.Builder setOpenFlags(int);
@@ -13032,7 +13032,7 @@ package android.database.sqlite {
    method public void onDowngrade(android.database.sqlite.SQLiteDatabase, int, int);
    method public void onOpen(android.database.sqlite.SQLiteDatabase);
    method public abstract void onUpgrade(android.database.sqlite.SQLiteDatabase, int, int);
    method public void setIdleConnectionTimeout(@IntRange(from=0) long);
    method @Deprecated public void setIdleConnectionTimeout(@IntRange(from=0) long);
    method public void setLookasideConfig(@IntRange(from=0) int, @IntRange(from=0) int);
    method public void setOpenParams(@NonNull android.database.sqlite.SQLiteDatabase.OpenParams);
    method public void setWriteAheadLoggingEnabled(boolean);
+19 −0
Original line number Diff line number Diff line
@@ -2644,10 +2644,29 @@ public final class SQLiteDatabase extends SQLiteClosable {
             * Sets the maximum number of milliseconds that SQLite connection is allowed to be idle
             * before it is closed and removed from the pool.
             *
             * <p>DO NOT USE this method unless you fully understand the implication
             * of what it does.
             * A connection timeout allows the system to internally close a connection to a SQLite
             * database after a given timeout.
             * This is good for reducing app's memory consumption, but it has
             * side effects that are hard to predict. For example, SQLite internally maintains
             * a lot of "per-connection" states that apps can typically modify with a {@code PRAGMA}
             * statement, and such states will be reset once the connection is closed.
             * The system does not provide a callback that would allow apps to
             * reconfigure a newly created connection and thus there's no way to re-configure
             * connections when they're re-made internally. Do not use it unless you're sure
             * your app uses no per-connection states.
             *
             * @param idleConnectionTimeoutMs timeout in milliseconds. Use {@link Long#MAX_VALUE}
             * to allow unlimited idle connections.
             *
             * @see SQLiteOpenHelper#setIdleConnectionTimeout(long)
             *
             * @deprecated DO NOT USE this method unless you fully understand the implication
             * of what it does.
             */
            @NonNull
            @Deprecated
            public Builder setIdleConnectionTimeout(
                    @IntRange(from = 0) long idleConnectionTimeoutMs) {
                Preconditions.checkArgument(idleConnectionTimeoutMs >= 0,
+12 −0
Original line number Diff line number Diff line
@@ -263,9 +263,21 @@ public abstract class SQLiteOpenHelper implements AutoCloseable {
     * <p>This method should be called from the constructor of the subclass,
     * before opening the database
     *
     * <p>DO NOT USE this method unless you fully understand the implication
     * of what it does.
     * See the javadoc of
     * {@link SQLiteDatabase.OpenParams.Builder#setIdleConnectionTimeout(long)}
     * for the details.
     *
     * @param idleConnectionTimeoutMs timeout in milliseconds. Use {@link Long#MAX_VALUE} value
     * to allow unlimited idle connections.
     *
     * @see SQLiteDatabase.OpenParams.Builder#setIdleConnectionTimeout(long)
     *
     * @deprecated DO NOT USE this method unless you fully understand the implication
     * of what it does.
     */
    @Deprecated
    public void setIdleConnectionTimeout(@IntRange(from = 0) final long idleConnectionTimeoutMs) {
        synchronized (this) {
            if (mDatabase != null && mDatabase.isOpen()) {