diff options
author | Raphael Moll <ralf@android.com> | 2011-08-19 20:19:38 -0700 |
---|---|---|
committer | Raphael Moll <ralf@android.com> | 2011-08-19 20:19:38 -0700 |
commit | 4674055b588bdb0588a8ef9cc5a96cf346ed976e (patch) | |
tree | a4d53b53186c14b43b40f7339e9f67075870294c | |
parent | 922e0f13aa83e84727076c48db39df6dde54c951 (diff) | |
download | sdk-4674055b588bdb0588a8ef9cc5a96cf346ed976e.zip sdk-4674055b588bdb0588a8ef9cc5a96cf346ed976e.tar.gz sdk-4674055b588bdb0588a8ef9cc5a96cf346ed976e.tar.bz2 |
Change way we report Eclipse version in stat ping.
This reverts the way Change I14dba0dd was sending
the Eclipse version. Instead of passing a new attribute,
we reuse the existing "app=>version" format, with a
specific app name of "eclipse". Since versions are
reformated in 4 parts, it will report something like
"3.5.0.0" (only major+minor and 2 zero sub parts).
We don't send more details than that (e.g. Milestones).
Change-Id: Id01e3ed6b96ea4ce4e1b4f643d08a050291a6e7b
4 files changed, 21 insertions, 22 deletions
diff --git a/ddms/app/src/com/android/ddms/Main.java b/ddms/app/src/com/android/ddms/Main.java index 6247a28..c8bab66 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 /*eclipseVersion*/, null); + SdkStatsService.ping(args[1], args[2], 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 /*eclipseVersion*/, null); //$NON-NLS-1$ + SdkStatsService.ping("ddms", sRevision, 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 0963d78..7a93dc3 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 @@ -1701,7 +1701,8 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger { * Pings the usage start server. */ private void pingUsageServer() { - // get the version of the plugin + + // Report the version of the ADT plugin to the stat server String versionString = (String) getBundle().getHeaders().get( Constants.BUNDLE_VERSION); Version version = new Version(versionString); @@ -1709,7 +1710,10 @@ 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()); - // get the version of eclipse by getting the version of one of the runtime plugins. + SdkStatsService.ping("adt", versionString, getDisplay()); //$NON-NLS-1$ + + // Report the version of Eclipse to the stat server. + // 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( @@ -1720,7 +1724,7 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger { eclipseVersionString = String.format("%1$d.%2$d", //$NON-NLS-1$ eclipseVersion.getMajor(), eclipseVersion.getMinor()); - SdkStatsService.ping("adt", versionString, eclipseVersionString, getDisplay()); //$NON-NLS-1$ + SdkStatsService.ping("eclipse", eclipseVersionString, getDisplay()); //$NON-NLS-1$ } /** diff --git a/sdkstats/src/com/android/sdkstats/SdkStatsService.java b/sdkstats/src/com/android/sdkstats/SdkStatsService.java index 1e2b418..399a903 100644 --- a/sdkstats/src/com/android/sdkstats/SdkStatsService.java +++ b/sdkstats/src/com/android/sdkstats/SdkStatsService.java @@ -115,8 +115,7 @@ 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 String eclipseVersion, - final Display display) { + public static void ping(final String app, final String version, final Display display) { // Unique, randomly assigned ID for this installation. PreferenceStore prefs = getPreferenceStore(); if (prefs != null) { @@ -126,9 +125,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, eclipseVersion, prefs, display); + getUserPermissionAndPing(app, version, prefs, display); } else { - doPing(app, version, eclipseVersion, prefs); + doPing(app, version, prefs); } } } @@ -187,13 +186,12 @@ 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, final String eclipseVersion, - PreferenceStore prefs) { + private static void doPing(final String app, String version, PreferenceStore prefs) { // Validate the application and version input. final String normalVersion = normalizeVersion(app, version); @@ -227,7 +225,7 @@ public class SdkStatsService { @Override public void run() { try { - actuallySendPing(app, normalVersion, eclipseVersion, id); + actuallySendPing(app, normalVersion, id); } catch (IOException e) { e.printStackTrace(); } @@ -241,12 +239,11 @@ 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, String eclipseVersion, long id) + private static void actuallySendPing(String app, String version, long id) throws IOException { // Detect and report the host OS. String os = System.getProperty("os.name"); //$NON-NLS-1$ @@ -278,9 +275,7 @@ 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$ - (eclipseVersion != null ? - "&eclipse=" + eclipseVersion : "")); //$NON-NLS-1$ //$NON-NLS-2$ + "&os=" + os); //$NON-NLS-1$ // Discard the actual response, but make sure it reads OK HttpURLConnection conn = (HttpURLConnection) url.openConnection(); @@ -314,10 +309,10 @@ public class SdkStatsService { /** * Prompt the user for whether they want to opt out of reporting, and then calls - * {@link #doPing(String, String, String, PreferenceStore)} + * {@link #doPing(String, String, PreferenceStore)} */ private static void getUserPermissionAndPing(final String app, final String version, - final String eclipseVersion, final PreferenceStore prefs, Display display) { + final PreferenceStore prefs, Display display) { boolean dispose = false; if (display == null) { display = new Display(); @@ -402,7 +397,7 @@ public class SdkStatsService { prefs.setValue(PING_OPT_IN, permission[0]); try { prefs.save(); - doPing(app, version, eclipseVersion, prefs); + doPing(app, version, prefs); } catch (IOException ioe) { } diff --git a/traceview/src/com/android/traceview/MainWindow.java b/traceview/src/com/android/traceview/MainWindow.java index 194b3c0..0b07163 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 /*eclipseView*/, null); + SdkStatsService.ping(PING_NAME, revision, null); } // Process command line arguments |