title: App freezes on custom Android Kitkat 4.4 with failed de-queue buffer error
body: <p>Am running my app on a <a href="http://posiflex.com/en-global/product/index/pos-terminal/JIVA-XT/JIVA_XT-2614Q" rel="nofollow noreferrer">Posiflex machine</a> which runs Android 4.4. My home page is a webview(which will use Chromium 30). Sometimes my app freezes and the logcat shows the following error</p>
  
  <pre><code>DequeueBufferWrapper: Failed to de-queue buffer
  
  Native window is invalid
  </code></pre>
  
  <p>After the above error theres also a stack trace with:</p>
  
  <pre><code>ViewRootImpl: Could not lock surface
  java.lang.IllegalArgumentException
  at android.view.Surface.nativeLockCanvas(Native Method)
  at android.view.Surface.lockCanvas(Surface.java:246)
  at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2435)
  at android.view.ViewRootImpl.draw(ViewRootImpl.java:2409)
  at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2253)
  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1883)
  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
  at android.view.Choreographer.doCallbacks(Choreographer.java:574)
  at android.view.Choreographer.doFrame(Choreographer.java:544)
  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
  at android.os.Handler.handleCallback(Handler.java:733)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:4998)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:515)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:811)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:627)
  at dalvik.system.NativeStart.main(Native Method)
  01-29 00:07:48.092 12167-12167/in.zeta.android.pos.debug E/Surface: dequeueBuffer failed (Invalid argument)
  01-29 00:07:48.092 12167-12167/in.zeta.android.pos.debug 
  
  E/ViewRootImpl: Could not lock surface
  java.lang.IllegalArgumentException
  at android.view.Surface.nativeLockCanvas(Native Method)
  at android.view.Surface.lockCanvas(Surface.java:246)
  at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2435)
  at android.view.ViewRootImpl.draw(ViewRootImpl.java:2409)
  at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2253)
  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1883)
  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
  at android.view.Choreographer.doCallbacks(Choreographer.java:574)
  at android.view.Choreographer.doFrame(Choreographer.java:544)
  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
  at android.os.Handler.handleCallback(Handler.java:733)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:4998)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:515)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:811)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:627)
  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>I am simply using this device and have no control on how the <code>Surface</code> or custom views have been implemented. Is there any workaround for this issue. My app freezes after such an error. </p>