Bug 856163 - Part 2: Move preprocessed code to AppConstants. r=kats,mfinkle,rnewman

--HG--
rename : mobile/android/base/CrashReporter.java.in => mobile/android/base/CrashReporter.java
rename : mobile/android/base/GeckoActivity.java.in => mobile/android/base/GeckoActivity.java
rename : mobile/android/base/Restarter.java.in => mobile/android/base/Restarter.java
rename : mobile/android/base/SmsManager.java.in => mobile/android/base/SmsManager.java
rename : mobile/android/base/UpdateServiceHelper.java.in => mobile/android/base/UpdateServiceHelper.java
rename : mobile/android/base/resources/menu-large-v11/browser_app_menu.xml.in => mobile/android/base/resources/menu-large-v11/browser_app_menu.xml
rename : mobile/android/base/resources/menu-v11/browser_app_menu.xml.in => mobile/android/base/resources/menu-v11/browser_app_menu.xml
rename : mobile/android/base/resources/menu-xlarge-v11/browser_app_menu.xml.in => mobile/android/base/resources/menu-xlarge-v11/browser_app_menu.xml
rename : mobile/android/base/resources/menu/browser_app_menu.xml.in => mobile/android/base/resources/menu/browser_app_menu.xml
rename : mobile/android/base/resources/xml/preferences.xml.in => mobile/android/base/resources/xml/preferences.xml
This commit is contained in:
Brian Nicholson 2013-04-09 17:10:47 -07:00
Родитель 9f410ec52a
Коммит ed0ffd2ff8
23 изменённых файлов: 267 добавлений и 226 удалений

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

@ -71,7 +71,7 @@
android:debuggable="true">
#endif
<activity android:name="App"
<activity android:name=".App"
android:label="@MOZ_APP_DISPLAYNAME@"
android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation|screenSize"
android:windowSoftInputMode="stateUnspecified|adjustResize"
@ -186,7 +186,7 @@
</intent-filter>
</receiver>
<activity android:name="Restarter"
<activity android:name="org.mozilla.gecko.Restarter"
android:process="@ANDROID_PACKAGE_NAME@Restarter"
android:theme="@style/Gecko">
<intent-filter>
@ -199,7 +199,7 @@
#include ../services/manifests/SyncAndroidManifest_activities.xml.in
#if MOZ_CRASHREPORTER
<activity android:name="CrashReporter"
<activity android:name="org.mozilla.gecko.CrashReporter"
android:label="@string/crash_reporter_title"
android:icon="@drawable/crash_reporter"
android:theme="@style/Gecko"

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

@ -6,61 +6,10 @@
#filter substitution
package @ANDROID_PACKAGE_NAME@;
import android.view.MenuItem;
import org.mozilla.gecko.BrowserApp;
import org.mozilla.gecko.GeckoProfile;
import org.mozilla.gecko.R;
import org.mozilla.gecko.util.HardwareUtils;
public class App extends BrowserApp {
@Override
public int getLayout() { return R.layout.gecko_app; }
@Override
public String getPackageName() {
return "@ANDROID_PACKAGE_NAME@";
}
@Override
public String getContentProcessName() {
return "@MOZ_CHILD_PROCESS_NAME@";
}
@Override
protected String getDefaultProfileName() {
String profile = GeckoProfile.findDefaultProfile(this);
return (profile != null ? profile : "default");
}
@Override
public String getDefaultUAString() {
String deviceType = "Mobile";
if (HardwareUtils.isTablet())
deviceType = "Tablet";
return "Mozilla/5.0 (Android; " + deviceType + "; rv:@MOZ_APP_VERSION@) Gecko/@MOZ_APP_VERSION@ Firefox/@MOZ_APP_VERSION@";
}
@Override
public String getUAStringForHost(String host) {
// With our standard UA String, we get a 200 response code and
// client-side redirect from t.co. This bot-like UA gives us a
// 301 response code
if ("t.co".equals(host))
return "Redirector/@MOZ_APP_VERSION@ (Android; rv:@MOZ_APP_VERSION@)";
return getDefaultUAString();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
#ifdef MOZ_PROFILING
if (item.getItemId() == org.mozilla.gecko.R.id.toggle_profiling) {
org.mozilla.gecko.GeckoAppShell.sendEventToGecko(
org.mozilla.gecko.GeckoEvent.createBroadcastEvent("ToggleProfiling", null));
return true;
}
#endif
return super.onOptionsItemSelected(item);
}
}
/**
* This class serves only as a namespace wrapper for BrowserApp.
*/
public class App extends BrowserApp {}

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

@ -0,0 +1,86 @@
#filter substitution
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko;
public class AppConstants {
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 MOZ_APP_ABI = "@MOZ_APP_ABI@";
public static final String MOZ_APP_BASENAME = "@MOZ_APP_BASENAME@";
public static final String MOZ_APP_BUILDID = "@MOZ_APP_BUILDID@";
public static final String MOZ_APP_ID = "@MOZ_APP_ID@";
public static final String MOZ_APP_NAME = "@MOZ_APP_NAME@";
public static final String MOZ_APP_VERSION = "@MOZ_APP_VERSION@";
public static final String MOZ_CHILD_PROCESS_NAME = "@MOZ_CHILD_PROCESS_NAME@";
public static final String MOZ_UPDATE_CHANNEL = "@MOZ_UPDATE_CHANNEL@";
public static final String OS_TARGET = "@OS_TARGET@";
public static final String USER_AGENT_BOT_LIKE = "Redirector/" + AppConstants.MOZ_APP_VERSION +
" (Android; rv:" + AppConstants.MOZ_APP_VERSION + ")";
public static final String USER_AGENT_FENNEC_MOBILE = "Mozilla/5.0 (Android; Mobile; rv:" +
AppConstants.MOZ_APP_VERSION + ") Gecko/" +
AppConstants.MOZ_APP_VERSION + " Firefox/" +
AppConstants.MOZ_APP_VERSION;
public static final String USER_AGENT_FENNEC_TABLET = "Mozilla/5.0 (Android; Tablet; rv:" +
AppConstants.MOZ_APP_VERSION + ") Gecko/" +
AppConstants.MOZ_APP_VERSION + " Firefox/" +
AppConstants.MOZ_APP_VERSION;
public static final int MOZ_MIN_CPU_VERSION = @MOZ_MIN_CPU_VERSION@;
public static final boolean MOZ_ANDROID_ANR_REPORTER =
#ifdef MOZ_ANDROID_ANR_REPORTER
true;
#else
false;
#endif
public static final String MOZ_PKG_SPECIAL =
#ifdef MOZ_PKG_SPECIAL
"@MOZ_PKG_SPECIAL@";
#else
null;
#endif
public static final boolean MOZ_PROFILING =
#ifdef MOZ_PROFILING
true;
#else
false;
#endif
public static final boolean MOZ_TELEMETRY_ON_BY_DEFAULT =
#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
true;
#else
false;
#endif
public static final boolean MOZ_TELEMETRY_REPORTING =
#ifdef MOZ_TELEMETRY_REPORTING
true;
#else
false;
#endif
public static final boolean MOZ_UPDATER =
#ifdef MOZ_UPDATER
true;
#else
false;
#endif
public static final boolean MOZ_WEBSMS_BACKEND =
#ifdef MOZ_WEBSMS_BACKEND
true;
#else
false;
#endif
}

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

@ -1466,6 +1466,10 @@ abstract public class BrowserApp extends GeckoApp
// In ICS+, it's easy to kill an app through the task switcher.
aMenu.findItem(R.id.quit).setVisible(Build.VERSION.SDK_INT < 14 || HardwareUtils.isTelevision());
if (AppConstants.MOZ_PROFILING) {
aMenu.findItem(R.id.toggle_profiling).setVisible(true);
}
if (tab == null || tab.getURL() == null) {
bookmark.setEnabled(false);
forward.setEnabled(false);
@ -1543,6 +1547,11 @@ abstract public class BrowserApp extends GeckoApp
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.toggle_profiling) {
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("ToggleProfiling", null));
return true;
}
Tab tab = null;
Intent intent = null;
switch (item.getItemId()) {
@ -1727,4 +1736,13 @@ abstract public class BrowserApp extends GeckoApp
}
}
@Override
public int getLayout() { return R.layout.gecko_app; }
@Override
protected String getDefaultProfileName() {
String profile = GeckoProfile.findDefaultProfile(this);
return (profile != null ? profile : "default");
}
}

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

@ -3,8 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#filter substitution
package @ANDROID_PACKAGE_NAME@;
package org.mozilla.gecko;
import java.util.HashMap;
import java.util.Map;
@ -34,10 +33,6 @@ import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import org.mozilla.gecko.GeckoApp;
import org.mozilla.gecko.R;
public class CrashReporter extends Activity
{
private static final String LOGTAG = "GeckoCrashReporter";
@ -279,14 +274,15 @@ public class CrashReporter extends Activity
// crash-stats.mozilla.org. Remove this when bug 607942 is fixed.
StringBuffer sb = new StringBuffer();
sb.append(extras.containsKey(NOTES_KEY) ? extras.get(NOTES_KEY) + "\n" : "");
if (@MOZ_MIN_CPU_VERSION@ < 7)
if (AppConstants.MOZ_MIN_CPU_VERSION < 7) {
sb.append("nothumb Build\n");
}
sb.append(Build.MANUFACTURER).append(' ')
.append(Build.MODEL).append('\n')
.append(Build.FINGERPRINT);
sendPart(os, boundary, NOTES_KEY, sb.toString());
sendPart(os, boundary, "Min_ARM_Version", "@MOZ_MIN_CPU_VERSION@");
sendPart(os, boundary, "Min_ARM_Version", Integer.toString(AppConstants.MOZ_MIN_CPU_VERSION));
sendPart(os, boundary, "Android_Manufacturer", Build.MANUFACTURER);
sendPart(os, boundary, "Android_Model", Build.MODEL);
sendPart(os, boundary, "Android_Board", Build.BOARD);
@ -343,8 +339,8 @@ public class CrashReporter extends Activity
try {
String action = "android.intent.action.MAIN";
Intent intent = new Intent(action);
intent.setClassName("@ANDROID_PACKAGE_NAME@",
"@ANDROID_PACKAGE_NAME@.App");
intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
AppConstants.BROWSER_INTENT_CLASS);
Log.i(LOGTAG, intent.toString());
startActivity(intent);
} catch (Exception e) {

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

@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#filter substitution
package org.mozilla.gecko;
import android.app.Activity;
@ -38,19 +36,21 @@ public class GeckoActivity extends Activity implements GeckoActivityStatus {
}
}
#ifdef MOZ_ANDROID_ANR_REPORTER
@Override
public void onCreate(android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ANRReporter.register(getApplicationContext());
if (AppConstants.MOZ_ANDROID_ANR_REPORTER) {
ANRReporter.register(getApplicationContext());
}
}
@Override
public void onDestroy() {
ANRReporter.unregister();
if (AppConstants.MOZ_ANDROID_ANR_REPORTER) {
ANRReporter.unregister();
}
super.onDestroy();
}
#endif
@Override
public void startActivity(Intent intent) {
@ -69,9 +69,8 @@ public class GeckoActivity extends Activity implements GeckoActivityStatus {
// If we call an activity from another package, or an open intent (leaving android to resolve)
// component has a different package name or it is null.
ComponentName component = intent.getComponent();
return (component != null
&& component.getPackageName() != null
&& component.getPackageName().equals("@ANDROID_PACKAGE_NAME@"));
return (component != null &&
AppConstants.ANDROID_PACKAGE_NAME.equals(component.getPackageName()));
}
@Override

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

@ -185,6 +185,9 @@ abstract public class GeckoApp
abstract public boolean hasTabsSideBar();
abstract protected String getDefaultProfileName();
private static final String RESTARTER_ACTION = "org.mozilla.gecko.restart";
private static final String RESTARTER_CLASS = "org.mozilla.gecko.Restarter";
void toggleChrome(final boolean aShow) { }
void focusChrome() { }
@ -1758,8 +1761,20 @@ abstract public class GeckoApp
mMainLayout.removeView(cameraView);
}
abstract public String getDefaultUAString();
abstract public String getUAStringForHost(String host);
public String getDefaultUAString() {
return HardwareUtils.isTablet() ? AppConstants.USER_AGENT_FENNEC_TABLET :
AppConstants.USER_AGENT_FENNEC_MOBILE;
}
public String getUAStringForHost(String host) {
// With our standard UA String, we get a 200 response code and
// client-side redirect from t.co. This bot-like UA gives us a
// 301 response code
if ("t.co".equals(host)) {
return AppConstants.USER_AGENT_BOT_LIKE;
}
return getDefaultUAString();
}
class PrefetchRunnable implements Runnable {
private String mPrefetchUrl;
@ -2072,9 +2087,9 @@ abstract public class GeckoApp
return Boolean.TRUE;
}
@Override
abstract public String getPackageName();
abstract public String getContentProcessName();
public String getContentProcessName() {
return AppConstants.MOZ_CHILD_PROCESS_NAME;
}
public void addEnvToIntent(Intent intent) {
Map<String,String> envMap = System.getenv();
@ -2090,15 +2105,14 @@ abstract public class GeckoApp
}
public void doRestart() {
doRestart("org.mozilla.gecko.restart");
doRestart(RESTARTER_ACTION);
}
public void doRestart(String action) {
Log.d(LOGTAG, "doRestart(\"" + action + "\")");
try {
Intent intent = new Intent(action);
intent.setClassName(getPackageName(),
getPackageName() + ".Restarter");
intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, RESTARTER_CLASS);
/* TODO: addEnvToIntent(intent); */
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_MULTIPLE_TASK);

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

@ -36,7 +36,7 @@ public final class GeckoAppInfo
}
public static String getUpdateChannel() {
return UpdateServiceHelper.UPDATE_CHANNEL;
return AppConstants.MOZ_UPDATE_CHANNEL;
}
public static String getPlatformBuildID() {

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

@ -581,7 +581,8 @@ public class GeckoAppShell
Intent intent = new Intent();
intent.setAction(GeckoApp.ACTION_WEBAPP_PREFIX + aIndex);
intent.setData(Uri.parse(aURI));
intent.setClassName(GeckoApp.mAppContext, GeckoApp.mAppContext.getPackageName() + ".WebApps$WebApp" + aIndex);
intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
AppConstants.ANDROID_PACKAGE_NAME + ".WebApps$WebApp" + aIndex);
return intent;
}
@ -619,8 +620,8 @@ public class GeckoAppShell
shortcutIntent = new Intent();
shortcutIntent.setAction(GeckoApp.ACTION_BOOKMARK);
shortcutIntent.setData(Uri.parse(aURI));
shortcutIntent.setClassName(GeckoApp.mAppContext,
GeckoApp.mAppContext.getPackageName() + ".App");
shortcutIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
AppConstants.BROWSER_INTENT_CLASS);
}
Intent intent = new Intent();
@ -658,8 +659,8 @@ public class GeckoAppShell
} else {
shortcutIntent = new Intent();
shortcutIntent.setAction(GeckoApp.ACTION_BOOKMARK);
shortcutIntent.setClassName(GeckoApp.mAppContext,
GeckoApp.mAppContext.getPackageName() + ".App");
shortcutIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
AppConstants.BROWSER_INTENT_CLASS);
shortcutIntent.setData(Uri.parse(aURI));
}
@ -1067,7 +1068,7 @@ public class GeckoAppShell
if ("vnd.youtube".equals(scheme) && getHandlersForURL(targetURI, action).length == 0) {
// Special case youtube to fallback to our own player
intent = new Intent(VideoPlayer.VIDEO_ACTION);
intent.setClassName(GeckoApp.mAppContext.getPackageName(),
intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
"org.mozilla.gecko.VideoPlayer");
} else {
intent = getIntentForActionString(action);
@ -1208,7 +1209,7 @@ public class GeckoAppShell
// The intent to launch when the user clicks the expanded notification
String app = GeckoApp.mAppContext.getClass().getName();
Intent notificationIntent = new Intent(GeckoApp.ACTION_ALERT_CALLBACK);
notificationIntent.setClassName(GeckoApp.mAppContext, app);
notificationIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, app);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
int notificationID = aAlertName.hashCode();

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

@ -54,10 +54,14 @@ public class GeckoPreferences
private static final String NON_PREF_PREFIX = "android.not_a_preference.";
// These match keys in resources/xml/preferences.xml.in.
public static String PREFS_MP_ENABLED = "privacy.masterpassword.enabled";
public static String PREFS_MENU_CHAR_ENCODING = "browser.menu.showCharacterEncoding";
public static String PREFS_ANNOUNCEMENTS_ENABLED = NON_PREF_PREFIX + "privacy.announcements.enabled";
public static String PREFS_UPDATER_AUTODOWNLOAD = "app.update.autodownload";
private static String PREFS_ANNOUNCEMENTS_ENABLED = NON_PREF_PREFIX + "privacy.announcements.enabled";
private static String PREFS_CATEGORY_GENERAL = "category_general";
private static String PREFS_CATEGORY_PRIVACY = "category_privacy";
private static String PREFS_MENU_CHAR_ENCODING = "browser.menu.showCharacterEncoding";
private static String PREFS_MP_ENABLED = "privacy.masterpassword.enabled";
private static String PREFS_TELEMETRY_ENABLED = "toolkit.telemetry.enabled";
private static String PREFS_TELEMETRY_ENABLED_PRERELEASE = "toolkit.telemetry.enabledPreRelease";
private static String PREFS_UPDATER_AUTODOWNLOAD = "app.update.autodownload";
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -67,6 +71,23 @@ public class GeckoPreferences
if (Build.VERSION.SDK_INT >= 14)
getActionBar().setHomeButtonEnabled(true);
mPreferenceScreen = getPreferenceScreen();
if (!AppConstants.MOZ_UPDATER) {
((PreferenceGroup) mPreferenceScreen.findPreference(PREFS_CATEGORY_GENERAL))
.removePreference(findPreference(PREFS_UPDATER_AUTODOWNLOAD));
}
Preference telemetryPref = findPreference(PREFS_TELEMETRY_ENABLED);
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
if (AppConstants.MOZ_TELEMETRY_ON_BY_DEFAULT) {
telemetryPref.setKey(PREFS_TELEMETRY_ENABLED_PRERELEASE);
}
} else {
((PreferenceGroup) mPreferenceScreen.findPreference(PREFS_CATEGORY_PRIVACY))
.removePreference(telemetryPref);
}
}
@Override
@ -75,7 +96,6 @@ public class GeckoPreferences
return;
mPreferencesList = new ArrayList<String>();
mPreferenceScreen = getPreferenceScreen();
initGroups(mPreferenceScreen);
initValues();
}

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

@ -44,6 +44,7 @@ UTIL_JAVA_FILES := \
$(NULL)
FENNEC_JAVA_FILES = \
ANRReporter.java \
ActivityHandlerHelper.java \
AlertNotification.java \
AllCapsTextView.java \
@ -88,6 +89,7 @@ FENNEC_JAVA_FILES = \
GeckoApplication.java \
GeckoApp.java \
GeckoAppShell.java \
GeckoActivity.java \
GeckoBatteryManager.java \
GeckoConnectivityReceiver.java \
GeckoEditable.java \
@ -102,6 +104,7 @@ FENNEC_JAVA_FILES = \
GeckoPreferences.java \
GeckoProfile.java \
GeckoPopupMenu.java \
GeckoSmsManager.java \
GeckoThread.java \
GlobalHistory.java \
GeckoViewsFactory.java \
@ -129,6 +132,7 @@ FENNEC_JAVA_FILES = \
PropertyAnimator.java \
ProfileMigrator.java \
PromptService.java \
Restarter.java \
sqlite/ByteBufferInputStream.java \
sqlite/MatrixBlobCursor.java \
sqlite/SQLiteBridge.java \
@ -141,6 +145,7 @@ FENNEC_JAVA_FILES = \
SetupScreen.java \
ShapedButton.java \
SiteIdentityPopup.java \
SmsManager.java \
SuggestClient.java \
SurfaceBits.java \
Tab.java \
@ -154,6 +159,7 @@ FENNEC_JAVA_FILES = \
TextSelectionHandle.java \
ThumbnailHelper.java \
TouchEventInterceptor.java \
UpdateServiceHelper.java \
VideoPlayer.java \
WebAppAllocator.java \
ZoomConstraints.java \
@ -216,10 +222,6 @@ FENNEC_JAVA_FILES = \
ReferrerReceiver.java \
$(NULL)
ifdef MOZ_WEBSMS_BACKEND
FENNEC_JAVA_FILES += GeckoSmsManager.java
endif
ifdef MOZ_WEBRTC
WEBRTC_VIDEO_CAPTURE_JAVA_FILES = \
CaptureCapabilityAndroid.java \
@ -234,7 +236,6 @@ endif
ifdef MOZ_ANDROID_ANR_REPORTER
DEFINES += -DMOZ_ANDROID_ANR_REPORTER=1
FENNEC_JAVA_FILES += ANRReporter.java
endif
FENNEC_PP_JAVA_VIEW_FILES = \
@ -253,26 +254,18 @@ FENNEC_PP_JAVA_FILES = \
App.java \
WebApp.java \
WebApps.java \
GeckoActivity.java \
GeckoAppInfo.java \
Restarter.java \
db/BrowserContract.java \
db/BrowserProvider.java \
db/PasswordsProvider.java \
db/FormHistoryProvider.java \
db/TabsProvider.java \
db/GeckoProvider.java \
SmsManager.java \
UpdateServiceHelper.java \
AppConstants.java \
$(NULL)
FENNEC_PP_XML_FILES = \
res/xml/preferences.xml \
res/xml/searchable.xml \
res/menu/browser_app_menu.xml \
res/menu-v11/browser_app_menu.xml \
res/menu-large-v11/browser_app_menu.xml \
res/menu-xlarge-v11/browser_app_menu.xml \
$(NULL)
ifneq (,$(findstring -march=armv7,$(OS_CFLAGS)))
@ -530,8 +523,9 @@ RES_VALUES_V14 = \
$(NULL)
RES_XML = \
$(SYNC_RES_XML) \
$(NULL)
res/xml/preferences.xml \
$(SYNC_RES_XML) \
$(NULL)
RES_ANIM = \
res/anim/awesomebar_fade_in.xml \
@ -987,16 +981,20 @@ RES_COLOR = \
$(NULL)
RES_MENU = \
res/menu/abouthome_topsites_contextmenu.xml \
res/menu/awesomebar_contextmenu.xml \
res/menu/browser_app_menu.xml \
res/menu/gecko_app_menu.xml \
res/menu/titlebar_contextmenu.xml \
res/menu/abouthome_topsites_contextmenu.xml \
res/menu-large-v11/browser_app_menu.xml \
res/menu-v11/browser_app_menu.xml \
res/menu-xlarge-v11/browser_app_menu.xml \
$(NULL)
JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
ifdef MOZ_CRASHREPORTER
FENNEC_PP_JAVA_FILES += CrashReporter.java
FENNEC_JAVA_FILES += CrashReporter.java
RES_DRAWABLE_MDPI += res/drawable-mdpi/crash_reporter.png
RES_LAYOUT += res/layout/crash_reporter.xml
endif

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

@ -3,22 +3,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#filter substitution
package @ANDROID_PACKAGE_NAME@;
package org.mozilla.gecko;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import org.mozilla.gecko.GeckoAppShell;
public class Restarter extends Activity {
private static final String LOGTAG = "GeckoRestarter";
@Override
public void onCreate(Bundle savedInstanceState) {
Log.i(LOGTAG, "trying to restart @MOZ_APP_NAME@");
Log.i(LOGTAG, "Trying to restart " + AppConstants.MOZ_APP_NAME);
try {
int countdown = 40;
while (GeckoAppShell.checkForGeckoProcs() && --countdown > 0) {
@ -27,7 +24,7 @@ public class Restarter extends Activity {
Thread.sleep(100);
} catch (InterruptedException ie) {}
}
if (countdown <= 0) {
// if the countdown expired, something is hung
GeckoAppShell.killAnyZombies();
@ -44,8 +41,8 @@ public class Restarter extends Activity {
}
try {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName("@ANDROID_PACKAGE_NAME@",
"@ANDROID_PACKAGE_NAME@.App");
intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
AppConstants.BROWSER_INTENT_CLASS);
Bundle b = getIntent().getExtras();
if (b != null)
intent.putExtras(b);

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

@ -5,22 +5,18 @@
package org.mozilla.gecko;
#ifdef MOZ_WEBSMS_BACKEND
import org.mozilla.gecko.GeckoSmsManager;
#endif
class SmsManager
{
static private ISmsManager sInstance = null;
static private ISmsManager sInstance = null;
static public ISmsManager getInstance() {
#ifdef MOZ_WEBSMS_BACKEND
if (sInstance == null) {
sInstance = new GeckoSmsManager();
static public ISmsManager getInstance() {
if (AppConstants.MOZ_WEBSMS_BACKEND) {
if (sInstance == null) {
sInstance = new GeckoSmsManager();
}
}
return sInstance;
}
#endif
return sInstance;
}
}
interface ISmsManager

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

@ -5,9 +5,11 @@
package org.mozilla.gecko.updater;
import org.mozilla.apache.commons.codec.binary.Hex;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.R;
import org.mozilla.apache.commons.codec.binary.Hex;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@ -136,8 +138,8 @@ public class UpdateService extends IntentService {
int interval;
if (isRetry) {
interval = INTERVAL_RETRY;
} else if (UpdateServiceHelper.UPDATE_CHANNEL.equals("nightly") ||
UpdateServiceHelper.UPDATE_CHANNEL.equals("aurora")) {
} else if (AppConstants.MOZ_UPDATE_CHANNEL.equals("nightly") ||
AppConstants.MOZ_UPDATE_CHANNEL.equals("aurora")) {
interval = INTERVAL_SHORT;
} else {
interval = INTERVAL_LONG;

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

@ -3,10 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#filter substitution
package org.mozilla.gecko.updater;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.util.GeckoJarReader;
import android.content.Context;
@ -22,12 +21,12 @@ import android.util.Log;
import java.net.URL;
public class UpdateServiceHelper {
public static final String ACTION_REGISTER_FOR_UPDATES = "@ANDROID_PACKAGE_NAME@.REGISTER_FOR_UPDATES";
public static final String ACTION_UNREGISTER_FOR_UPDATES = "@ANDROID_PACKAGE_NAME@.UNREGISTER_FOR_UPDATES";
public static final String ACTION_CHECK_FOR_UPDATE = "@ANDROID_PACKAGE_NAME@.CHECK_FOR_UPDATE";
public static final String ACTION_CHECK_UPDATE_RESULT = "@ANDROID_PACKAGE_NAME@.CHECK_UPDATE_RESULT";
public static final String ACTION_DOWNLOAD_UPDATE = "@ANDROID_PACKAGE_NAME@.DOWNLOAD_UPDATE";
public static final String ACTION_APPLY_UPDATE = "@ANDROID_PACKAGE_NAME@.APPLY_UPDATE";
public static final String ACTION_REGISTER_FOR_UPDATES = AppConstants.ANDROID_PACKAGE_NAME + ".REGISTER_FOR_UPDATES";
public static final String ACTION_UNREGISTER_FOR_UPDATES = AppConstants.ANDROID_PACKAGE_NAME + ".UNREGISTER_FOR_UPDATES";
public static final String ACTION_CHECK_FOR_UPDATE = AppConstants.ANDROID_PACKAGE_NAME + ".CHECK_FOR_UPDATE";
public static final String ACTION_CHECK_UPDATE_RESULT = AppConstants.ANDROID_PACKAGE_NAME + ".CHECK_UPDATE_RESULT";
public static final String ACTION_DOWNLOAD_UPDATE = AppConstants.ANDROID_PACKAGE_NAME + ".DOWNLOAD_UPDATE";
public static final String ACTION_APPLY_UPDATE = AppConstants.ANDROID_PACKAGE_NAME + ".APPLY_UPDATE";
// Flags for ACTION_CHECK_FOR_UPDATE
public static final int FLAG_FORCE_DOWNLOAD = 1;
@ -49,18 +48,26 @@ public class UpdateServiceHelper {
// Name of the Intent extra that holds the APK path, used with ACTION_APPLY_UPDATE
public static final String EXTRA_PACKAGE_PATH_NAME = "packagePath";
public static final String UPDATE_CHANNEL = "@MOZ_UPDATE_CHANNEL@";
private static final String LOGTAG = "UpdateServiceHelper";
private static final String BUILDID = "@MOZ_APP_BUILDID@";
private static final String DEFAULT_UPDATE_LOCALE = "en-US";
#ifdef MOZ_PKG_SPECIAL
private static final String UPDATE_URL = "https://aus2.mozilla.org/update/4/@MOZ_APP_BASENAME@/@MOZ_APP_VERSION@/%BUILDID%/Android_@MOZ_APP_ABI@-@MOZ_PKG_SPECIAL@/%LOCALE%/@MOZ_UPDATE_CHANNEL@/%OS_VERSION%/default/default/@MOZ_APP_VERSION@/update.xml";
#else
private static final String UPDATE_URL = "https://aus2.mozilla.org/update/4/@MOZ_APP_BASENAME@/@MOZ_APP_VERSION@/%BUILDID%/Android_@MOZ_APP_ABI@/%LOCALE%/@MOZ_UPDATE_CHANNEL@/%OS_VERSION%/default/default/@MOZ_APP_VERSION@/update.xml";
#endif
private static final String UPDATE_URL;
static {
final String pkgSpecial;
if (AppConstants.MOZ_PKG_SPECIAL != null) {
pkgSpecial = "-" + AppConstants.MOZ_PKG_SPECIAL;
} else {
pkgSpecial = "";
}
UPDATE_URL = "https://aus2.mozilla.org/update/4/" + AppConstants.MOZ_APP_BASENAME + "/" +
AppConstants.MOZ_APP_VERSION +
"/%BUILDID%/Android_ " + AppConstants.MOZ_APP_ABI + pkgSpecial +
"/%LOCALE%/" + AppConstants.MOZ_UPDATE_CHANNEL +
"/%OS_VERSION%/default/default/" + AppConstants.MOZ_APP_VERSION +
"/update.xml";
}
public enum CheckUpdateResult {
// Keep these in sync with mobile/android/chrome/content/about.xhtml
NOT_AVAILABLE,
@ -74,7 +81,7 @@ public class UpdateServiceHelper {
String locale = null;
try {
ApplicationInfo info = pm.getApplicationInfo("@ANDROID_PACKAGE_NAME@", 0);
ApplicationInfo info = pm.getApplicationInfo(AppConstants.ANDROID_PACKAGE_NAME, 0);
String updateLocaleUrl = "jar:jar:file://" + info.sourceDir + "!/omni.ja!/update.locale";
locale = GeckoJarReader.getText(updateLocaleUrl);
@ -91,7 +98,7 @@ public class UpdateServiceHelper {
String url = UPDATE_URL.replace("%LOCALE%", locale).
replace("%OS_VERSION%", Build.VERSION.RELEASE).
replace("%BUILDID%", force ? "0" : BUILDID);
replace("%BUILDID%", force ? "0" : AppConstants.MOZ_APP_BUILDID);
try {
return new URL(url);
@ -102,11 +109,7 @@ public class UpdateServiceHelper {
}
public static boolean isUpdaterEnabled() {
#ifdef MOZ_UPDATER
return true;
#else
return false;
#endif
return AppConstants.MOZ_UPDATER;
}
public static void registerForUpdates(Context context, String policy) {

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

@ -145,34 +145,6 @@ public class WebApp extends GeckoApp {
}
}
@Override
public String getPackageName() {
return "@ANDROID_PACKAGE_NAME@";
}
@Override
public String getContentProcessName() {
return "@MOZ_CHILD_PROCESS_NAME@";
}
@Override
public String getDefaultUAString() {
String deviceType = "Mobile";
if (HardwareUtils.isTablet())
deviceType = "Tablet";
return "Mozilla/5.0 (Android; " + deviceType + "; rv:@MOZ_APP_VERSION@) Gecko/@MOZ_APP_VERSION@ Firefox/@MOZ_APP_VERSION@";
}
@Override
public String getUAStringForHost(String host) {
// With our standard UA String, we get a 200 response code and
// client-side redirect from t.co. This bot-like UA gives us a
// 301 response code
if ("t.co".equals(host))
return "Redirector/@MOZ_APP_VERSION@ (Android; rv:@MOZ_APP_VERSION@)";
return getDefaultUAString();
}
@Override
protected String getDefaultProfileName() {
String action = getIntent().getAction();

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

@ -6,19 +6,21 @@
#filter substitution
package org.mozilla.gecko.db;
import org.mozilla.gecko.AppConstants;
import android.net.Uri;
public class BrowserContract {
public static final String AUTHORITY = "@ANDROID_PACKAGE_NAME@.db.browser";
public static final String AUTHORITY = AppConstants.ANDROID_PACKAGE_NAME + ".db.browser";
public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);
public static final String PASSWORDS_AUTHORITY = "@ANDROID_PACKAGE_NAME@.db.passwords";
public static final String PASSWORDS_AUTHORITY = AppConstants.ANDROID_PACKAGE_NAME + ".db.passwords";
public static final Uri PASSWORDS_AUTHORITY_URI = Uri.parse("content://" + PASSWORDS_AUTHORITY);
public static final String FORM_HISTORY_AUTHORITY = "@ANDROID_PACKAGE_NAME@.db.formhistory";
public static final String FORM_HISTORY_AUTHORITY = AppConstants.ANDROID_PACKAGE_NAME + ".db.formhistory";
public static final Uri FORM_HISTORY_AUTHORITY_URI = Uri.parse("content://" + FORM_HISTORY_AUTHORITY);
public static final String TABS_AUTHORITY = "@ANDROID_PACKAGE_NAME@.db.tabs";
public static final String TABS_AUTHORITY = AppConstants.ANDROID_PACKAGE_NAME + ".db.tabs";
public static final Uri TABS_AUTHORITY_URI = Uri.parse("content://" + TABS_AUTHORITY);
public static final String PARAM_PROFILE = "profile";

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

@ -29,8 +29,8 @@
<item android:id="@+id/share"
android:icon="@drawable/ic_menu_share"
android:title="@string/share" />
android:title="@string/share" />
<item android:id="@+id/find_in_page"
android:icon="@drawable/ic_menu_find_in_page"
android:title="@string/find_in_page" />
@ -72,8 +72,7 @@
android:icon="@drawable/ic_menu_settings"
android:title="@string/settings" />
#ifdef MOZ_PROFILING
<item android:id="@+id/toggle_profiling"
android:visible="false"
android:title="@string/toggle_profiling" />
#endif
</menu>

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

@ -30,8 +30,8 @@
<item android:id="@+id/share"
android:icon="@drawable/ic_menu_share"
android:title="@string/share" />
android:title="@string/share" />
<item android:id="@+id/find_in_page"
android:icon="@drawable/ic_menu_find_in_page"
android:title="@string/find_in_page" />
@ -73,8 +73,7 @@
android:icon="@drawable/ic_menu_settings"
android:title="@string/settings" />
#ifdef MOZ_PROFILING
<item android:id="@+id/toggle_profiling"
android:visible="false"
android:title="@string/toggle_profiling" />
#endif
</menu>

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

@ -30,8 +30,8 @@
<item android:id="@+id/share"
android:icon="@drawable/ic_menu_share"
android:title="@string/share" />
android:title="@string/share" />
<item android:id="@+id/find_in_page"
android:icon="@drawable/ic_menu_find_in_page"
android:title="@string/find_in_page" />
@ -73,8 +73,7 @@
android:icon="@drawable/ic_menu_settings"
android:title="@string/settings" />
#ifdef MOZ_PROFILING
<item android:id="@+id/toggle_profiling"
android:visible="false"
android:title="@string/toggle_profiling" />
#endif
</menu>

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

@ -26,8 +26,8 @@
android:title="@string/new_private_tab"/>
<item android:id="@+id/share"
android:title="@string/share" />
android:title="@string/share" />
<item android:id="@+id/save_as_pdf"
android:title="@string/save_as_pdf" />
@ -54,8 +54,7 @@
<item android:id="@+id/settings"
android:title="@string/settings" />
#ifdef MOZ_PROFILING
<item android:id="@+id/toggle_profiling"
android:visible="false"
android:title="@string/toggle_profiling" />
#endif
</menu>

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

@ -1,4 +1,3 @@
#filter substitution
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
@ -9,20 +8,19 @@
xmlns:gecko="http://schemas.android.com/apk/res-auto"
android:enabled="false">
<PreferenceCategory android:title="@string/pref_category_general">
<PreferenceCategory android:title="@string/pref_category_general"
android:key="category_general">
<org.mozilla.gecko.LinkPreference android:title="@string/pref_about_firefox"
url="about:" />
<org.mozilla.gecko.SyncPreference android:title="@string/pref_sync"
android:persistent="false" />
#ifdef MOZ_UPDATER
<ListPreference android:key="app.update.autodownload"
android:title="@string/pref_update_autodownload"
android:entries="@array/pref_update_autodownload_entries"
android:entryValues="@array/pref_update_autodownload_values"
android:persistent="false" />
#endif
</PreferenceCategory>
@ -55,7 +53,8 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_category_privacy">
<PreferenceCategory android:title="@string/pref_category_privacy"
android:key="category_privacy">
<ListPreference android:key="network.cookie.cookieBehavior"
android:title="@string/pref_cookies_menu"
@ -93,16 +92,9 @@
android:defaultValue="true"
android:persistent="false" />
#ifdef MOZ_TELEMETRY_REPORTING
<CheckBoxPreference
#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
android:key="toolkit.telemetry.enabledPreRelease"
#else
android:key="toolkit.telemetry.enabled"
#endif
<CheckBoxPreference android:key="toolkit.telemetry.enabled"
android:title="@string/pref_telemetry"
android:persistent="false" />
#endif
<CheckBoxPreference android:key="android.not_a_preference.privacy.announcements.enabled"
android:title="@string/pref_show_product_announcements"

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

@ -837,7 +837,7 @@ nsresult SetExceptionHandler(nsIFile* aXREDirectory,
#else
// On Android, we launch using the application package name
// instead of a filename, so use ANDROID_PACKAGE_NAME to do that here.
nsCString package(ANDROID_PACKAGE_NAME "/.CrashReporter");
nsCString package(ANDROID_PACKAGE_NAME "/org.mozilla.gecko.CrashReporter");
crashReporterPath = ToNewCString(package);
#endif
}