Bug 990116 - Part 1: Split BROWSER_INTENT_CLASS and BROWSER_INTENT_CLASS_NAME. r=mcomella

This commit is contained in:
Nick Alexander 2014-04-01 22:00:46 -07:00
parent b24663d5f8
commit f5f1d5757e
6 changed files with 20 additions and 7 deletions

View File

@ -6,7 +6,10 @@
package org.mozilla.gecko; package org.mozilla.gecko;
import android.app.Activity;
import org.mozilla.gecko.mozglue.RobocopTarget; import org.mozilla.gecko.mozglue.RobocopTarget;
/** /**
* A collection of constants that pertain to the build and runtime state of the * A collection of constants that pertain to the build and runtime state of the
* application. Typically these are sourced from build-time definitions (see * application. Typically these are sourced from build-time definitions (see
@ -19,9 +22,19 @@ import org.mozilla.gecko.mozglue.RobocopTarget;
@RobocopTarget @RobocopTarget
public class AppConstants { public class AppConstants {
public static final String ANDROID_PACKAGE_NAME = "@ANDROID_PACKAGE_NAME@"; public static final String ANDROID_PACKAGE_NAME = "@ANDROID_PACKAGE_NAME@";
public static final String BROWSER_INTENT_CLASS = ANDROID_PACKAGE_NAME + ".App";
public static final String MANGLED_ANDROID_PACKAGE_NAME = "@MANGLED_ANDROID_PACKAGE_NAME@"; public static final String MANGLED_ANDROID_PACKAGE_NAME = "@MANGLED_ANDROID_PACKAGE_NAME@";
/**
* The Java Class instance that launches the browser.
* <p>
* This should always agree with <code>BROWSER_INTENT_CLASS_NAME</code>.
*/
public static final Class<? extends Activity> BROWSER_INTENT_CLASS = @ANDROID_PACKAGE_NAME@.App.class;
/**
* The name of the Java class that launches the browser.
*/
public static final String BROWSER_INTENT_CLASS_NAME = BROWSER_INTENT_CLASS.getName();
public static final String GRE_MILESTONE = "@GRE_MILESTONE@"; public static final String GRE_MILESTONE = "@GRE_MILESTONE@";
public static final String MOZ_APP_ABI = "@MOZ_APP_ABI@"; public static final String MOZ_APP_ABI = "@MOZ_APP_ABI@";

View File

@ -1230,7 +1230,7 @@ abstract public class BrowserApp extends GeckoApp
} else if (event.equals("Prompt:ShowTop")) { } else if (event.equals("Prompt:ShowTop")) {
// Bring this activity to front so the prompt is visible.. // Bring this activity to front so the prompt is visible..
Intent bringToFrontIntent = new Intent(); Intent bringToFrontIntent = new Intent();
bringToFrontIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, AppConstants.BROWSER_INTENT_CLASS); bringToFrontIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, AppConstants.BROWSER_INTENT_CLASS_NAME);
bringToFrontIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); bringToFrontIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(bringToFrontIntent); startActivity(bringToFrontIntent);
} else if (event.equals("Accounts:Create")) { } else if (event.equals("Accounts:Create")) {

View File

@ -450,7 +450,7 @@ public class CrashReporter extends Activity
String action = "android.intent.action.MAIN"; String action = "android.intent.action.MAIN";
Intent intent = new Intent(action); Intent intent = new Intent(action);
intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
AppConstants.BROWSER_INTENT_CLASS); AppConstants.BROWSER_INTENT_CLASS_NAME);
intent.putExtra("didRestart", true); intent.putExtra("didRestart", true);
Log.i(LOGTAG, intent.toString()); Log.i(LOGTAG, intent.toString());
startActivity(intent); startActivity(intent);

View File

@ -39,7 +39,7 @@ public class DataReportingNotification {
// Launch main App to launch Data choices when notification is clicked. // Launch main App to launch Data choices when notification is clicked.
Intent prefIntent = new Intent(GeckoApp.ACTION_LAUNCH_SETTINGS); Intent prefIntent = new Intent(GeckoApp.ACTION_LAUNCH_SETTINGS);
prefIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, AppConstants.BROWSER_INTENT_CLASS); prefIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, AppConstants.BROWSER_INTENT_CLASS_NAME);
GeckoPreferences.setResourceToOpen(prefIntent, "preferences_vendor"); GeckoPreferences.setResourceToOpen(prefIntent, "preferences_vendor");
prefIntent.putExtra(ALERT_NAME_DATAREPORTING_NOTIFICATION, true); prefIntent.putExtra(ALERT_NAME_DATAREPORTING_NOTIFICATION, true);

View File

@ -833,7 +833,7 @@ public class GeckoAppShell
shortcutIntent.setAction(GeckoApp.ACTION_BOOKMARK); shortcutIntent.setAction(GeckoApp.ACTION_BOOKMARK);
shortcutIntent.setData(Uri.parse(aURI)); shortcutIntent.setData(Uri.parse(aURI));
shortcutIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, shortcutIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
AppConstants.BROWSER_INTENT_CLASS); AppConstants.BROWSER_INTENT_CLASS_NAME);
} }
Intent intent = new Intent(); Intent intent = new Intent();
@ -871,7 +871,7 @@ public class GeckoAppShell
shortcutIntent = new Intent(); shortcutIntent = new Intent();
shortcutIntent.setAction(GeckoApp.ACTION_BOOKMARK); shortcutIntent.setAction(GeckoApp.ACTION_BOOKMARK);
shortcutIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, shortcutIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
AppConstants.BROWSER_INTENT_CLASS); AppConstants.BROWSER_INTENT_CLASS_NAME);
shortcutIntent.setData(Uri.parse(aURI)); shortcutIntent.setData(Uri.parse(aURI));
} }

View File

@ -44,7 +44,7 @@ public class Restarter extends Activity {
try { try {
Intent intent = new Intent(Intent.ACTION_MAIN); Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
AppConstants.BROWSER_INTENT_CLASS); AppConstants.BROWSER_INTENT_CLASS_NAME);
Bundle b = getIntent().getExtras(); Bundle b = getIntent().getExtras();
if (b != null) if (b != null)
intent.putExtras(b); intent.putExtras(b);