Bug 1078394 - Remove AppConstants.SEARCH_PACKAGE_NAME. r=margaret

This commit is contained in:
Richard Newman 2014-10-06 12:01:51 -07:00
Родитель 222b53c498
Коммит efa0bd6b80
2 изменённых файлов: 29 добавлений и 34 удалений

Просмотреть файл

@ -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@";
/**

Просмотреть файл

@ -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)) {
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");
} else if (intent.getAction().equals(ACTION_LAUNCH_NEW_TAB)) {
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)) {
break;
case ACTION_LAUNCH_SEARCH:
redirect = buildRedirectIntent(Intent.ACTION_VIEW,
AppConstants.SEARCH_PACKAGE_NAME,
AppConstants.ANDROID_PACKAGE_NAME,
AppConstants.SEARCH_INTENT_CLASS_NAME,
intent);
Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH,
TelemetryContract.Method.WIDGET, "search");
} else {
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);
}
}
super.onReceive(context, intent);