title: Does a SurfaceTexture survive an activity pause/resume cycle?
body: <p>Below is a little experiment I made where I attach a SurfaceTextureListener to a TextureView in the onResume() part of an activity. </p>
  
  <ul>
  <li><p><em>on fresh start</em> : a surface texture is made available ("onSurfaceTextureAvailable")</p></li>
  <li><p><em>on orientation change</em> : as I would expect, the surface texture is destroyed ("onSurfaceTextureDestroyed") and a surface texture is then made available ("onSurfaceTextureAvailable").</p></li>
  </ul>
  
  <p><strong>Now here's what surprises me:</strong></p>
  
  <ul>
  <li><em>on task switch then resume</em> : the surface  texture is not destroyed (no "onSurfaceTextureDestroyed") and a surface texture is not made available (no "onSurfaceTextureAvailable")</li>
  </ul>
  
  <p><strong>Under these conditions, am I guaranteed that the old SurfaceTexture is stil valid? How can I make sure that I actually know when my SurfaceTexture is available? Why is it that an orientation change is different from a task switch and how should I know?</strong></p>
  
  <hr>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
      private final String TAG = "MainActivity";
      TextureView mTextureView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          mTextureView = (TextureView) findViewById(R.id.textureView);
       }
  
      @Override
      public void onResume() {
          super.onResume();
          mTextureView.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() {
              @Override
              public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
                  Log.d(TAG, "onSurfaceTextureAvailable");
              }
              @Override
              public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
                  Log.d(TAG, "onSurfaceTextureSizeChanged");
              }
              @Override
              public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
                  Log.d(TAG, "onSurfaceTextureDestroyed");
                  return false;
              }
              @Override
              public void onSurfaceTextureUpdated(SurfaceTexture surface) {
              }
          });
      }
  }
  </code></pre>