title: Failed to unregister input channel
body: <p>In one of my marketplace apps, I'm seeing a few reports of these from the wild from time to time, and can't determine why they are being thrown.  I'm not doing anything that I would consider unusual in my app.  Does anyone have any ideas?</p>
  
  <pre><code>java.lang.RuntimeException: Failed to unregister input channel.  status=-22
      at android.view.InputQueue.nativeUnregisterInputChannel(Native Method)
      at android.view.InputQueue.unregisterInputChannel(InputQueue.java:119)
      at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:2471)
      at android.view.ViewRootImpl.doDie(ViewRootImpl.java:4030)
      at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2790)
      at android.os.Handler.dispatchMessage(Handler.java:99)
      at android.os.Looper.loop(Looper.java:137)
      at android.app.ActivityThread.main(ActivityThread.java:4517)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:511)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
      at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>I'm seeing plenty of hits for "Failed to <em>register</em> input channel", but none for <em>unregister</em>, hence the reason for this question.</p>
  
  <p>I tried searching but came up with only this from the AOSP tree as the exception origin:</p>
  
  <pre><code>from: aosp-frameworks-base / core / jni / android_view_InputQueue.cpp
  
  static void android_view_InputQueue_nativeUnregisterInputChannel(JNIEnv* env, jclass clazz,
          jobject inputChannelObj) {
      status_t status = gNativeInputQueue.unregisterInputChannel(env, inputChannelObj);
  
      if (status) {
          String8 message;
          message.appendFormat("Failed to unregister input channel.  status=%d", status); &lt;-- POSSIBLY THROWING THIS EXCEPTION
          jniThrowRuntimeException(env, message.string());
      }
  }
  </code></pre>