Backout bug 1294823 because I accidentally pushed the wrong patch r=me
authorJames Willcox <snorp@snorp.net>
Tue, 23 Aug 2016 09:44:55 -0500
changeset 352212 a924e27a4666b61f16905163f9516df5f3b5fb61
parent 352211 b6e4605e1217e7ac04f2ac2e9f3dee9cd160414a
child 352213 fdea18c3afa6dcb007f066c393185b14ec083e0a
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1294823
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backout bug 1294823 because I accidentally pushed the wrong patch r=me
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
mobile/android/base/java/org/mozilla/gecko/media/FullScreenMediaController.java
mobile/android/base/java/org/mozilla/gecko/media/VideoFrameLayout.java
mobile/android/base/moz.build
mobile/android/base/resources/layout/gecko_app.xml
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -6,16 +6,17 @@
 package org.mozilla.gecko;
 
 import android.Manifest;
 import android.app.DownloadManager;
 import android.os.Environment;
 import android.support.annotation.CheckResult;
 import android.support.annotation.NonNull;
 
+import android.widget.VideoView;
 import android.graphics.Rect;
 
 import org.json.JSONArray;
 import org.mozilla.gecko.activitystream.ActivityStream;
 import org.mozilla.gecko.adjust.AdjustHelperInterface;
 import org.mozilla.gecko.adjust.AttributionHelperListener;
 import org.mozilla.gecko.annotation.RobocopTarget;
 import org.mozilla.gecko.AppConstants.Versions;
@@ -52,18 +53,16 @@ import org.mozilla.gecko.home.HomeConfig
 import org.mozilla.gecko.home.HomeFragment;
 import org.mozilla.gecko.home.HomePager.OnUrlOpenInBackgroundListener;
 import org.mozilla.gecko.home.HomePager.OnUrlOpenListener;
 import org.mozilla.gecko.home.HomePanelsManager;
 import org.mozilla.gecko.home.HomeScreen;
 import org.mozilla.gecko.home.SearchEngine;
 import org.mozilla.gecko.javaaddons.JavaAddonManager;
 import org.mozilla.gecko.media.AudioFocusAgent;
-import org.mozilla.gecko.media.FullScreenMediaController;
-import org.mozilla.gecko.media.VideoFrameLayout;
 import org.mozilla.gecko.menu.GeckoMenu;
 import org.mozilla.gecko.menu.GeckoMenuItem;
 import org.mozilla.gecko.mozglue.SafeIntent;
 import org.mozilla.gecko.notifications.NotificationClient;
 import org.mozilla.gecko.notifications.ServiceNotificationClient;
 import org.mozilla.gecko.overlays.ui.ShareDialog;
 import org.mozilla.gecko.permissions.Permissions;
 import org.mozilla.gecko.preferences.ClearOnShutdownPref;
@@ -124,17 +123,16 @@ import android.content.ContentResolver;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.content.res.Resources;
 import android.graphics.Bitmap;
-import android.graphics.Color;
 import android.graphics.drawable.BitmapDrawable;
 import android.net.Uri;
 import android.nfc.NdefMessage;
 import android.nfc.NdefRecord;
 import android.nfc.NfcAdapter;
 import android.nfc.NfcEvent;
 import android.os.Build;
 import android.os.Bundle;
@@ -159,20 +157,18 @@ import android.view.MotionEvent;
 import android.view.SubMenu;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewStub;
 import android.view.ViewTreeObserver;
 import android.view.Window;
 import android.view.animation.Interpolator;
 import android.widget.Button;
-import android.widget.FrameLayout;
 import android.widget.ListView;
 import android.widget.RelativeLayout;
-import android.widget.VideoView;
 import android.widget.ViewFlipper;
 import com.keepsafe.switchboard.AsyncConfigLoader;
 import com.keepsafe.switchboard.SwitchBoard;
 import android.animation.Animator;
 import android.animation.ObjectAnimator;
 import org.json.JSONException;
 import org.json.JSONObject;
 
@@ -235,17 +231,16 @@ public class BrowserApp extends GeckoApp
     private static final String EOL_NOTIFIED = "eol_notified";
 
     private BrowserSearch mBrowserSearch;
     private View mBrowserSearchContainer;
 
     public ViewGroup mBrowserChrome;
     public ViewFlipper mActionBarFlipper;
     public ActionModeCompatView mActionBar;
-    private VideoFrameLayout mVideoLayout;
     private BrowserToolbar mBrowserToolbar;
     private View mDoorhangerOverlay;
     // We can't name the TabStrip class because it's not included on API 9.
     private TabStripInterface mTabStrip;
     private ToolbarProgressView mProgressView;
     private FirstrunAnimationContainer mFirstrunAnimationContainer;
     private HomeScreen mHomeScreen;
     private TabsPanel mTabsPanel;
@@ -582,18 +577,16 @@ public class BrowserApp extends GeckoApp
 
         initSwitchboard(this, intent, isInAutomation);
         initTelemetryUploader(isInAutomation);
 
         mBrowserChrome = (ViewGroup) findViewById(R.id.browser_chrome);
         mActionBarFlipper = (ViewFlipper) findViewById(R.id.browser_actionbar);
         mActionBar = (ActionModeCompatView) findViewById(R.id.actionbar);
 
-        mVideoLayout = (VideoFrameLayout) findViewById(R.id.video_layout);
-
         mBrowserToolbar = (BrowserToolbar) findViewById(R.id.browser_toolbar);
         mBrowserToolbar.setTouchEventInterceptor(new TouchEventInterceptor() {
             @Override
             public boolean onInterceptTouchEvent(View view, MotionEvent event) {
                 // Manually dismiss text selection bar if it's not overlaying the toolbar.
                 mTextSelection.dismiss();
                 return false;
             }
@@ -966,27 +959,16 @@ public class BrowserApp extends GeckoApp
             endActionModeCompat();
             return;
         }
 
         if (hideFirstrunPager(TelemetryContract.Method.BACK)) {
             return;
         }
 
-        if (mVideoLayout.isFullScreen()) {
-            mVideoLayout.setFullScreen(false);
-            setFullScreen(false);
-            return;
-        }
-
-        if (mVideoLayout.hasVideo()) {
-            mVideoLayout.removeVideo();
-            return;
-        }
-
         super.onBackPressed();
     }
 
     @Override
     public void onAttachedToWindow() {
         mDoorhangerOverlay = findViewById(R.id.doorhanger_overlay);
         mDoorhangerOverlay.setVisibility(View.VISIBLE);
 
@@ -2000,32 +1982,22 @@ public class BrowserApp extends GeckoApp
                 });
             } else if (event.equals("Video:Play")) {
                 final String uri = message.getString("uri");
                 final String uuid = message.getString("uuid");
                 ThreadUtils.postToUiThread(new Runnable() {
                     @Override
                     public void run() {
                         VideoView view = new VideoView(BrowserApp.this);
-                        FullScreenMediaController mediaController = new FullScreenMediaController(BrowserApp.this);
-                        mediaController.setFullScreenListener(new FullScreenMediaController.FullScreenListener() {
-                            @Override
-                            public void onFullScreenClicked() {
-                                boolean fullScreen = !BrowserApp.this.mVideoLayout.isFullScreen();
-                                BrowserApp.this.setFullScreen(fullScreen);
-                                BrowserApp.this.mVideoLayout.setFullScreen(fullScreen);
-                            }
-                        });
+                        android.widget.MediaController mediaController = new android.widget.MediaController(BrowserApp.this);
                         view.setMediaController(mediaController);
-                        mediaController.setAnchorView(view);
                         view.setVideoURI(Uri.parse(uri));
+                        BrowserApp.this.addFullScreenPluginView(view);
                         view.start();
 
-                        mVideoLayout.setVideo(view);
-
                         Telemetry.sendUIEvent(TelemetryContract.Event.SHOW, TelemetryContract.Method.CONTENT, "playhls");
                     }
                 });
             } else if (event.equals("Prompt:ShowTop")) {
                 // Bring this activity to front so the prompt is visible..
                 Intent bringToFrontIntent = new Intent();
                 bringToFrontIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, AppConstants.MOZ_ANDROID_BROWSER_INTENT_CLASS);
                 bringToFrontIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
deleted file mode 100644
--- a/mobile/android/base/java/org/mozilla/gecko/media/FullScreenMediaController.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.media;
-
-import android.content.Context;
-
-import android.graphics.Color;
-
-import android.view.View;
-
-import android.widget.ImageButton;
-import android.widget.LinearLayout;
-import android.widget.MediaController;
-
-public class FullScreenMediaController extends MediaController {
-    private FullScreenListener mFullScreenListener;
-
-    public FullScreenMediaController(Context ctx) {
-        super(ctx);
-    }
-
-    public void setFullScreenListener(FullScreenListener listener) {
-        mFullScreenListener = listener;
-    }
-
-    private void onFullScreenClicked() {
-        if (this.mFullScreenListener != null) {
-            mFullScreenListener.onFullScreenClicked();
-        }
-    }
-
-    @Override
-    public void setAnchorView(final View view) {
-        super.setAnchorView(view);
-
-        // Add the fullscreen button here because this is where the parent class actually creates
-        // the media buttons and their layout.
-        //
-        // http://androidxref.com/6.0.1_r10/xref/frameworks/base/core/java/android/widget/MediaController.java#239
-        ImageButton button = new ImageButton(getContext());
-        button.setBackgroundColor(Color.TRANSPARENT);
-        button.setImageResource(android.R.drawable.picture_frame);
-        button.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                FullScreenMediaController.this.onFullScreenClicked();
-            }
-        });
-
-        // The media buttons are in a horizontal linear layout which is itself packed into
-        // a vertical layout. The vertical layout is the only child of the FrameLayout which
-        // MediaController inherits from.
-        LinearLayout child = (LinearLayout)getChildAt(0);
-        LinearLayout buttons = (LinearLayout)child.getChildAt(0);
-
-        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
-        buttons.addView(button, params);
-    }
-
-    public interface FullScreenListener {
-        void onFullScreenClicked();
-    }
-}
\ No newline at end of file
deleted file mode 100644
--- a/mobile/android/base/java/org/mozilla/gecko/media/VideoFrameLayout.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.mozilla.gecko.media;
-
-import android.content.Context;
-
-import android.graphics.Color;
-
-import android.util.AttributeSet;
-import android.view.Gravity;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-import android.view.View;
-import android.widget.FrameLayout;
-import android.widget.VideoView;
-
-import org.mozilla.gecko.R;
-
-public class VideoFrameLayout extends FrameLayout {
-    private VideoView mVideo;
-    private boolean mIsFullScreen;
-
-    public VideoFrameLayout(Context ctx) {
-        this(ctx, null);
-    }
-
-    public VideoFrameLayout(Context ctx, AttributeSet attrs) {
-        this(ctx, attrs, 0);
-    }
-
-    public VideoFrameLayout(Context ctx, AttributeSet attrs, int defStyle) {
-        super(ctx, attrs, defStyle);
-    }
-
-    public void setVideo(VideoView video) {
-        if (mVideo != null) {
-            removeVideo();
-        }
-
-        mVideo = video;
-
-        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
-            FrameLayout.LayoutParams.MATCH_PARENT,
-            FrameLayout.LayoutParams.WRAP_CONTENT,
-            Gravity.CENTER);
-
-        addView(mVideo, layoutParams);
-        setVisibility(View.VISIBLE);
-
-        mVideo.setZOrderOnTop(true);
-    }
-
-    public boolean isFullScreen() {
-        return mIsFullScreen;
-    }
-
-    public void setFullScreen(boolean fullScreen) {
-        mIsFullScreen = fullScreen;
-        if (fullScreen) {
-            setBackgroundColor(Color.BLACK);
-        } else {
-            setBackgroundResource(R.color.dark_transparent_overlay);
-        }
-    }
-
-    public boolean hasVideo() {
-        return mVideo != null;
-    }
-
-    public void removeVideo() {
-        removeAllViews();
-        setVisibility(View.GONE);
-        mVideo = null;
-    }
-
-    @Override
-    public boolean onKeyDown(int keyCode, KeyEvent event) {
-        if (event.isSystem()) {
-            return super.onKeyDown(keyCode, event);
-        }
-        return true;
-    }
-
-    @Override
-    public boolean onKeyUp(int keyCode, KeyEvent event) {
-        if (event.isSystem()) {
-            return super.onKeyUp(keyCode, event);
-        }
-        return true;
-    }
-
-    @Override
-    public boolean onTouchEvent(MotionEvent event) {
-        super.onTouchEvent(event);
-        return true;
-    }
-
-    @Override
-    public boolean onTrackballEvent(MotionEvent event) {
-        super.onTrackballEvent(event);
-        return true;
-    }
-}
\ No newline at end of file
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -501,21 +501,19 @@ gbjar.sources += ['java/org/mozilla/geck
     'mdns/MulticastDNSManager.java',
     'media/AsyncCodec.java',
     'media/AsyncCodecFactory.java',
     'media/AudioFocusAgent.java',
     'media/Codec.java',
     'media/CodecManager.java',
     'media/CodecProxy.java',
     'media/FormatParam.java',
-    'media/FullScreenMediaController.java',
     'media/JellyBeanAsyncCodec.java',
     'media/MediaControlService.java',
     'media/Sample.java',
-    'media/VideoFrameLayout.java',
     'MediaCastingBar.java',
     'MemoryMonitor.java',
     'menu/GeckoMenu.java',
     'menu/GeckoMenuInflater.java',
     'menu/GeckoMenuItem.java',
     'menu/GeckoSubMenu.java',
     'menu/MenuItemActionBar.java',
     'menu/MenuItemDefault.java',
--- a/mobile/android/base/resources/layout/gecko_app.xml
+++ b/mobile/android/base/resources/layout/gecko_app.xml
@@ -45,23 +45,16 @@
 
             <FrameLayout android:id="@+id/camera_layout"
                          android:layout_height="wrap_content"
                          android:layout_width="wrap_content"
                          android:layout_alignParentRight="true"
                          android:layout_alignParentBottom="true">
             </FrameLayout>
 
-            <view class="org.mozilla.gecko.VideoFrameLayout" android:id="@+id/video_layout"
-                         android:layout_height="match_parent"
-                         android:layout_width="match_parent"
-                         android:visibility="gone"
-                         android:background="@color/dark_transparent_overlay">
-            </view>
-
             <ViewStub android:id="@+id/zoomed_view_stub"
                       android:inflatedId="@+id/zoomed_view"
                       android:layout="@layout/zoomed_view"
                       android:layout_width="wrap_content"
                       android:layout_height="wrap_content" />
 
             <FrameLayout android:id="@+id/home_screen_container"
                          android:layout_width="match_parent"