Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 37cc31c6 authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Add a return value for SurfaceTextureListener#onSurfaceTextureDestroyed."

parents 8f28f669 402f0553
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -17930,7 +17930,7 @@ package android.renderscript {
    method public void destroyRenderScriptGL();
    method public android.renderscript.RenderScriptGL getRenderScriptGL();
    method public void onSurfaceTextureAvailable(android.graphics.SurfaceTexture, int, int);
    method public void onSurfaceTextureDestroyed(android.graphics.SurfaceTexture);
    method public boolean onSurfaceTextureDestroyed(android.graphics.SurfaceTexture);
    method public void onSurfaceTextureSizeChanged(android.graphics.SurfaceTexture, int, int);
    method public void onSurfaceTextureUpdated(android.graphics.SurfaceTexture);
    method public void pause();
@@ -22351,7 +22351,7 @@ package android.view {
  public static abstract interface TextureView.SurfaceTextureListener {
    method public abstract void onSurfaceTextureAvailable(android.graphics.SurfaceTexture, int, int);
    method public abstract void onSurfaceTextureDestroyed(android.graphics.SurfaceTexture);
    method public abstract boolean onSurfaceTextureDestroyed(android.graphics.SurfaceTexture);
    method public abstract void onSurfaceTextureSizeChanged(android.graphics.SurfaceTexture, int, int);
    method public abstract void onSurfaceTextureUpdated(android.graphics.SurfaceTexture);
  }
+8 −6
Original line number Diff line number Diff line
@@ -73,9 +73,10 @@ import android.util.Log;
 *          // Ignored, Camera does all the work for us
 *      }
 *
 *      public void onSurfaceTextureDestroyed(SurfaceTexture surface) {
 *      public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
 *          mCamera.stopPreview();
 *          mCamera.release();
 *          return true;
 *      }
 *
 *      public void onSurfaceTextureUpdated(SurfaceTexture surface) {
@@ -195,8 +196,9 @@ public class TextureView extends View {
        super.onDetachedFromWindow();

        if (mLayer != null) {
            boolean shouldRelease = true;
            if (mListener != null) {
                mListener.onSurfaceTextureDestroyed(mSurface);
                shouldRelease = mListener.onSurfaceTextureDestroyed(mSurface);
            }

            synchronized (mNativeWindowLock) {
@@ -204,7 +206,7 @@ public class TextureView extends View {
            }

            mLayer.destroy();
            mSurface.release();
            if (shouldRelease) mSurface.release();
            mSurface = null;
            mLayer = null;
        }
@@ -578,12 +580,12 @@ public class TextureView extends View {

        /**
         * Invoked when the specified {@link SurfaceTexture} is about to be destroyed.
         * After this method is invoked, no rendering should happen inside the surface
         * texture.
         * If returns true, no rendering should happen inside the surface texture after this method
         * is invoked. If returns false, the client needs to call {@link SurfaceTexture#release()}.
         * 
         * @param surface The surface about to be destroyed
         */
        public void onSurfaceTextureDestroyed(SurfaceTexture surface);
        public boolean onSurfaceTextureDestroyed(SurfaceTexture surface);

        /**
         * Invoked when the specified {@link SurfaceTexture} is updated through
+3 −1
Original line number Diff line number Diff line
@@ -85,13 +85,15 @@ public class RSTextureView extends TextureView implements TextureView.SurfaceTex
    }

    @Override
    public void onSurfaceTextureDestroyed(SurfaceTexture surface) {
    public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
        //Log.e(RenderScript.LOG_TAG, "onSurfaceTextureDestroyed");
        mSurfaceTexture = surface;

        if (mRS != null) {
            mRS.setSurfaceTexture(null, 0, 0);
        }

        return true;
    }

    @Override
+2 −1
Original line number Diff line number Diff line
@@ -58,8 +58,9 @@ public class CanvasTextureViewActivity extends Activity
    }

    @Override
    public void onSurfaceTextureDestroyed(SurfaceTexture surface) {
    public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
        if (mThread != null) mThread.stopRendering();
        return true;
    }

    @Override
+2 −1
Original line number Diff line number Diff line
@@ -110,13 +110,14 @@ public class GLTextureViewActivity extends Activity implements TextureView.Surfa
    }

    @Override
    public void onSurfaceTextureDestroyed(SurfaceTexture surface) {
    public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
        mRenderThread.finish();
        try {
            mRenderThread.join();
        } catch (InterruptedException e) {
            Log.e(RenderThread.LOG_TAG, "Could not wait for render thread");
        }
        return true;
    }

    @Override
Loading