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
This commit is contained in:
@@ -124,7 +124,11 @@ public class AboutDialog extends Dialog {
|
|||||||
|
|
||||||
// Text lines
|
// Text lines
|
||||||
label = new Label(textArea, SWT.NONE);
|
label = new Label(textArea, SWT.NONE);
|
||||||
label.setText("Dalvik Debug Monitor v" + Main.VERSION);
|
if (Main.sRevision != null && Main.sRevision.length() > 0) {
|
||||||
|
label.setText("Dalvik Debug Monitor Revision " + Main.sRevision);
|
||||||
|
} else {
|
||||||
|
label.setText("Dalvik Debug Monitor");
|
||||||
|
}
|
||||||
label = new Label(textArea, SWT.NONE);
|
label = new Label(textArea, SWT.NONE);
|
||||||
label.setText("Copyright 2007, The Android Open Source Project");
|
label.setText("Copyright 2007, The Android Open Source Project");
|
||||||
label = new Label(textArea, SWT.NONE);
|
label = new Label(textArea, SWT.NONE);
|
||||||
|
|||||||
@@ -21,10 +21,15 @@ import com.android.ddmlib.DebugPortManager;
|
|||||||
import com.android.ddmlib.Log;
|
import com.android.ddmlib.Log;
|
||||||
import com.android.sdkstats.SdkStatsService;
|
import com.android.sdkstats.SdkStatsService;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
import java.lang.management.RuntimeMXBean;
|
import java.lang.management.RuntimeMXBean;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,8 +37,7 @@ import java.lang.management.RuntimeMXBean;
|
|||||||
*/
|
*/
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
/** User visible version number. */
|
public static String sRevision;
|
||||||
public static final String VERSION = "0.8.1";
|
|
||||||
|
|
||||||
public Main() {
|
public Main() {
|
||||||
}
|
}
|
||||||
@@ -85,8 +89,12 @@ public class Main {
|
|||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ddms itself is wanted: send a ping for ourselves
|
// get the ddms parent folder location
|
||||||
SdkStatsService.ping("ddms", VERSION, null); //$NON-NLS-1$
|
String ddmsParentLocation = System.getProperty("com.android.ddms.bindir"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
// we're past the point where ddms can be called just to send a ping, so we can
|
||||||
|
// ping for ddms itself.
|
||||||
|
ping(ddmsParentLocation);
|
||||||
|
|
||||||
DebugPortManager.setProvider(DebugPortProvider.getInstance());
|
DebugPortManager.setProvider(DebugPortProvider.getInstance());
|
||||||
|
|
||||||
@@ -94,7 +102,7 @@ public class Main {
|
|||||||
UIThread ui = UIThread.getInstance();
|
UIThread ui = UIThread.getInstance();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ui.runUI();
|
ui.runUI(ddmsParentLocation);
|
||||||
} finally {
|
} finally {
|
||||||
PrefsDialog.save();
|
PrefsDialog.save();
|
||||||
|
|
||||||
@@ -107,4 +115,25 @@ public class Main {
|
|||||||
// a thread called AWT-Shutdown. This will help while I track this down.
|
// a thread called AWT-Shutdown. This will help while I track this down.
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ping(String ddmsParentLocation) {
|
||||||
|
Properties p = new Properties();
|
||||||
|
try{
|
||||||
|
File sourceProp;
|
||||||
|
if (ddmsParentLocation != null && ddmsParentLocation.length() > 0) {
|
||||||
|
sourceProp = new File(ddmsParentLocation, "source.properties"); //$NON-NLS-1$
|
||||||
|
} else {
|
||||||
|
sourceProp = new File("source.properties"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
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$
|
||||||
|
}
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
// couldn't find the file? don't ping.
|
||||||
|
} catch (IOException e) {
|
||||||
|
// couldn't find the file? don't ping.
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -404,8 +404,9 @@ public class UIThread implements IUiSelectionListener, IClientChangeListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create SWT objects and drive the user interface event loop.
|
* Create SWT objects and drive the user interface event loop.
|
||||||
|
* @param location location of the folder that contains ddms.
|
||||||
*/
|
*/
|
||||||
public void runUI() {
|
public void runUI(String ddmsParentLocation) {
|
||||||
Display.setAppName("ddms");
|
Display.setAppName("ddms");
|
||||||
mDisplay = new Display();
|
mDisplay = new Display();
|
||||||
final Shell shell = new Shell(mDisplay);
|
final Shell shell = new Shell(mDisplay);
|
||||||
@@ -445,9 +446,9 @@ public class UIThread implements IUiSelectionListener, IClientChangeListener {
|
|||||||
ClientData.setMethodProfilingHandler(new MethodProfilingHandler(shell));
|
ClientData.setMethodProfilingHandler(new MethodProfilingHandler(shell));
|
||||||
|
|
||||||
// [try to] ensure ADB is running
|
// [try to] ensure ADB is running
|
||||||
String adbLocation = System.getProperty("com.android.ddms.bindir"); //$NON-NLS-1$
|
String adbLocation;
|
||||||
if (adbLocation != null && adbLocation.length() != 0) {
|
if (ddmsParentLocation != null && ddmsParentLocation.length() != 0) {
|
||||||
adbLocation += File.separator + "adb"; //$NON-NLS-1$
|
adbLocation = ddmsParentLocation + File.separator + "adb"; //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
adbLocation = "adb"; //$NON-NLS-1$
|
adbLocation = "adb"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* Main class for the 'android' application.
|
* Main class for the 'android' application.
|
||||||
*/
|
*/
|
||||||
class Main {
|
public class Main {
|
||||||
|
|
||||||
/** Java property that defines the location of the sdk/tools directory. */
|
/** Java property that defines the location of the sdk/tools directory. */
|
||||||
private final static String TOOLSDIR = "com.android.sdkmanager.toolsdir";
|
public final static String TOOLSDIR = "com.android.sdkmanager.toolsdir";
|
||||||
/** Java property that defines the working directory. On Windows the current working directory
|
/** Java property that defines the working directory. On Windows the current working directory
|
||||||
* is actually the tools dir, in which case this is used to get the original CWD. */
|
* is actually the tools dir, in which case this is used to get the original CWD. */
|
||||||
private final static String WORKDIR = "com.android.sdkmanager.workdir";
|
private final static String WORKDIR = "com.android.sdkmanager.workdir";
|
||||||
|
|||||||
@@ -17,16 +17,20 @@
|
|||||||
package com.android.sdkmanager.internal.repository;
|
package com.android.sdkmanager.internal.repository;
|
||||||
|
|
||||||
|
|
||||||
|
import com.android.sdkmanager.*;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
|
||||||
/*
|
import java.io.File;
|
||||||
* TODO list
|
import java.io.FileInputStream;
|
||||||
* - Change version to be a constant pulled from somewhere.
|
import java.io.FileNotFoundException;
|
||||||
*/
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
public class AboutPage extends Composite {
|
public class AboutPage extends Composite {
|
||||||
|
|
||||||
@@ -45,11 +49,21 @@ public class AboutPage extends Composite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createContents(Composite parent) {
|
private void createContents(Composite parent) {
|
||||||
parent.setLayout(new GridLayout(1, false));
|
parent.setLayout(new GridLayout(2, false));
|
||||||
|
|
||||||
|
Label logo = new Label(parent, SWT.NONE);
|
||||||
|
InputStream imageStream = this.getClass().getResourceAsStream("logo.png");
|
||||||
|
|
||||||
|
if (imageStream != null) {
|
||||||
|
Image img = new Image(parent.getShell().getDisplay(), imageStream);
|
||||||
|
logo.setImage(img);
|
||||||
|
}
|
||||||
|
|
||||||
mLabel = new Label(parent, SWT.NONE);
|
mLabel = new Label(parent, SWT.NONE);
|
||||||
mLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true, 1, 1));
|
mLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
|
||||||
mLabel.setText("Android SDK Updater.\n\nVersion 0.1.\n\nCopyright (C) 2009 The Android Open Source Project.");
|
mLabel.setText(String.format(
|
||||||
|
"Android SDK Updater.\nRevision %1$s\nCopyright (C) 2009 The Android Open Source Project.",
|
||||||
|
getRevision()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -69,4 +83,28 @@ public class AboutPage extends Composite {
|
|||||||
|
|
||||||
// End of hiding from SWT Designer
|
// End of hiding from SWT Designer
|
||||||
//$hide<<$
|
//$hide<<$
|
||||||
|
|
||||||
|
private String getRevision() {
|
||||||
|
Properties p = new Properties();
|
||||||
|
try{
|
||||||
|
String toolsdir = System.getProperty(Main.TOOLSDIR);
|
||||||
|
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) {
|
||||||
|
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 "?";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
@@ -14,27 +14,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# 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,
|
# 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.
|
# and set up progdir to be the fully-qualified pathname of its directory.
|
||||||
prog="$0"
|
prog="$0"
|
||||||
@@ -118,4 +97,4 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "${javaCmd}" $javaOpts -Djava.ext.dirs="$frameworkdir" -jar "$jarpath" "$@"
|
exec "${javaCmd}" $javaOpts -Djava.ext.dirs="$frameworkdir" -Dcom.android.traceview.toolsdir="$progdir" -jar "$jarpath" "$@"
|
||||||
|
|||||||
@@ -55,4 +55,4 @@ if exist %swt_path% goto SetPath
|
|||||||
:SetPath
|
:SetPath
|
||||||
set javaextdirs=%swt_path%;%frameworkdir%
|
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% %*
|
||||||
|
|||||||
@@ -30,11 +30,13 @@ import org.eclipse.swt.widgets.Display;
|
|||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
public class MainWindow extends ApplicationWindow {
|
public class MainWindow extends ApplicationWindow {
|
||||||
|
|
||||||
@@ -128,12 +130,44 @@ public class MainWindow extends ApplicationWindow {
|
|||||||
return temp.getPath();
|
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) {
|
public static void main(String[] args) {
|
||||||
TraceReader reader = null;
|
TraceReader reader = null;
|
||||||
boolean regression = false;
|
boolean regression = false;
|
||||||
|
|
||||||
// ping the usage server
|
// 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
|
// Process command line arguments
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user