diff options
| -rw-r--r-- | core/java/android/database/BulkCursorNative.java | 20 | ||||
| -rw-r--r-- | core/java/android/database/sqlite/flags.aconfig | 7 |
2 files changed, 20 insertions, 7 deletions
diff --git a/core/java/android/database/BulkCursorNative.java b/core/java/android/database/BulkCursorNative.java index 8ea450c6ca44..41585b3571d6 100644 --- a/core/java/android/database/BulkCursorNative.java +++ b/core/java/android/database/BulkCursorNative.java @@ -53,7 +53,7 @@ public abstract class BulkCursorNative extends Binder implements IBulkCursor return new BulkCursorProxy(obj); } - + @Override public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { @@ -79,7 +79,7 @@ public abstract class BulkCursorNative extends Binder implements IBulkCursor reply.writeNoException(); return true; } - + case CLOSE_TRANSACTION: { data.enforceInterface(IBulkCursor.descriptor); close(); @@ -212,15 +212,22 @@ final class BulkCursorProxy implements IBulkCursor { Parcel reply = Parcel.obtain(); try { data.writeInterfaceToken(IBulkCursor.descriptor); - - mRemote.transact(CLOSE_TRANSACTION, data, reply, 0); - DatabaseUtils.readExceptionFromParcel(reply); + // If close() is being called from the finalizer thread, do not wait for a reply from + // the remote side. + final boolean fromFinalizer = + android.database.sqlite.Flags.onewayFinalizerClose() + && "FinalizerDaemon".equals(Thread.currentThread().getName()); + mRemote.transact(CLOSE_TRANSACTION, data, reply, + fromFinalizer ? IBinder.FLAG_ONEWAY: 0); + if (!fromFinalizer) { + DatabaseUtils.readExceptionFromParcel(reply); + } } finally { data.recycle(); reply.recycle(); } } - + public int requery(IContentObserver observer) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); @@ -282,4 +289,3 @@ final class BulkCursorProxy implements IBulkCursor { } } } - diff --git a/core/java/android/database/sqlite/flags.aconfig b/core/java/android/database/sqlite/flags.aconfig index 285f984faab7..c597895899b6 100644 --- a/core/java/android/database/sqlite/flags.aconfig +++ b/core/java/android/database/sqlite/flags.aconfig @@ -2,6 +2,13 @@ package: "android.database.sqlite" container: "system" flag { + name: "oneway_finalizer_close" + namespace: "system_performance" + description: "Make BuildCursorNative.close oneway if in the the finalizer" + bug: "368221351" +} + +flag { name: "sqlite_apis_35" is_exported: true namespace: "system_performance" |