Backed out changeset a1d7b16101c7 (bug 1064669). r=mfinkle
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Fri, 03 Oct 2014 14:27:16 +0200
changeset 233221 6976df8915c4ee76aad6bb00e3535bc2d2c41060
parent 233220 54a2ae5e9c1810599a739534ad9af1a8b7919648
child 233222 6ebee67371f43f5942ae4de4be6de58428131e50
push id611
push userraliiev@mozilla.com
push dateMon, 05 Jan 2015 23:23:16 +0000
treeherdermozilla-release@345cd3b9c445 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs1064669
milestone35.0a1
backs outa1d7b16101c718acb913416bd36608c098c29b87
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
Backed out changeset a1d7b16101c7 (bug 1064669). r=mfinkle
mobile/android/base/BrowserApp.java
mobile/android/base/GeckoApp.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -659,16 +659,26 @@ public class BrowserApp extends GeckoApp
             public void onEnabledChanged(boolean enabled) {
                 setDynamicToolbarEnabled(enabled);
             }
         });
 
         // Set the maximum bits-per-pixel the favicon system cares about.
         IconDirectoryEntry.setMaxBPP(GeckoAppShell.getScreenDepth());
 
+        Class<?> mediaManagerClass = getMediaPlayerManager();
+        if (mediaManagerClass != null) {
+            try {
+                Method init = mediaManagerClass.getMethod("init", Context.class);
+                init.invoke(null, this);
+            } catch(Exception ex) {
+                Log.e(LOGTAG, "Error initializing media manager", ex);
+            }
+        }
+
         if (getProfile().inGuestMode()) {
             GuestSession.showNotification(this);
         } else {
             // If we're restarting, we won't destroy the activity. Make sure we remove any guest notifications that might have been shown.
             GuestSession.hideNotification(this);
         }
     }
 
@@ -1534,42 +1544,28 @@ public class BrowserApp extends GeckoApp
                     @Override
                     public void run() {
                         // Force tabs panel inflation once the initial
                         // pageload is finished.
                         ensureTabsPanelExists();
                     }
                 });
 
-                if (AppConstants.MOZ_MEDIA_PLAYER) {
-                    // If casting is disabled, these classes aren't built. We use reflection to initialize them.
-                    Class<?> mediaManagerClass = getMediaPlayerManager();
-                    if (mediaManagerClass != null) {
-                        try {
-                            Method init = mediaManagerClass.getMethod("init", Context.class);
-                            init.invoke(null, this);
-                        } catch(Exception ex) {
-                            Log.e(LOGTAG, "Error initializing media manager", ex);
-                        }
-                    }
-                }
-
                 if (AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED) {
                     // Start (this acts as ping if started already) the stumbler lib; if the stumbler has queued data it will upload it.
                     // Stumbler operates on its own thread, and startup impact is further minimized by delaying work (such as upload) a few seconds.
                     // Avoid any potential startup CPU/thread contention by delaying the pref broadcast.
                     final long oneSecondInMillis = 1000;
                     ThreadUtils.getBackgroundHandler().postDelayed(new Runnable() {
                         @Override
                         public void run() {
                              GeckoPreferences.broadcastStumblerPref(BrowserApp.this);
                         }
                     }, oneSecondInMillis);
                 }
-
                 super.handleMessage(event, message);
             } else if (event.equals("Gecko:Ready")) {
                 // Handle this message in GeckoApp, but also enable the Settings
                 // menuitem, which is specific to BrowserApp.
                 super.handleMessage(event, message);
                 final Menu menu = mMenu;
                 ThreadUtils.postToUiThread(new Runnable() {
                     @Override
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -186,17 +186,16 @@ public abstract class GeckoApp
     private HashMap<String, PowerManager.WakeLock> mWakeLocks = new HashMap<String, PowerManager.WakeLock>();
 
     protected boolean mShouldRestore;
     protected boolean mInitialized;
     private Telemetry.Timer mJavaUiStartupTimer;
     private Telemetry.Timer mGeckoReadyStartupTimer;
 
     private String mPrivateBrowsingSession;
-    private volatile boolean mIsPaused = true;
 
     private volatile HealthRecorder mHealthRecorder;
     private volatile Locale mLastLocale;
 
     private EventListener mWebappEventListener;
 
     abstract public int getLayout();
     abstract public boolean hasTabsSideBar();
@@ -242,23 +241,17 @@ public abstract class GeckoApp
         return this;
     }
 
     public View getCameraView() {
         return mCameraView;
     }
 
     public void addAppStateListener(GeckoAppShell.AppStateListener listener) {
-        ThreadUtils.assertOnUiThread();
         mAppStateListeners.add(listener);
-
-        // If we're already resumed, make sure the listener gets a notification.
-        if (!mIsPaused) {
-            listener.onResume();
-        }
     }
 
     public void removeAppStateListener(GeckoAppShell.AppStateListener listener) {
         mAppStateListeners.remove(listener);
     }
 
     public FormAssistPopup getFormAssistPopup() {
         return mFormAssistPopup;
@@ -1887,18 +1880,16 @@ public abstract class GeckoApp
             GeckoAccessibility.updateAccessibilitySettings(this);
         }
 
         if (mAppStateListeners != null) {
             for (GeckoAppShell.AppStateListener listener: mAppStateListeners) {
                 listener.onResume();
             }
         }
-        // Setting this state will force any listeners added after this to have their onResume() method called
-        mIsPaused = false;
 
         // We use two times: a pseudo-unique wall-clock time to identify the
         // current session across power cycles, and the elapsed realtime to
         // track the duration of the session.
         final long now = System.currentTimeMillis();
         final long realTime = android.os.SystemClock.elapsedRealtime();
 
         ThreadUtils.postToBackgroundThread(new Runnable() {
@@ -1965,19 +1956,16 @@ public abstract class GeckoApp
 
                 // In theory, the first browser session will not run long enough that we need to
                 // prune during it and we'd rather run it when the browser is inactive so we wait
                 // until here to register the prune service.
                 GeckoPreferences.broadcastHealthReportPrune(context);
             }
         });
 
-        // Setting this state will keep any listeners registered after this from having their onResume
-        // method called.
-        mIsPaused = true;
         if (mAppStateListeners != null) {
             for(GeckoAppShell.AppStateListener listener: mAppStateListeners) {
                 listener.onPause();
             }
         }
 
         super.onPause();
     }