Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c47997de authored by Ady Abraham's avatar Ady Abraham
Browse files

Add units to getLatchTime

Addressed API feedback

Bug: 320461972
Test: presubmit
Change-Id: I76e4a8d5efd3b67cf650ddbb3db545ebc4f3fba3
parent 0176ffa3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -51413,7 +51413,7 @@ package android.view {
    method @NonNull public android.view.SurfaceControl.Transaction setCrop(@NonNull android.view.SurfaceControl, @Nullable android.graphics.Rect);
    method @NonNull public android.view.SurfaceControl.Transaction setDamageRegion(@NonNull android.view.SurfaceControl, @Nullable android.graphics.Region);
    method @NonNull public android.view.SurfaceControl.Transaction setDataSpace(@NonNull android.view.SurfaceControl, int);
    method @FlaggedApi("com.android.window.flags.sdk_desired_present_time") @NonNull public android.view.SurfaceControl.Transaction setDesiredPresentTime(long);
    method @FlaggedApi("com.android.window.flags.sdk_desired_present_time") @NonNull public android.view.SurfaceControl.Transaction setDesiredPresentTimeNanos(long);
    method @NonNull public android.view.SurfaceControl.Transaction setExtendedRangeBrightness(@NonNull android.view.SurfaceControl, float, float);
    method @NonNull public android.view.SurfaceControl.Transaction setFrameRate(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0) float, int);
    method @NonNull public android.view.SurfaceControl.Transaction setFrameRate(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0) float, int, int);
@@ -51434,7 +51434,7 @@ package android.view {
  }
  @FlaggedApi("com.android.window.flags.sdk_desired_present_time") public static final class SurfaceControl.TransactionStats {
    method @FlaggedApi("com.android.window.flags.sdk_desired_present_time") public long getLatchTime();
    method @FlaggedApi("com.android.window.flags.sdk_desired_present_time") public long getLatchTimeNanos();
    method @FlaggedApi("com.android.window.flags.sdk_desired_present_time") @NonNull public android.hardware.SyncFence getPresentFence();
  }
+14 −14
Original line number Diff line number Diff line
@@ -294,8 +294,8 @@ public final class SurfaceControl implements Parcelable {
    private static native void nativeClearTrustedPresentationCallback(long transactionObj,
            long nativeObject);
    private static native StalledTransactionInfo nativeGetStalledTransactionInfo(int pid);
    private static native void nativeSetDesiredPresentTime(long transactionObj,
                                                           long desiredPresentTime);
    private static native void nativeSetDesiredPresentTimeNanos(long transactionObj,
                                                                long desiredPresentTimeNanos);
    private static native void nativeSetFrameTimeline(long transactionObj,
                                                           long vsyncId);

@@ -2563,12 +2563,12 @@ public final class SurfaceControl implements Parcelable {
     */
    @FlaggedApi(Flags.FLAG_SDK_DESIRED_PRESENT_TIME)
    public static final class TransactionStats {
        private long mLatchTime;
        private long mLatchTimeNanos;
        private SyncFence mSyncFence;

        // called from native
        private TransactionStats(long latchTime, long presentFencePtr) {
            mLatchTime = latchTime;
        private TransactionStats(long latchTimeNanos, long presentFencePtr) {
            mLatchTimeNanos = latchTimeNanos;
            mSyncFence = new SyncFence(presentFencePtr);
        }

@@ -2581,12 +2581,12 @@ public final class SurfaceControl implements Parcelable {
        }

        /**
         * Returns the timestamp of when the frame was latched by the framework and queued for
         * presentation.
         * Returns the timestamp (in CLOCK_MONOTONIC) of when the frame was latched by the
         * framework and queued for presentation.
         */
        @FlaggedApi(Flags.FLAG_SDK_DESIRED_PRESENT_TIME)
        public long getLatchTime() {
            return mLatchTime;
        public long getLatchTimeNanos() {
            return mLatchTimeNanos;
        }

        /**
@@ -4426,8 +4426,8 @@ public final class SurfaceControl implements Parcelable {
        }

        /**
         * Specifies a desiredPresentTime for the transaction. The framework will try to present
         * the transaction at or after the time specified.
         * Specifies a desiredPresentTimeNanos for the transaction. The framework will try to
         * present the transaction at or after the time specified.
         *
         * Transactions will not be presented until all of their acquire fences have signaled even
         * if the app requests an earlier present time.
@@ -4436,17 +4436,17 @@ public final class SurfaceControl implements Parcelable {
         * a desired present time that is before x, the later transaction will not preempt the
         * earlier transaction.
         *
         * @param desiredPresentTime The desired time (in CLOCK_MONOTONIC) for the transaction.
         * @param desiredPresentTimeNanos The desired time (in CLOCK_MONOTONIC) for the transaction.
         * @return This transaction
         */
        @FlaggedApi(Flags.FLAG_SDK_DESIRED_PRESENT_TIME)
        @NonNull
        public Transaction setDesiredPresentTime(long desiredPresentTime) {
        public Transaction setDesiredPresentTimeNanos(long desiredPresentTimeNanos) {
            if (!Flags.sdkDesiredPresentTime()) {
                Log.w(TAG, "addTransactionCompletedListener was called but flag is disabled");
                return this;
            }
            nativeSetDesiredPresentTime(mNativeObject, desiredPresentTime);
            nativeSetDesiredPresentTimeNanos(mNativeObject, desiredPresentTimeNanos);
            return this;
        }
        /**
+5 −5
Original line number Diff line number Diff line
@@ -1938,11 +1938,11 @@ static void nativeSetFrameTimelineVsync(JNIEnv* env, jclass clazz, jlong transac
    transaction->setFrameTimelineInfo(ftInfo);
}

static void nativeSetDesiredPresentTime(JNIEnv* env, jclass clazz, jlong transactionObj,
                                        jlong desiredPresentTime) {
static void nativeSetDesiredPresentTimeNanos(JNIEnv* env, jclass clazz, jlong transactionObj,
                                             jlong desiredPresentTimeNanos) {
    auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);

    transaction->setDesiredPresentTime(desiredPresentTime);
    transaction->setDesiredPresentTime(desiredPresentTimeNanos);
}

static void nativeAddTransactionCommittedListener(JNIEnv* env, jclass clazz, jlong transactionObj,
@@ -2412,8 +2412,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
    {"getNativeTrustedPresentationCallbackFinalizer", "()J", (void*)getNativeTrustedPresentationCallbackFinalizer },
    {"nativeGetStalledTransactionInfo", "(I)Landroid/gui/StalledTransactionInfo;",
            (void*) nativeGetStalledTransactionInfo },
    {"nativeSetDesiredPresentTime", "(JJ)V",
            (void*) nativeSetDesiredPresentTime },
    {"nativeSetDesiredPresentTimeNanos", "(JJ)V",
            (void*) nativeSetDesiredPresentTimeNanos },
        // clang-format on
};