Bug 801627 - Fix fullscreen Flash on Android r=blassey
authorJames Willcox <jwillcox@mozilla.com>
Mon, 22 Oct 2012 10:51:29 -0400
changeset 111195 b1e1fbb9f169c219fe9c05b4f45d07932927eeed
parent 111194 d7b878ec3d7d34c02d6cdb50e9efb57df856b765
child 111196 74b38f9c3cb009fe01d2cae9e722750b195be087
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersblassey
bugs801627
milestone19.0a1
Bug 801627 - Fix fullscreen Flash on Android r=blassey
mobile/android/base/GeckoApp.java
mobile/android/base/gfx/LayerView.java
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -1352,25 +1352,25 @@ abstract public class GeckoApp
             Log.w(LOGTAG, "Passed view is not the current full screen view");
             return;
         }
 
         mFullScreenPluginContainer.removeView(mFullScreenPluginView);
 
         // We need do do this on the next iteration in order to avoid
         // a deadlock, see comment below in FullScreenHolder
-        mMainHandler.post(new Runnable() { 
+        mMainHandler.post(new Runnable() {
             public void run() {
-                mLayerView.setVisibility(View.VISIBLE);
+                mLayerView.show();
             }
         });
 
         FrameLayout decor = (FrameLayout)getWindow().getDecorView();
         decor.removeView(mFullScreenPluginContainer);
-        
+
         mFullScreenPluginView = null;
 
         GeckoScreenOrientationListener.getInstance().unlockScreenOrientation();
         setFullScreen(false);
     }
 
     void removePluginView(final View view, final boolean isFullScreen) {
         mMainHandler.post(new Runnable() { 
@@ -2646,17 +2646,17 @@ abstract public class GeckoApp
              * event to be sent to Gecko. We synchronously wait for that to be
              * processed. Simultaneously, however, Flash is waiting on a mutex so
              * the post() below is an attempt to avoid a deadlock.
              */
             super.addView(view, index);
 
             mMainHandler.post(new Runnable() { 
                 public void run() {
-                    mLayerView.setVisibility(View.INVISIBLE);
+                    mLayerView.hide();
                 }
             });
         }
 
         /**
          * The methods below are simply copied from what Android WebKit does.
          * It wasn't ever called in my testing, but might as well
          * keep it in case it is for some reason. The methods
--- a/mobile/android/base/gfx/LayerView.java
+++ b/mobile/android/base/gfx/LayerView.java
@@ -105,16 +105,26 @@ public class LayerView extends FrameLayo
         mInputConnectionHandler = null;
 
         setFocusable(true);
         setFocusableInTouchMode(true);
 
         GeckoAccessibility.setDelegate(this);
     }
 
+    public void show() {
+        // Fix this if TextureView support is turned back on above
+        mSurfaceView.setVisibility(View.VISIBLE);
+    }
+
+    public void hide() {
+        // Fix this if TextureView support is turned back on above
+        mSurfaceView.setVisibility(View.INVISIBLE);
+    }
+
     public void destroy() {
         if (mLayerClient != null) {
             mLayerClient.destroy();
         }
         if (mRenderer != null) {
             mRenderer.destroy();
         }
     }