Bug 1124052 - Part 2: Don't preprocess Java in background services. r=rnewman

--HG--
rename : mobile/android/base/background/common/GlobalConstants.java.in => mobile/android/base/background/common/GlobalConstants.java
rename : mobile/android/base/background/healthreport/HealthReportConstants.java.in => mobile/android/base/background/healthreport/HealthReportConstants.java
rename : mobile/android/base/fxa/FxAccountConstants.java.in => mobile/android/base/fxa/FxAccountConstants.java
rename : mobile/android/base/sync/SyncConstants.java.in => mobile/android/base/sync/SyncConstants.java
extra : rebase_source : 833561a9970bd2705d81c094a2d62a510c3484e0
This commit is contained in:
Nick Alexander 2015-01-21 11:15:24 -08:00
Родитель cbb083cd6f
Коммит 058f960cde
10 изменённых файлов: 34 добавлений и 58 удалений

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

@ -8,9 +8,6 @@ package org.mozilla.gecko;
import android.os.Build;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* A collection of constants that pertain to the build and runtime state of the
* application. Typically these are sourced from build-time definitions (see
@ -27,6 +24,9 @@ public class AppConstants {
public static final String ANDROID_PACKAGE_NAME = "@ANDROID_PACKAGE_NAME@";
public static final String MANGLED_ANDROID_PACKAGE_NAME = "@MANGLED_ANDROID_PACKAGE_NAME@";
public static final String MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@";
public static final String MOZ_ANDROID_SHARED_FXACCOUNT_TYPE = "@MOZ_ANDROID_SHARED_FXACCOUNT_TYPE@";
/**
* Encapsulates access to compile-time version definitions, allowing
* for dead code removal for particular APKs.
@ -92,6 +92,7 @@ public class AppConstants {
public static final String MOZ_APP_NAME = "@MOZ_APP_NAME@";
public static final String MOZ_APP_VENDOR = "@MOZ_APP_VENDOR@";
public static final String MOZ_APP_VERSION = "@MOZ_APP_VERSION@";
public static final String MOZ_APP_DISPLAYNAME = "@MOZ_APP_DISPLAYNAME@";
// MOZILLA_VERSION is already quoted when it gets substituted in. If we
// add additional quotes we end up with ""x.y"", which is a syntax error.

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

@ -14,9 +14,6 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.regex.Pattern;
/**

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

@ -770,6 +770,7 @@ sync_java_files = [
'background/bagheera/BoundedByteArrayEntity.java',
'background/bagheera/DeflateHelper.java',
'background/common/DateUtils.java',
'background/common/GlobalConstants.java',
'background/common/log/Logger.java',
'background/common/log/writers/AndroidLevelCachingLogWriter.java',
'background/common/log/writers/AndroidLogWriter.java',
@ -805,6 +806,7 @@ sync_java_files = [
'background/healthreport/EnvironmentV2.java',
'background/healthreport/HealthReportBroadcastReceiver.java',
'background/healthreport/HealthReportBroadcastService.java',
'background/healthreport/HealthReportConstants.java',
'background/healthreport/HealthReportDatabases.java',
'background/healthreport/HealthReportDatabaseStorage.java',
'background/healthreport/HealthReportGenerator.java',
@ -858,6 +860,7 @@ sync_java_files = [
'fxa/authenticator/FxAccountLoginDelegate.java',
'fxa/authenticator/FxAccountLoginException.java',
'fxa/FirefoxAccounts.java',
'fxa/FxAccountConstants.java',
'fxa/login/BaseRequestDelegate.java',
'fxa/login/Cohabiting.java',
'fxa/login/Doghouse.java',
@ -1116,6 +1119,7 @@ sync_java_files = [
'sync/syncadapter/SyncService.java',
'sync/SyncConfiguration.java',
'sync/SyncConfigurationException.java',
'sync/SyncConstants.java',
'sync/SyncException.java',
'sync/synchronizer/ConcurrentRecordConsumer.java',
'sync/synchronizer/RecordConsumer.java',
@ -1143,10 +1147,3 @@ sync_java_files = [
'tokenserver/TokenServerException.java',
'tokenserver/TokenServerToken.java',
]
sync_generated_java_files = [
'background/common/GlobalConstants.java',
'background/healthreport/HealthReportConstants.java',
'fxa/FxAccountConstants.java',
'sync/SyncConstants.java',
]

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

@ -1,38 +1,25 @@
//#filter substitution
/* 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.background.common;
import org.mozilla.gecko.AppConstants;
/**
* Preprocessed class for storing preprocessed values common to all
* Android services.
*/
public class GlobalConstants {
public static final String ANDROID_CPU_ARCH = "@ANDROID_CPU_ARCH@";
// One of 'beta', 'aurora', 'nightly', 'default'.
// If this is an official build, 'default' means 'release'.
// Otherwise, it means 'dev'.
public static final String MOZ_UPDATE_CHANNEL = "@MOZ_UPDATE_CHANNEL@";
//#ifdef MOZ_OFFICIAL_BRANDING
public static final boolean MOZ_OFFICIAL_BRANDING = true;
//#else
public static final boolean MOZ_OFFICIAL_BRANDING = false;
//#endif
public static final String MOZ_APP_DISPLAYNAME = "@MOZ_APP_DISPLAYNAME@";
public static final String MOZ_APP_VERSION = "@MOZ_APP_VERSION@";
public static final String BROWSER_INTENT_PACKAGE = "@ANDROID_PACKAGE_NAME@";
public static final String BROWSER_INTENT_CLASS = "org.mozilla.gecko.BrowserApp";
public static final String BROWSER_INTENT_PACKAGE = AppConstants.ANDROID_PACKAGE_NAME;
public static final String BROWSER_INTENT_CLASS = AppConstants.BROWSER_INTENT_CLASS_NAME;
/**
* Bug 800244: this signing-level permission protects broadcast intents that
* should be received only by the Firefox versions with the given Android
* package name.
*/
public static final String PER_ANDROID_PACKAGE_PERMISSION = "@ANDROID_PACKAGE_NAME@.permission.PER_ANDROID_PACKAGE";
public static final String PER_ANDROID_PACKAGE_PERMISSION = AppConstants.ANDROID_PACKAGE_NAME + ".permission.PER_ANDROID_PACKAGE";
public static final int SHARED_PREFERENCES_MODE = 0;

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

@ -1,4 +1,3 @@
//#filter substitution
/* 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/. */
@ -6,12 +5,13 @@
package org.mozilla.gecko.background.healthreport;
import org.mozilla.gecko.background.common.GlobalConstants;
import org.mozilla.gecko.AppConstants;
public class HealthReportConstants {
public static final String HEALTH_AUTHORITY = "@ANDROID_PACKAGE_NAME@.health";
public static final String HEALTH_AUTHORITY = AppConstants.ANDROID_PACKAGE_NAME + ".health";
public static final String GLOBAL_LOG_TAG = "GeckoHealth";
public static final String USER_AGENT = "Firefox-Android-HealthReport/" + GlobalConstants.MOZ_APP_VERSION + " (" + GlobalConstants.MOZ_APP_DISPLAYNAME + ")";
public static final String USER_AGENT = "Firefox-Android-HealthReport/" + AppConstants.MOZ_APP_VERSION + " (" + AppConstants.MOZ_APP_DISPLAYNAME + ")";
/**
* The earliest allowable value for the last ping time, corresponding to May 2nd 2013.
@ -35,8 +35,8 @@ public class HealthReportConstants {
public static final String PREF_PRUNE_INTENT_INTERVAL_MSEC = "healthreport_prune_intent_interval_msec";
public static final long DEFAULT_PRUNE_INTENT_INTERVAL_MSEC = GlobalConstants.MILLISECONDS_PER_DAY;
public static final String ACTION_HEALTHREPORT_UPLOAD_PREF = "@ANDROID_PACKAGE_NAME@.HEALTHREPORT_UPLOAD_PREF";
public static final String ACTION_HEALTHREPORT_PRUNE = "@ANDROID_PACKAGE_NAME@.HEALTHREPORT_PRUNE";
public static final String ACTION_HEALTHREPORT_UPLOAD_PREF = AppConstants.ANDROID_PACKAGE_NAME + ".HEALTHREPORT_UPLOAD_PREF";
public static final String ACTION_HEALTHREPORT_PRUNE = AppConstants.ANDROID_PACKAGE_NAME + ".HEALTHREPORT_PRUNE";
public static final String PREF_MINIMUM_TIME_BETWEEN_UPLOADS = "healthreport_time_between_uploads";
public static final long DEFAULT_MINIMUM_TIME_BETWEEN_UPLOADS = GlobalConstants.MILLISECONDS_PER_DAY;

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

@ -1,15 +1,14 @@
//#filter substitution
/* 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.fxa;
import org.mozilla.gecko.background.common.GlobalConstants;
import org.mozilla.gecko.AppConstants;
public class FxAccountConstants {
public static final String GLOBAL_LOG_TAG = "FxAccounts";
public static final String ACCOUNT_TYPE = "@MOZ_ANDROID_SHARED_FXACCOUNT_TYPE@";
public static final String ACCOUNT_TYPE = AppConstants.MOZ_ANDROID_SHARED_FXACCOUNT_TYPE;
public static final String DEFAULT_AUTH_SERVER_ENDPOINT = "https://api.accounts.firefox.com/v1";
public static final String DEFAULT_TOKEN_SERVER_ENDPOINT = "https://token.services.mozilla.com/1.0/sync/1.5";
@ -23,7 +22,7 @@ public class FxAccountConstants {
// You must wait 15 minutes after failing an age check before trying to create a different account.
public static final long MINIMUM_TIME_TO_WAIT_AFTER_AGE_CHECK_FAILED_IN_MILLISECONDS = 15 * 60 * 1000;
public static final String USER_AGENT = "Firefox-Android-FxAccounts/" + GlobalConstants.MOZ_APP_VERSION + " (" + GlobalConstants.MOZ_APP_DISPLAYNAME + ")";
public static final String USER_AGENT = "Firefox-Android-FxAccounts/" + AppConstants.MOZ_APP_VERSION + " (" + AppConstants.MOZ_APP_DISPLAYNAME + ")";
public static final String ACCOUNT_PICKLE_FILENAME = "fxa.account.json";
@ -53,7 +52,7 @@ public class FxAccountConstants {
*
* See bug 790931 for additional information in the context of Sync.
*/
public static final String ACCOUNT_DELETED_ACTION = "@MOZ_ANDROID_SHARED_FXACCOUNT_TYPE@.accounts.ACCOUNT_DELETED_ACTION";
public static final String ACCOUNT_DELETED_ACTION = AppConstants.MOZ_ANDROID_SHARED_FXACCOUNT_TYPE + ".accounts.ACCOUNT_DELETED_ACTION";
/**
* Version number of contents of SYNC_ACCOUNT_DELETED_ACTION intent.
@ -67,7 +66,7 @@ public class FxAccountConstants {
* This signing-level permission protects broadcast intents that should be
* received only by Firefox channels sharing the same Android Firefox Account type.
*/
public static final String PER_ACCOUNT_TYPE_PERMISSION = "@MOZ_ANDROID_SHARED_FXACCOUNT_TYPE@.permission.PER_ACCOUNT_TYPE";
public static final String PER_ACCOUNT_TYPE_PERMISSION = AppConstants.MOZ_ANDROID_SHARED_FXACCOUNT_TYPE + ".permission.PER_ACCOUNT_TYPE";
/**
* This action is broadcast when an Android Firefox Account's internal state
@ -77,5 +76,5 @@ public class FxAccountConstants {
* can be received only by Firefox versions sharing the same Android Firefox
* Account type.
*/
public static final String ACCOUNT_STATE_CHANGED_ACTION = "@MOZ_ANDROID_SHARED_FXACCOUNT_TYPE@.accounts.ACCOUNT_STATE_CHANGED_ACTION";
public static final String ACCOUNT_STATE_CHANGED_ACTION = AppConstants.MOZ_ANDROID_SHARED_FXACCOUNT_TYPE + ".accounts.ACCOUNT_STATE_CHANGED_ACTION";
}

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

@ -18,7 +18,6 @@ constants_jar.sources = [
constants_jar.generated_sources = [
'preprocessed/org/mozilla/gecko/AppConstants.java',
]
constants_jar.generated_sources += ['preprocessed/org/mozilla/gecko/' + f for f in sync_generated_java_files]
resjar = add_java_jar('gecko-R')
resjar.sources = []

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

@ -4,8 +4,8 @@
package org.mozilla.gecko.sync;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.R;
import org.mozilla.gecko.background.common.GlobalConstants;
import org.mozilla.gecko.sync.delegates.ClientsDataDelegate;
import org.mozilla.gecko.util.HardwareUtils;
@ -54,7 +54,7 @@ public class SharedPreferencesClientsDataDelegate implements ClientsDataDelegate
@Override
public String getDefaultClientName() {
String name = GlobalConstants.MOZ_APP_DISPLAYNAME; // The display name is never translated.
String name = AppConstants.MOZ_APP_DISPLAYNAME; // The display name is never translated.
// Change "Firefox Aurora" or similar into "Aurora".
if (name.contains("Aurora")) {
name = "Aurora";

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

@ -1,11 +1,10 @@
//#filter substitution
/* 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.sync;
import org.mozilla.gecko.background.common.GlobalConstants;
import org.mozilla.gecko.AppConstants;
/**
* Preprocessed class for storing preprocessed values specific to Android Sync.
@ -15,14 +14,14 @@ public class SyncConstants {
public static final String SYNC_MAJOR_VERSION = "1";
public static final String SYNC_MINOR_VERSION = "0";
public static final String SYNC_VERSION_STRING = SYNC_MAJOR_VERSION + "." +
GlobalConstants.MOZ_APP_VERSION + "." +
AppConstants.MOZ_APP_VERSION + "." +
SYNC_MINOR_VERSION;
public static final String USER_AGENT = "Firefox AndroidSync " +
SYNC_VERSION_STRING + " (" +
GlobalConstants.MOZ_APP_DISPLAYNAME + ")";
AppConstants.MOZ_APP_DISPLAYNAME + ")";
public static final String ACCOUNTTYPE_SYNC = "@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@";
public static final String ACCOUNTTYPE_SYNC = AppConstants.MOZ_ANDROID_SHARED_ACCOUNT_TYPE;
/**
* Bug 790931: this action is broadcast when an Android Sync Account is
@ -36,7 +35,7 @@ public class SyncConstants {
* See {@link org.mozilla.gecko.sync.setup.SyncAccounts#makeSyncAccountDeletedIntent(android.content.Context, android.accounts.AccountManager, android.accounts.Account)}
* for contents of the intent.
*/
public static final String SYNC_ACCOUNT_DELETED_ACTION = "@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@.accounts.SYNC_ACCOUNT_DELETED_ACTION";
public static final String SYNC_ACCOUNT_DELETED_ACTION = AppConstants.MOZ_ANDROID_SHARED_ACCOUNT_TYPE + ".accounts.SYNC_ACCOUNT_DELETED_ACTION";
/**
* Bug 790931: version number of contents of SYNC_ACCOUNT_DELETED_ACTION
@ -52,7 +51,7 @@ public class SyncConstants {
* should be received only by Firefox versions sharing the same Android Sync
* Account type.
*/
public static final String PER_ACCOUNT_TYPE_PERMISSION = "@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@.permission.PER_ACCOUNT_TYPE";
public static final String PER_ACCOUNT_TYPE_PERMISSION = AppConstants.MOZ_ANDROID_SHARED_ACCOUNT_TYPE + ".permission.PER_ACCOUNT_TYPE";
public static final String DEFAULT_AUTH_SERVER = "https://auth.services.mozilla.com/";

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

@ -14,7 +14,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.background.common.GlobalConstants;
import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.sync.CommandProcessor;
import org.mozilla.gecko.sync.CommandProcessor.Command;
@ -39,9 +38,7 @@ import org.mozilla.gecko.sync.repositories.android.RepoUtils;
import org.mozilla.gecko.sync.repositories.domain.ClientRecord;
import org.mozilla.gecko.sync.repositories.domain.ClientRecordFactory;
import org.mozilla.gecko.sync.repositories.domain.VersionConstants;
import org.mozilla.gecko.util.HardwareUtils;
import android.content.Context;
import ch.boye.httpclientandroidlib.HttpStatus;
public class SyncClientsEngineStage extends AbstractSessionManagingSyncStage {
@ -362,7 +359,7 @@ public class SyncClientsEngineStage extends AbstractSessionManagingSyncStage {
}
protected String getLocalClientVersion() {
return GlobalConstants.MOZ_APP_VERSION;
return AppConstants.MOZ_APP_VERSION;
}
@SuppressWarnings("unchecked")
@ -383,7 +380,7 @@ public class SyncClientsEngineStage extends AbstractSessionManagingSyncStage {
r.protocols = getLocalClientProtocols();
r.os = "Android";
r.application = GlobalConstants.MOZ_APP_DISPLAYNAME;
r.application = AppConstants.MOZ_APP_DISPLAYNAME;
r.appPackage = AppConstants.ANDROID_PACKAGE_NAME;
r.device = android.os.Build.MODEL;
r.formfactor = delegate.getFormFactor();