aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ddms/app/src/com/android/ddms/Main.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java13
-rw-r--r--sdkstats/src/com/android/sdkstats/SdkStatsService.java28
-rw-r--r--traceview/src/com/android/traceview/MainWindow.java2
4 files changed, 32 insertions, 15 deletions
diff --git a/ddms/app/src/com/android/ddms/Main.java b/ddms/app/src/com/android/ddms/Main.java
index c8bab66..6247a28 100644
--- a/ddms/app/src/com/android/ddms/Main.java
+++ b/ddms/app/src/com/android/ddms/Main.java
@@ -74,7 +74,7 @@ public class Main {
// the "ping" argument means to check in with the server and exit
// the application name and version number must also be supplied
if (args.length >= 3 && args[0].equals("ping")) {
- SdkStatsService.ping(args[1], args[2], null);
+ SdkStatsService.ping(args[1], args[2], null /*eclipseVersion*/, null);
return;
} else if (args.length > 0) {
Log.e("ddms", "Unknown argument: " + args[0]);
@@ -134,7 +134,7 @@ public class Main {
p.load(new FileInputStream(sourceProp));
sRevision = p.getProperty("Pkg.Revision"); //$NON-NLS-1$
if (sRevision != null && sRevision.length() > 0) {
- SdkStatsService.ping("ddms", sRevision, null); //$NON-NLS-1$
+ SdkStatsService.ping("ddms", sRevision, null /*eclipseVersion*/, null); //$NON-NLS-1$
}
} catch (FileNotFoundException e) {
// couldn't find the file? don't ping.
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
index 6bc4b38..9603255 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
@@ -1709,7 +1709,18 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger {
versionString = String.format("%1$d.%2$d.%3$d", version.getMajor(), //$NON-NLS-1$
version.getMinor(), version.getMicro());
- SdkStatsService.ping("adt", versionString, getDisplay()); //$NON-NLS-1$
+ // get the version of eclipse by getting the version of one of the runtime plugins.
+ ResourcesPlugin resPlugin = ResourcesPlugin.getPlugin();
+
+ String eclipseVersionString = (String) resPlugin.getBundle().getHeaders().get(
+ Constants.BUNDLE_VERSION);
+
+ // parse the string using the Version class.
+ Version eclipseVersion = new Version(eclipseVersionString);
+ eclipseVersionString = String.format("%1$d.%2$d", //$NON-NLS-1$
+ eclipseVersion.getMajor(), eclipseVersion.getMinor());
+
+ SdkStatsService.ping("adt", versionString, eclipseVersionString, getDisplay()); //$NON-NLS-1$
}
/**
diff --git a/sdkstats/src/com/android/sdkstats/SdkStatsService.java b/sdkstats/src/com/android/sdkstats/SdkStatsService.java
index f750413..1e2b418 100644
--- a/sdkstats/src/com/android/sdkstats/SdkStatsService.java
+++ b/sdkstats/src/com/android/sdkstats/SdkStatsService.java
@@ -115,7 +115,8 @@ public class SdkStatsService {
* @param display an optional {@link Display} object to use, or null, if a new one should be
* created.
*/
- public static void ping(final String app, final String version, final Display display) {
+ public static void ping(final String app, final String version, final String eclipseVersion,
+ final Display display) {
// Unique, randomly assigned ID for this installation.
PreferenceStore prefs = getPreferenceStore();
if (prefs != null) {
@@ -125,9 +126,9 @@ public class SdkStatsService {
// ask the user whether he/she wants to opt-out.
// This will call doPing in the Display thread after the dialog closes.
- getUserPermissionAndPing(app, version, prefs, display);
+ getUserPermissionAndPing(app, version, eclipseVersion, prefs, display);
} else {
- doPing(app, version, prefs);
+ doPing(app, version, eclipseVersion, prefs);
}
}
}
@@ -188,9 +189,11 @@ public class SdkStatsService {
* Pings the usage stats server, as long as the prefs contain the opt-in boolean
* @param app name to report in the ping
* @param version to report in the ping
+ * @param eclipseVersion optional version of eclipse.
* @param prefs the preference store where the opt-in value and ping times are store
*/
- private static void doPing(final String app, String version, PreferenceStore prefs) {
+ private static void doPing(final String app, String version, final String eclipseVersion,
+ PreferenceStore prefs) {
// Validate the application and version input.
final String normalVersion = normalizeVersion(app, version);
@@ -224,7 +227,7 @@ public class SdkStatsService {
@Override
public void run() {
try {
- actuallySendPing(app, normalVersion, id);
+ actuallySendPing(app, normalVersion, eclipseVersion, id);
} catch (IOException e) {
e.printStackTrace();
}
@@ -238,11 +241,12 @@ public class SdkStatsService {
*
* @param app name to report in the ping
* @param version to report in the ping (dotted numbers, no more than four)
+ * @param eclipseVersion optional version of eclipse.
* @param id of the local installation
* @throws IOException if the ping failed
*/
@SuppressWarnings("deprecation")
- private static void actuallySendPing(String app, String version, long id)
+ private static void actuallySendPing(String app, String version, String eclipseVersion, long id)
throws IOException {
// Detect and report the host OS.
String os = System.getProperty("os.name"); //$NON-NLS-1$
@@ -274,7 +278,9 @@ public class SdkStatsService {
"/service/update?as=androidsdk_" + app + //$NON-NLS-1$
"&id=" + Long.toHexString(id) + //$NON-NLS-1$
"&version=" + version + //$NON-NLS-1$
- "&os=" + os); //$NON-NLS-1$
+ "&os=" + os + //$NON-NLS-1$
+ (eclipseVersion != null ?
+ "&eclipse=" + eclipseVersion : "")); //$NON-NLS-1$ //$NON-NLS-2$
// Discard the actual response, but make sure it reads OK
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
@@ -308,10 +314,10 @@ public class SdkStatsService {
/**
* Prompt the user for whether they want to opt out of reporting, and then calls
- * {@link #doPing(String, String, PreferenceStore)}
+ * {@link #doPing(String, String, String, PreferenceStore)}
*/
private static void getUserPermissionAndPing(final String app, final String version,
- final PreferenceStore prefs, Display display) {
+ final String eclipseVersion, final PreferenceStore prefs, Display display) {
boolean dispose = false;
if (display == null) {
display = new Display();
@@ -396,7 +402,7 @@ public class SdkStatsService {
prefs.setValue(PING_OPT_IN, permission[0]);
try {
prefs.save();
- doPing(app, version, prefs);
+ doPing(app, version, eclipseVersion, prefs);
}
catch (IOException ioe) {
}
@@ -452,7 +458,7 @@ public class SdkStatsService {
* @return normalized dotted quad version
*/
private static String normalizeVersion(String app, String version) {
- // Application name must contain only word characters (no punctuaation)
+ // Application name must contain only word characters (no punctuation)
if (!app.matches("\\w+")) {
throw new IllegalArgumentException("Bad app name: " + app);
}
diff --git a/traceview/src/com/android/traceview/MainWindow.java b/traceview/src/com/android/traceview/MainWindow.java
index 0b07163..194b3c0 100644
--- a/traceview/src/com/android/traceview/MainWindow.java
+++ b/traceview/src/com/android/traceview/MainWindow.java
@@ -201,7 +201,7 @@ public class MainWindow extends ApplicationWindow {
String revision = getRevision();
if (revision != null) {
- SdkStatsService.ping(PING_NAME, revision, null);
+ SdkStatsService.ping(PING_NAME, revision, null /*eclipseView*/, null);
}
// Process command line arguments