aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins
diff options
context:
space:
mode:
authorSiva Velusamy <vsiva@google.com>2012-09-17 10:13:56 -0700
committerandroid code review <noreply-gerritcodereview@google.com>2012-09-17 10:13:56 -0700
commit6940ec16be261afff39538fec3ee7b702b92c656 (patch)
treedb9143ea60b41b4d6963ca58ccc5aaff6778d9d6 /eclipse/plugins
parentf8d4d4c018973fdf2b89e1f507a497a0c4253584 (diff)
parenta117eae7f5299afc95fcd81804293f5786b62b0f (diff)
downloadsdk-6940ec16be261afff39538fec3ee7b702b92c656.zip
sdk-6940ec16be261afff39538fec3ee7b702b92c656.tar.gz
sdk-6940ec16be261afff39538fec3ee7b702b92c656.tar.bz2
Merge "gltrace: Allow fully qualified activity names"
Diffstat (limited to 'eclipse/plugins')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/CollectTraceAction.java16
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceCollectorDialog.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceOptionsDialog.java27
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/TraceOptions.java6
4 files changed, 43 insertions, 10 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/CollectTraceAction.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/CollectTraceAction.java
index 9acff50..5e97305 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/CollectTraceAction.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/CollectTraceAction.java
@@ -126,7 +126,8 @@ public class CollectTraceAction implements IWorkbenchWindowActionDelegate {
try {
if (!SYSTEM_APP.equals(traceOptions.appToTrace)) {
- startActivity(device, traceOptions.appToTrace, traceOptions.activityToTrace);
+ startActivity(device, traceOptions.appToTrace, traceOptions.activityToTrace,
+ traceOptions.isActivityNameFullyQualified);
}
} catch (Exception e) {
MessageDialog.openError(shell, "Setup GL Trace",
@@ -272,19 +273,24 @@ public class CollectTraceAction implements IWorkbenchWindowActionDelegate {
}
}
- private void startActivity(IDevice device, String appPackage, String activity)
+ private void startActivity(IDevice device, String appPackage, String activity,
+ boolean isActivityNameFullyQualified)
throws TimeoutException, AdbCommandRejectedException,
ShellCommandUnresponsiveException, IOException, InterruptedException {
killApp(device, appPackage); // kill app if it is already running
waitUntilAppKilled(device, appPackage, KILL_TIMEOUT);
- String activityPath = appPackage;
+ StringBuilder activityPath = new StringBuilder(appPackage);
if (!activity.isEmpty()) {
- activityPath = String.format("%s/.%s", appPackage, activity); //$NON-NLS-1$
+ activityPath.append('/');
+ if (!isActivityNameFullyQualified) {
+ activityPath.append('.');
+ }
+ activityPath.append(activity);
}
String startAppCmd = String.format(
"am start --opengl-trace %s -a android.intent.action.MAIN -c android.intent.category.LAUNCHER", //$NON-NLS-1$
- activityPath);
+ activityPath.toString());
Semaphore launchCompletionSempahore = new Semaphore(0);
StartActivityOutputReceiver receiver = new StartActivityOutputReceiver(
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceCollectorDialog.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceCollectorDialog.java
index 4dfcafa..56dc8e9 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceCollectorDialog.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceCollectorDialog.java
@@ -35,11 +35,13 @@ import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;
import java.io.IOException;
+import java.text.DecimalFormat;
/** Dialog displayed while the trace is being streamed from device to host. */
public class GLTraceCollectorDialog extends TitleAreaDialog {
private static final String TITLE = "OpenGL ES Trace";
private static final String DEFAULT_MESSAGE = "Trace collection in progress.";
+ private static final DecimalFormat SIZE_FORMATTER = new DecimalFormat("#.##"); //$NON-NLS-1$
private TraceOptions mTraceOptions;
private final TraceFileWriter mTraceFileWriter;
@@ -194,7 +196,7 @@ public class GLTraceCollectorDialog extends TitleAreaDialog {
double fileSize = mTraceFileWriter.getCurrentFileSize();
fileSize /= (1024 * 1024); // convert to size in MB
- final String frameSize = String.format("%.2g MB", fileSize); //$NON-NLS-1$
+ final String frameSize = SIZE_FORMATTER.format(fileSize) + " MB";
Display.getDefault().syncExec(new Runnable() {
@Override
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceOptionsDialog.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceOptionsDialog.java
index 1ddb6d8..e18427e 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceOptionsDialog.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceOptionsDialog.java
@@ -64,6 +64,7 @@ public class GLTraceOptionsDialog extends TitleAreaDialog {
private Combo mDeviceCombo;
private Text mAppPackageToTraceText;
private Text mActivityToTraceText;
+ private Button mIsActivityFullyQualifiedButton;
private Text mTraceFilePathText;
private String mSelectedDevice = "";
@@ -74,6 +75,7 @@ public class GLTraceOptionsDialog extends TitleAreaDialog {
private static boolean sCollectFbOnEglSwap = true;
private static boolean sCollectFbOnGlDraw = false;
private static boolean sCollectTextureData = false;
+ private static boolean sIsActivityFullyQualified = false;
private IDevice[] mDevices;
public GLTraceOptionsDialog(Shell parentShell) {
@@ -95,12 +97,20 @@ public class GLTraceOptionsDialog extends TitleAreaDialog {
mDevices = AndroidDebugBridge.getBridge().getDevices();
createDeviceDropdown(c, mDevices);
+ createSeparator(c);
+
createLabel(c, "Application Package:");
createAppToTraceText(c, "e.g. com.example.package");
createLabel(c, "Activity to launch:");
createActivityToTraceText(c, "Leave blank to launch default activity");
+ createLabel(c, "");
+ createIsFullyQualifedActivityButton(c,
+ "Activity name is fully qualified, do not prefix with package name");
+
+ createSeparator(c);
+
createLabel(c, "Data Collection Options:");
createCaptureImageOptions(c);
@@ -245,6 +255,15 @@ public class GLTraceOptionsDialog extends TitleAreaDialog {
return mActivityToTraceText;
}
+ private Button createIsFullyQualifedActivityButton(Composite parent, String message) {
+ mIsActivityFullyQualifiedButton = new Button(parent, SWT.CHECK);
+ mIsActivityFullyQualifiedButton.setText(message);
+ mIsActivityFullyQualifiedButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ mIsActivityFullyQualifiedButton.setSelection(sIsActivityFullyQualified);
+
+ return mIsActivityFullyQualifiedButton;
+ }
+
private void validateAndSetMessage() {
DialogStatus status = validateDialog();
mOkButton.setEnabled(status.valid);
@@ -324,6 +343,7 @@ public class GLTraceOptionsDialog extends TitleAreaDialog {
if (mActivityToTrace.startsWith(".")) { //$NON-NLS-1$
mActivityToTrace = mActivityToTrace.substring(1);
}
+ sIsActivityFullyQualified = mIsActivityFullyQualifiedButton.getSelection();
mTraceFilePath = mTraceFilePathText.getText().trim();
mSelectedDevice = mDeviceCombo.getText();
@@ -333,7 +353,7 @@ public class GLTraceOptionsDialog extends TitleAreaDialog {
}
private void savePreferences() {
- IEclipsePreferences prefs = new InstanceScope().getNode(GlTracePlugin.PLUGIN_ID);
+ IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(GlTracePlugin.PLUGIN_ID);
prefs.put(PREF_APP_PACKAGE, mAppPackageToTrace);
prefs.put(PREF_ACTIVITY, mActivityToTrace);
prefs.put(PREF_TRACEFILE, mTraceFilePath);
@@ -346,7 +366,7 @@ public class GLTraceOptionsDialog extends TitleAreaDialog {
}
private void loadPreferences() {
- IEclipsePreferences prefs = new InstanceScope().getNode(GlTracePlugin.PLUGIN_ID);
+ IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(GlTracePlugin.PLUGIN_ID);
mAppPackageToTrace = prefs.get(PREF_APP_PACKAGE, "");
mActivityToTrace = prefs.get(PREF_ACTIVITY, "");
mTraceFilePath = prefs.get(PREF_TRACEFILE, "");
@@ -355,6 +375,7 @@ public class GLTraceOptionsDialog extends TitleAreaDialog {
public TraceOptions getTraceOptions() {
return new TraceOptions(mSelectedDevice, mAppPackageToTrace, mActivityToTrace,
- mTraceFilePath, sCollectFbOnEglSwap, sCollectFbOnGlDraw, sCollectTextureData);
+ sIsActivityFullyQualified, mTraceFilePath, sCollectFbOnEglSwap,
+ sCollectFbOnGlDraw, sCollectTextureData);
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/TraceOptions.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/TraceOptions.java
index e7ad17e..ac9fb6b 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/TraceOptions.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/TraceOptions.java
@@ -26,6 +26,8 @@ public class TraceOptions {
/** Activity to trace. */
public final String activityToTrace;
+ public final boolean isActivityNameFullyQualified;
+
/** Path where the trace file should be saved. */
public final String traceDestination;
@@ -38,11 +40,13 @@ public class TraceOptions {
/** Flag indicating whether texture data should be captured on glTexImage*() */
public final boolean collectTextureData;
- public TraceOptions(String device, String appPackage, String activity, String destinationPath,
+ public TraceOptions(String device, String appPackage, String activity,
+ boolean isActivityNameFullyQualified, String destinationPath,
boolean collectFbOnEglSwap, boolean collectFbOnGlDraw, boolean collectTextureData) {
this.device = device;
this.appToTrace = appPackage;
this.activityToTrace = activity;
+ this.isActivityNameFullyQualified = isActivityNameFullyQualified;
this.traceDestination = destinationPath;
this.collectFbOnEglSwap = collectFbOnEglSwap;
this.collectFbOnGlDraw = collectFbOnGlDraw;