Commit c110a912 authored by Jeffrey I. Schiller's avatar Jeffrey I. Schiller

Convert from Bugsense to ACRA

Change-Id: Iba724b4213d23e920c6b4c1653fdbba300839535
parent a1bf22b6
......@@ -90,8 +90,8 @@
<pathelement location="lib/oauth/google-oauth-client-1.10.1-beta.jar" />
<!-- fusiontables libs -->
<pathelement location="lib/fusiontables/fusiontables.jar" />
<!-- bugsense -->
<pathelement location="lib/bugsense/bugsense3.1.jar" />
<!-- acra -->
<pathelement location="lib/acra/acra-4.4.0.jar" />
<!-- gwt libs -->
<pathelement location="lib/gwt/2.3.0/gwt-dev.jar"/>
<pathelement location="lib/gwt/2.3.0/gwt-user.jar"/>
......
......@@ -129,7 +129,7 @@
</copy>
<copy toFile="${classes.files.dir}/YailGenerator.jar" file="${local.build.dir}/YailGenerator.jar" />
<copy toFile="${classes.files.dir}/kawa.jar" file="${lib.dir}/kawa/kawa-1.11-modified.jar" />
<copy toFile="${classes.files.dir}/bugsense3.1.jar" file="${lib.dir}/bugsense/bugsense3.1.jar" />
<copy toFile="${classes.files.dir}/acra-4.4.0.jar" file="${lib.dir}/acra/acra-4.4.0.jar" />
<copy toFile="${classes.files.dir}/twitter4j.jar" file="${lib.dir}/twitter/twitter4j-core-android-2.2.6.jar" />
<copy toFile="${classes.files.dir}/fusiontables.jar" file="${lib.dir}/fusiontables/fusiontables.jar" />
<copy toFile="${classes.files.dir}/google-api-client-beta.jar" file="${lib.dir}/oauth/google-api-client-1.10.3-beta.jar" />
......
......@@ -94,8 +94,8 @@ public final class Compiler {
"/tools/linux/aapt";
private static final String KAWA_RUNTIME =
RUNTIME_FILES_DIR + "kawa.jar";
private static final String BUGSENSE_RUNTIME =
RUNTIME_FILES_DIR + "bugsense3.1.jar";
private static final String ACRA_RUNTIME =
RUNTIME_FILES_DIR + "acra-4.4.0.jar";
private static final String DX_JAR =
RUNTIME_FILES_DIR + "dx.jar";
......@@ -174,6 +174,10 @@ public final class Compiler {
for (String componentType : componentTypes) {
permissions.addAll(componentPermissions.get(componentType));
}
if (isForWireless) { // This is so ACRA can do a logcat on phones older then Jelly Bean
permissions.add("android.permission.READ_LOGS");
}
return permissions;
}
......@@ -279,7 +283,7 @@ public final class Compiler {
out.write("android:debuggable=\"false\" ");
out.write("android:label=\"" + projectName + "\" ");
out.write("android:icon=\"@drawable/ya\" ");
if (isForWireless) { // This is to hook into Bugsense
if (isForWireless) { // This is to hook into ACRA
out.write("android:name=\"com.google.appinventor.components.runtime.ReplApplication\" ");
}
out.write(">\n");
......@@ -624,7 +628,7 @@ public final class Compiler {
// Construct the class path including component libraries (jars)
String classpath =
getResource(KAWA_RUNTIME) + File.pathSeparator +
getResource(BUGSENSE_RUNTIME) + File.pathSeparator +
getResource(ACRA_RUNTIME) + File.pathSeparator +
getResource(SIMPLE_ANDROID_RUNTIME_JAR) + File.pathSeparator;
// Add component library names to classpath
......@@ -837,7 +841,7 @@ public final class Compiler {
commandLineList.add(classesDir.getAbsolutePath());
commandLineList.add(getResource(SIMPLE_ANDROID_RUNTIME_JAR));
commandLineList.add(getResource(KAWA_RUNTIME));
commandLineList.add(getResource(BUGSENSE_RUNTIME));
commandLineList.add(getResource(ACRA_RUNTIME));
// Add libraries to command line arguments
System.out.println("Libraries needed command line n = " + librariesNeeded.size());
......
......@@ -17,7 +17,7 @@ public final class GitBuildId {
public static final String GIT_BUILD_VERSION = "@git.build.version@";
public static final String GIT_BUILD_FINGERPRINT = "@git.build.fingerprint@";
public static final String ANT_BUILD_DATE = "@ant.build.date@";
public static final String BUGSENSE_API_KEY = "@bugsense.apikey@";
public static final String ACRA_URI = "@acra.uri@";
private GitBuildId() {
}
......@@ -44,10 +44,10 @@ public final class GitBuildId {
return ANT_BUILD_DATE;
}
public static String getBugsenseApiKey() {
if (BUGSENSE_API_KEY.equals("${bugsense.apikey}")) // This is the value if no value is provided to ant
public static String getAcraUri() {
if (ACRA_URI.equals("${acra.uri}")) // This is the value if no value is provided to ant
return("");
return BUGSENSE_API_KEY.trim();
return ACRA_URI.trim();
}
}
......@@ -110,7 +110,7 @@
<property name="ant.build.date" value="${TODAY}" />
<filter token="ant.build.date" value="${ant.build.date}" />
<filter token="bugsense.apikey" value="${bugsense.apikey}" />
<filter token="acra.uri" value="${acra.uri}" />
<mkdir dir="${local.build.dir}/src/${common.pkg}/version/"/>
<copy tofile="${local.build.dir}/src/${common.pkg}/version/GitBuildId.java" file="GitBuildId.template" filtering="true" />
......
......@@ -119,7 +119,7 @@
<pathelement location="${build.dir}/common/CommonVersion.jar" />
<pathelement location="${lib.dir}/android/2.2/android.jar" />
<pathelement location="${lib.dir}/kawa/kawa-1.11-modified.jar" />
<pathelement location="${lib.dir}/bugsense/bugsense3.1.jar" />
<pathelement location="${lib.dir}/acra/acra-4.4.0.jar" />
<pathelement location="${lib.dir}/twitter/twitter4j-core-android-2.2.6.jar" />
<pathelement location="${lib.dir}/fusiontables/fusiontables.jar" />
<pathelement location="${lib.dir}/oauth/google-api-client-1.10.3-beta.jar" />
......@@ -151,7 +151,7 @@
<pathelement location="${lib.dir}/junit/junit-4.8.2.jar" />
<pathelement location="${lib.dir}/junit4/tl4j-junit4-1.1.3.jar" />
<pathelement location="${lib.dir}/kawa/kawa-1.11-modified.jar" />
<pathelement location="${lib.dir}/bugsense/bugsense3.1.jar" />
<pathelement location="${lib.dir}/acra/acra-4.4.0.jar" />
<pathelement location="${lib.dir}/powermock/cglib-nodep-2.2.jar" />
<pathelement location="${lib.dir}/powermock/easymock-3.0.jar" />
<pathelement location="${lib.dir}/powermock/javassist-3.15.0-GA.jar" />
......@@ -216,7 +216,7 @@
<pathelement location="${lib.dir}/android/2.2/android.jar" />
<pathelement location="${lib.dir}/guava/guava-11.0.1.jar" />
<pathelement location="${lib.dir}/kawa/kawa-1.11-modified.jar" />
<pathelement location="${lib.dir}/bugsense/bugsense3.1.jar" />
<pathelement location="${lib.dir}/acra/acra-4.4.0.jar" />
<pathelement location="${lib.dir}/twitter/twitter4j-core-android-2.2.6.jar" />
<pathelement location="${lib.dir}/fusiontables/fusiontables.jar" />
<pathelement location="${lib.dir}/oauth/google-api-client-1.10.3-beta.jar" />
......
......@@ -11,45 +11,47 @@ import com.google.appinventor.common.version.GitBuildId;
import com.google.appinventor.components.runtime.util.EclairUtil;
import com.google.appinventor.components.runtime.util.SdkLevel;
import org.acra.*;
import org.acra.annotation.*;
/**
* Subclass of Application. Normally App Inventor apps just use the
* android.app.Application class as their main application. However we
* use the Bugsense debugging application with the MIT AI Companion
* use the ACRA debugging application with the MIT AI Companion
* app. This class is only pointed to by the Android Manifest if
* Compiler.java (which builds the Manifest) is building the Wireless
* version of the MIT AI Companion. In this fashion we only turn on
* bugsense when using the Wireless MIT AI Companion.
*
* Bugsense *can* be hooked into an Activity as well as an
* Application, however ACRA, which we may use as an alternative, only
* hooks into an Application object, so that is why we hook bugsense
* here. It Makes changing over to ACRA reasonably easy.
* ACRA when using the Wireless MIT AI Companion.
*
* @author jis@mit.edu (Jeffrey I. Schiller)
*/
@ReportsCrashes(formKey="")
public class ReplApplication extends Application {
private static ReplApplication theInstance = null;
private boolean active = false;
private static ReplApplication thisInstance;
@Override
public void onCreate() {
super.onCreate();
String apikey = GitBuildId.getBugsenseApiKey();
if ((SdkLevel.getLevel() > SdkLevel.LEVEL_DONUT) && !apikey.equals("")) {
EclairUtil.setupBugSense((Context) this, apikey);
theInstance = this;
active = true;
Log.i("ReplApplication", "Bugsense Active APIKEY = " + apikey);
thisInstance = this;
String acraUri = GitBuildId.getAcraUri();
if (acraUri.equals("")) {
Log.i("ReplApplication", "ACRA Not Active");
} else {
Log.i("ReplApplication", "Bugsense NOT ACTIVE");
Log.i("ReplApplication", "ACRA Active, URI = " + acraUri);
ACRAConfiguration config = ACRA.getNewDefaultConfig(this);
config.setFormUri(acraUri);
config.setDisableSSLCertValidation(true); // So we can use an MIT or self signed cert
ACRA.setConfig(config); // On the server.
ACRA.init(this);
active = true;
}
}
public static void reportError(Exception ex) {
if (theInstance != null && theInstance.active) {
EclairUtil.sendBugSenseException(ex);
}
public static void reportError(Throwable ex) {
if (thisInstance != null && thisInstance.active)
ACRA.getErrorReporter().handleException(ex);
}
}
......@@ -11,8 +11,6 @@ import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import com.bugsense.trace.BugSenseHandler;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.GeolocationPermissions;
......@@ -44,14 +42,6 @@ public class EclairUtil {
activity.overridePendingTransition(enterAnim, exitAnim);
}
public static void setupBugSense(Context context, String api_key) {
BugSenseHandler.initAndStartSession(context, api_key);
}
public static void sendBugSenseException(Exception ex) {
BugSenseHandler.sendException(ex);
}
/**
* Setup Dialog Box to request location permission from end-user for the Javascript
* location (navigator.geolocation.getCurrentLocation()) API.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment