diff --git a/mobile/android/base/AppConstants.java.in b/mobile/android/base/AppConstants.java.in index 9977d73314c..fed41782d19 100644 --- a/mobile/android/base/AppConstants.java.in +++ b/mobile/android/base/AppConstants.java.in @@ -22,8 +22,6 @@ import android.os.Build; @RobocopTarget public class AppConstants { public static final String ANDROID_PACKAGE_NAME = "@ANDROID_PACKAGE_NAME@"; - // Maintain a separate search package name so that we can speciailize it in the standalone search project - public static final String SEARCH_PACKAGE_NAME = "@ANDROID_PACKAGE_NAME@"; public static final String MANGLED_ANDROID_PACKAGE_NAME = "@MANGLED_ANDROID_PACKAGE_NAME@"; /** diff --git a/mobile/android/search/java/org/mozilla/search/SearchWidget.java b/mobile/android/search/java/org/mozilla/search/SearchWidget.java index 18da762ed85..8d237ccd354 100644 --- a/mobile/android/search/java/org/mozilla/search/SearchWidget.java +++ b/mobile/android/search/java/org/mozilla/search/SearchWidget.java @@ -61,42 +61,39 @@ public class SearchWidget extends AppWidgetProvider { @Override public void onReceive(final Context context, final Intent intent) { - // This will hold the intent to redispatch + // This will hold the intent to redispatch. final Intent redirect; - if (intent.getAction().equals(ACTION_LAUNCH_BROWSER)) { - redirect = buildRedirectIntent(Intent.ACTION_MAIN, - AppConstants.ANDROID_PACKAGE_NAME, - AppConstants.BROWSER_INTENT_CLASS_NAME, - intent); - Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH, - TelemetryContract.Method.WIDGET, "browser"); - } else if (intent.getAction().equals(ACTION_LAUNCH_NEW_TAB)) { + switch (intent.getAction()) { + case ACTION_LAUNCH_BROWSER: + redirect = buildRedirectIntent(Intent.ACTION_MAIN, + AppConstants.ANDROID_PACKAGE_NAME, + AppConstants.BROWSER_INTENT_CLASS_NAME, + intent); + Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH, + TelemetryContract.Method.WIDGET, "browser"); + break; + case ACTION_LAUNCH_NEW_TAB: redirect = buildRedirectIntent(Intent.ACTION_VIEW, - AppConstants.ANDROID_PACKAGE_NAME, - AppConstants.BROWSER_INTENT_CLASS_NAME, - intent); - Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH, - TelemetryContract.Method.WIDGET, "new-tab"); - } else if (intent.getAction().equals(ACTION_LAUNCH_SEARCH)) { - redirect = buildRedirectIntent(Intent.ACTION_VIEW, - AppConstants.SEARCH_PACKAGE_NAME, - AppConstants.SEARCH_INTENT_CLASS_NAME, - intent); - Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH, - TelemetryContract.Method.WIDGET, "search"); - } else { - redirect = null; + AppConstants.ANDROID_PACKAGE_NAME, + AppConstants.BROWSER_INTENT_CLASS_NAME, + intent); + Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH, + TelemetryContract.Method.WIDGET, "new-tab"); + break; + case ACTION_LAUNCH_SEARCH: + redirect = buildRedirectIntent(Intent.ACTION_VIEW, + AppConstants.ANDROID_PACKAGE_NAME, + AppConstants.SEARCH_INTENT_CLASS_NAME, + intent); + Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH, + TelemetryContract.Method.WIDGET, "search"); + break; + default: + redirect = null; } if (redirect != null) { - try { - context.startActivity(redirect); - } catch(Exception ex) { - // When this is built stand alone, its hardcoded to try and launch nightly. - // If that fails, just fire a generic VIEW intent. - Intent redirect2 = buildRedirectIntent(Intent.ACTION_VIEW, null, null, intent); - context.startActivity(redirect2); - } + context.startActivity(redirect); } super.onReceive(context, intent); @@ -142,4 +139,4 @@ public class SearchWidget extends AppWidgetProvider { return activity; } -} \ No newline at end of file +}