summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/surfaceflinger/LayerBuffer.cpp32
-rw-r--r--tests/AndroidTests/Android.mk2
-rw-r--r--tests/AndroidTests/src/com/android/unit_tests/GoogleLoginServiceTest.java10
-rw-r--r--tools/preload/Policy.java1
4 files changed, 33 insertions, 12 deletions
diff --git a/libs/surfaceflinger/LayerBuffer.cpp b/libs/surfaceflinger/LayerBuffer.cpp
index 091856f9dc58..ac9b6b05c460 100644
--- a/libs/surfaceflinger/LayerBuffer.cpp
+++ b/libs/surfaceflinger/LayerBuffer.cpp
@@ -370,8 +370,23 @@ LayerBuffer::BufferSource::BufferSource(LayerBuffer& layer,
LayerBuffer::BufferSource::~BufferSource()
{
+ class MessageDestroyTexture : public MessageBase {
+ SurfaceFlinger* flinger;
+ GLuint name;
+ public:
+ MessageDestroyTexture(
+ SurfaceFlinger* flinger, GLuint name)
+ : flinger(flinger), name(name) { }
+ virtual bool handler() {
+ glDeleteTextures(1, &name);
+ return true;
+ }
+ };
+
if (mTexture.name != -1U) {
- glDeleteTextures(1, &mTexture.name);
+ // GL textures can only be destroyed from the GL thread
+ mLayer.mFlinger->mEventQueue.postMessage(
+ new MessageDestroyTexture(mLayer.mFlinger.get(), mTexture.name) );
}
if (mTexture.image != EGL_NO_IMAGE_KHR) {
EGLDisplay dpy(mLayer.mFlinger->graphicPlane(0).getEGLDisplay());
@@ -444,6 +459,10 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const
NativeBuffer src(ourBuffer->getBuffer());
const Rect transformedBounds(mLayer.getTransformedBounds());
+ if (UNLIKELY(mTexture.name == -1LU)) {
+ mTexture.name = mLayer.createTexture();
+ }
+
#if defined(EGL_ANDROID_image_native_buffer)
if (mLayer.mFlags & DisplayHardware::DIRECT_TEXTURE) {
copybit_device_t* copybit = mLayer.mBlitEngine;
@@ -483,9 +502,6 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const
t.format = src.img.format;
t.data = (GGLubyte*)src.img.base;
const Region dirty(Rect(t.width, t.height));
- if (UNLIKELY(mTexture.name == -1LU)) {
- mTexture.name = mLayer.createTexture();
- }
mLayer.loadTexture(&mTexture, dirty, t);
}
@@ -566,11 +582,17 @@ status_t LayerBuffer::BufferSource::initTempBuffer() const
void LayerBuffer::BufferSource::clearTempBufferImage() const
{
+ // delete the image
EGLDisplay dpy(mLayer.mFlinger->graphicPlane(0).getEGLDisplay());
- glDeleteTextures(1, &mTexture.name);
eglDestroyImageKHR(dpy, mTexture.image);
+
+ // and the associated texture (recreate a name)
+ glDeleteTextures(1, &mTexture.name);
Texture defaultTexture;
mTexture = defaultTexture;
+ mTexture.name = mLayer.createTexture();
+
+ // and the associated buffer
mTempGraphicBuffer.clear();
}
diff --git a/tests/AndroidTests/Android.mk b/tests/AndroidTests/Android.mk
index 757044f7a476..a81b77908077 100644
--- a/tests/AndroidTests/Android.mk
+++ b/tests/AndroidTests/Android.mk
@@ -5,7 +5,7 @@ LOCAL_MODULE_TAGS := tests
LOCAL_JAVA_LIBRARIES := framework-tests android.test.runner services
-LOCAL_STATIC_JAVA_LIBRARIES := googlelogin-client
+LOCAL_STATIC_JAVA_LIBRARIES := gsf-client
# Resource unit tests use a private locale
LOCAL_AAPT_FLAGS = -c xx_YY -c cs -c 160dpi -c 32dpi -c 240dpi
diff --git a/tests/AndroidTests/src/com/android/unit_tests/GoogleLoginServiceTest.java b/tests/AndroidTests/src/com/android/unit_tests/GoogleLoginServiceTest.java
index 59f14bf23ed1..1d48030e31b7 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/GoogleLoginServiceTest.java
+++ b/tests/AndroidTests/src/com/android/unit_tests/GoogleLoginServiceTest.java
@@ -17,9 +17,9 @@ import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.Suppress;
import android.util.Log;
-import com.google.android.googleapps.GoogleLoginCredentialsResult;
-import com.google.android.googleapps.IGoogleLoginService;
-import com.google.android.googlelogin.GoogleLoginServiceConstants;
+import com.google.android.gsf.GoogleLoginCredentialsResult;
+import com.google.android.gsf.IGoogleLoginService;
+import com.google.android.gsf.GoogleLoginServiceConstants;
import junit.framework.Assert;
@@ -60,8 +60,8 @@ public class GoogleLoginServiceTest extends AndroidTestCase {
protected void setUp() throws Exception {
super.setUp();
getContext().bindService((new Intent())
- .setClassName("com.google.android.googleapps",
- "com.google.android.googleapps.GoogleLoginService"),
+ .setClassName("com.google.android.gsf",
+ "com.google.android.gsf.loginservice.GoogleLoginService"),
mConnection, Context.BIND_AUTO_CREATE);
// wait for the service to cnnnect
diff --git a/tools/preload/Policy.java b/tools/preload/Policy.java
index 7a190ac273d4..a8d761d5261f 100644
--- a/tools/preload/Policy.java
+++ b/tools/preload/Policy.java
@@ -46,7 +46,6 @@ public class Policy {
"com.android.phone",
"com.google.android.apps.maps.FriendService",
"com.google.android.apps.maps.LocationFriendService",
- "com.google.android.googleapps",
"com.google.process.gapps",
"android.tts"
));