title: Camera freezes after screen unlock
body: <p>I'm currently developing photo camera app and I'm having some trouble: if you lock screen and then unlock it, image freezes.</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(layout.activity_main);
  
      //...
  
      surfaceView = (SurfaceView) findViewById(id.surfaceView);
      holder = surfaceView.getHolder();
      holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  
      holderCallback = new HolderCallback();
      holder.addCallback(holderCallback);
  }
      @Override
  protected void onResume() {
      super.onResume();
      camera = Camera.open(CAMERA_ID);
  }
  
      @Override
  protected void onPause() {
      super.onPause();
      if (camera != null) {
          camera.setPreviewCallback(null);
          camera.stopPreview();
          camera.release();
          camera = null;
      }
  }
  </code></pre>
  
  <p>(<code>CameraOverlay()</code> is the class which extends <code>SurfaceView</code> and implements <code>SurfaceHolder.Callback</code>.  - from the post with similar problem) 
  I don't use <code>CameraOverlay</code> anywhere, do I have to create it just for resuming preview after unlocking screen.</p>
  
  <p>I have searched through multiple posts on this subject but couldn't find any solution that works for me, please help. I'm just starting to develop for android.</p>