summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-02-15 08:26:15 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-02-15 08:26:15 +0000
commit45a707277ff3a229be249f10d3abccaf89085969 (patch)
tree3848fb2a84789c29dc55ff75e0acc0e242ba52f3
parentc5b51cbea2231db9527ffbe4dbf460467a4ee0db (diff)
parentc3441bcb11dc414911dd5681fd01ca1d2dde74d2 (diff)
downloadandroid_packages_screensavers_Basic-45a707277ff3a229be249f10d3abccaf89085969.tar.gz
android_packages_screensavers_Basic-45a707277ff3a229be249f10d3abccaf89085969.tar.bz2
android_packages_screensavers_Basic-45a707277ff3a229be249f10d3abccaf89085969.zip
Snap for 4605948 from c3441bcb11dc414911dd5681fd01ca1d2dde74d2 to pi-release
Change-Id: I1aae93bc105838eebcfa34917742f52f8c4d24f9
-rw-r--r--src/com/android/dreams/basic/Colors.java39
-rw-r--r--src/com/android/dreams/basic/ColorsGLRenderer.java5
2 files changed, 19 insertions, 25 deletions
diff --git a/src/com/android/dreams/basic/Colors.java b/src/com/android/dreams/basic/Colors.java
index aaacfcd..9a75146 100644
--- a/src/com/android/dreams/basic/Colors.java
+++ b/src/com/android/dreams/basic/Colors.java
@@ -16,10 +16,10 @@
package com.android.dreams.basic;
-import android.graphics.SurfaceTexture;
import android.service.dreams.DreamService;
import android.util.Log;
-import android.view.TextureView;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
import android.os.Handler;
import android.os.HandlerThread;
@@ -29,7 +29,7 @@ import android.os.HandlerThread;
* This dream performs its rendering using OpenGL on a separate rendering thread.
* </p>
*/
-public class Colors extends DreamService implements TextureView.SurfaceTextureListener {
+public class Colors extends DreamService implements SurfaceHolder.Callback {
static final String TAG = Colors.class.getSimpleName();
static final boolean DEBUG = false;
@@ -38,7 +38,7 @@ public class Colors extends DreamService implements TextureView.SurfaceTextureLi
Log.v(TAG, String.format(fmt, args));
}
- private TextureView mTextureView;
+ private SurfaceView mSurfaceView;
// The handler thread and handler on which the GL renderer is running.
private HandlerThread mRendererHandlerThread;
@@ -53,8 +53,8 @@ public class Colors extends DreamService implements TextureView.SurfaceTextureLi
setInteractive(false);
- mTextureView = new TextureView(this);
- mTextureView.setSurfaceTextureListener(this);
+ mSurfaceView = new SurfaceView(this);
+ mSurfaceView.getHolder().addCallback(this);
if (mRendererHandlerThread == null) {
mRendererHandlerThread = new HandlerThread(TAG);
@@ -69,13 +69,13 @@ public class Colors extends DreamService implements TextureView.SurfaceTextureLi
setInteractive(false);
setLowProfile(true);
setFullscreen(true);
- setContentView(mTextureView);
+ setContentView(mSurfaceView);
}
@Override
- public void onSurfaceTextureAvailable(final SurfaceTexture surface,
- final int width, final int height) {
- LOG("onSurfaceTextureAvailable(%s, %d, %d)", surface, width, height);
+ public void surfaceCreated(SurfaceHolder holder) {
+ LOG("surfaceCreated(%s, %d, %d)", holder.getSurface(),
+ holder.getSurfaceFrame().width(), holder.getSurfaceFrame().height());
mRendererHandler.post(new Runnable() {
@Override
@@ -83,16 +83,16 @@ public class Colors extends DreamService implements TextureView.SurfaceTextureLi
if (mRenderer != null) {
mRenderer.stop();
}
- mRenderer = new ColorsGLRenderer(surface, width, height);
+ mRenderer = new ColorsGLRenderer(holder.getSurface(),
+ holder.getSurfaceFrame().width(), holder.getSurfaceFrame().height());
mRenderer.start();
}
});
}
@Override
- public void onSurfaceTextureSizeChanged(SurfaceTexture surface,
- final int width, final int height) {
- LOG("onSurfaceTextureSizeChanged(%s, %d, %d)", surface, width, height);
+ public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
+ LOG("surfaceChanged(%s, %d, %d, %d)", holder.getSurface(), format, width, height);
mRendererHandler.post(new Runnable() {
@Override
@@ -105,8 +105,8 @@ public class Colors extends DreamService implements TextureView.SurfaceTextureLi
}
@Override
- public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
- LOG("onSurfaceTextureDestroyed(%s)", surface);
+ public void surfaceDestroyed(SurfaceHolder holder) {
+ LOG("surfaceDestroyed(%s)", holder.getSurface());
mRendererHandler.post(new Runnable() {
@Override
@@ -124,12 +124,5 @@ public class Colors extends DreamService implements TextureView.SurfaceTextureLi
} catch (InterruptedException e) {
LOG("Error while waiting for renderer", e);
}
-
- return true;
- }
-
- @Override
- public void onSurfaceTextureUpdated(SurfaceTexture surface) {
- LOG("onSurfaceTextureUpdated(%s)", surface);
}
}
diff --git a/src/com/android/dreams/basic/ColorsGLRenderer.java b/src/com/android/dreams/basic/ColorsGLRenderer.java
index 91e4432..6c4b466 100644
--- a/src/com/android/dreams/basic/ColorsGLRenderer.java
+++ b/src/com/android/dreams/basic/ColorsGLRenderer.java
@@ -20,6 +20,7 @@ import android.graphics.Color;
import android.graphics.SurfaceTexture;
import android.util.Log;
import android.view.Choreographer;
+import android.view.Surface;
import android.os.SystemClock;
import javax.microedition.khronos.egl.EGL10;
@@ -54,7 +55,7 @@ final class ColorsGLRenderer implements Choreographer.FrameCallback {
Log.v(TAG, String.format(fmt, args));
}
- private final SurfaceTexture mSurface;
+ private final Surface mSurface;
private int mWidth;
private int mHeight;
@@ -70,7 +71,7 @@ final class ColorsGLRenderer implements Choreographer.FrameCallback {
private EGLContext mEglContext;
private EGLSurface mEglSurface;
- public ColorsGLRenderer(SurfaceTexture surface, int width, int height) {
+ public ColorsGLRenderer(Surface surface, int width, int height) {
mSurface = surface;
mWidth = width;
mHeight = height;