Merge changes I5a218ca1,I853a76d9
* changes: Refactoring: Rename SurfaceTextureClient to Surface clean-up following Surface split
This commit is contained in:
committed by
Android (Google) Code Review
commit
ceec31b7da
@ -32,6 +32,20 @@ import dalvik.system.CloseGuard;
|
||||
public class Surface implements Parcelable {
|
||||
private static final String TAG = "Surface";
|
||||
|
||||
private static native int nativeCreateFromSurfaceTexture(SurfaceTexture surfaceTexture)
|
||||
throws OutOfResourcesException;
|
||||
|
||||
private native Canvas nativeLockCanvas(int nativeObject, Rect dirty);
|
||||
private native void nativeUnlockCanvasAndPost(int nativeObject, Canvas canvas);
|
||||
|
||||
private static native void nativeRelease(int nativeObject);
|
||||
private static native void nativeDestroy(int nativeObject);
|
||||
private static native boolean nativeIsValid(int nativeObject);
|
||||
private static native boolean nativeIsConsumerRunningBehind(int nativeObject);
|
||||
private static native int nativeCopyFrom(int nativeObject, int surfaceControlNativeObject);
|
||||
private static native int nativeReadFromParcel(int nativeObject, Parcel source);
|
||||
private static native void nativeWriteToParcel(int nativeObject, Parcel dest);
|
||||
|
||||
public static final Parcelable.Creator<Surface> CREATOR =
|
||||
new Parcelable.Creator<Surface>() {
|
||||
public Surface createFromParcel(Parcel source) {
|
||||
@ -44,33 +58,11 @@ public class Surface implements Parcelable {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Surface[] newArray(int size) {
|
||||
return new Surface[size];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Rotation constant: 0 degree rotation (natural orientation)
|
||||
*/
|
||||
public static final int ROTATION_0 = 0;
|
||||
|
||||
/**
|
||||
* Rotation constant: 90 degree rotation.
|
||||
*/
|
||||
public static final int ROTATION_90 = 1;
|
||||
|
||||
/**
|
||||
* Rotation constant: 180 degree rotation.
|
||||
*/
|
||||
public static final int ROTATION_180 = 2;
|
||||
|
||||
/**
|
||||
* Rotation constant: 270 degree rotation.
|
||||
*/
|
||||
public static final int ROTATION_270 = 3;
|
||||
|
||||
|
||||
private final CloseGuard mCloseGuard = CloseGuard.get();
|
||||
private String mName;
|
||||
|
||||
@ -94,6 +86,28 @@ public class Surface implements Parcelable {
|
||||
private Matrix mCompatibleMatrix;
|
||||
|
||||
|
||||
/**
|
||||
* Rotation constant: 0 degree rotation (natural orientation)
|
||||
*/
|
||||
public static final int ROTATION_0 = 0;
|
||||
|
||||
/**
|
||||
* Rotation constant: 90 degree rotation.
|
||||
*/
|
||||
public static final int ROTATION_90 = 1;
|
||||
|
||||
/**
|
||||
* Rotation constant: 180 degree rotation.
|
||||
*/
|
||||
public static final int ROTATION_180 = 2;
|
||||
|
||||
/**
|
||||
* Rotation constant: 270 degree rotation.
|
||||
*/
|
||||
public static final int ROTATION_270 = 3;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create an empty surface, which will later be filled in by readFromParcel().
|
||||
* @hide
|
||||
@ -436,20 +450,4 @@ public class Surface implements Parcelable {
|
||||
if (mNativeObject == 0) throw new NullPointerException(
|
||||
"mNativeObject is null. Have you called release() already?");
|
||||
}
|
||||
|
||||
private native int nativeCreateFromSurfaceTexture(SurfaceTexture surfaceTexture)
|
||||
throws OutOfResourcesException;
|
||||
|
||||
private native void nativeRelease(int nativeObject);
|
||||
private native void nativeDestroy(int nativeObject);
|
||||
private native boolean nativeIsValid(int nativeObject);
|
||||
|
||||
private native boolean nativeIsConsumerRunningBehind(int nativeObject);
|
||||
|
||||
private native Canvas nativeLockCanvas(int nativeObject, Rect dirty);
|
||||
private native void nativeUnlockCanvasAndPost(int nativeObject, Canvas canvas);
|
||||
|
||||
private native int nativeCopyFrom(int nativeObject, int surfaceControlNativeObject);
|
||||
private native int nativeReadFromParcel(int nativeObject, Parcel source);
|
||||
private native void nativeWriteToParcel(int nativeObject, Parcel dest);
|
||||
}
|
||||
|
@ -30,6 +30,46 @@ import android.util.Log;
|
||||
*/
|
||||
public class SurfaceControl {
|
||||
private static final String TAG = "SurfaceControl";
|
||||
|
||||
private static native int nativeCreate(SurfaceSession session, String name,
|
||||
int w, int h, int format, int flags)
|
||||
throws OutOfResourcesException;
|
||||
private static native void nativeRelease(int nativeObject);
|
||||
private static native void nativeDestroy(int nativeObject);
|
||||
|
||||
private static native Bitmap nativeScreenshot(IBinder displayToken,
|
||||
int width, int height, int minLayer, int maxLayer, boolean allLayers);
|
||||
|
||||
private static native void nativeOpenTransaction();
|
||||
private static native void nativeCloseTransaction();
|
||||
private static native void nativeSetAnimationTransaction();
|
||||
|
||||
private static native void nativeSetLayer(int nativeObject, int zorder);
|
||||
private static native void nativeSetPosition(int nativeObject, float x, float y);
|
||||
private static native void nativeSetSize(int nativeObject, int w, int h);
|
||||
private static native void nativeSetTransparentRegionHint(int nativeObject, Region region);
|
||||
private static native void nativeSetAlpha(int nativeObject, float alpha);
|
||||
private static native void nativeSetMatrix(int nativeObject, float dsdx, float dtdx, float dsdy, float dtdy);
|
||||
private static native void nativeSetFlags(int nativeObject, int flags, int mask);
|
||||
private static native void nativeSetWindowCrop(int nativeObject, int l, int t, int r, int b);
|
||||
private static native void nativeSetLayerStack(int nativeObject, int layerStack);
|
||||
|
||||
private static native IBinder nativeGetBuiltInDisplay(int physicalDisplayId);
|
||||
private static native IBinder nativeCreateDisplay(String name, boolean secure);
|
||||
private static native void nativeSetDisplaySurface(
|
||||
IBinder displayToken, int nativeSurfaceObject);
|
||||
private static native void nativeSetDisplayLayerStack(
|
||||
IBinder displayToken, int layerStack);
|
||||
private static native void nativeSetDisplayProjection(
|
||||
IBinder displayToken, int orientation,
|
||||
int l, int t, int r, int b,
|
||||
int L, int T, int R, int B);
|
||||
private static native boolean nativeGetDisplayInfo(
|
||||
IBinder displayToken, SurfaceControl.PhysicalDisplayInfo outInfo);
|
||||
private static native void nativeBlankDisplay(IBinder displayToken);
|
||||
private static native void nativeUnblankDisplay(IBinder displayToken);
|
||||
|
||||
|
||||
private final CloseGuard mCloseGuard = CloseGuard.get();
|
||||
private String mName;
|
||||
int mNativeObject; // package visibility only for Surface.java access
|
||||
@ -532,44 +572,4 @@ public class SurfaceControl {
|
||||
throw new UnsupportedOperationException("Device is headless");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private native int nativeCreate(SurfaceSession session, String name,
|
||||
int w, int h, int format, int flags)
|
||||
throws OutOfResourcesException;
|
||||
private native void nativeRelease(int nativeObject);
|
||||
private native void nativeDestroy(int nativeObject);
|
||||
|
||||
private static native Bitmap nativeScreenshot(IBinder displayToken,
|
||||
int width, int height, int minLayer, int maxLayer, boolean allLayers);
|
||||
|
||||
private static native void nativeOpenTransaction();
|
||||
private static native void nativeCloseTransaction();
|
||||
private static native void nativeSetAnimationTransaction();
|
||||
|
||||
private native void nativeSetLayer(int nativeObject, int zorder);
|
||||
private native void nativeSetPosition(int nativeObject, float x, float y);
|
||||
private native void nativeSetSize(int nativeObject, int w, int h);
|
||||
private native void nativeSetTransparentRegionHint(int nativeObject, Region region);
|
||||
private native void nativeSetAlpha(int nativeObject, float alpha);
|
||||
private native void nativeSetMatrix(int nativeObject, float dsdx, float dtdx, float dsdy, float dtdy);
|
||||
private native void nativeSetFlags(int nativeObject, int flags, int mask);
|
||||
private native void nativeSetWindowCrop(int nativeObject, int l, int t, int r, int b);
|
||||
private native void nativeSetLayerStack(int nativeObject, int layerStack);
|
||||
|
||||
private static native IBinder nativeGetBuiltInDisplay(int physicalDisplayId);
|
||||
private static native IBinder nativeCreateDisplay(String name, boolean secure);
|
||||
private static native void nativeSetDisplaySurface(
|
||||
IBinder displayToken, int nativeSurfaceObject);
|
||||
private static native void nativeSetDisplayLayerStack(
|
||||
IBinder displayToken, int layerStack);
|
||||
private static native void nativeSetDisplayProjection(
|
||||
IBinder displayToken, int orientation,
|
||||
int l, int t, int r, int b,
|
||||
int L, int T, int R, int B);
|
||||
private static native boolean nativeGetDisplayInfo(
|
||||
IBinder displayToken, SurfaceControl.PhysicalDisplayInfo outInfo);
|
||||
private static native void nativeBlankDisplay(IBinder displayToken);
|
||||
private static native void nativeUnblankDisplay(IBinder displayToken);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gui/GLConsumer.h>
|
||||
#include <gui/SurfaceTextureClient.h>
|
||||
#include <gui/Surface.h>
|
||||
|
||||
#include <android_runtime/AndroidRuntime.h>
|
||||
|
||||
@ -86,8 +86,8 @@ sp<ANativeWindow> android_SurfaceTexture_getNativeWindow(
|
||||
JNIEnv* env, jobject thiz)
|
||||
{
|
||||
sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
|
||||
sp<SurfaceTextureClient> surfaceTextureClient(surfaceTexture != NULL ?
|
||||
new SurfaceTextureClient(surfaceTexture->getBufferQueue()) : NULL);
|
||||
sp<Surface> surfaceTextureClient(surfaceTexture != NULL ?
|
||||
new Surface(surfaceTexture->getBufferQueue()) : NULL);
|
||||
return surfaceTextureClient;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
uint32_t width, uint32_t height, uint32_t flags) {
|
||||
JNIEnv* env = AndroidRuntime::getJNIEnv();
|
||||
|
||||
jobject surfaceObj = android_view_Surface_createFromISurfaceTexture(env, bufferProducer);
|
||||
jobject surfaceObj = android_view_Surface_createFromIGraphicBufferProducer(env, bufferProducer);
|
||||
if (surfaceObj == NULL) {
|
||||
ALOGE("Could not create Surface from surface texture %p provided by media server.",
|
||||
bufferProducer.get());
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include <gui/Surface.h>
|
||||
#include <gui/GLConsumer.h>
|
||||
#include <gui/SurfaceTextureClient.h>
|
||||
#include <gui/Surface.h>
|
||||
|
||||
#include <ui/ANativeObjectBase.h>
|
||||
|
||||
@ -631,7 +631,7 @@ not_valid_surface:
|
||||
if (surfaceTexture == NULL)
|
||||
goto not_valid_surface;
|
||||
|
||||
window = new android::SurfaceTextureClient(surfaceTexture->getBufferQueue());
|
||||
window = new android::Surface(surfaceTexture->getBufferQueue());
|
||||
|
||||
if (window == NULL)
|
||||
goto not_valid_surface;
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <android_runtime/android_graphics_SurfaceTexture.h>
|
||||
|
||||
#include <gui/Surface.h>
|
||||
#include <gui/SurfaceControl.h>
|
||||
#include <gui/GLConsumer.h>
|
||||
|
||||
#include <ui/Rect.h>
|
||||
@ -85,7 +86,7 @@ sp<Surface> android_view_Surface_getSurface(JNIEnv* env, jobject surfaceObj) {
|
||||
env->GetIntField(surfaceObj, gSurfaceClassInfo.mNativeObject));
|
||||
}
|
||||
|
||||
jobject android_view_Surface_createFromISurfaceTexture(JNIEnv* env,
|
||||
jobject android_view_Surface_createFromIGraphicBufferProducer(JNIEnv* env,
|
||||
const sp<IGraphicBufferProducer>& bufferProducer) {
|
||||
if (bufferProducer == NULL) {
|
||||
return NULL;
|
||||
@ -111,7 +112,13 @@ jobject android_view_Surface_createFromISurfaceTexture(JNIEnv* env,
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static jint nativeCreateFromSurfaceTexture(JNIEnv* env, jobject surfaceObj,
|
||||
static bool isSurfaceValid(const sp<Surface>& sur) {
|
||||
return sur != 0 && sur->getISurfaceTexture() != 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static jint nativeCreateFromSurfaceTexture(JNIEnv* env, jclass clazz,
|
||||
jobject surfaceTextureObj) {
|
||||
sp<GLConsumer> st(SurfaceTexture_getSurfaceTexture(env, surfaceTextureObj));
|
||||
if (st == NULL) {
|
||||
@ -127,28 +134,28 @@ static jint nativeCreateFromSurfaceTexture(JNIEnv* env, jobject surfaceObj,
|
||||
return 0;
|
||||
}
|
||||
|
||||
surface->incStrong(surfaceObj);
|
||||
surface->incStrong(clazz);
|
||||
return int(surface.get());
|
||||
}
|
||||
|
||||
static void nativeRelease(JNIEnv* env, jobject surfaceObj, jint nativeObject) {
|
||||
static void nativeRelease(JNIEnv* env, jclass clazz, jint nativeObject) {
|
||||
sp<Surface> sur(reinterpret_cast<Surface *>(nativeObject));
|
||||
sur->decStrong(surfaceObj);
|
||||
sur->decStrong(clazz);
|
||||
}
|
||||
|
||||
static void nativeDestroy(JNIEnv* env, jobject surfaceObj, jint nativeObject) {
|
||||
static void nativeDestroy(JNIEnv* env, jclass clazz, jint nativeObject) {
|
||||
sp<Surface> sur(reinterpret_cast<Surface *>(nativeObject));
|
||||
sur->decStrong(surfaceObj);
|
||||
sur->decStrong(clazz);
|
||||
}
|
||||
|
||||
static jboolean nativeIsValid(JNIEnv* env, jobject surfaceObj, jint nativeObject) {
|
||||
static jboolean nativeIsValid(JNIEnv* env, jclass clazz, jint nativeObject) {
|
||||
sp<Surface> sur(reinterpret_cast<Surface *>(nativeObject));
|
||||
return Surface::isValid(sur) ? JNI_TRUE : JNI_FALSE;
|
||||
return isSurfaceValid(sur) ? JNI_TRUE : JNI_FALSE;
|
||||
}
|
||||
|
||||
static jboolean nativeIsConsumerRunningBehind(JNIEnv* env, jobject surfaceObj, jint nativeObject) {
|
||||
static jboolean nativeIsConsumerRunningBehind(JNIEnv* env, jclass clazz, jint nativeObject) {
|
||||
sp<Surface> sur(reinterpret_cast<Surface *>(nativeObject));
|
||||
if (!Surface::isValid(sur)) {
|
||||
if (!isSurfaceValid(sur)) {
|
||||
doThrowIAE(env);
|
||||
return JNI_FALSE;
|
||||
}
|
||||
@ -176,7 +183,7 @@ static inline SkBitmap::Config convertPixelFormat(PixelFormat format) {
|
||||
static jobject nativeLockCanvas(JNIEnv* env, jobject surfaceObj, jint nativeObject, jobject dirtyRectObj) {
|
||||
sp<Surface> surface(reinterpret_cast<Surface *>(nativeObject));
|
||||
|
||||
if (!Surface::isValid(surface)) {
|
||||
if (!isSurfaceValid(surface)) {
|
||||
doThrowIAE(env);
|
||||
return NULL;
|
||||
}
|
||||
@ -196,9 +203,11 @@ static jobject nativeLockCanvas(JNIEnv* env, jobject surfaceObj, jint nativeObje
|
||||
dirtyRegion.set(Rect(0x3FFF, 0x3FFF));
|
||||
}
|
||||
|
||||
Surface::SurfaceInfo info;
|
||||
status_t err = surface->lock(&info, &dirtyRegion);
|
||||
ANativeWindow_Buffer outBuffer;
|
||||
Rect dirtyBounds(dirtyRegion.getBounds());
|
||||
status_t err = surface->lock(&outBuffer, &dirtyBounds);
|
||||
if (err < 0) {
|
||||
dirtyRegion.set(dirtyBounds);
|
||||
const char* const exception = (err == NO_MEMORY) ?
|
||||
OutOfResourcesException :
|
||||
"java/lang/IllegalArgumentException";
|
||||
@ -208,18 +217,18 @@ static jobject nativeLockCanvas(JNIEnv* env, jobject surfaceObj, jint nativeObje
|
||||
|
||||
// Associate a SkCanvas object to this surface
|
||||
jobject canvasObj = env->GetObjectField(surfaceObj, gSurfaceClassInfo.mCanvas);
|
||||
env->SetIntField(canvasObj, gCanvasClassInfo.mSurfaceFormat, info.format);
|
||||
env->SetIntField(canvasObj, gCanvasClassInfo.mSurfaceFormat, outBuffer.format);
|
||||
|
||||
SkCanvas* nativeCanvas = reinterpret_cast<SkCanvas*>(
|
||||
env->GetIntField(canvasObj, gCanvasClassInfo.mNativeCanvas));
|
||||
SkBitmap bitmap;
|
||||
ssize_t bpr = info.s * bytesPerPixel(info.format);
|
||||
bitmap.setConfig(convertPixelFormat(info.format), info.w, info.h, bpr);
|
||||
if (info.format == PIXEL_FORMAT_RGBX_8888) {
|
||||
ssize_t bpr = outBuffer.stride * bytesPerPixel(outBuffer.format);
|
||||
bitmap.setConfig(convertPixelFormat(outBuffer.format), outBuffer.width, outBuffer.height, bpr);
|
||||
if (outBuffer.format == PIXEL_FORMAT_RGBX_8888) {
|
||||
bitmap.setIsOpaque(true);
|
||||
}
|
||||
if (info.w > 0 && info.h > 0) {
|
||||
bitmap.setPixels(info.bits);
|
||||
if (outBuffer.width > 0 && outBuffer.height > 0) {
|
||||
bitmap.setPixels(outBuffer.bits);
|
||||
} else {
|
||||
// be safe with an empty bitmap.
|
||||
bitmap.setPixels(NULL);
|
||||
@ -263,7 +272,7 @@ static void nativeUnlockCanvasAndPost(JNIEnv* env, jobject surfaceObj, jint nati
|
||||
}
|
||||
|
||||
sp<Surface> surface(reinterpret_cast<Surface *>(nativeObject));
|
||||
if (!Surface::isValid(surface)) {
|
||||
if (!isSurfaceValid(surface)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -284,7 +293,7 @@ static void nativeUnlockCanvasAndPost(JNIEnv* env, jobject surfaceObj, jint nati
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static jint nativeCopyFrom(JNIEnv* env, jobject surfaceObj,
|
||||
static jint nativeCopyFrom(JNIEnv* env, jclass clazz,
|
||||
jint nativeObject, jint surfaceControlNativeObj) {
|
||||
/*
|
||||
* This is used by the WindowManagerService just after constructing
|
||||
@ -295,18 +304,18 @@ static jint nativeCopyFrom(JNIEnv* env, jobject surfaceObj,
|
||||
sp<SurfaceControl> ctrl(reinterpret_cast<SurfaceControl *>(surfaceControlNativeObj));
|
||||
sp<Surface> other(ctrl->getSurface());
|
||||
if (other != NULL) {
|
||||
other->incStrong(surfaceObj);
|
||||
other->incStrong(clazz);
|
||||
}
|
||||
|
||||
sp<Surface> sur(reinterpret_cast<Surface *>(nativeObject));
|
||||
if (sur != NULL) {
|
||||
sur->decStrong(surfaceObj);
|
||||
sur->decStrong(clazz);
|
||||
}
|
||||
|
||||
return int(other.get());
|
||||
}
|
||||
|
||||
static jint nativeReadFromParcel(JNIEnv* env, jobject surfaceObj,
|
||||
static jint nativeReadFromParcel(JNIEnv* env, jclass clazz,
|
||||
jint nativeObject, jobject parcelObj) {
|
||||
Parcel* parcel = parcelForJavaObject(env, parcelObj);
|
||||
if (parcel == NULL) {
|
||||
@ -315,16 +324,16 @@ static jint nativeReadFromParcel(JNIEnv* env, jobject surfaceObj,
|
||||
}
|
||||
sp<Surface> self(reinterpret_cast<Surface *>(nativeObject));
|
||||
if (self != NULL) {
|
||||
self->decStrong(surfaceObj);
|
||||
self->decStrong(clazz);
|
||||
}
|
||||
sp<Surface> sur(Surface::readFromParcel(*parcel));
|
||||
if (sur != NULL) {
|
||||
sur->incStrong(surfaceObj);
|
||||
sur->incStrong(clazz);
|
||||
}
|
||||
return int(sur.get());
|
||||
}
|
||||
|
||||
static void nativeWriteToParcel(JNIEnv* env, jobject surfaceObj,
|
||||
static void nativeWriteToParcel(JNIEnv* env, jclass clazz,
|
||||
jint nativeObject, jobject parcelObj) {
|
||||
Parcel* parcel = parcelForJavaObject(env, parcelObj);
|
||||
if (parcel == NULL) {
|
||||
|
@ -120,7 +120,7 @@ private:
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static jint nativeCreate(JNIEnv* env, jobject surfaceObj, jobject sessionObj,
|
||||
static jint nativeCreate(JNIEnv* env, jclass clazz, jobject sessionObj,
|
||||
jstring nameStr, jint w, jint h, jint format, jint flags) {
|
||||
ScopedUtfChars name(env, nameStr);
|
||||
sp<SurfaceComposerClient> client(android_view_SurfaceSession_getClient(env, sessionObj));
|
||||
@ -130,19 +130,19 @@ static jint nativeCreate(JNIEnv* env, jobject surfaceObj, jobject sessionObj,
|
||||
jniThrowException(env, OutOfResourcesException, NULL);
|
||||
return 0;
|
||||
}
|
||||
surface->incStrong(surfaceObj);
|
||||
surface->incStrong(clazz);
|
||||
return int(surface.get());
|
||||
}
|
||||
|
||||
static void nativeRelease(JNIEnv* env, jobject surfaceObj, jint nativeObject) {
|
||||
static void nativeRelease(JNIEnv* env, jclass clazz, jint nativeObject) {
|
||||
sp<SurfaceControl> ctrl(reinterpret_cast<SurfaceControl *>(nativeObject));
|
||||
ctrl->decStrong(surfaceObj);
|
||||
ctrl->decStrong(clazz);
|
||||
}
|
||||
|
||||
static void nativeDestroy(JNIEnv* env, jobject surfaceObj, jint nativeObject) {
|
||||
static void nativeDestroy(JNIEnv* env, jclass clazz, jint nativeObject) {
|
||||
sp<SurfaceControl> ctrl(reinterpret_cast<SurfaceControl *>(nativeObject));
|
||||
ctrl->clear();
|
||||
ctrl->decStrong(surfaceObj);
|
||||
ctrl->decStrong(clazz);
|
||||
}
|
||||
|
||||
static inline SkBitmap::Config convertPixelFormat(PixelFormat format) {
|
||||
@ -210,7 +210,7 @@ static void nativeSetAnimationTransaction(JNIEnv* env, jclass clazz) {
|
||||
SurfaceComposerClient::setAnimationTransaction();
|
||||
}
|
||||
|
||||
static void nativeSetLayer(JNIEnv* env, jobject surfaceObj, jint nativeObject, jint zorder) {
|
||||
static void nativeSetLayer(JNIEnv* env, jclass clazz, jint nativeObject, jint zorder) {
|
||||
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
|
||||
status_t err = ctrl->setLayer(zorder);
|
||||
if (err < 0 && err != NO_INIT) {
|
||||
@ -218,7 +218,7 @@ static void nativeSetLayer(JNIEnv* env, jobject surfaceObj, jint nativeObject, j
|
||||
}
|
||||
}
|
||||
|
||||
static void nativeSetPosition(JNIEnv* env, jobject surfaceObj, jint nativeObject, jfloat x, jfloat y) {
|
||||
static void nativeSetPosition(JNIEnv* env, jclass clazz, jint nativeObject, jfloat x, jfloat y) {
|
||||
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
|
||||
status_t err = ctrl->setPosition(x, y);
|
||||
if (err < 0 && err != NO_INIT) {
|
||||
@ -226,7 +226,7 @@ static void nativeSetPosition(JNIEnv* env, jobject surfaceObj, jint nativeObject
|
||||
}
|
||||
}
|
||||
|
||||
static void nativeSetSize(JNIEnv* env, jobject surfaceObj, jint nativeObject, jint w, jint h) {
|
||||
static void nativeSetSize(JNIEnv* env, jclass clazz, jint nativeObject, jint w, jint h) {
|
||||
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
|
||||
status_t err = ctrl->setSize(w, h);
|
||||
if (err < 0 && err != NO_INIT) {
|
||||
@ -234,7 +234,7 @@ static void nativeSetSize(JNIEnv* env, jobject surfaceObj, jint nativeObject, ji
|
||||
}
|
||||
}
|
||||
|
||||
static void nativeSetFlags(JNIEnv* env, jobject surfaceObj, jint nativeObject, jint flags, jint mask) {
|
||||
static void nativeSetFlags(JNIEnv* env, jclass clazz, jint nativeObject, jint flags, jint mask) {
|
||||
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
|
||||
status_t err = ctrl->setFlags(flags, mask);
|
||||
if (err < 0 && err != NO_INIT) {
|
||||
@ -242,7 +242,7 @@ static void nativeSetFlags(JNIEnv* env, jobject surfaceObj, jint nativeObject, j
|
||||
}
|
||||
}
|
||||
|
||||
static void nativeSetTransparentRegionHint(JNIEnv* env, jobject surfaceObj, jint nativeObject, jobject regionObj) {
|
||||
static void nativeSetTransparentRegionHint(JNIEnv* env, jclass clazz, jint nativeObject, jobject regionObj) {
|
||||
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
|
||||
SkRegion* region = android_graphics_Region_getSkRegion(env, regionObj);
|
||||
if (!region) {
|
||||
@ -267,7 +267,7 @@ static void nativeSetTransparentRegionHint(JNIEnv* env, jobject surfaceObj, jint
|
||||
}
|
||||
}
|
||||
|
||||
static void nativeSetAlpha(JNIEnv* env, jobject surfaceObj, jint nativeObject, jfloat alpha) {
|
||||
static void nativeSetAlpha(JNIEnv* env, jclass clazz, jint nativeObject, jfloat alpha) {
|
||||
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
|
||||
status_t err = ctrl->setAlpha(alpha);
|
||||
if (err < 0 && err != NO_INIT) {
|
||||
@ -275,7 +275,7 @@ static void nativeSetAlpha(JNIEnv* env, jobject surfaceObj, jint nativeObject, j
|
||||
}
|
||||
}
|
||||
|
||||
static void nativeSetMatrix(JNIEnv* env, jobject surfaceObj, jint nativeObject,
|
||||
static void nativeSetMatrix(JNIEnv* env, jclass clazz, jint nativeObject,
|
||||
jfloat dsdx, jfloat dtdx, jfloat dsdy, jfloat dtdy) {
|
||||
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
|
||||
status_t err = ctrl->setMatrix(dsdx, dtdx, dsdy, dtdy);
|
||||
@ -284,7 +284,7 @@ static void nativeSetMatrix(JNIEnv* env, jobject surfaceObj, jint nativeObject,
|
||||
}
|
||||
}
|
||||
|
||||
static void nativeSetWindowCrop(JNIEnv* env, jobject surfaceObj, jint nativeObject,
|
||||
static void nativeSetWindowCrop(JNIEnv* env, jclass clazz, jint nativeObject,
|
||||
jint l, jint t, jint r, jint b) {
|
||||
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
|
||||
Rect crop(l, t, r, b);
|
||||
@ -294,7 +294,7 @@ static void nativeSetWindowCrop(JNIEnv* env, jobject surfaceObj, jint nativeObje
|
||||
}
|
||||
}
|
||||
|
||||
static void nativeSetLayerStack(JNIEnv* env, jobject surfaceObj, jint nativeObject, jint layerStack) {
|
||||
static void nativeSetLayerStack(JNIEnv* env, jclass clazz, jint nativeObject, jint layerStack) {
|
||||
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
|
||||
status_t err = ctrl->setLayerStack(layerStack);
|
||||
if (err < 0 && err != NO_INIT) {
|
||||
@ -320,7 +320,7 @@ static void nativeSetDisplaySurface(JNIEnv* env, jclass clazz,
|
||||
sp<IBinder> token(ibinderForJavaObject(env, tokenObj));
|
||||
if (token == NULL) return;
|
||||
sp<Surface> sur(reinterpret_cast<Surface *>(nativeSurfaceObject));
|
||||
sp<IGraphicBufferProducer> bufferProducer(sur->getSurfaceTexture());
|
||||
sp<IGraphicBufferProducer> bufferProducer(sur->getIGraphicBufferProducer());
|
||||
SurfaceComposerClient::setDisplaySurface(token, bufferProducer);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <ui/Rect.h>
|
||||
|
||||
#include <gui/GLConsumer.h>
|
||||
#include <gui/SurfaceTextureClient.h>
|
||||
#include <gui/Surface.h>
|
||||
|
||||
#include <SkBitmap.h>
|
||||
#include <SkCanvas.h>
|
||||
@ -102,7 +102,7 @@ static void android_view_TextureView_createNativeWindow(JNIEnv* env, jobject tex
|
||||
jobject surface) {
|
||||
|
||||
sp<GLConsumer> glConsumer(SurfaceTexture_getSurfaceTexture(env, surface));
|
||||
sp<ANativeWindow> window = new SurfaceTextureClient(glConsumer->getBufferQueue());
|
||||
sp<ANativeWindow> window = new Surface(glConsumer->getBufferQueue());
|
||||
|
||||
window->incStrong(0);
|
||||
SET_INT(textureView, gTextureViewClassInfo.nativeWindow, jint(window.get()));
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include <gui/Surface.h>
|
||||
#include <gui/GLConsumer.h>
|
||||
#include <gui/SurfaceTextureClient.h>
|
||||
#include <gui/Surface.h>
|
||||
|
||||
#include <SkBitmap.h>
|
||||
#include <SkPixelRef.h>
|
||||
@ -355,7 +355,7 @@ not_valid_surface:
|
||||
|
||||
sp<GLConsumer> glConsumer(SurfaceTexture_getSurfaceTexture(_env, native_window));
|
||||
|
||||
window = new SurfaceTextureClient(glConsumer->getBufferQueue());
|
||||
window = new Surface(glConsumer->getBufferQueue());
|
||||
if (window == NULL)
|
||||
goto not_valid_surface;
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include <rsEnv.h>
|
||||
#include <gui/Surface.h>
|
||||
#include <gui/GLConsumer.h>
|
||||
#include <gui/SurfaceTextureClient.h>
|
||||
#include <gui/Surface.h>
|
||||
#include <android_runtime/android_graphics_SurfaceTexture.h>
|
||||
|
||||
//#define LOG_API ALOGE
|
||||
@ -247,7 +247,7 @@ nContextSetSurfaceTexture(JNIEnv *_env, jobject _this, RsContext con, jint width
|
||||
|
||||
} else {
|
||||
st = SurfaceTexture_getSurfaceTexture(_env, sur);
|
||||
window = new SurfaceTextureClient(st->getBufferQueue());
|
||||
window = new Surface(st->getBufferQueue());
|
||||
}
|
||||
|
||||
rsContextSetSurface(con, width, height, window.get());
|
||||
|
@ -37,7 +37,7 @@ extern bool android_view_Surface_isInstanceOf(JNIEnv* env, jobject obj);
|
||||
extern sp<Surface> android_view_Surface_getSurface(JNIEnv* env, jobject surfaceObj);
|
||||
|
||||
/* Creates a Surface from an IGraphicBufferProducer. */
|
||||
extern jobject android_view_Surface_createFromISurfaceTexture(JNIEnv* env,
|
||||
extern jobject android_view_Surface_createFromIGraphicBufferProducer(JNIEnv* env,
|
||||
const sp<IGraphicBufferProducer>& bufferProducer);
|
||||
|
||||
} // namespace android
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "JNIHelp.h"
|
||||
|
||||
#include <gui/Surface.h>
|
||||
#include <gui/SurfaceTextureClient.h>
|
||||
|
||||
#include <media/ICrypto.h>
|
||||
#include <media/stagefright/MediaCodec.h>
|
||||
@ -114,9 +113,9 @@ status_t JMediaCodec::configure(
|
||||
const sp<IGraphicBufferProducer> &bufferProducer,
|
||||
const sp<ICrypto> &crypto,
|
||||
int flags) {
|
||||
sp<SurfaceTextureClient> client;
|
||||
sp<Surface> client;
|
||||
if (bufferProducer != NULL) {
|
||||
mSurfaceTextureClient = new SurfaceTextureClient(bufferProducer);
|
||||
mSurfaceTextureClient = new Surface(bufferProducer);
|
||||
} else {
|
||||
mSurfaceTextureClient.clear();
|
||||
}
|
||||
@ -398,7 +397,7 @@ static void android_media_MediaCodec_native_configure(
|
||||
if (jsurface != NULL) {
|
||||
sp<Surface> surface(android_view_Surface_getSurface(env, jsurface));
|
||||
if (surface != NULL) {
|
||||
bufferProducer = surface->getSurfaceTexture();
|
||||
bufferProducer = surface->getIGraphicBufferProducer();
|
||||
} else {
|
||||
jniThrowException(
|
||||
env,
|
||||
|
@ -32,7 +32,7 @@ struct AString;
|
||||
struct ICrypto;
|
||||
struct IGraphicBufferProducer;
|
||||
struct MediaCodec;
|
||||
struct SurfaceTextureClient;
|
||||
class Surface;
|
||||
|
||||
struct JMediaCodec : public RefBase {
|
||||
JMediaCodec(
|
||||
@ -91,7 +91,7 @@ protected:
|
||||
private:
|
||||
jclass mClass;
|
||||
jweak mObject;
|
||||
sp<SurfaceTextureClient> mSurfaceTextureClient;
|
||||
sp<Surface> mSurfaceTextureClient;
|
||||
|
||||
sp<ALooper> mLooper;
|
||||
sp<MediaCodec> mCodec;
|
||||
|
@ -273,7 +273,7 @@ setVideoSurface(JNIEnv *env, jobject thiz, jobject jsurface, jboolean mediaPlaye
|
||||
if (jsurface) {
|
||||
sp<Surface> surface(android_view_Surface_getSurface(env, jsurface));
|
||||
if (surface != NULL) {
|
||||
new_st = surface->getSurfaceTexture();
|
||||
new_st = surface->getIGraphicBufferProducer();
|
||||
if (new_st == NULL) {
|
||||
jniThrowException(env, "java/lang/IllegalArgumentException",
|
||||
"The surface does not have a binding SurfaceTexture!");
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "native/core/gl_env.h"
|
||||
|
||||
#include <gui/IGraphicBufferProducer.h>
|
||||
#include <gui/SurfaceTextureClient.h>
|
||||
#include <gui/Surface.h>
|
||||
#include <utils/Errors.h>
|
||||
#include <system/window.h>
|
||||
|
||||
@ -34,7 +34,7 @@ using android::filterfw::WindowHandle;
|
||||
using android::MediaRecorder;
|
||||
using android::sp;
|
||||
using android::IGraphicBufferProducer;
|
||||
using android::SurfaceTextureClient;
|
||||
using android::Surface;
|
||||
|
||||
|
||||
class NativeWindowHandle : public WindowHandle {
|
||||
@ -290,7 +290,7 @@ jint Java_android_filterfw_core_GLEnvironment_nativeAddSurfaceFromMediaRecorder(
|
||||
<IGraphicBufferProducer> handle.");
|
||||
return -1;
|
||||
}
|
||||
sp<SurfaceTextureClient> surfaceTC = new SurfaceTextureClient(surfaceMS);
|
||||
sp<Surface> surfaceTC = new Surface(surfaceMS);
|
||||
// Get the ANativeWindow
|
||||
sp<ANativeWindow> window = surfaceTC;
|
||||
|
||||
|
@ -161,7 +161,7 @@ bool GLEnv::InitWithNewContext() {
|
||||
|
||||
// Create dummy surface using a GLConsumer
|
||||
surfaceTexture_ = new GLConsumer(0);
|
||||
window_ = new SurfaceTextureClient(static_cast<sp<IGraphicBufferProducer> >(
|
||||
window_ = new Surface(static_cast<sp<IGraphicBufferProducer> >(
|
||||
surfaceTexture_->getBufferQueue()));
|
||||
|
||||
surfaces_[0] = SurfaceWindowPair(eglCreateWindowSurface(display(), config, window_.get(), NULL), NULL);
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <EGL/egl.h>
|
||||
|
||||
#include <gui/IGraphicBufferProducer.h>
|
||||
#include <gui/SurfaceTextureClient.h>
|
||||
#include <gui/Surface.h>
|
||||
|
||||
namespace android {
|
||||
namespace filterfw {
|
||||
|
@ -22,12 +22,14 @@
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <utils/String8.h>
|
||||
#include <gui/Surface.h>
|
||||
|
||||
#include <SkBitmap.h>
|
||||
#include <SkCanvas.h>
|
||||
#include <SkColor.h>
|
||||
#include <SkPaint.h>
|
||||
#include <SkXfermode.h>
|
||||
#include <android/native_window.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
@ -197,16 +199,16 @@ void SpriteController::doUpdateSprites() {
|
||||
if (update.state.surfaceControl != NULL && !update.state.surfaceDrawn
|
||||
&& update.state.wantSurfaceVisible()) {
|
||||
sp<Surface> surface = update.state.surfaceControl->getSurface();
|
||||
Surface::SurfaceInfo surfaceInfo;
|
||||
status_t status = surface->lock(&surfaceInfo);
|
||||
ANativeWindow_Buffer outBuffer;
|
||||
status_t status = surface->lock(&outBuffer, NULL);
|
||||
if (status) {
|
||||
ALOGE("Error %d locking sprite surface before drawing.", status);
|
||||
} else {
|
||||
SkBitmap surfaceBitmap;
|
||||
ssize_t bpr = surfaceInfo.s * bytesPerPixel(surfaceInfo.format);
|
||||
ssize_t bpr = outBuffer.stride * bytesPerPixel(outBuffer.format);
|
||||
surfaceBitmap.setConfig(SkBitmap::kARGB_8888_Config,
|
||||
surfaceInfo.w, surfaceInfo.h, bpr);
|
||||
surfaceBitmap.setPixels(surfaceInfo.bits);
|
||||
outBuffer.width, outBuffer.height, bpr);
|
||||
surfaceBitmap.setPixels(outBuffer.bits);
|
||||
|
||||
SkCanvas surfaceCanvas;
|
||||
surfaceCanvas.setBitmapDevice(surfaceBitmap);
|
||||
@ -215,15 +217,15 @@ void SpriteController::doUpdateSprites() {
|
||||
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
|
||||
surfaceCanvas.drawBitmap(update.state.icon.bitmap, 0, 0, &paint);
|
||||
|
||||
if (surfaceInfo.w > uint32_t(update.state.icon.bitmap.width())) {
|
||||
if (outBuffer.width > uint32_t(update.state.icon.bitmap.width())) {
|
||||
paint.setColor(0); // transparent fill color
|
||||
surfaceCanvas.drawRectCoords(update.state.icon.bitmap.width(), 0,
|
||||
surfaceInfo.w, update.state.icon.bitmap.height(), paint);
|
||||
outBuffer.width, update.state.icon.bitmap.height(), paint);
|
||||
}
|
||||
if (surfaceInfo.h > uint32_t(update.state.icon.bitmap.height())) {
|
||||
if (outBuffer.height > uint32_t(update.state.icon.bitmap.height())) {
|
||||
paint.setColor(0); // transparent fill color
|
||||
surfaceCanvas.drawRectCoords(0, update.state.icon.bitmap.height(),
|
||||
surfaceInfo.w, surfaceInfo.h, paint);
|
||||
outBuffer.width, outBuffer.height, paint);
|
||||
}
|
||||
|
||||
status = surface->unlockAndPost();
|
||||
@ -371,8 +373,7 @@ sp<SurfaceControl> SpriteController::obtainSurface(int32_t width, int32_t height
|
||||
sp<SurfaceControl> surfaceControl = mSurfaceComposerClient->createSurface(
|
||||
String8("Sprite"), width, height, PIXEL_FORMAT_RGBA_8888,
|
||||
ISurfaceComposerClient::eHidden);
|
||||
if (surfaceControl == NULL || !surfaceControl->isValid()
|
||||
|| !surfaceControl->getSurface()->isValid()) {
|
||||
if (surfaceControl == NULL || !surfaceControl->isValid()) {
|
||||
ALOGE("Error creating sprite surface.");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -713,17 +713,17 @@ final class ElectronBeam {
|
||||
*/
|
||||
private static final class NaturalSurfaceLayout implements DisplayTransactionListener {
|
||||
private final DisplayManagerService mDisplayManager;
|
||||
private SurfaceControl mSurface;
|
||||
private SurfaceControl mSurfaceControl;
|
||||
|
||||
public NaturalSurfaceLayout(DisplayManagerService displayManager, SurfaceControl surface) {
|
||||
public NaturalSurfaceLayout(DisplayManagerService displayManager, SurfaceControl surfaceControl) {
|
||||
mDisplayManager = displayManager;
|
||||
mSurface = surface;
|
||||
mSurfaceControl = surfaceControl;
|
||||
mDisplayManager.registerDisplayTransactionListener(this);
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
synchronized (this) {
|
||||
mSurface = null;
|
||||
mSurfaceControl = null;
|
||||
}
|
||||
mDisplayManager.unregisterDisplayTransactionListener(this);
|
||||
}
|
||||
@ -731,27 +731,27 @@ final class ElectronBeam {
|
||||
@Override
|
||||
public void onDisplayTransaction() {
|
||||
synchronized (this) {
|
||||
if (mSurface == null) {
|
||||
if (mSurfaceControl == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
DisplayInfo displayInfo = mDisplayManager.getDisplayInfo(Display.DEFAULT_DISPLAY);
|
||||
switch (displayInfo.rotation) {
|
||||
case Surface.ROTATION_0:
|
||||
mSurface.setPosition(0, 0);
|
||||
mSurface.setMatrix(1, 0, 0, 1);
|
||||
mSurfaceControl.setPosition(0, 0);
|
||||
mSurfaceControl.setMatrix(1, 0, 0, 1);
|
||||
break;
|
||||
case Surface.ROTATION_90:
|
||||
mSurface.setPosition(0, displayInfo.logicalHeight);
|
||||
mSurface.setMatrix(0, -1, 1, 0);
|
||||
mSurfaceControl.setPosition(0, displayInfo.logicalHeight);
|
||||
mSurfaceControl.setMatrix(0, -1, 1, 0);
|
||||
break;
|
||||
case Surface.ROTATION_180:
|
||||
mSurface.setPosition(displayInfo.logicalWidth, displayInfo.logicalHeight);
|
||||
mSurface.setMatrix(-1, 0, 0, -1);
|
||||
mSurfaceControl.setPosition(displayInfo.logicalWidth, displayInfo.logicalHeight);
|
||||
mSurfaceControl.setMatrix(-1, 0, 0, -1);
|
||||
break;
|
||||
case Surface.ROTATION_270:
|
||||
mSurface.setPosition(displayInfo.logicalWidth, 0);
|
||||
mSurface.setMatrix(0, 1, -1, 0);
|
||||
mSurfaceControl.setPosition(displayInfo.logicalWidth, 0);
|
||||
mSurfaceControl.setMatrix(0, 1, -1, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ class AppWindowToken extends WindowToken {
|
||||
+ win.isDrawnLw()
|
||||
+ ", isAnimating=" + win.mWinAnimator.isAnimating());
|
||||
if (!win.isDrawnLw()) {
|
||||
Slog.v(WindowManagerService.TAG, "Not displayed: s=" + win.mWinAnimator.mSurface
|
||||
Slog.v(WindowManagerService.TAG, "Not displayed: s=" + win.mWinAnimator.mSurfaceControl
|
||||
+ " pv=" + win.mPolicyVisibility
|
||||
+ " mDrawState=" + win.mWinAnimator.mDrawState
|
||||
+ " ah=" + win.mAttachedHidden
|
||||
|
@ -37,13 +37,13 @@ public class BlackFrame {
|
||||
final SurfaceControl surface;
|
||||
|
||||
BlackSurface(SurfaceSession session, int layer, int l, int t, int r, int b, int layerStack)
|
||||
throws Surface.OutOfResourcesException {
|
||||
throws SurfaceControl.OutOfResourcesException {
|
||||
left = l;
|
||||
top = t;
|
||||
this.layer = layer;
|
||||
int w = r-l;
|
||||
int h = b-t;
|
||||
try {
|
||||
|
||||
if (WindowManagerService.DEBUG_SURFACE_TRACE) {
|
||||
surface = new WindowStateAnimator.SurfaceTrace(session, "BlackSurface("
|
||||
+ l + ", " + t + ")",
|
||||
@ -52,9 +52,7 @@ public class BlackFrame {
|
||||
surface = new SurfaceControl(session, "BlackSurface",
|
||||
w, h, PixelFormat.OPAQUE, SurfaceControl.FX_SURFACE_DIM | SurfaceControl.HIDDEN);
|
||||
}
|
||||
} catch (SurfaceControl.OutOfResourcesException e) {
|
||||
throw new Surface.OutOfResourcesException(e.getMessage());
|
||||
}
|
||||
|
||||
surface.setAlpha(1);
|
||||
surface.setLayerStack(layerStack);
|
||||
surface.setLayer(layer);
|
||||
@ -109,7 +107,7 @@ public class BlackFrame {
|
||||
}
|
||||
|
||||
public BlackFrame(SurfaceSession session, Rect outer, Rect inner,
|
||||
int layer, final int layerStack) throws Surface.OutOfResourcesException {
|
||||
int layer, final int layerStack) throws SurfaceControl.OutOfResourcesException {
|
||||
boolean success = false;
|
||||
|
||||
mOuterRect = new Rect(outer);
|
||||
|
@ -491,15 +491,15 @@ final class DisplayMagnifier {
|
||||
private boolean mInvalidated;
|
||||
|
||||
public ViewportWindow(Context context) {
|
||||
SurfaceControl surface = null;
|
||||
SurfaceControl surfaceControl = null;
|
||||
try {
|
||||
mWindowManager.getDefaultDisplay().getRealSize(mTempPoint);
|
||||
surface = new SurfaceControl(mWindowManagerService.mFxSession, SURFACE_TITLE,
|
||||
surfaceControl = new SurfaceControl(mWindowManagerService.mFxSession, SURFACE_TITLE,
|
||||
mTempPoint.x, mTempPoint.y, PixelFormat.TRANSLUCENT, SurfaceControl.HIDDEN);
|
||||
} catch (SurfaceControl.OutOfResourcesException oore) {
|
||||
/* ignore */
|
||||
}
|
||||
mSurfaceControl = surface;
|
||||
mSurfaceControl = surfaceControl;
|
||||
mSurfaceControl.setLayerStack(mWindowManager.getDefaultDisplay().getLayerStack());
|
||||
mSurfaceControl.setLayer(mWindowManagerService.mPolicy.windowTypeToLayerLw(
|
||||
WindowManager.LayoutParams.TYPE_MAGNIFICATION_OVERLAY)
|
||||
|
@ -46,7 +46,7 @@ import java.util.ArrayList;
|
||||
class DragState {
|
||||
final WindowManagerService mService;
|
||||
IBinder mToken;
|
||||
SurfaceControl mSurface;
|
||||
SurfaceControl mSurfaceControl;
|
||||
int mFlags;
|
||||
IBinder mLocalWin;
|
||||
ClipData mData;
|
||||
@ -69,17 +69,17 @@ class DragState {
|
||||
int flags, IBinder localWin) {
|
||||
mService = service;
|
||||
mToken = token;
|
||||
mSurface = surface;
|
||||
mSurfaceControl = surface;
|
||||
mFlags = flags;
|
||||
mLocalWin = localWin;
|
||||
mNotifiedWindows = new ArrayList<WindowState>();
|
||||
}
|
||||
|
||||
void reset() {
|
||||
if (mSurface != null) {
|
||||
mSurface.destroy();
|
||||
if (mSurfaceControl != null) {
|
||||
mSurfaceControl.destroy();
|
||||
}
|
||||
mSurface = null;
|
||||
mSurfaceControl = null;
|
||||
mFlags = 0;
|
||||
mLocalWin = null;
|
||||
mToken = null;
|
||||
@ -296,9 +296,9 @@ class DragState {
|
||||
WindowManagerService.TAG, ">>> OPEN TRANSACTION notifyMoveLw");
|
||||
SurfaceControl.openTransaction();
|
||||
try {
|
||||
mSurface.setPosition(x - mThumbOffsetX, y - mThumbOffsetY);
|
||||
mSurfaceControl.setPosition(x - mThumbOffsetX, y - mThumbOffsetY);
|
||||
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, " DRAG "
|
||||
+ mSurface + ": pos=(" +
|
||||
+ mSurfaceControl + ": pos=(" +
|
||||
(int)(x - mThumbOffsetX) + "," + (int)(y - mThumbOffsetY) + ")");
|
||||
} finally {
|
||||
SurfaceControl.closeTransaction();
|
||||
|
@ -44,7 +44,7 @@ class ScreenRotationAnimation {
|
||||
|
||||
final Context mContext;
|
||||
final Display mDisplay;
|
||||
SurfaceControl mSurface;
|
||||
SurfaceControl mSurfaceControl;
|
||||
BlackFrame mCustomBlackFrame;
|
||||
BlackFrame mExitingBlackFrame;
|
||||
BlackFrame mEnteringBlackFrame;
|
||||
@ -128,7 +128,7 @@ class ScreenRotationAnimation {
|
||||
long mHalfwayPoint;
|
||||
|
||||
public void printTo(String prefix, PrintWriter pw) {
|
||||
pw.print(prefix); pw.print("mSurface="); pw.print(mSurface);
|
||||
pw.print(prefix); pw.print("mSurface="); pw.print(mSurfaceControl);
|
||||
pw.print(" mWidth="); pw.print(mWidth);
|
||||
pw.print(" mHeight="); pw.println(mHeight);
|
||||
if (USE_CUSTOM_BLACK_FRAME) {
|
||||
@ -220,25 +220,25 @@ class ScreenRotationAnimation {
|
||||
try {
|
||||
try {
|
||||
if (WindowManagerService.DEBUG_SURFACE_TRACE) {
|
||||
mSurface = new SurfaceTrace(session, "FreezeSurface",
|
||||
mSurfaceControl = new SurfaceTrace(session, "FreezeSurface",
|
||||
mWidth, mHeight,
|
||||
PixelFormat.OPAQUE, SurfaceControl.FX_SURFACE_SCREENSHOT | SurfaceControl.HIDDEN);
|
||||
} else {
|
||||
mSurface = new SurfaceControl(session, "FreezeSurface",
|
||||
mSurfaceControl = new SurfaceControl(session, "FreezeSurface",
|
||||
mWidth, mHeight,
|
||||
PixelFormat.OPAQUE, SurfaceControl.FX_SURFACE_SCREENSHOT | SurfaceControl.HIDDEN);
|
||||
}
|
||||
mSurface.setLayerStack(mDisplay.getLayerStack());
|
||||
mSurface.setLayer(FREEZE_LAYER + 1);
|
||||
mSurface.setAlpha(0);
|
||||
mSurface.show();
|
||||
mSurfaceControl.setLayerStack(mDisplay.getLayerStack());
|
||||
mSurfaceControl.setLayer(FREEZE_LAYER + 1);
|
||||
mSurfaceControl.setAlpha(0);
|
||||
mSurfaceControl.show();
|
||||
} catch (SurfaceControl.OutOfResourcesException e) {
|
||||
Slog.w(TAG, "Unable to allocate freeze surface", e);
|
||||
}
|
||||
|
||||
if (WindowManagerService.SHOW_TRANSACTIONS ||
|
||||
WindowManagerService.SHOW_SURFACE_ALLOC) Slog.i(WindowManagerService.TAG,
|
||||
" FREEZE " + mSurface + ": CREATE");
|
||||
" FREEZE " + mSurfaceControl + ": CREATE");
|
||||
|
||||
setRotationInTransaction(originalRotation);
|
||||
} finally {
|
||||
@ -251,7 +251,7 @@ class ScreenRotationAnimation {
|
||||
}
|
||||
|
||||
boolean hasScreenshot() {
|
||||
return mSurface != null;
|
||||
return mSurfaceControl != null;
|
||||
}
|
||||
|
||||
static int deltaRotation(int oldRotation, int newRotation) {
|
||||
@ -261,13 +261,13 @@ class ScreenRotationAnimation {
|
||||
}
|
||||
|
||||
private void setSnapshotTransformInTransaction(Matrix matrix, float alpha) {
|
||||
if (mSurface != null) {
|
||||
if (mSurfaceControl != null) {
|
||||
matrix.getValues(mTmpFloats);
|
||||
mSurface.setPosition(mTmpFloats[Matrix.MTRANS_X], mTmpFloats[Matrix.MTRANS_Y]);
|
||||
mSurface.setMatrix(
|
||||
mSurfaceControl.setPosition(mTmpFloats[Matrix.MTRANS_X], mTmpFloats[Matrix.MTRANS_Y]);
|
||||
mSurfaceControl.setMatrix(
|
||||
mTmpFloats[Matrix.MSCALE_X], mTmpFloats[Matrix.MSKEW_Y],
|
||||
mTmpFloats[Matrix.MSKEW_X], mTmpFloats[Matrix.MSCALE_Y]);
|
||||
mSurface.setAlpha(alpha);
|
||||
mSurfaceControl.setAlpha(alpha);
|
||||
if (DEBUG_TRANSFORMS) {
|
||||
float[] srcPnts = new float[] { 0, 0, mWidth, mHeight };
|
||||
float[] dstPnts = new float[4];
|
||||
@ -333,7 +333,7 @@ class ScreenRotationAnimation {
|
||||
*/
|
||||
private boolean startAnimation(SurfaceSession session, long maxAnimationDuration,
|
||||
float animationScale, int finalWidth, int finalHeight, boolean dismissing) {
|
||||
if (mSurface == null) {
|
||||
if (mSurfaceControl == null) {
|
||||
// Can't do animation.
|
||||
return false;
|
||||
}
|
||||
@ -509,7 +509,7 @@ class ScreenRotationAnimation {
|
||||
mCustomBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER + 3,
|
||||
layerStack);
|
||||
mCustomBlackFrame.setMatrix(mFrameInitialMatrix);
|
||||
} catch (Surface.OutOfResourcesException e) {
|
||||
} catch (SurfaceControl.OutOfResourcesException e) {
|
||||
Slog.w(TAG, "Unable to allocate black surface", e);
|
||||
} finally {
|
||||
SurfaceControl.closeTransaction();
|
||||
@ -539,7 +539,7 @@ class ScreenRotationAnimation {
|
||||
mExitingBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER + 2,
|
||||
layerStack);
|
||||
mExitingBlackFrame.setMatrix(mFrameInitialMatrix);
|
||||
} catch (Surface.OutOfResourcesException e) {
|
||||
} catch (SurfaceControl.OutOfResourcesException e) {
|
||||
Slog.w(TAG, "Unable to allocate black surface", e);
|
||||
} finally {
|
||||
SurfaceControl.closeTransaction();
|
||||
@ -561,7 +561,7 @@ class ScreenRotationAnimation {
|
||||
Rect inner = new Rect(0, 0, finalWidth, finalHeight);
|
||||
mEnteringBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER,
|
||||
layerStack);
|
||||
} catch (Surface.OutOfResourcesException e) {
|
||||
} catch (SurfaceControl.OutOfResourcesException e) {
|
||||
Slog.w(TAG, "Unable to allocate black surface", e);
|
||||
} finally {
|
||||
SurfaceControl.closeTransaction();
|
||||
@ -580,7 +580,7 @@ class ScreenRotationAnimation {
|
||||
public boolean dismiss(SurfaceSession session, long maxAnimationDuration,
|
||||
float animationScale, int finalWidth, int finalHeight) {
|
||||
if (DEBUG_STATE) Slog.v(TAG, "Dismiss!");
|
||||
if (mSurface == null) {
|
||||
if (mSurfaceControl == null) {
|
||||
// Can't do animation.
|
||||
return false;
|
||||
}
|
||||
@ -598,12 +598,12 @@ class ScreenRotationAnimation {
|
||||
|
||||
public void kill() {
|
||||
if (DEBUG_STATE) Slog.v(TAG, "Kill!");
|
||||
if (mSurface != null) {
|
||||
if (mSurfaceControl != null) {
|
||||
if (WindowManagerService.SHOW_TRANSACTIONS ||
|
||||
WindowManagerService.SHOW_SURFACE_ALLOC) Slog.i(WindowManagerService.TAG,
|
||||
" FREEZE " + mSurface + ": DESTROY");
|
||||
mSurface.destroy();
|
||||
mSurface = null;
|
||||
" FREEZE " + mSurfaceControl + ": DESTROY");
|
||||
mSurfaceControl.destroy();
|
||||
mSurfaceControl = null;
|
||||
}
|
||||
if (mCustomBlackFrame != null) {
|
||||
mCustomBlackFrame.kill();
|
||||
@ -861,10 +861,10 @@ class ScreenRotationAnimation {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mSurface != null) {
|
||||
if (mSurfaceControl != null) {
|
||||
if (!mMoreStartExit && !mMoreFinishExit && !mMoreRotateExit) {
|
||||
if (DEBUG_STATE) Slog.v(TAG, "Exit animations done, hiding screenshot surface");
|
||||
mSurface.hide();
|
||||
mSurfaceControl.hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -314,17 +314,17 @@ final class Session extends IWindowSession.Stub
|
||||
mService.mDragState.mThumbOffsetY = thumbCenterY;
|
||||
|
||||
// Make the surface visible at the proper location
|
||||
final SurfaceControl surface = mService.mDragState.mSurface;
|
||||
final SurfaceControl surfaceControl = mService.mDragState.mSurfaceControl;
|
||||
if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(
|
||||
WindowManagerService.TAG, ">>> OPEN TRANSACTION performDrag");
|
||||
SurfaceControl.openTransaction();
|
||||
try {
|
||||
surface.setPosition(touchX - thumbCenterX,
|
||||
surfaceControl.setPosition(touchX - thumbCenterX,
|
||||
touchY - thumbCenterY);
|
||||
surface.setAlpha(.7071f);
|
||||
surface.setLayer(mService.mDragState.getDragLayerLw());
|
||||
surface.setLayerStack(display.getLayerStack());
|
||||
surface.show();
|
||||
surfaceControl.setAlpha(.7071f);
|
||||
surfaceControl.setLayer(mService.mDragState.getDragLayerLw());
|
||||
surfaceControl.setLayerStack(display.getLayerStack());
|
||||
surfaceControl.show();
|
||||
} finally {
|
||||
SurfaceControl.closeTransaction();
|
||||
if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(
|
||||
|
@ -225,7 +225,7 @@ public class WindowAnimator {
|
||||
WindowStateAnimator winAnimator = win.mWinAnimator;
|
||||
final int flags = winAnimator.mAttrFlags;
|
||||
|
||||
if (winAnimator.mSurface != null) {
|
||||
if (winAnimator.mSurfaceControl != null) {
|
||||
final boolean wasAnimating = winAnimator.mWasAnimating;
|
||||
final boolean nowAnimating = winAnimator.stepAnimationLocked(mCurrentTime);
|
||||
|
||||
@ -373,7 +373,7 @@ public class WindowAnimator {
|
||||
for (int i = windows.size() - 1; i >= 0; i--) {
|
||||
final WindowState win = windows.get(i);
|
||||
WindowStateAnimator winAnimator = win.mWinAnimator;
|
||||
if (winAnimator.mSurface == null) {
|
||||
if (winAnimator.mSurfaceControl == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1112,7 +1112,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
if (DEBUG_INPUT_METHOD) {
|
||||
Slog.i(TAG, "isVisibleOrAdding " + w + ": " + w.isVisibleOrAdding());
|
||||
if (!w.isVisibleOrAdding()) {
|
||||
Slog.i(TAG, " mSurface=" + w.mWinAnimator.mSurface
|
||||
Slog.i(TAG, " mSurface=" + w.mWinAnimator.mSurfaceControl
|
||||
+ " relayoutCalled=" + w.mRelayoutCalled + " viewVis=" + w.mViewVisibility
|
||||
+ " policyVis=" + w.mPolicyVisibility
|
||||
+ " policyVisAfterAnim=" + w.mPolicyVisibilityAfterAnim
|
||||
@ -2278,14 +2278,14 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
TAG, "Remove " + win + " client="
|
||||
+ Integer.toHexString(System.identityHashCode(
|
||||
win.mClient.asBinder()))
|
||||
+ ", surface=" + win.mWinAnimator.mSurface);
|
||||
+ ", surface=" + win.mWinAnimator.mSurfaceControl);
|
||||
|
||||
final long origId = Binder.clearCallingIdentity();
|
||||
|
||||
win.disposeInputChannel();
|
||||
|
||||
if (DEBUG_APP_TRANSITIONS) Slog.v(
|
||||
TAG, "Remove " + win + ": mSurface=" + win.mWinAnimator.mSurface
|
||||
TAG, "Remove " + win + ": mSurface=" + win.mWinAnimator.mSurfaceControl
|
||||
+ " mExiting=" + win.mExiting
|
||||
+ " isAnimating=" + win.mWinAnimator.isAnimating()
|
||||
+ " app-animation="
|
||||
@ -2775,9 +2775,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
if (!win.mHasSurface) {
|
||||
surfaceChanged = true;
|
||||
}
|
||||
SurfaceControl surface = winAnimator.createSurfaceLocked();
|
||||
if (surface != null) {
|
||||
outSurface.copyFrom(surface);
|
||||
SurfaceControl surfaceControl = winAnimator.createSurfaceLocked();
|
||||
if (surfaceControl != null) {
|
||||
outSurface.copyFrom(surfaceControl);
|
||||
if (SHOW_TRANSACTIONS) Slog.i(TAG,
|
||||
" OUT SURFACE " + outSurface + ": copied");
|
||||
} else {
|
||||
@ -2817,7 +2817,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
} else {
|
||||
winAnimator.mEnterAnimationPending = false;
|
||||
if (winAnimator.mSurface != null) {
|
||||
if (winAnimator.mSurfaceControl != null) {
|
||||
if (DEBUG_VISIBILITY) Slog.i(TAG, "Relayout invis " + win
|
||||
+ ": mExiting=" + win.mExiting);
|
||||
// If we are not currently running the exit animation, we
|
||||
@ -7935,15 +7935,15 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
// TODO(multi-display): support other displays
|
||||
final DisplayContent displayContent = getDefaultDisplayContentLocked();
|
||||
final Display display = displayContent.getDisplay();
|
||||
SurfaceControl surface = new SurfaceControl(mFxSession,
|
||||
SurfaceControl surfaceControl = new SurfaceControl(mFxSession,
|
||||
"thumbnail anim",
|
||||
dirty.width(), dirty.height(),
|
||||
PixelFormat.TRANSLUCENT, SurfaceControl.HIDDEN);
|
||||
surface.setLayerStack(display.getLayerStack());
|
||||
appAnimator.thumbnail = surface;
|
||||
if (SHOW_TRANSACTIONS) Slog.i(TAG, " THUMBNAIL " + surface + ": CREATE");
|
||||
surfaceControl.setLayerStack(display.getLayerStack());
|
||||
appAnimator.thumbnail = surfaceControl;
|
||||
if (SHOW_TRANSACTIONS) Slog.i(TAG, " THUMBNAIL " + surfaceControl + ": CREATE");
|
||||
Surface drawSurface = new Surface();
|
||||
drawSurface.copyFrom(surface);
|
||||
drawSurface.copyFrom(surfaceControl);
|
||||
Canvas c = drawSurface.lockCanvas(dirty);
|
||||
c.drawBitmap(nextAppTransitionThumbnail, 0, 0, null);
|
||||
drawSurface.unlockCanvasAndPost(c);
|
||||
@ -8064,7 +8064,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
if (w.mOrientationChanging) {
|
||||
if (DEBUG_SURFACE_TRACE || DEBUG_ANIM || DEBUG_ORIENTATION) Slog.v(TAG,
|
||||
"Orientation start waiting for draw mDrawState=DRAW_PENDING in "
|
||||
+ w + ", surface " + winAnimator.mSurface);
|
||||
+ w + ", surface " + winAnimator.mSurfaceControl);
|
||||
winAnimator.mDrawState = WindowStateAnimator.DRAW_PENDING;
|
||||
if (w.mAppToken != null) {
|
||||
w.mAppToken.allDrawn = false;
|
||||
@ -8081,7 +8081,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
if (w.isDrawnLw()) {
|
||||
if (DEBUG_ORIENTATION) Slog.v(TAG,
|
||||
"Orientation not waiting for draw in "
|
||||
+ w + ", surface " + winAnimator.mSurface);
|
||||
+ w + ", surface " + winAnimator.mSurfaceControl);
|
||||
w.mOrientationChanging = false;
|
||||
}
|
||||
}
|
||||
@ -8429,7 +8429,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
Slog.v(TAG, "Eval win " + w + ": isDrawn=" + w.isDrawnLw()
|
||||
+ ", isAnimating=" + winAnimator.isAnimating());
|
||||
if (!w.isDrawnLw()) {
|
||||
Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurface
|
||||
Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurfaceControl
|
||||
+ " pv=" + w.mPolicyVisibility
|
||||
+ " mDrawState=" + winAnimator.mDrawState
|
||||
+ " ah=" + w.mAttachedHidden
|
||||
@ -8914,7 +8914,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
boolean reclaimSomeSurfaceMemoryLocked(WindowStateAnimator winAnimator, String operation,
|
||||
boolean secure) {
|
||||
final SurfaceControl surface = winAnimator.mSurface;
|
||||
final SurfaceControl surface = winAnimator.mSurfaceControl;
|
||||
boolean leakedSurface = false;
|
||||
boolean killedApps = false;
|
||||
|
||||
@ -8936,28 +8936,28 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
while (mTmpWindowsIterator.hasNext()) {
|
||||
WindowState ws = mTmpWindowsIterator.next();
|
||||
WindowStateAnimator wsa = ws.mWinAnimator;
|
||||
if (wsa.mSurface != null) {
|
||||
if (wsa.mSurfaceControl != null) {
|
||||
if (!mSessions.contains(wsa.mSession)) {
|
||||
Slog.w(TAG, "LEAKED SURFACE (session doesn't exist): "
|
||||
+ ws + " surface=" + wsa.mSurface
|
||||
+ ws + " surface=" + wsa.mSurfaceControl
|
||||
+ " token=" + ws.mToken
|
||||
+ " pid=" + ws.mSession.mPid
|
||||
+ " uid=" + ws.mSession.mUid);
|
||||
if (SHOW_TRANSACTIONS) logSurface(ws, "LEAK DESTROY", null);
|
||||
wsa.mSurface.destroy();
|
||||
wsa.mSurfaceControl.destroy();
|
||||
wsa.mSurfaceShown = false;
|
||||
wsa.mSurface = null;
|
||||
wsa.mSurfaceControl = null;
|
||||
ws.mHasSurface = false;
|
||||
mForceRemoves.add(ws);
|
||||
leakedSurface = true;
|
||||
} else if (ws.mAppToken != null && ws.mAppToken.clientHidden) {
|
||||
Slog.w(TAG, "LEAKED SURFACE (app token hidden): "
|
||||
+ ws + " surface=" + wsa.mSurface
|
||||
+ ws + " surface=" + wsa.mSurfaceControl
|
||||
+ " token=" + ws.mAppToken);
|
||||
if (SHOW_TRANSACTIONS) logSurface(ws, "LEAK DESTROY", null);
|
||||
wsa.mSurface.destroy();
|
||||
wsa.mSurfaceControl.destroy();
|
||||
wsa.mSurfaceShown = false;
|
||||
wsa.mSurface = null;
|
||||
wsa.mSurfaceControl = null;
|
||||
ws.mHasSurface = false;
|
||||
leakedSurface = true;
|
||||
}
|
||||
@ -8974,7 +8974,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
continue;
|
||||
}
|
||||
WindowStateAnimator wsa = ws.mWinAnimator;
|
||||
if (wsa.mSurface != null) {
|
||||
if (wsa.mSurfaceControl != null) {
|
||||
pidCandidates.append(wsa.mSession.mPid, wsa.mSession.mPid);
|
||||
}
|
||||
}
|
||||
@ -9001,7 +9001,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
"RECOVER DESTROY", null);
|
||||
surface.destroy();
|
||||
winAnimator.mSurfaceShown = false;
|
||||
winAnimator.mSurface = null;
|
||||
winAnimator.mSurfaceControl = null;
|
||||
winAnimator.mWin.mHasSurface = false;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ class WindowStateAnimator {
|
||||
int mAnimLayer;
|
||||
int mLastLayer;
|
||||
|
||||
SurfaceControl mSurface;
|
||||
SurfaceControl mSurfaceControl;
|
||||
SurfaceControl mPendingDestroySurface;
|
||||
|
||||
/**
|
||||
@ -404,7 +404,7 @@ class WindowStateAnimator {
|
||||
if (WindowManagerService.localLOGV) Slog.v(
|
||||
TAG, "Exit animation finished in " + this
|
||||
+ ": remove=" + mWin.mRemoveOnExit);
|
||||
if (mSurface != null) {
|
||||
if (mSurfaceControl != null) {
|
||||
mService.mDestroySurface.add(mWin);
|
||||
mWin.mDestroying = true;
|
||||
if (WindowState.SHOW_TRANSACTIONS) WindowManagerService.logSurface(
|
||||
@ -425,10 +425,10 @@ class WindowStateAnimator {
|
||||
mLastHidden = true;
|
||||
if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(mWin,
|
||||
"HIDE (performLayout)", null);
|
||||
if (mSurface != null) {
|
||||
if (mSurfaceControl != null) {
|
||||
mSurfaceShown = false;
|
||||
try {
|
||||
mSurface.hide();
|
||||
mSurfaceControl.hide();
|
||||
} catch (RuntimeException e) {
|
||||
Slog.w(TAG, "Exception hiding surface in " + mWin);
|
||||
}
|
||||
@ -445,7 +445,7 @@ class WindowStateAnimator {
|
||||
if (mDrawState == DRAW_PENDING) {
|
||||
if (DEBUG_SURFACE_TRACE || DEBUG_ANIM || SHOW_TRANSACTIONS || DEBUG_ORIENTATION)
|
||||
Slog.v(TAG, "finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING " + this + " in "
|
||||
+ mSurface);
|
||||
+ mSurfaceControl);
|
||||
if (DEBUG_STARTING_WINDOW &&
|
||||
mWin.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING) {
|
||||
Slog.v(TAG, "Draw state now committed in " + mWin);
|
||||
@ -467,7 +467,7 @@ class WindowStateAnimator {
|
||||
return false;
|
||||
}
|
||||
if (DEBUG_SURFACE_TRACE || DEBUG_ANIM) {
|
||||
Slog.i(TAG, "commitFinishDrawingLocked: mDrawState=READY_TO_SHOW " + mSurface);
|
||||
Slog.i(TAG, "commitFinishDrawingLocked: mDrawState=READY_TO_SHOW " + mSurfaceControl);
|
||||
}
|
||||
mDrawState = READY_TO_SHOW;
|
||||
final boolean starting = mWin.mAttrs.type == TYPE_APPLICATION_STARTING;
|
||||
@ -625,7 +625,7 @@ class WindowStateAnimator {
|
||||
}
|
||||
|
||||
SurfaceControl createSurfaceLocked() {
|
||||
if (mSurface == null) {
|
||||
if (mSurfaceControl == null) {
|
||||
if (DEBUG_ANIM || DEBUG_ORIENTATION) Slog.i(TAG,
|
||||
"createSurface " + this + ": mDrawState=DRAW_PENDING");
|
||||
mDrawState = DRAW_PENDING;
|
||||
@ -685,12 +685,12 @@ class WindowStateAnimator {
|
||||
flags |= SurfaceControl.OPAQUE;
|
||||
}
|
||||
if (DEBUG_SURFACE_TRACE) {
|
||||
mSurface = new SurfaceTrace(
|
||||
mSurfaceControl = new SurfaceTrace(
|
||||
mSession.mSurfaceSession,
|
||||
attrs.getTitle().toString(),
|
||||
w, h, format, flags);
|
||||
} else {
|
||||
mSurface = new SurfaceControl(
|
||||
mSurfaceControl = new SurfaceControl(
|
||||
mSession.mSurfaceSession,
|
||||
attrs.getTitle().toString(),
|
||||
w, h, format, flags);
|
||||
@ -698,7 +698,7 @@ class WindowStateAnimator {
|
||||
mWin.mHasSurface = true;
|
||||
if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) Slog.i(TAG,
|
||||
" CREATE SURFACE "
|
||||
+ mSurface + " IN SESSION "
|
||||
+ mSurfaceControl + " IN SESSION "
|
||||
+ mSession.mSurfaceSession
|
||||
+ ": pid=" + mSession.mPid + " format="
|
||||
+ attrs.format + " flags=0x"
|
||||
@ -718,7 +718,7 @@ class WindowStateAnimator {
|
||||
}
|
||||
|
||||
if (WindowManagerService.localLOGV) Slog.v(
|
||||
TAG, "Got surface: " + mSurface
|
||||
TAG, "Got surface: " + mSurfaceControl
|
||||
+ ", set left=" + mWin.mFrame.left + " top=" + mWin.mFrame.top
|
||||
+ ", animLayer=" + mAnimLayer);
|
||||
if (SHOW_LIGHT_TRANSACTIONS) {
|
||||
@ -733,11 +733,11 @@ class WindowStateAnimator {
|
||||
try {
|
||||
mSurfaceX = mWin.mFrame.left + mWin.mXOffset;
|
||||
mSurfaceY = mWin.mFrame.top + mWin.mYOffset;
|
||||
mSurface.setPosition(mSurfaceX, mSurfaceY);
|
||||
mSurfaceControl.setPosition(mSurfaceX, mSurfaceY);
|
||||
mSurfaceLayer = mAnimLayer;
|
||||
mSurface.setLayerStack(mLayerStack);
|
||||
mSurface.setLayer(mAnimLayer);
|
||||
mSurface.setAlpha(0);
|
||||
mSurfaceControl.setLayerStack(mLayerStack);
|
||||
mSurfaceControl.setLayer(mAnimLayer);
|
||||
mSurfaceControl.setAlpha(0);
|
||||
mSurfaceShown = false;
|
||||
} catch (RuntimeException e) {
|
||||
Slog.w(TAG, "Error creating surface in " + w, e);
|
||||
@ -752,7 +752,7 @@ class WindowStateAnimator {
|
||||
if (WindowManagerService.localLOGV) Slog.v(
|
||||
TAG, "Created surface " + this);
|
||||
}
|
||||
return mSurface;
|
||||
return mSurfaceControl;
|
||||
}
|
||||
|
||||
void destroySurfaceLocked() {
|
||||
@ -760,7 +760,7 @@ class WindowStateAnimator {
|
||||
mWin.mAppToken.startingDisplayed = false;
|
||||
}
|
||||
|
||||
if (mSurface != null) {
|
||||
if (mSurfaceControl != null) {
|
||||
|
||||
int i = mWin.mChildWindows.size();
|
||||
while (i > 0) {
|
||||
@ -777,10 +777,10 @@ class WindowStateAnimator {
|
||||
e.fillInStackTrace();
|
||||
}
|
||||
Slog.w(TAG, "Window " + this + " destroying surface "
|
||||
+ mSurface + ", session " + mSession, e);
|
||||
+ mSurfaceControl + ", session " + mSession, e);
|
||||
}
|
||||
if (mSurfaceDestroyDeferred) {
|
||||
if (mSurface != null && mPendingDestroySurface != mSurface) {
|
||||
if (mSurfaceControl != null && mPendingDestroySurface != mSurfaceControl) {
|
||||
if (mPendingDestroySurface != null) {
|
||||
if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
|
||||
RuntimeException e = null;
|
||||
@ -792,7 +792,7 @@ class WindowStateAnimator {
|
||||
}
|
||||
mPendingDestroySurface.destroy();
|
||||
}
|
||||
mPendingDestroySurface = mSurface;
|
||||
mPendingDestroySurface = mSurfaceControl;
|
||||
}
|
||||
} else {
|
||||
if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
|
||||
@ -803,17 +803,17 @@ class WindowStateAnimator {
|
||||
}
|
||||
WindowManagerService.logSurface(mWin, "DESTROY", e);
|
||||
}
|
||||
mSurface.destroy();
|
||||
mSurfaceControl.destroy();
|
||||
}
|
||||
mAnimator.hideWallpapersLocked(mWin);
|
||||
} catch (RuntimeException e) {
|
||||
Slog.w(TAG, "Exception thrown when destroying Window " + this
|
||||
+ " surface " + mSurface + " session " + mSession
|
||||
+ " surface " + mSurfaceControl + " session " + mSession
|
||||
+ ": " + e.toString());
|
||||
}
|
||||
|
||||
mSurfaceShown = false;
|
||||
mSurface = null;
|
||||
mSurfaceControl = null;
|
||||
mWin.mHasSurface = false;
|
||||
mDrawState = NO_SURFACE;
|
||||
}
|
||||
@ -1120,7 +1120,7 @@ class WindowStateAnimator {
|
||||
try {
|
||||
if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
|
||||
"CROP " + w.mSystemDecorRect.toShortString(), null);
|
||||
mSurface.setWindowCrop(w.mSystemDecorRect);
|
||||
mSurfaceControl.setWindowCrop(w.mSystemDecorRect);
|
||||
} catch (RuntimeException e) {
|
||||
Slog.w(TAG, "Error setting crop surface of " + w
|
||||
+ " crop=" + w.mSystemDecorRect.toShortString(), e);
|
||||
@ -1164,7 +1164,7 @@ class WindowStateAnimator {
|
||||
"POS " + left + ", " + top, null);
|
||||
mSurfaceX = left;
|
||||
mSurfaceY = top;
|
||||
mSurface.setPosition(left, top);
|
||||
mSurfaceControl.setPosition(left, top);
|
||||
} catch (RuntimeException e) {
|
||||
Slog.w(TAG, "Error positioning surface of " + w
|
||||
+ " pos=(" + left
|
||||
@ -1180,7 +1180,7 @@ class WindowStateAnimator {
|
||||
if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
|
||||
"SIZE " + width + "x" + height, null);
|
||||
mSurfaceResized = true;
|
||||
mSurface.setSize(width, height);
|
||||
mSurfaceControl.setSize(width, height);
|
||||
final int displayId = w.mDisplayContent.getDisplayId();
|
||||
mAnimator.setPendingLayoutChanges(displayId,
|
||||
WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER);
|
||||
@ -1204,7 +1204,7 @@ class WindowStateAnimator {
|
||||
|
||||
public void prepareSurfaceLocked(final boolean recoveringMemory) {
|
||||
final WindowState w = mWin;
|
||||
if (mSurface == null) {
|
||||
if (mSurfaceControl == null) {
|
||||
if (w.mOrientationChanging) {
|
||||
if (DEBUG_ORIENTATION) {
|
||||
Slog.v(TAG, "Orientation change skips hidden " + w);
|
||||
@ -1262,13 +1262,13 @@ class WindowStateAnimator {
|
||||
+ "," + (mDtDx*w.mVScale)
|
||||
+ "][" + (mDsDy*w.mHScale)
|
||||
+ "," + (mDtDy*w.mVScale) + "]", null);
|
||||
if (mSurface != null) {
|
||||
if (mSurfaceControl != null) {
|
||||
try {
|
||||
mSurfaceAlpha = mShownAlpha;
|
||||
mSurface.setAlpha(mShownAlpha);
|
||||
mSurfaceControl.setAlpha(mShownAlpha);
|
||||
mSurfaceLayer = mAnimLayer;
|
||||
mSurface.setLayer(mAnimLayer);
|
||||
mSurface.setMatrix(
|
||||
mSurfaceControl.setLayer(mAnimLayer);
|
||||
mSurfaceControl.setMatrix(
|
||||
mDsDx*w.mHScale, mDtDx*w.mVScale,
|
||||
mDsDy*w.mHScale, mDtDy*w.mVScale);
|
||||
|
||||
@ -1286,7 +1286,7 @@ class WindowStateAnimator {
|
||||
w.mOrientationChanging = false;
|
||||
}
|
||||
}
|
||||
if (mSurface != null) {
|
||||
if (mSurfaceControl != null) {
|
||||
w.mToken.hasVisible = true;
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
@ -1319,7 +1319,7 @@ class WindowStateAnimator {
|
||||
}
|
||||
|
||||
void setTransparentRegionHintLocked(final Region region) {
|
||||
if (mSurface == null) {
|
||||
if (mSurfaceControl == null) {
|
||||
Slog.w(TAG, "setTransparentRegionHint: null mSurface after mHasSurface true");
|
||||
return;
|
||||
}
|
||||
@ -1329,7 +1329,7 @@ class WindowStateAnimator {
|
||||
try {
|
||||
if (SHOW_TRANSACTIONS) WindowManagerService.logSurface(mWin,
|
||||
"transparentRegionHint=" + region, null);
|
||||
mSurface.setTransparentRegionHint(region);
|
||||
mSurfaceControl.setTransparentRegionHint(region);
|
||||
} finally {
|
||||
SurfaceControl.closeTransaction();
|
||||
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
|
||||
@ -1356,7 +1356,7 @@ class WindowStateAnimator {
|
||||
try {
|
||||
if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(mWin,
|
||||
"POS " + left + ", " + top, null);
|
||||
mSurface.setPosition(mWin.mFrame.left + left, mWin.mFrame.top + top);
|
||||
mSurfaceControl.setPosition(mWin.mFrame.left + left, mWin.mFrame.top + top);
|
||||
updateSurfaceWindowCrop(false);
|
||||
} catch (RuntimeException e) {
|
||||
Slog.w(TAG, "Error positioning surface of " + mWin
|
||||
@ -1431,7 +1431,7 @@ class WindowStateAnimator {
|
||||
WindowState c = mWin.mChildWindows.get(i);
|
||||
if (c.mAttachedHidden) {
|
||||
c.mAttachedHidden = false;
|
||||
if (c.mWinAnimator.mSurface != null) {
|
||||
if (c.mWinAnimator.mSurfaceControl != null) {
|
||||
c.mWinAnimator.performShowLocked();
|
||||
// It hadn't been shown, which means layout not
|
||||
// performed on it, so now we want to make sure to
|
||||
@ -1479,9 +1479,9 @@ class WindowStateAnimator {
|
||||
*/
|
||||
boolean showSurfaceRobustlyLocked() {
|
||||
try {
|
||||
if (mSurface != null) {
|
||||
if (mSurfaceControl != null) {
|
||||
mSurfaceShown = true;
|
||||
mSurface.show();
|
||||
mSurfaceControl.show();
|
||||
if (mWin.mTurnOnScreen) {
|
||||
if (DEBUG_VISIBILITY) Slog.v(TAG,
|
||||
"Show surface turning screen on: " + mWin);
|
||||
@ -1491,7 +1491,7 @@ class WindowStateAnimator {
|
||||
}
|
||||
return true;
|
||||
} catch (RuntimeException e) {
|
||||
Slog.w(TAG, "Failure showing surface " + mSurface + " in " + mWin, e);
|
||||
Slog.w(TAG, "Failure showing surface " + mSurfaceControl + " in " + mWin, e);
|
||||
}
|
||||
|
||||
mService.reclaimSomeSurfaceMemoryLocked(this, "show", true);
|
||||
@ -1600,9 +1600,9 @@ class WindowStateAnimator {
|
||||
pw.print(" "); mTransformation.printShortString(pw);
|
||||
pw.println();
|
||||
}
|
||||
if (mSurface != null) {
|
||||
if (mSurfaceControl != null) {
|
||||
if (dumpAll) {
|
||||
pw.print(prefix); pw.print("mSurface="); pw.println(mSurface);
|
||||
pw.print(prefix); pw.print("mSurface="); pw.println(mSurfaceControl);
|
||||
pw.print(prefix); pw.print("mDrawState=");
|
||||
pw.print(drawStateToString(mDrawState));
|
||||
pw.print(" mLastHidden="); pw.println(mLastHidden);
|
||||
|
Reference in New Issue
Block a user