Bug 856163 - Part 3: Remove GeckoAppInfo. r=jchen

This commit is contained in:
Brian Nicholson 2013-04-09 17:10:47 -07:00
parent ed0ffd2ff8
commit 0993a7cd96
4 changed files with 19 additions and 68 deletions

View File

@ -34,6 +34,7 @@ import java.nio.charset.Charset;
import java.security.GeneralSecurityException;
import java.security.MessageDigest;
import java.util.UUID;
import java.util.Locale;
import java.util.regex.Pattern;
public final class ANRReporter extends BroadcastReceiver
@ -207,9 +208,9 @@ public final class ANRReporter extends BroadcastReceiver
// Regex for finding our package name in the traces file
Pattern pkgPattern = Pattern.compile(Pattern.quote(pkgName) + END_OF_PACKAGE_NAME);
Pattern mangledPattern = null;
if (!GeckoAppInfo.getMangledPackageName().equals(pkgName)) {
if (!AppConstants.MANGLED_ANDROID_PACKAGE_NAME.equals(pkgName)) {
mangledPattern = Pattern.compile(Pattern.quote(
GeckoAppInfo.getMangledPackageName()) + END_OF_PACKAGE_NAME);
AppConstants.MANGLED_ANDROID_PACKAGE_NAME) + END_OF_PACKAGE_NAME);
}
if (DEBUG) {
Log.d(LOGTAG, "trying to match package: " + pkgName);
@ -273,6 +274,12 @@ public final class ANRReporter extends BroadcastReceiver
return 0L;
}
private static String getLocale() {
// Having a different locale than system locale is not
// supported right now; assume we are using the system locale
return Locale.getDefault().toString().replace('_', '-');
}
/*
a saved telemetry ping file consists of JSON in the following format,
{
@ -329,15 +336,16 @@ public final class ANRReporter extends BroadcastReceiver
"}," +
"\"info\":{" +
"\"reason\":\"android-anr-report\"," +
"\"OS\":" + JSONObject.quote(GeckoAppInfo.getOS()) + "," +
"\"OS\":" + JSONObject.quote(AppConstants.OS_TARGET) + "," +
"\"version\":\"" + String.valueOf(Build.VERSION.SDK_INT) + "\"," +
"\"appID\":" + JSONObject.quote(GeckoAppInfo.getID()) + "," +
"\"appVersion\":" + JSONObject.quote(GeckoAppInfo.getVersion()) + "," +
"\"appName\":" + JSONObject.quote(GeckoAppInfo.getName()) + "," +
"\"appBuildID\":" + JSONObject.quote(GeckoAppInfo.getBuildID()) + "," +
"\"appUpdateChannel\":" + JSONObject.quote(GeckoAppInfo.getUpdateChannel()) + "," +
"\"platformBuildID\":" + JSONObject.quote(GeckoAppInfo.getPlatformBuildID()) + "," +
"\"locale\":" + JSONObject.quote(GeckoAppInfo.getLocale()) + "," +
"\"appID\":" + JSONObject.quote(AppConstants.MOZ_APP_ID) + "," +
"\"appVersion\":" + JSONObject.quote(AppConstants.MOZ_APP_VERSION)+ "," +
"\"appName\":" + JSONObject.quote(AppConstants.MOZ_APP_BASENAME) + "," +
"\"appBuildID\":" + JSONObject.quote(AppConstants.MOZ_APP_BUILDID) + "," +
"\"appUpdateChannel\":" + JSONObject.quote(AppConstants.MOZ_UPDATE_CHANNEL) + "," +
// Technically the platform build ID may be different, but we'll never know
"\"platformBuildID\":" + JSONObject.quote(AppConstants.MOZ_APP_BUILDID) + "," +
"\"locale\":" + JSONObject.quote(getLocale()) + "," +
"\"cpucount\":" + String.valueOf(Runtime.getRuntime().availableProcessors()) + "," +
"\"memsize\":" + String.valueOf(getTotalMem()) + "," +
"\"arch\":" + JSONObject.quote(System.getProperty("os.arch")) + "," +

View File

@ -1310,7 +1310,7 @@ abstract public class GeckoApp
GeckoAppShell.registerGlobalExceptionHandler();
// Enable Android Strict Mode for developers' local builds (the "default" channel).
if ("default".equals(GeckoAppInfo.getUpdateChannel())) {
if ("default".equals(AppConstants.MOZ_UPDATE_CHANNEL)) {
enableStrictMode();
}

View File

@ -1,56 +0,0 @@
/* -*- 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/. */
#filter substitution
package org.mozilla.gecko;
import org.mozilla.gecko.updater.UpdateServiceHelper;
import java.util.Locale;
public final class GeckoAppInfo
{
private static final boolean DEBUG = false;
private static final String LOGTAG = "GeckoAppInfo";
public static String getOS() {
return "@OS_TARGET@";
}
public static String getID() {
return "@MOZ_APP_ID@";
}
public static String getName() {
return "@MOZ_APP_BASENAME@";
}
public static String getVersion() {
return "@MOZ_APP_VERSION@";
}
public static String getBuildID() {
return "@MOZ_APP_BUILDID@";
}
public static String getUpdateChannel() {
return AppConstants.MOZ_UPDATE_CHANNEL;
}
public static String getPlatformBuildID() {
// Technically the platform build ID may be different, but we'll never know
return getBuildID();
}
public static String getLocale() {
// Having a different locale than system locale is not
// supported right now; assume we are using the system locale
return Locale.getDefault().toString().replace('_', '-');
}
public static String getMangledPackageName() {
return "@MANGLED_ANDROID_PACKAGE_NAME@";
}
}

View File

@ -254,7 +254,6 @@ FENNEC_PP_JAVA_FILES = \
App.java \
WebApp.java \
WebApps.java \
GeckoAppInfo.java \
db/BrowserContract.java \
db/BrowserProvider.java \
db/PasswordsProvider.java \