Loading api/test-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -4860,7 +4860,9 @@ package android.view { } public final class SurfaceControl implements android.os.Parcelable { ctor public SurfaceControl(@NonNull android.view.SurfaceControl); method public static long acquireFrameRateFlexibilityToken(); method public boolean isSameSurface(@NonNull android.view.SurfaceControl); method public static void releaseFrameRateFlexibilityToken(long); } Loading core/java/android/view/InsetsSourceConsumer.java +8 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,8 @@ public class InsetsSourceConsumer { if (mSourceControl == control) { return; } SurfaceControl oldLeash = mSourceControl != null ? mSourceControl.getLeash() : null; final InsetsSourceControl lastControl = mSourceControl; mSourceControl = control; Loading @@ -116,6 +118,12 @@ public class InsetsSourceConsumer { // However make sure that the leash visibility is still up to date. if (applyLocalVisibilityOverride()) { mController.notifyVisibilityChanged(); } // If we have a new leash, make sure visibility is up-to-date, even though we // didn't want to run an animation above. SurfaceControl newLeash = mSourceControl.getLeash(); if (oldLeash == null || newLeash == null || !oldLeash.isSameSurface(newLeash)) { applyHiddenToControl(); } } Loading core/java/android/view/InsetsSourceControl.java +1 −2 Original line number Diff line number Diff line Loading @@ -44,8 +44,7 @@ public class InsetsSourceControl implements Parcelable { public InsetsSourceControl(InsetsSourceControl other) { mType = other.mType; if (other.mLeash != null) { mLeash = new SurfaceControl(); mLeash.copyFrom(other.mLeash); mLeash = new SurfaceControl(other.mLeash); } else { mLeash = null; } Loading core/java/android/view/SurfaceControl.java +25 −13 Original line number Diff line number Diff line Loading @@ -216,6 +216,7 @@ public final class SurfaceControl implements Parcelable { private static native void nativeSetFrameRate( long transactionObj, long nativeObject, float frameRate, int compatibility); private static native long nativeGetHandle(long nativeObject); private static native long nativeAcquireFrameRateFlexibilityToken(); private static native void nativeReleaseFrameRateFlexibilityToken(long token); Loading @@ -226,6 +227,7 @@ public final class SurfaceControl implements Parcelable { * @hide */ public long mNativeObject; private long mNativeHandle; // TODO: Move this to native. private final Object mSizeLock = new Object(); Loading Loading @@ -428,12 +430,13 @@ public final class SurfaceControl implements Parcelable { mCloseGuard.open("release"); } mNativeObject = nativeObject; mNativeHandle = mNativeObject != 0 ? nativeGetHandle(nativeObject) : 0; } /** * @hide */ public void copyFrom(SurfaceControl other) { public void copyFrom(@NonNull SurfaceControl other) { mName = other.mName; mWidth = other.mWidth; mHeight = other.mHeight; Loading Loading @@ -853,23 +856,19 @@ public final class SurfaceControl implements Parcelable { throw new OutOfResourcesException( "Couldn't allocate SurfaceControl native object"); } mNativeHandle = nativeGetHandle(mNativeObject); mCloseGuard.open("release"); } /** This is a transfer constructor, useful for transferring a live SurfaceControl native * object to another Java wrapper which could have some different behavior, e.g. * event logging. /** * Copy constructor. Creates a new native object pointing to the same surface as {@code other}. * * @param other The object to copy the surface from. * @hide */ public SurfaceControl(SurfaceControl other) { mName = other.mName; mWidth = other.mWidth; mHeight = other.mHeight; mNativeObject = other.mNativeObject; other.mCloseGuard.close(); other.mNativeObject = 0; mCloseGuard.open("release"); @TestApi public SurfaceControl(@NonNull SurfaceControl other) { copyFrom(other); } private SurfaceControl(Parcel in) { Loading Loading @@ -920,6 +919,18 @@ public final class SurfaceControl implements Parcelable { } } /** * Checks whether two {@link SurfaceControl} objects represent the same surface. * * @param other The other object to check * @return {@code true} if these two {@link SurfaceControl} objects represent the same surface. * @hide */ @TestApi public boolean isSameSurface(@NonNull SurfaceControl other) { return other.mNativeHandle == mNativeHandle; } /** * Write to a protocol buffer output stream. Protocol buffer message definition is at {@link * android.view.SurfaceControlProto}. Loading Loading @@ -977,6 +988,7 @@ public final class SurfaceControl implements Parcelable { if (mNativeObject != 0) { nativeRelease(mNativeObject); mNativeObject = 0; mNativeHandle = 0; mCloseGuard.close(); } } Loading core/jni/android_view_SurfaceControl.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -1430,6 +1430,12 @@ static void nativeSetGlobalShadowSettings(JNIEnv* env, jclass clazz, jfloatArray client->setGlobalShadowSettings(ambientColor, spotColor, lightPosY, lightPosZ, lightRadius); } static jlong nativeGetHandle(JNIEnv* env, jclass clazz, jlong nativeObject) { SurfaceControl *surfaceControl = reinterpret_cast<SurfaceControl*>(nativeObject); return reinterpret_cast<jlong>(surfaceControl->getHandle().get()); } // ---------------------------------------------------------------------------- static const JNINativeMethod sSurfaceControlMethods[] = { Loading Loading @@ -1606,6 +1612,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeMirrorSurface }, {"nativeSetGlobalShadowSettings", "([F[FFFF)V", (void*)nativeSetGlobalShadowSettings }, {"nativeGetHandle", "(J)J", (void*)nativeGetHandle }, }; int register_android_view_SurfaceControl(JNIEnv* env) Loading Loading
api/test-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -4860,7 +4860,9 @@ package android.view { } public final class SurfaceControl implements android.os.Parcelable { ctor public SurfaceControl(@NonNull android.view.SurfaceControl); method public static long acquireFrameRateFlexibilityToken(); method public boolean isSameSurface(@NonNull android.view.SurfaceControl); method public static void releaseFrameRateFlexibilityToken(long); } Loading
core/java/android/view/InsetsSourceConsumer.java +8 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,8 @@ public class InsetsSourceConsumer { if (mSourceControl == control) { return; } SurfaceControl oldLeash = mSourceControl != null ? mSourceControl.getLeash() : null; final InsetsSourceControl lastControl = mSourceControl; mSourceControl = control; Loading @@ -116,6 +118,12 @@ public class InsetsSourceConsumer { // However make sure that the leash visibility is still up to date. if (applyLocalVisibilityOverride()) { mController.notifyVisibilityChanged(); } // If we have a new leash, make sure visibility is up-to-date, even though we // didn't want to run an animation above. SurfaceControl newLeash = mSourceControl.getLeash(); if (oldLeash == null || newLeash == null || !oldLeash.isSameSurface(newLeash)) { applyHiddenToControl(); } } Loading
core/java/android/view/InsetsSourceControl.java +1 −2 Original line number Diff line number Diff line Loading @@ -44,8 +44,7 @@ public class InsetsSourceControl implements Parcelable { public InsetsSourceControl(InsetsSourceControl other) { mType = other.mType; if (other.mLeash != null) { mLeash = new SurfaceControl(); mLeash.copyFrom(other.mLeash); mLeash = new SurfaceControl(other.mLeash); } else { mLeash = null; } Loading
core/java/android/view/SurfaceControl.java +25 −13 Original line number Diff line number Diff line Loading @@ -216,6 +216,7 @@ public final class SurfaceControl implements Parcelable { private static native void nativeSetFrameRate( long transactionObj, long nativeObject, float frameRate, int compatibility); private static native long nativeGetHandle(long nativeObject); private static native long nativeAcquireFrameRateFlexibilityToken(); private static native void nativeReleaseFrameRateFlexibilityToken(long token); Loading @@ -226,6 +227,7 @@ public final class SurfaceControl implements Parcelable { * @hide */ public long mNativeObject; private long mNativeHandle; // TODO: Move this to native. private final Object mSizeLock = new Object(); Loading Loading @@ -428,12 +430,13 @@ public final class SurfaceControl implements Parcelable { mCloseGuard.open("release"); } mNativeObject = nativeObject; mNativeHandle = mNativeObject != 0 ? nativeGetHandle(nativeObject) : 0; } /** * @hide */ public void copyFrom(SurfaceControl other) { public void copyFrom(@NonNull SurfaceControl other) { mName = other.mName; mWidth = other.mWidth; mHeight = other.mHeight; Loading Loading @@ -853,23 +856,19 @@ public final class SurfaceControl implements Parcelable { throw new OutOfResourcesException( "Couldn't allocate SurfaceControl native object"); } mNativeHandle = nativeGetHandle(mNativeObject); mCloseGuard.open("release"); } /** This is a transfer constructor, useful for transferring a live SurfaceControl native * object to another Java wrapper which could have some different behavior, e.g. * event logging. /** * Copy constructor. Creates a new native object pointing to the same surface as {@code other}. * * @param other The object to copy the surface from. * @hide */ public SurfaceControl(SurfaceControl other) { mName = other.mName; mWidth = other.mWidth; mHeight = other.mHeight; mNativeObject = other.mNativeObject; other.mCloseGuard.close(); other.mNativeObject = 0; mCloseGuard.open("release"); @TestApi public SurfaceControl(@NonNull SurfaceControl other) { copyFrom(other); } private SurfaceControl(Parcel in) { Loading Loading @@ -920,6 +919,18 @@ public final class SurfaceControl implements Parcelable { } } /** * Checks whether two {@link SurfaceControl} objects represent the same surface. * * @param other The other object to check * @return {@code true} if these two {@link SurfaceControl} objects represent the same surface. * @hide */ @TestApi public boolean isSameSurface(@NonNull SurfaceControl other) { return other.mNativeHandle == mNativeHandle; } /** * Write to a protocol buffer output stream. Protocol buffer message definition is at {@link * android.view.SurfaceControlProto}. Loading Loading @@ -977,6 +988,7 @@ public final class SurfaceControl implements Parcelable { if (mNativeObject != 0) { nativeRelease(mNativeObject); mNativeObject = 0; mNativeHandle = 0; mCloseGuard.close(); } } Loading
core/jni/android_view_SurfaceControl.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -1430,6 +1430,12 @@ static void nativeSetGlobalShadowSettings(JNIEnv* env, jclass clazz, jfloatArray client->setGlobalShadowSettings(ambientColor, spotColor, lightPosY, lightPosZ, lightRadius); } static jlong nativeGetHandle(JNIEnv* env, jclass clazz, jlong nativeObject) { SurfaceControl *surfaceControl = reinterpret_cast<SurfaceControl*>(nativeObject); return reinterpret_cast<jlong>(surfaceControl->getHandle().get()); } // ---------------------------------------------------------------------------- static const JNINativeMethod sSurfaceControlMethods[] = { Loading Loading @@ -1606,6 +1612,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeMirrorSurface }, {"nativeSetGlobalShadowSettings", "([F[FFFF)V", (void*)nativeSetGlobalShadowSettings }, {"nativeGetHandle", "(J)J", (void*)nativeGetHandle }, }; int register_android_view_SurfaceControl(JNIEnv* env) Loading