Back out bug 1395841 - Part 2 for breaking PWA shortcut installation r=me
authorJames Willcox <snorp@snorp.net>
Mon, 02 Oct 2017 14:12:37 -0500
changeset 426600 4d4e89492b76f33cea17e294661d7a519d4379c5
parent 426599 8222a2787c3c432ff252565d5d551a65faa9f224
child 426601 a42ecd2ce80cd7d2362f888fd3c4905aa95189e5
push id97
push userfmarier@mozilla.com
push dateSat, 14 Oct 2017 01:12:59 +0000
reviewersme
bugs1395841
milestone58.0a1
Back out bug 1395841 - Part 2 for breaking PWA shortcut installation r=me This reverts commit eadc939a6ecf5eaff2a233f7015e814cc76a33ed. MozReview-Commit-ID: 2V2oF1PC5cf
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/menu/ActivityStreamContextMenu.java
mobile/android/base/java/org/mozilla/gecko/delegates/BookmarkStateChangeDelegate.java
mobile/android/base/java/org/mozilla/gecko/home/HomeFragment.java
mobile/android/base/java/org/mozilla/gecko/promotion/HomeScreenPrompt.java
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -1501,17 +1501,17 @@ public class BrowserApp extends GeckoApp
             final String title = tab.getDisplayTitle();
             if (url == null || title == null) {
                 return true;
             }
 
             ThreadUtils.postToBackgroundThread(new Runnable() {
                 @Override
                 public void run() {
-                    GeckoApplication.createBrowserShortcut(title, url);
+                    GeckoApplication.createShortcut(title, url);
                 }
             });
 
             Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU,
                 getResources().getResourceEntryName(itemId));
             return true;
         }
 
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
@@ -42,17 +42,16 @@ import org.mozilla.gecko.util.ActivityUt
 import org.mozilla.gecko.telemetry.TelemetryBackgroundReceiver;
 import org.mozilla.gecko.util.BundleEventListener;
 import org.mozilla.gecko.util.EventCallback;
 import org.mozilla.gecko.util.GeckoBundle;
 import org.mozilla.gecko.util.HardwareUtils;
 import org.mozilla.gecko.util.PRNGFixes;
 import org.mozilla.gecko.util.ShortcutUtils;
 import org.mozilla.gecko.util.ThreadUtils;
-import org.mozilla.gecko.util.UIAsyncTask;
 
 import java.io.File;
 import java.lang.reflect.Method;
 import java.util.UUID;
 
 public class GeckoApplication extends Application
                               implements HapticFeedbackDelegate {
     private static final String LOG_TAG = "GeckoApplication";
--- a/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/menu/ActivityStreamContextMenu.java
+++ b/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/menu/ActivityStreamContextMenu.java
@@ -279,22 +279,17 @@ public abstract class ActivityStreamCont
                 });
                 break;
 
             case R.id.copy_url:
                 Clipboard.setText(item.getUrl());
                 break;
 
             case R.id.add_homescreen:
-                ThreadUtils.postToBackgroundThread(new Runnable() {
-                    @Override
-                    public void run() {
-                        GeckoApplication.createBrowserShortcut(item.getTitle(), item.getUrl());
-                    }
-                });
+                GeckoApplication.createShortcut(item.getTitle(), item.getUrl());
                 break;
 
             case R.id.open_new_tab:
                 onUrlOpenInBackgroundListener.onUrlOpenInBackgroundWithReferrer(item.getUrl(), referrerUri,
                         EnumSet.noneOf(HomePager.OnUrlOpenInBackgroundListener.Flags.class));
                 break;
 
             case R.id.open_new_private_tab:
--- a/mobile/android/base/java/org/mozilla/gecko/delegates/BookmarkStateChangeDelegate.java
+++ b/mobile/android/base/java/org/mozilla/gecko/delegates/BookmarkStateChangeDelegate.java
@@ -179,17 +179,17 @@ public class BookmarkStateChangeDelegate
 
                     final String url = tab.getURL();
                     final String title = tab.getDisplayTitle();
 
                     if (url != null && title != null) {
                         ThreadUtils.postToBackgroundThread(new Runnable() {
                             @Override
                             public void run() {
-                                GeckoApplication.createBrowserShortcut(title, url);
+                                GeckoApplication.createShortcut(title, url);
                             }
                         });
                     }
                 }
             }
         });
 
         final PromptListItem[] items = new PromptListItem[2];
--- a/mobile/android/base/java/org/mozilla/gecko/home/HomeFragment.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/HomeFragment.java
@@ -304,17 +304,18 @@ public abstract class HomeFragment exten
                 return false;
             }
 
             // Fetch an icon big enough for use as a home screen icon.
             final String displayTitle = info.getDisplayTitle();
             ThreadUtils.postToBackgroundThread(new Runnable() {
                 @Override
                 public void run() {
-                    GeckoApplication.createBrowserShortcut(displayTitle, info.url);
+                    GeckoApplication.createShortcut(displayTitle, info.url);
+
                 }
             });
 
             Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "home_add_to_launcher");
             return true;
         }
 
         if (itemId == R.id.home_open_private_tab || itemId == R.id.home_open_new_tab) {
--- a/mobile/android/base/java/org/mozilla/gecko/promotion/HomeScreenPrompt.java
+++ b/mobile/android/base/java/org/mozilla/gecko/promotion/HomeScreenPrompt.java
@@ -115,27 +115,29 @@ public class HomeScreenPrompt extends Lo
             }
         });
     }
 
     private void addToHomeScreen() {
         ThreadUtils.postToBackgroundThread(new Runnable() {
             @Override
             public void run() {
-                GeckoApplication.createBrowserShortcut(title, url);
+                GeckoApplication.createShortcut(title, url);
 
                 Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.BUTTON, TELEMETRY_EXTRA);
 
                 ActivityUtils.goToHomeScreen(HomeScreenPrompt.this);
 
                 finish();
             }
         });
     }
 
+
+
     private void loadShortcutIcon() {
         Icons.with(this)
                 .pageUrl(url)
                 .skipNetwork()
                 .skipMemory()
                 .forLauncherIcon()
                 .build()
                 .execute(this);