summaryrefslogtreecommitdiff
path: root/libs/nativewindow/ANativeWindow.cpp
diff options
context:
space:
mode:
author Kriti Dang <kritidang@google.com> 2022-08-26 16:30:37 +0200
committer Kriti Dang <kritidang@google.com> 2022-09-02 11:39:48 +0000
commit4113fc1776406b3e55e855ebccc029381b92ddf9 (patch)
treeed99eb6d2b9f47c3933a957e5592d6be8070783d /libs/nativewindow/ANativeWindow.cpp
parent501a72a312b06d5a3438ca4a55f73749d1278162 (diff)
Add clearFrameRate API in ndk
This API is same as using setFrameRate with 0 as frame-rate value. But this causes confusion, as the remaining two arguments are ignored, when frame-rate is 0. Bug: 241096917 Test: android.graphics.cts.SetFrameRateTest#testClearFrameRate Change-Id: I469e41cc1a15abf4c0b402caca12a9f6db4cdb71
Diffstat (limited to 'libs/nativewindow/ANativeWindow.cpp')
-rw-r--r--libs/nativewindow/ANativeWindow.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/libs/nativewindow/ANativeWindow.cpp b/libs/nativewindow/ANativeWindow.cpp
index 731f989658..b0750809f8 100644
--- a/libs/nativewindow/ANativeWindow.cpp
+++ b/libs/nativewindow/ANativeWindow.cpp
@@ -220,6 +220,15 @@ int32_t ANativeWindow_setFrameRateWithChangeStrategy(ANativeWindow* window, floa
return native_window_set_frame_rate(window, frameRate, compatibility, changeFrameRateStrategy);
}
+int32_t ANativeWindow_clearFrameRate(ANativeWindow* window) {
+ if (!window || !query(window, NATIVE_WINDOW_IS_VALID)) {
+ return -EINVAL;
+ }
+ return native_window_set_frame_rate(window, 0,
+ ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT,
+ ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS);
+}
+
/**************************************************************************************************
* vndk-stable
**************************************************************************************************/