Merge "SurfaceControl: Query native object for transform hint" into sc-dev
This commit is contained in:
@@ -234,6 +234,7 @@ public final class SurfaceControl implements Parcelable {
|
|||||||
private static native long nativeCreateJankDataListenerWrapper(OnJankDataListener listener);
|
private static native long nativeCreateJankDataListenerWrapper(OnJankDataListener listener);
|
||||||
private static native int nativeGetGPUContextPriority();
|
private static native int nativeGetGPUContextPriority();
|
||||||
private static native void nativeSetTransformHint(long nativeObject, int transformHint);
|
private static native void nativeSetTransformHint(long nativeObject, int transformHint);
|
||||||
|
private static native int nativeGetTransformHint(long nativeObject);
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@GuardedBy("mLock")
|
@GuardedBy("mLock")
|
||||||
@@ -608,7 +609,6 @@ public final class SurfaceControl implements Parcelable {
|
|||||||
mName = other.mName;
|
mName = other.mName;
|
||||||
mWidth = other.mWidth;
|
mWidth = other.mWidth;
|
||||||
mHeight = other.mHeight;
|
mHeight = other.mHeight;
|
||||||
mTransformHint = other.mTransformHint;
|
|
||||||
mLocalOwnerView = other.mLocalOwnerView;
|
mLocalOwnerView = other.mLocalOwnerView;
|
||||||
assignNativeObject(nativeCopyFromSurfaceControl(other.mNativeObject), callsite);
|
assignNativeObject(nativeCopyFromSurfaceControl(other.mNativeObject), callsite);
|
||||||
}
|
}
|
||||||
@@ -1471,7 +1471,6 @@ public final class SurfaceControl implements Parcelable {
|
|||||||
mName = in.readString8();
|
mName = in.readString8();
|
||||||
mWidth = in.readInt();
|
mWidth = in.readInt();
|
||||||
mHeight = in.readInt();
|
mHeight = in.readInt();
|
||||||
mTransformHint = in.readInt();
|
|
||||||
|
|
||||||
long object = 0;
|
long object = 0;
|
||||||
if (in.readInt() != 0) {
|
if (in.readInt() != 0) {
|
||||||
@@ -1490,7 +1489,6 @@ public final class SurfaceControl implements Parcelable {
|
|||||||
dest.writeString8(mName);
|
dest.writeString8(mName);
|
||||||
dest.writeInt(mWidth);
|
dest.writeInt(mWidth);
|
||||||
dest.writeInt(mHeight);
|
dest.writeInt(mHeight);
|
||||||
dest.writeInt(mTransformHint);
|
|
||||||
if (mNativeObject == 0) {
|
if (mNativeObject == 0) {
|
||||||
dest.writeInt(0);
|
dest.writeInt(0);
|
||||||
} else {
|
} else {
|
||||||
@@ -3603,7 +3601,8 @@ public final class SurfaceControl implements Parcelable {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public int getTransformHint() {
|
public int getTransformHint() {
|
||||||
return mTransformHint;
|
checkNotReleased();
|
||||||
|
return nativeGetTransformHint(mNativeObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3616,9 +3615,6 @@ public final class SurfaceControl implements Parcelable {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public void setTransformHint(@Surface.Rotation int transformHint) {
|
public void setTransformHint(@Surface.Rotation int transformHint) {
|
||||||
if (mTransformHint != transformHint) {
|
|
||||||
mTransformHint = transformHint;
|
|
||||||
nativeSetTransformHint(mNativeObject, transformHint);
|
nativeSetTransformHint(mNativeObject, transformHint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1785,6 +1785,14 @@ static void nativeSetTransformHint(JNIEnv* env, jclass clazz, jlong nativeSurfac
|
|||||||
ui::Transform::toRotationFlags(static_cast<ui::Rotation>(transformHint)));
|
ui::Transform::toRotationFlags(static_cast<ui::Rotation>(transformHint)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static jint nativeGetTransformHint(JNIEnv* env, jclass clazz, jlong nativeSurfaceControl) {
|
||||||
|
sp<SurfaceControl> surface(reinterpret_cast<SurfaceControl*>(nativeSurfaceControl));
|
||||||
|
ui::Transform::RotationFlags transformHintRotationFlags =
|
||||||
|
static_cast<ui::Transform::RotationFlags>(surface->getTransformHint());
|
||||||
|
|
||||||
|
return toRotationInt(ui::Transform::toRotation((transformHintRotationFlags)));
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static const JNINativeMethod sSurfaceControlMethods[] = {
|
static const JNINativeMethod sSurfaceControlMethods[] = {
|
||||||
@@ -1974,6 +1982,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
|
|||||||
(void*)nativeGetGPUContextPriority },
|
(void*)nativeGetGPUContextPriority },
|
||||||
{"nativeSetTransformHint", "(JI)V",
|
{"nativeSetTransformHint", "(JI)V",
|
||||||
(void*)nativeSetTransformHint },
|
(void*)nativeSetTransformHint },
|
||||||
|
{"nativeGetTransformHint", "(J)I",
|
||||||
|
(void*)nativeGetTransformHint },
|
||||||
// clang-format on
|
// clang-format on
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user