Temporarily revert field name change (DO NOT MERGE)
VisualOn is using hidden fields, causing HBO and Xfinity to crash. Bug: 8549617 Bug: 8331866 Change-Id: I35a9fe66dea8d56f4fcff9b492679226a17f4acc
This commit is contained in:
@@ -71,8 +71,8 @@ public class Surface implements Parcelable {
|
|||||||
// Guarded state.
|
// Guarded state.
|
||||||
final Object mLock = new Object(); // protects the native state
|
final Object mLock = new Object(); // protects the native state
|
||||||
private String mName;
|
private String mName;
|
||||||
int mNativeObject; // package scope only for SurfaceControl access
|
int mNativeSurface; // package scope only for SurfaceControl access
|
||||||
private int mGenerationId; // incremented each time mNativeObject changes
|
private int mGenerationId; // incremented each time mNativeSurface changes
|
||||||
private final Canvas mCanvas = new CompatibleCanvas();
|
private final Canvas mCanvas = new CompatibleCanvas();
|
||||||
|
|
||||||
// A matrix to scale the matrix set by application. This is set to null for
|
// A matrix to scale the matrix set by application. This is set to null for
|
||||||
@@ -158,8 +158,8 @@ public class Surface implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public void release() {
|
public void release() {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
if (mNativeObject != 0) {
|
if (mNativeSurface != 0) {
|
||||||
nativeRelease(mNativeObject);
|
nativeRelease(mNativeSurface);
|
||||||
setNativeObjectLocked(0);
|
setNativeObjectLocked(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -183,8 +183,8 @@ public class Surface implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
if (mNativeObject == 0) return false;
|
if (mNativeSurface == 0) return false;
|
||||||
return nativeIsValid(mNativeObject);
|
return nativeIsValid(mNativeSurface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,7 +210,7 @@ public class Surface implements Parcelable {
|
|||||||
public boolean isConsumerRunningBehind() {
|
public boolean isConsumerRunningBehind() {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
checkNotReleasedLocked();
|
checkNotReleasedLocked();
|
||||||
return nativeIsConsumerRunningBehind(mNativeObject);
|
return nativeIsConsumerRunningBehind(mNativeSurface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ public class Surface implements Parcelable {
|
|||||||
throws OutOfResourcesException, IllegalArgumentException {
|
throws OutOfResourcesException, IllegalArgumentException {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
checkNotReleasedLocked();
|
checkNotReleasedLocked();
|
||||||
nativeLockCanvas(mNativeObject, mCanvas, inOutDirty);
|
nativeLockCanvas(mNativeSurface, mCanvas, inOutDirty);
|
||||||
return mCanvas;
|
return mCanvas;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -252,7 +252,7 @@ public class Surface implements Parcelable {
|
|||||||
|
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
checkNotReleasedLocked();
|
checkNotReleasedLocked();
|
||||||
nativeUnlockCanvasAndPost(mNativeObject, canvas);
|
nativeUnlockCanvasAndPost(mNativeSurface, canvas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,8 +298,8 @@ public class Surface implements Parcelable {
|
|||||||
int newNativeObject = nativeCreateFromSurfaceControl(surfaceControlPtr);
|
int newNativeObject = nativeCreateFromSurfaceControl(surfaceControlPtr);
|
||||||
|
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
if (mNativeObject != 0) {
|
if (mNativeSurface != 0) {
|
||||||
nativeRelease(mNativeObject);
|
nativeRelease(mNativeSurface);
|
||||||
}
|
}
|
||||||
setNativeObjectLocked(newNativeObject);
|
setNativeObjectLocked(newNativeObject);
|
||||||
}
|
}
|
||||||
@@ -319,13 +319,13 @@ public class Surface implements Parcelable {
|
|||||||
if (other != this) {
|
if (other != this) {
|
||||||
final int newPtr;
|
final int newPtr;
|
||||||
synchronized (other.mLock) {
|
synchronized (other.mLock) {
|
||||||
newPtr = other.mNativeObject;
|
newPtr = other.mNativeSurface;
|
||||||
other.setNativeObjectLocked(0);
|
other.setNativeObjectLocked(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
if (mNativeObject != 0) {
|
if (mNativeSurface != 0) {
|
||||||
nativeRelease(mNativeObject);
|
nativeRelease(mNativeSurface);
|
||||||
}
|
}
|
||||||
setNativeObjectLocked(newPtr);
|
setNativeObjectLocked(newPtr);
|
||||||
}
|
}
|
||||||
@@ -344,7 +344,7 @@ public class Surface implements Parcelable {
|
|||||||
|
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
mName = source.readString();
|
mName = source.readString();
|
||||||
setNativeObjectLocked(nativeReadFromParcel(mNativeObject, source));
|
setNativeObjectLocked(nativeReadFromParcel(mNativeSurface, source));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,7 +355,7 @@ public class Surface implements Parcelable {
|
|||||||
}
|
}
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
dest.writeString(mName);
|
dest.writeString(mName);
|
||||||
nativeWriteToParcel(mNativeObject, dest);
|
nativeWriteToParcel(mNativeSurface, dest);
|
||||||
}
|
}
|
||||||
if ((flags & Parcelable.PARCELABLE_WRITE_RETURN_VALUE) != 0) {
|
if ((flags & Parcelable.PARCELABLE_WRITE_RETURN_VALUE) != 0) {
|
||||||
release();
|
release();
|
||||||
@@ -370,19 +370,19 @@ public class Surface implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setNativeObjectLocked(int ptr) {
|
private void setNativeObjectLocked(int ptr) {
|
||||||
if (mNativeObject != ptr) {
|
if (mNativeSurface != ptr) {
|
||||||
if (mNativeObject == 0 && ptr != 0) {
|
if (mNativeSurface == 0 && ptr != 0) {
|
||||||
mCloseGuard.open("release");
|
mCloseGuard.open("release");
|
||||||
} else if (mNativeObject != 0 && ptr == 0) {
|
} else if (mNativeSurface != 0 && ptr == 0) {
|
||||||
mCloseGuard.close();
|
mCloseGuard.close();
|
||||||
}
|
}
|
||||||
mNativeObject = ptr;
|
mNativeSurface = ptr;
|
||||||
mGenerationId += 1;
|
mGenerationId += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkNotReleasedLocked() {
|
private void checkNotReleasedLocked() {
|
||||||
if (mNativeObject == 0) {
|
if (mNativeSurface == 0) {
|
||||||
throw new IllegalStateException("Surface has already been released.");
|
throw new IllegalStateException("Surface has already been released.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -499,7 +499,7 @@ public class SurfaceControl {
|
|||||||
|
|
||||||
if (surface != null) {
|
if (surface != null) {
|
||||||
synchronized (surface.mLock) {
|
synchronized (surface.mLock) {
|
||||||
nativeSetDisplaySurface(displayToken, surface.mNativeObject);
|
nativeSetDisplaySurface(displayToken, surface.mNativeSurface);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
nativeSetDisplaySurface(displayToken, 0);
|
nativeSetDisplaySurface(displayToken, 0);
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ int register_android_view_Surface(JNIEnv* env)
|
|||||||
jclass clazz = env->FindClass("android/view/Surface");
|
jclass clazz = env->FindClass("android/view/Surface");
|
||||||
gSurfaceClassInfo.clazz = jclass(env->NewGlobalRef(clazz));
|
gSurfaceClassInfo.clazz = jclass(env->NewGlobalRef(clazz));
|
||||||
gSurfaceClassInfo.mNativeObject =
|
gSurfaceClassInfo.mNativeObject =
|
||||||
env->GetFieldID(gSurfaceClassInfo.clazz, "mNativeObject", "I");
|
env->GetFieldID(gSurfaceClassInfo.clazz, "mNativeSurface", "I");
|
||||||
gSurfaceClassInfo.mLock =
|
gSurfaceClassInfo.mLock =
|
||||||
env->GetFieldID(gSurfaceClassInfo.clazz, "mLock", "Ljava/lang/Object;");
|
env->GetFieldID(gSurfaceClassInfo.clazz, "mLock", "Ljava/lang/Object;");
|
||||||
gSurfaceClassInfo.ctor = env->GetMethodID(gSurfaceClassInfo.clazz, "<init>", "(I)V");
|
gSurfaceClassInfo.ctor = env->GetMethodID(gSurfaceClassInfo.clazz, "<init>", "(I)V");
|
||||||
|
|||||||
Reference in New Issue
Block a user