diff options
| author | 2023-10-13 19:47:09 +0000 | |
|---|---|---|
| committer | 2023-10-13 19:47:09 +0000 | |
| commit | cef77d0402a6c658e858693f466f0bcc307e631b (patch) | |
| tree | b6aa681cfdbc1a3a0f8dfeead29f01e4ff99ca6c | |
| parent | ffe884611bc0f05c1b8e2cfee6d43bcba4611c89 (diff) | |
| parent | 0d7afd23a2f907dbd87e0356ea48b8290e9c1d52 (diff) | |
Merge "Put new SQLite APIs behind a flag" into main
| -rw-r--r-- | AconfigFlags.bp | 14 | ||||
| -rw-r--r-- | core/api/current.txt | 14 | ||||
| -rw-r--r-- | core/java/android/database/sqlite/SQLiteDatabase.java | 7 | ||||
| -rw-r--r-- | core/java/android/database/sqlite/SQLiteRawStatement.java | 2 | ||||
| -rw-r--r-- | core/java/android/database/sqlite/flags.aconfig | 9 |
5 files changed, 39 insertions, 7 deletions
diff --git a/AconfigFlags.bp b/AconfigFlags.bp index fd9915751695..a1375d79846d 100644 --- a/AconfigFlags.bp +++ b/AconfigFlags.bp @@ -36,6 +36,7 @@ aconfig_srcjars = [ ":com.android.media.flags.bettertogether-aconfig-java{.generated_srcjars}", ":sdk_sandbox_flags_lib{.generated_srcjars}", ":android.permission.flags-aconfig-java{.generated_srcjars}", + ":android.database.sqlite-aconfig-java{.generated_srcjars}", ":hwui_flags_java_lib{.generated_srcjars}", ":framework_graphics_flags_java_lib{.generated_srcjars}", ":display_flags_lib{.generated_srcjars}", @@ -334,6 +335,19 @@ java_aconfig_library { } +// SQLite +aconfig_declarations { + name: "android.database.sqlite-aconfig", + package: "android.database.sqlite", + srcs: ["core/java/android/database/sqlite/*.aconfig"], +} + +java_aconfig_library { + name: "android.database.sqlite-aconfig-java", + aconfig_declarations: "android.database.sqlite-aconfig", + defaults: ["framework-minus-apex-aconfig-java-defaults"], +} + // Biometrics aconfig_declarations { name: "android.hardware.biometrics.flags-aconfig", diff --git a/core/api/current.txt b/core/api/current.txt index e4cfcb155e19..36cdd7fb84bb 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -14352,14 +14352,14 @@ package android.database.sqlite { public final class SQLiteDatabase extends android.database.sqlite.SQLiteClosable { method public void beginTransaction(); method public void beginTransactionNonExclusive(); - method public void beginTransactionReadOnly(); + method @FlaggedApi("android.database.sqlite.sqlite_apis_15") public void beginTransactionReadOnly(); method public void beginTransactionWithListener(@Nullable android.database.sqlite.SQLiteTransactionListener); method public void beginTransactionWithListenerNonExclusive(@Nullable android.database.sqlite.SQLiteTransactionListener); - method public void beginTransactionWithListenerReadOnly(@Nullable android.database.sqlite.SQLiteTransactionListener); + method @FlaggedApi("android.database.sqlite.sqlite_apis_15") public void beginTransactionWithListenerReadOnly(@Nullable android.database.sqlite.SQLiteTransactionListener); method public android.database.sqlite.SQLiteStatement compileStatement(String) throws android.database.SQLException; method @NonNull public static android.database.sqlite.SQLiteDatabase create(@Nullable android.database.sqlite.SQLiteDatabase.CursorFactory); method @NonNull public static android.database.sqlite.SQLiteDatabase createInMemory(@NonNull android.database.sqlite.SQLiteDatabase.OpenParams); - method @NonNull public android.database.sqlite.SQLiteRawStatement createRawStatement(@NonNull String); + method @FlaggedApi("android.database.sqlite.sqlite_apis_15") @NonNull public android.database.sqlite.SQLiteRawStatement createRawStatement(@NonNull String); method public int delete(@NonNull String, @Nullable String, @Nullable String[]); method public static boolean deleteDatabase(@NonNull java.io.File); method public void disableWriteAheadLogging(); @@ -14370,13 +14370,13 @@ package android.database.sqlite { method public void execSQL(@NonNull String, @NonNull Object[]) throws android.database.SQLException; method public static String findEditTable(String); method public java.util.List<android.util.Pair<java.lang.String,java.lang.String>> getAttachedDbs(); - method public long getLastChangedRowCount(); - method public long getLastInsertRowId(); + method @FlaggedApi("android.database.sqlite.sqlite_apis_15") public long getLastChangedRowCount(); + method @FlaggedApi("android.database.sqlite.sqlite_apis_15") public long getLastInsertRowId(); method public long getMaximumSize(); method public long getPageSize(); method public String getPath(); method @Deprecated public java.util.Map<java.lang.String,java.lang.String> getSyncedTables(); - method public long getTotalChangedRowCount(); + method @FlaggedApi("android.database.sqlite.sqlite_apis_15") public long getTotalChangedRowCount(); method public int getVersion(); method public boolean inTransaction(); method public long insert(@NonNull String, @Nullable String, @Nullable android.content.ContentValues); @@ -14598,7 +14598,7 @@ package android.database.sqlite { method public int update(@NonNull android.database.sqlite.SQLiteDatabase, @NonNull android.content.ContentValues, @Nullable String, @Nullable String[]); } - public final class SQLiteRawStatement implements java.io.Closeable { + @FlaggedApi("android.database.sqlite.sqlite_apis_15") public final class SQLiteRawStatement implements java.io.Closeable { method public void bindBlob(int, @NonNull byte[]) throws android.database.sqlite.SQLiteException; method public void bindBlob(int, @NonNull byte[], int, int) throws android.database.sqlite.SQLiteException; method public void bindDouble(int, double) throws android.database.sqlite.SQLiteException; diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java index 746f2f23fd5c..b003e75b4e50 100644 --- a/core/java/android/database/sqlite/SQLiteDatabase.java +++ b/core/java/android/database/sqlite/SQLiteDatabase.java @@ -16,6 +16,7 @@ package android.database.sqlite; +import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.IntRange; import android.annotation.NonNull; @@ -700,6 +701,7 @@ public final class SQLiteDatabase extends SQLiteClosable { * } * </pre> */ + @FlaggedApi(Flags.FLAG_SQLITE_APIS_15) public void beginTransactionReadOnly() { beginTransactionWithListenerReadOnly(null); } @@ -783,6 +785,7 @@ public final class SQLiteDatabase extends SQLiteClosable { * } * </pre> */ + @FlaggedApi(Flags.FLAG_SQLITE_APIS_15) public void beginTransactionWithListenerReadOnly( @Nullable SQLiteTransactionListener transactionListener) { beginTransaction(transactionListener, SQLiteSession.TRANSACTION_MODE_DEFERRED); @@ -2221,6 +2224,7 @@ public final class SQLiteDatabase extends SQLiteClosable { * @throws IllegalStateException if a transaction is not in progress. * @throws SQLiteException if the SQL cannot be compiled. */ + @FlaggedApi(Flags.FLAG_SQLITE_APIS_15) @NonNull public SQLiteRawStatement createRawStatement(@NonNull String sql) { Objects.requireNonNull(sql); @@ -2240,6 +2244,7 @@ public final class SQLiteDatabase extends SQLiteClosable { * @return The ROWID of the last row to be inserted under this connection. * @throws IllegalStateException if there is no current transaction. */ + @FlaggedApi(Flags.FLAG_SQLITE_APIS_15) public long getLastInsertRowId() { return getThreadSession().getLastInsertRowId(); } @@ -2253,6 +2258,7 @@ public final class SQLiteDatabase extends SQLiteClosable { * @return The number of rows changed by the most recent sql statement * @throws IllegalStateException if there is no current transaction. */ + @FlaggedApi(Flags.FLAG_SQLITE_APIS_15) public long getLastChangedRowCount() { return getThreadSession().getLastChangedRowCount(); } @@ -2280,6 +2286,7 @@ public final class SQLiteDatabase extends SQLiteClosable { * @return The number of rows changed on the current connection. * @throws IllegalStateException if there is no current transaction. */ + @FlaggedApi(Flags.FLAG_SQLITE_APIS_15) public long getTotalChangedRowCount() { return getThreadSession().getTotalChangedRowCount(); } diff --git a/core/java/android/database/sqlite/SQLiteRawStatement.java b/core/java/android/database/sqlite/SQLiteRawStatement.java index 165f1810c894..827420f96fed 100644 --- a/core/java/android/database/sqlite/SQLiteRawStatement.java +++ b/core/java/android/database/sqlite/SQLiteRawStatement.java @@ -16,6 +16,7 @@ package android.database.sqlite; +import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; @@ -70,6 +71,7 @@ import java.util.Objects; * * @see <a href="http://sqlite.org/c3ref/stmt.html">sqlite3_stmt</a> */ +@FlaggedApi(Flags.FLAG_SQLITE_APIS_15) public final class SQLiteRawStatement implements Closeable { private static final String TAG = "SQLiteRawStatement"; diff --git a/core/java/android/database/sqlite/flags.aconfig b/core/java/android/database/sqlite/flags.aconfig new file mode 100644 index 000000000000..564df039456b --- /dev/null +++ b/core/java/android/database/sqlite/flags.aconfig @@ -0,0 +1,9 @@ +package: "android.database.sqlite" + +flag { + name: "sqlite_apis_15" + namespace: "system_performance" + is_fixed_read_only: true + description: "SQLite APIs held back for Android 15" + bug: "279043253" +} |