Bug 1145581 - Show tabs when opening fennec from the Tab Queue notification (r=mcomella)
authorMartyn Haigh <martyn.haigh@gmail.com>
Fri, 27 Mar 2015 11:58:30 +0000
changeset 266273 d629b3d07fa91218096d39ae3fb1a30ba6df7587
parent 266272 58b3c3a8e8a8f24ba81a0cc8135dd9b5cbc3c2c1
child 266274 676a58f4538556afb2c2d5564f7a965f94bd4820
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs1145581
milestone39.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
Bug 1145581 - Show tabs when opening fennec from the Tab Queue notification (r=mcomella)
mobile/android/base/BrowserApp.java
mobile/android/base/tabqueue/TabQueueHelper.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -3391,16 +3391,17 @@ public class BrowserApp extends GeckoApp
      * open a new tab with about:feedback when launching the app from the icon shortcut.
      */
     @Override
     protected void onNewIntent(Intent intent) {
         String action = intent.getAction();
 
         final boolean isViewAction = Intent.ACTION_VIEW.equals(action);
         final boolean isBookmarkAction = GeckoApp.ACTION_HOMESCREEN_SHORTCUT.equals(action);
+        final boolean isTabQueueAction = TabQueueHelper.LOAD_URLS_ACTION.equals(action);
 
         if (mInitialized && (isViewAction || isBookmarkAction)) {
             // Dismiss editing mode if the user is loading a URL from an external app.
             mBrowserToolbar.cancelEdit();
 
             // Hide firstrun-pane if the user is loading a URL from an external app.
             hideFirstrunPager();
 
@@ -3419,16 +3420,27 @@ public class BrowserApp extends GeckoApp
             GeckoAppShell.sendEventToGecko(GeckoEvent.createURILoadEvent(uri));
         }
 
         // Only solicit feedback when the app has been launched from the icon shortcut.
         if (GuestSession.NOTIFICATION_INTENT.equals(action)) {
             GuestSession.handleIntent(this, intent);
         }
 
+        // If the user has clicked the tab queue notification then load the tabs.
+        if(AppConstants.NIGHTLY_BUILD  && AppConstants.MOZ_ANDROID_TAB_QUEUE && mInitialized && isTabQueueAction) {
+            int queuedTabCount = TabQueueHelper.getTabQueueLength(this);
+            TabQueueHelper.openQueuedUrls(this, mProfile, TabQueueHelper.FILE_NAME);
+
+            // If there's more than one tab then also show the tabs panel.
+            if (queuedTabCount > 1) {
+                showNormalTabs();
+            }
+        }
+
         if (!mInitialized || !Intent.ACTION_MAIN.equals(action)) {
             return;
         }
 
         // Check to see how many times the app has been launched.
         final String keyName = getPackageName() + ".feedback_launch_count";
         final StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskReads();
 
--- a/mobile/android/base/tabqueue/TabQueueHelper.java
+++ b/mobile/android/base/tabqueue/TabQueueHelper.java
@@ -98,17 +98,17 @@ public class TabQueueHelper {
         final SharedPreferences prefs = GeckoSharedPrefs.forApp(context);
 
         boolean tabQueueEnabled = prefs.getBoolean(GeckoPreferences.PREFS_TAB_QUEUE, false);
         int tabsQueued = prefs.getInt(PREF_TAB_QUEUE_COUNT, 0);
 
         return tabQueueEnabled && tabsQueued > 0;
     }
 
-    private static int getTabQueueLength(final Context context) {
+    public static int getTabQueueLength(final Context context) {
         ThreadUtils.assertNotOnUiThread();
 
         // TODO: Use profile shared prefs when bug 1147925 gets fixed.
         final SharedPreferences prefs = GeckoSharedPrefs.forApp(context);
         return prefs.getInt(PREF_TAB_QUEUE_COUNT, 0);
     }
 
     public static void openQueuedUrls(final Context context, final GeckoProfile profile, final String filename) {