title: Android WebView crashes when video ends on KitKat
body: <p>As the title states, when I play a <code>full-screen</code> video in the WebView (i.e. a YouTube video) and let it play all the way to the end, the WebView crashes with <code>VM Aborting</code> and <code>Fatal Signal 6 (SIGABRT)</code> errors as shown below:</p>
  
  <pre><code>01-06 15:36:38.489: W/dalvikvm(2940): Invalid indirect reference 0x10 in decodeIndirectRef
  01-06 15:36:38.489: I/dalvikvm(2940): "main" prio=5 tid=1 RUNNABLE
  01-06 15:36:38.489: I/dalvikvm(2940):   | group="main" sCount=0 dsCount=0 obj=0x41854ca8 self=0x418433c8
  01-06 15:36:38.489: I/dalvikvm(2940):   | sysTid=2940 nice=-6 sched=0/0 cgrp=apps handle=1074430292
  01-06 15:36:38.489: I/dalvikvm(2940):   | state=R schedstat=( 0 0 0 ) utm=413 stm=91 core=0
  01-06 15:36:38.489: I/dalvikvm(2940):   at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
  01-06 15:36:38.489: I/dalvikvm(2940):   at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:27)
  01-06 15:36:38.489: I/dalvikvm(2940):   at android.os.Handler.dispatchMessage(Handler.java:102)
  01-06 15:36:38.489: I/dalvikvm(2940):   at android.os.Looper.loop(Looper.java:136)
  01-06 15:36:38.489: I/dalvikvm(2940):   at android.app.ActivityThread.main(ActivityThread.java:5017)
  01-06 15:36:38.489: I/dalvikvm(2940):   at java.lang.reflect.Method.invokeNative(Native Method)
  01-06 15:36:38.489: I/dalvikvm(2940):   at java.lang.reflect.Method.invoke(Method.java:515)
  01-06 15:36:38.489: I/dalvikvm(2940):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
  01-06 15:36:38.489: I/dalvikvm(2940):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
  01-06 15:36:38.489: I/dalvikvm(2940):   at dalvik.system.NativeStart.main(Native Method)
  01-06 15:36:38.489: E/dalvikvm(2940): VM aborting
  01-06 15:36:38.489: A/libc(2940): Fatal signal 6 (SIGABRT) at 0x00000b7c (code=-6), thread 2940 (acr.browser)
  </code></pre>
  
  <p>I would normally have assumed that I did something wrong in my <code>onHideCustomView</code> or <code>onShowCustomView</code> but my code appears fine and worked on Jelly Bean. In fact, when I take the old code I was using for Jelly Bean, set the TargetSdk to 18 and play the video, <code>onHideCustomView</code> is called when the video finishes and there are no errors. As soon as I switch it to TargetSdk 19, it isn't called and just crashes with the above error. I am at a loss as to how to fix it.</p>
  
  <p>Below, you can find my <code>onShowCustomView</code> and <code>onHideCustomView</code> code as that is the only place I imagine there could be an error. There are no new methods in KitKat that tell the WebView when a video has finished.</p>
  
  <pre><code>    @Override
      public void onShowCustomView(View view, int requestedOrientation, CustomViewCallback callback) {
          // if a view already exists then immediately terminate the new one
  
          if (mCustomView != null) {
              callback.onCustomViewHidden();
              return;
          }
          view.setKeepScreenOn(true);
          mOriginalOrientation = getRequestedOrientation();
          FrameLayout decor = (FrameLayout) getWindow().getDecorView();
          mFullscreenContainer = new FullscreenHolder(this);
          mFullscreenContainer.addView(view, COVER_SCREEN_PARAMS);
          decor.addView(mFullscreenContainer, COVER_SCREEN_PARAMS);
          mCustomView = view;
          setFullscreen(true);
          mCurrentView.getWebView().setVisibility(View.INVISIBLE);
          mCustomViewCallback = callback;
      }
  
      @Override
      public void onHideCustomView() {
          if (mCustomView == null &amp;&amp; mCustomViewCallback == null)
              return;
          mCurrentView.getWebView().setVisibility(View.VISIBLE);
          mCustomView.setKeepScreenOn(false);
          setFullscreen(false);
          FrameLayout decor = (FrameLayout) getWindow().getDecorView();
          decor.removeView(mFullscreenContainer);
          mFullscreenContainer = null;
          mCustomView = null;
          mCustomViewCallback.onCustomViewHidden();
          // Show the content view.
          setRequestedOrientation(mOriginalOrientation);
      }
  </code></pre>
  
  <p>Thanks for any help anyone can give me.</p>