summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-10-28 19:23:37 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2024-10-28 19:23:37 +0000
commit61a14d28aa851a6f1608b99e9f9960c486e43ebf (patch)
tree5db33bd84bf04cf45c37591ad7c094f181d7b86e
parent07dbdcd45f0ac21d1dd047e1607e4f7127be3464 (diff)
parentc38363d4029dc6fe9b2f613b850d42390ea421d9 (diff)
Merge "Finalize BulkCursorNative asynchronously" into main am: 7300c9f3b4 am: c38363d402
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3266452 Change-Id: I2dadd85c0a78f6bd79d24f5703b8ba54344612ec Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--core/java/android/database/BulkCursorNative.java20
-rw-r--r--core/java/android/database/sqlite/flags.aconfig7
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 d5a7db82d456..826b908e6775 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"