Bug 1240560 - After shortcut is created, show the mobile desktop. r=sebastian
authorNevin Chen <cnevinchen@gmail.com>
Thu, 24 Nov 2016 10:57:19 +0800
changeset 324233 c08d0aa688dcd1d9e264da3ecf0a2bf1a81c6b28
parent 324232 df6b2f6295009fbe4158b8e3e703cede5e854ed2
child 324234 36c0196cf2ef2b1753e464a1d29621003c3d7e2c
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewerssebastian
bugs1240560
milestone53.0a1
Bug 1240560 - After shortcut is created, show the mobile desktop. r=sebastian MozReview-Commit-ID: 21YzmJfNC6E
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
mobile/android/base/java/org/mozilla/gecko/promotion/HomeScreenPrompt.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ActivityUtils.java
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -1926,16 +1926,19 @@ public abstract class GeckoApp
         intent.putExtra("duplicate", false);
 
         intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
         getApplicationContext().sendBroadcast(intent);
 
         // Remember interaction
         final UrlAnnotations urlAnnotations = BrowserDB.from(getApplicationContext()).getUrlAnnotations();
         urlAnnotations.insertHomeScreenShortcut(getContentResolver(), aURI, true);
+
+        // After shortcut is created, show the mobile desktop.
+        ActivityUtils.goToHomeScreen(this);
     }
 
     private Bitmap getLauncherIcon(Bitmap aSource, int size) {
         final float[] DEFAULT_LAUNCHER_ICON_HSV = { 32.0f, 1.0f, 1.0f };
         final int kOffset = 6;
         final int kRadius = 5;
 
         int insetSize = aSource != null ? size * 2 / 3 : size;
--- a/mobile/android/base/java/org/mozilla/gecko/promotion/HomeScreenPrompt.java
+++ b/mobile/android/base/java/org/mozilla/gecko/promotion/HomeScreenPrompt.java
@@ -120,16 +120,18 @@ public class HomeScreenPrompt extends Lo
         ThreadUtils.postToBackgroundThread(new Runnable() {
             @Override
             public void run() {
                 GeckoAppShell.createShortcut(title, url);
 
                 Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.BUTTON, TELEMETRY_EXTRA);
 
                 ActivityUtils.goToHomeScreen(HomeScreenPrompt.this);
+
+                finish();
             }
         });
     }
 
 
 
     private void loadShortcutIcon() {
         Icons.with(this)
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ActivityUtils.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ActivityUtils.java
@@ -63,11 +63,10 @@ public class ActivityUtils {
      */
     public static void goToHomeScreen(Activity activity) {
         Intent intent = new Intent(Intent.ACTION_MAIN);
 
         intent.addCategory(Intent.CATEGORY_HOME);
         intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         activity.startActivity(intent);
 
-        activity.finish();
     }
 }