Merge "Expose transaction id" into tm-qpr-dev

This commit is contained in:
Pablo Gamito
2022-06-14 14:41:25 +00:00
committed by Android (Google) Code Review
2 changed files with 17 additions and 0 deletions

View File

@@ -121,6 +121,7 @@ public final class SurfaceControl implements Parcelable {
private static native void nativeSetAnimationTransaction(long transactionObj);
private static native void nativeSetEarlyWakeupStart(long transactionObj);
private static native void nativeSetEarlyWakeupEnd(long transactionObj);
private static native long nativeGetTransactionId(long transactionObj);
private static native void nativeSetLayer(long transactionObj, long nativeObject, int zorder);
private static native void nativeSetRelativeLayer(long transactionObj, long nativeObject,
@@ -3536,6 +3537,15 @@ public final class SurfaceControl implements Parcelable {
return this;
}
/**
* @hide
* @return The transaction's current id.
* The id changed every time the transaction is applied.
*/
public long getId() {
return nativeGetTransactionId(mNativeObject);
}
/**
* Sets an arbitrary piece of metadata on the surface. This is a helper for int data.
* @hide

View File

@@ -580,6 +580,11 @@ static void nativeSetEarlyWakeupEnd(JNIEnv* env, jclass clazz, jlong transaction
transaction->setEarlyWakeupEnd();
}
static jlong nativeGetTransactionId(JNIEnv* env, jclass clazz, jlong transactionObj) {
auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
return transaction->getId();
}
static void nativeSetLayer(JNIEnv* env, jclass clazz, jlong transactionObj,
jlong nativeObject, jint zorder) {
auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
@@ -2103,6 +2108,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
(void*)nativeSetEarlyWakeupStart },
{"nativeSetEarlyWakeupEnd", "(J)V",
(void*)nativeSetEarlyWakeupEnd },
{"nativeGetTransactionId", "(J)J",
(void*)nativeGetTransactionId },
{"nativeSetLayer", "(JJI)V",
(void*)nativeSetLayer },
{"nativeSetRelativeLayer", "(JJJI)V",