Expose the flush jank data transaction via JNI.

Bug: 235178314
Bug: 221393601
Bug: 225105422
Test: atest SurfaceFlinger_test
Change-Id: I119a5264dfb7b831dc3d0bf051ddcf1a0ffe7e60
This commit is contained in:
Pascal Muetschard
2022-12-13 13:45:58 +01:00
committed by Pascal Mütschard
parent 8b0474030b
commit 0f50d93d49
2 changed files with 17 additions and 0 deletions

View File

@@ -173,6 +173,7 @@ public final class SurfaceControl implements Parcelable {
boolean isTrustedOverlay);
private static native void nativeSetDropInputMode(
long transactionObj, long nativeObject, int flags);
private static native void nativeSurfaceFlushJankData(long nativeSurfaceObject);
private static native boolean nativeClearContentFrameStats(long nativeObject);
private static native boolean nativeGetContentFrameStats(long nativeObject, WindowContentFrameStats outStats);
private static native boolean nativeClearAnimationFrameStats();
@@ -3884,6 +3885,15 @@ public final class SurfaceControl implements Parcelable {
return this;
}
/**
* Sends a flush jank data transaction for the given surface.
* @hide
*/
public static void sendSurfaceFlushJankData(SurfaceControl sc) {
sc.checkNotReleased();
nativeSurfaceFlushJankData(sc.mNativeObject);
}
/**
* @hide
*/

View File

@@ -951,6 +951,11 @@ static void nativeSetDropInputMode(JNIEnv* env, jclass clazz, jlong transactionO
transaction->setDropInputMode(ctrl, static_cast<gui::DropInputMode>(mode));
}
static void nativeSurfaceFlushJankData(JNIEnv* env, jclass clazz, jlong nativeObject) {
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl*>(nativeObject);
SurfaceComposerClient::Transaction::sendSurfaceFlushJankDataTransaction(ctrl);
}
static void nativeSanitize(JNIEnv* env, jclass clazz, jlong transactionObj) {
auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
transaction->sanitize();
@@ -2246,6 +2251,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
(void*)nativeGetLayerId },
{"nativeSetDropInputMode", "(JJI)V",
(void*)nativeSetDropInputMode },
{"nativeSurfaceFlushJankData", "(J)V",
(void*)nativeSurfaceFlushJankData },
{"nativeAddTransactionCommittedListener", "(JLandroid/view/SurfaceControl$TransactionCommittedListener;)V",
(void*) nativeAddTransactionCommittedListener },
{"nativeSetTrustedPresentationCallback", "(JJJLandroid/view/SurfaceControl$TrustedPresentationThresholds;)V",