Loading api/test-current.txt +5 −0 Original line number Diff line number Diff line Loading @@ -4859,6 +4859,11 @@ package android.view { method public abstract String asyncImpl() default ""; } public final class SurfaceControl implements android.os.Parcelable { method public static long acquireFrameRateFlexibilityToken(); method public static void releaseFrameRateFlexibilityToken(long); } public class SurfaceControlViewHost { method public void relayout(android.view.WindowManager.LayoutParams); method public void setView(@NonNull android.view.View, @NonNull android.view.WindowManager.LayoutParams); Loading core/java/android/view/SurfaceControl.java +24 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Size; import android.annotation.TestApi; import android.compat.annotation.UnsupportedAppUsage; import android.graphics.Bitmap; import android.graphics.ColorSpace; Loading Loading @@ -216,6 +217,9 @@ public final class SurfaceControl implements Parcelable { private static native void nativeSetFrameRate( long transactionObj, long nativeObject, float frameRate, int compatibility); private static native long nativeAcquireFrameRateFlexibilityToken(); private static native void nativeReleaseFrameRateFlexibilityToken(long token); private final CloseGuard mCloseGuard = CloseGuard.get(); private String mName; /** Loading Loading @@ -2868,4 +2872,24 @@ public final class SurfaceControl implements Parcelable { } } } /** * Acquire a frame rate flexibility token, which allows surface flinger to freely switch display * frame rates. This is used by CTS tests to put the device in a consistent state. See * ISurfaceComposer::acquireFrameRateFlexibilityToken(). * @hide */ @TestApi public static long acquireFrameRateFlexibilityToken() { return nativeAcquireFrameRateFlexibilityToken(); } /** * Release a frame rate flexibility token. * @hide */ @TestApi public static void releaseFrameRateFlexibilityToken(long token) { nativeReleaseFrameRateFlexibilityToken(token); } } core/jni/android_view_SurfaceControl.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -29,11 +29,13 @@ #include <android_runtime/AndroidRuntime.h> #include <android_runtime/android_view_Surface.h> #include <android_runtime/android_view_SurfaceSession.h> #include <gui/ISurfaceComposer.h> #include <gui/Surface.h> #include <gui/SurfaceComposerClient.h> #include <jni.h> #include <nativehelper/JNIHelp.h> #include <nativehelper/ScopedUtfChars.h> #include <private/gui/ComposerService.h> #include <stdio.h> #include <system/graphics.h> #include <ui/ConfigStoreTypes.h> Loading Loading @@ -624,6 +626,23 @@ static void nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong transactionObj, transaction->setFrameRate(ctrl, frameRate, static_cast<int8_t>(compatibility)); } static jlong nativeAcquireFrameRateFlexibilityToken(JNIEnv* env, jclass clazz) { sp<ISurfaceComposer> composer = ComposerService::getComposerService(); sp<IBinder> token; status_t result = composer->acquireFrameRateFlexibilityToken(&token); if (result < 0) { ALOGE("Failed acquiring frame rate flexibility token: %s (%d)", strerror(-result), result); return 0; } token->incStrong((void*)nativeAcquireFrameRateFlexibilityToken); return reinterpret_cast<jlong>(token.get()); } static void nativeReleaseFrameRateFlexibilityToken(JNIEnv* env, jclass clazz, jlong tokenLong) { sp<IBinder> token(reinterpret_cast<IBinder*>(tokenLong)); token->decStrong((void*)nativeAcquireFrameRateFlexibilityToken); } static jlongArray nativeGetPhysicalDisplayIds(JNIEnv* env, jclass clazz) { const auto displayIds = SurfaceComposerClient::getPhysicalDisplayIds(); jlongArray array = env->NewLongArray(displayIds.size()); Loading Loading @@ -1474,6 +1493,10 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetShadowRadius }, {"nativeSetFrameRate", "(JJFI)V", (void*)nativeSetFrameRate }, {"nativeAcquireFrameRateFlexibilityToken", "()J", (void*)nativeAcquireFrameRateFlexibilityToken }, {"nativeReleaseFrameRateFlexibilityToken", "(J)V", (void*)nativeReleaseFrameRateFlexibilityToken }, {"nativeGetPhysicalDisplayIds", "()[J", (void*)nativeGetPhysicalDisplayIds }, {"nativeGetPhysicalDisplayToken", "(J)Landroid/os/IBinder;", Loading Loading
api/test-current.txt +5 −0 Original line number Diff line number Diff line Loading @@ -4859,6 +4859,11 @@ package android.view { method public abstract String asyncImpl() default ""; } public final class SurfaceControl implements android.os.Parcelable { method public static long acquireFrameRateFlexibilityToken(); method public static void releaseFrameRateFlexibilityToken(long); } public class SurfaceControlViewHost { method public void relayout(android.view.WindowManager.LayoutParams); method public void setView(@NonNull android.view.View, @NonNull android.view.WindowManager.LayoutParams); Loading
core/java/android/view/SurfaceControl.java +24 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Size; import android.annotation.TestApi; import android.compat.annotation.UnsupportedAppUsage; import android.graphics.Bitmap; import android.graphics.ColorSpace; Loading Loading @@ -216,6 +217,9 @@ public final class SurfaceControl implements Parcelable { private static native void nativeSetFrameRate( long transactionObj, long nativeObject, float frameRate, int compatibility); private static native long nativeAcquireFrameRateFlexibilityToken(); private static native void nativeReleaseFrameRateFlexibilityToken(long token); private final CloseGuard mCloseGuard = CloseGuard.get(); private String mName; /** Loading Loading @@ -2868,4 +2872,24 @@ public final class SurfaceControl implements Parcelable { } } } /** * Acquire a frame rate flexibility token, which allows surface flinger to freely switch display * frame rates. This is used by CTS tests to put the device in a consistent state. See * ISurfaceComposer::acquireFrameRateFlexibilityToken(). * @hide */ @TestApi public static long acquireFrameRateFlexibilityToken() { return nativeAcquireFrameRateFlexibilityToken(); } /** * Release a frame rate flexibility token. * @hide */ @TestApi public static void releaseFrameRateFlexibilityToken(long token) { nativeReleaseFrameRateFlexibilityToken(token); } }
core/jni/android_view_SurfaceControl.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -29,11 +29,13 @@ #include <android_runtime/AndroidRuntime.h> #include <android_runtime/android_view_Surface.h> #include <android_runtime/android_view_SurfaceSession.h> #include <gui/ISurfaceComposer.h> #include <gui/Surface.h> #include <gui/SurfaceComposerClient.h> #include <jni.h> #include <nativehelper/JNIHelp.h> #include <nativehelper/ScopedUtfChars.h> #include <private/gui/ComposerService.h> #include <stdio.h> #include <system/graphics.h> #include <ui/ConfigStoreTypes.h> Loading Loading @@ -624,6 +626,23 @@ static void nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong transactionObj, transaction->setFrameRate(ctrl, frameRate, static_cast<int8_t>(compatibility)); } static jlong nativeAcquireFrameRateFlexibilityToken(JNIEnv* env, jclass clazz) { sp<ISurfaceComposer> composer = ComposerService::getComposerService(); sp<IBinder> token; status_t result = composer->acquireFrameRateFlexibilityToken(&token); if (result < 0) { ALOGE("Failed acquiring frame rate flexibility token: %s (%d)", strerror(-result), result); return 0; } token->incStrong((void*)nativeAcquireFrameRateFlexibilityToken); return reinterpret_cast<jlong>(token.get()); } static void nativeReleaseFrameRateFlexibilityToken(JNIEnv* env, jclass clazz, jlong tokenLong) { sp<IBinder> token(reinterpret_cast<IBinder*>(tokenLong)); token->decStrong((void*)nativeAcquireFrameRateFlexibilityToken); } static jlongArray nativeGetPhysicalDisplayIds(JNIEnv* env, jclass clazz) { const auto displayIds = SurfaceComposerClient::getPhysicalDisplayIds(); jlongArray array = env->NewLongArray(displayIds.size()); Loading Loading @@ -1474,6 +1493,10 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetShadowRadius }, {"nativeSetFrameRate", "(JJFI)V", (void*)nativeSetFrameRate }, {"nativeAcquireFrameRateFlexibilityToken", "()J", (void*)nativeAcquireFrameRateFlexibilityToken }, {"nativeReleaseFrameRateFlexibilityToken", "(J)V", (void*)nativeReleaseFrameRateFlexibilityToken }, {"nativeGetPhysicalDisplayIds", "()[J", (void*)nativeGetPhysicalDisplayIds }, {"nativeGetPhysicalDisplayToken", "(J)Landroid/os/IBinder;", Loading