diff options
author | Xavier Ducrohet <xav@android.com> | 2009-09-25 14:52:55 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2009-09-25 15:18:37 -0700 |
commit | 0c44ff52ccfbafa1bfa5dbd49be773dd8e922678 (patch) | |
tree | c4aa9e5377e885e2810b01fdfd09aa839a731bb2 /traceview | |
parent | f1b490003a4c81cdc04c994875d9cedbb0a63d6a (diff) | |
download | sdk-0c44ff52ccfbafa1bfa5dbd49be773dd8e922678.zip sdk-0c44ff52ccfbafa1bfa5dbd49be773dd8e922678.tar.gz sdk-0c44ff52ccfbafa1bfa5dbd49be773dd8e922678.tar.bz2 |
Sync DDMS/Traceview/Android version on the repository source.
All apps now read source.properties located in SDK/tools
to know which version they. This is used in about box display
and in ping usage.
Change-Id: I6620c3eb703c32bfcdfd96e6a27bffc7a123b974
Diffstat (limited to 'traceview')
-rwxr-xr-x | traceview/etc/traceview | 23 | ||||
-rwxr-xr-x | traceview/etc/traceview.bat | 2 | ||||
-rw-r--r-- | traceview/src/com/android/traceview/MainWindow.java | 48 |
3 files changed, 43 insertions, 30 deletions
diff --git a/traceview/etc/traceview b/traceview/etc/traceview index 8f52e77..3d1771f 100755 --- a/traceview/etc/traceview +++ b/traceview/etc/traceview @@ -14,27 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This script assumes that the path to this script is something like: -# -# /somepath/outdir/archdir/hostdir/bindir/traceview -# -# where "somepath" is some pathname (like "/work/android/device/") -# "outdir" is a subdirectory (like "out") -# "archdir" is a subdirectory (like "linux-x86-release") -# "hostdir" is a subdirectory (like "host") -# "bindir" is a subdirectory (like "bin") -# -# e.g. /work/android/device/out/linux-x86-release/host/bin/traceview -# -# and that the following directories also exist: -# -# /somepath/outdir/archdir/hostdir/lib/ -# /somepath/outdir/archdir/hostdir/framework/ -# -# where: -# "lib", and "framework" are at the same level as "bindir", -# and are the literal names. - # Set up prog to be the path of this script, including following symlinks, # and set up progdir to be the fully-qualified pathname of its directory. prog="$0" @@ -118,4 +97,4 @@ else exit 1 fi -exec "${javaCmd}" $javaOpts -Djava.ext.dirs="$frameworkdir" -jar "$jarpath" "$@" +exec "${javaCmd}" $javaOpts -Djava.ext.dirs="$frameworkdir" -Dcom.android.traceview.toolsdir="$progdir" -jar "$jarpath" "$@" diff --git a/traceview/etc/traceview.bat b/traceview/etc/traceview.bat index 2da8a3b..02fbe85 100755 --- a/traceview/etc/traceview.bat +++ b/traceview/etc/traceview.bat @@ -55,4 +55,4 @@ if exist %swt_path% goto SetPath :SetPath set javaextdirs=%swt_path%;%frameworkdir% -call java -Djava.ext.dirs=%javaextdirs% -jar %jarpath% %* +call java -Djava.ext.dirs=%javaextdirs% -Dcom.android.traceview.toolsdir= -jar %jarpath% %* diff --git a/traceview/src/com/android/traceview/MainWindow.java b/traceview/src/com/android/traceview/MainWindow.java index 5800f81..00fcc8b 100644 --- a/traceview/src/com/android/traceview/MainWindow.java +++ b/traceview/src/com/android/traceview/MainWindow.java @@ -30,14 +30,16 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import java.io.File; -import java.io.IOException; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.FileOutputStream; +import java.io.IOException; import java.nio.channels.FileChannel; import java.util.HashMap; +import java.util.Properties; public class MainWindow extends ApplicationWindow { - + private final static String PING_NAME = "Traceview"; private final static String PING_VERSION = "1.0"; @@ -99,10 +101,10 @@ public class MainWindow extends ApplicationWindow { /** * Convert the old two-file format into the current concatenated one. - * + * * @param base Base path of the two files, i.e. base.key and base.data * @return Path to a temporary file that will be deleted on exit. - * @throws IOException + * @throws IOException */ private static String makeTempTraceFile(String base) throws IOException { // Make a temporary file that will go away on exit and prepare to @@ -127,13 +129,45 @@ public class MainWindow extends ApplicationWindow { // Return the path of the temp file. return temp.getPath(); } - + + /** + * Returns the tools revision number. + */ + private static String getRevision() { + Properties p = new Properties(); + try{ + String toolsdir = System.getProperty("com.android.traceview.toolsdir"); //$NON-NLS-1$ + File sourceProp; + if (toolsdir == null || toolsdir.length() == 0) { + sourceProp = new File("source.properties"); //$NON-NLS-1$ + } else { + sourceProp = new File(toolsdir, "source.properties"); //$NON-NLS-1$ + } + p.load(new FileInputStream(sourceProp)); + String revision = p.getProperty("Pkg.Revision"); //$NON-NLS-1$ + if (revision != null && revision.length() > 0) { + return revision; + } + } catch (FileNotFoundException e) { + // couldn't find the file? don't ping. + } catch (IOException e) { + // couldn't find the file? don't ping. + } + + return null; + } + + public static void main(String[] args) { TraceReader reader = null; boolean regression = false; - + // ping the usage server - SdkStatsService.ping(PING_NAME, PING_VERSION, null); + + String revision = getRevision(); + if (revision != null) { + SdkStatsService.ping(PING_NAME, revision, null); + } // Process command line arguments int argc = 0; |