Fix monitor

"traceview" is no longer shipped as a separate tool, and has been
tombstoned for some time.
Additionally, the doubleclick handler was for the separate .key/.data
trace files, which haven't been generated for many years.

Test: Just removing functionality. Also, this is for the
soon-to-be-removed eclipse-based tools, so hopefully no new tests
are needed.
Change-Id: I7a2f6f890ded1ef5bdbb05a502467453708b5fb2
(cherry picked from commit 2f60707484a92ec92504bff9f2c1a7ba3fb59f69)
diff --git a/ddms/ddmuilib/src/main/java/com/android/ddmuilib/DdmUiPreferences.java b/ddms/ddmuilib/src/main/java/com/android/ddmuilib/DdmUiPreferences.java
index 9a6a4ff..8de0efc 100644
--- a/ddms/ddmuilib/src/main/java/com/android/ddmuilib/DdmUiPreferences.java
+++ b/ddms/ddmuilib/src/main/java/com/android/ddmuilib/DdmUiPreferences.java
@@ -34,7 +34,6 @@
     private static String sSymbolLocation =""; //$NON-NLS-1$
     private static String sAddr2LineLocation =""; //$NON-NLS-1$
     private static String sAddr2LineLocation64 =""; //$NON-NLS-1$
-    private static String sTraceviewLocation =""; //$NON-NLS-1$
 
     public static void setStore(IPreferenceStore store) {
         mStore = store;
@@ -76,13 +75,4 @@
         sAddr2LineLocation64 = location;
     }
 
-    public static String getTraceview() {
-        return sTraceviewLocation;
-    }
-
-    public static void setTraceviewLocation(String location) {
-        sTraceviewLocation = location;
-    }
-
-
 }
diff --git a/ddms/ddmuilib/src/main/java/com/android/ddmuilib/explorer/DeviceExplorer.java b/ddms/ddmuilib/src/main/java/com/android/ddmuilib/explorer/DeviceExplorer.java
index b69d3b5..b84c52f 100644
--- a/ddms/ddmuilib/src/main/java/com/android/ddmuilib/explorer/DeviceExplorer.java
+++ b/ddms/ddmuilib/src/main/java/com/android/ddmuilib/explorer/DeviceExplorer.java
@@ -78,14 +78,6 @@
  */
 public class DeviceExplorer extends Panel {
 
-    private final static String TRACE_KEY_EXT = ".key"; // $NON-NLS-1S
-    private final static String TRACE_DATA_EXT = ".data"; // $NON-NLS-1S
-
-    private static Pattern mKeyFilePattern = Pattern.compile(
-            "(.+)\\" + TRACE_KEY_EXT); // $NON-NLS-1S
-    private static Pattern mDataFilePattern = Pattern.compile(
-            "(.+)\\" + TRACE_DATA_EXT); // $NON-NLS-1S
-
     public static String COLUMN_NAME = "android.explorer.name"; //$NON-NLS-1S
     public static String COLUMN_SIZE = "android.explorer.size"; //$NON-NLS-1S
     public static String COLUMN_DATE = "android.explorer.data"; //$NON-NLS-1S
@@ -233,58 +225,6 @@
             }
         });
 
-        // add support for double click
-        mTreeViewer.addDoubleClickListener(new IDoubleClickListener() {
-            @Override
-            public void doubleClick(DoubleClickEvent event) {
-                ISelection sel = event.getSelection();
-
-                if (sel instanceof IStructuredSelection) {
-                    IStructuredSelection selection = (IStructuredSelection) sel;
-
-                    if (selection.size() == 1) {
-                        FileEntry entry = (FileEntry)selection.getFirstElement();
-                        String name = entry.getName();
-
-                        FileEntry parentEntry = entry.getParent();
-
-                        // can't really do anything with no parent
-                        if (parentEntry == null) {
-                            return;
-                        }
-
-                        // check this is a file like we want.
-                        Matcher m = mKeyFilePattern.matcher(name);
-                        if (m.matches()) {
-                            // get the name w/o the extension
-                            String baseName = m.group(1);
-
-                            // add the data extension
-                            String dataName = baseName + TRACE_DATA_EXT;
-
-                            FileEntry dataEntry = parentEntry.findChild(dataName);
-
-                            handleTraceDoubleClick(baseName, entry, dataEntry);
-
-                        } else {
-                            m = mDataFilePattern.matcher(name);
-                            if (m.matches()) {
-                                // get the name w/o the extension
-                                String baseName = m.group(1);
-
-                                // add the key extension
-                                String keyName = baseName + TRACE_KEY_EXT;
-
-                                FileEntry keyEntry = parentEntry.findChild(keyName);
-
-                                handleTraceDoubleClick(baseName, keyEntry, entry);
-                            }
-                        }
-                    }
-                }
-            }
-        });
-
         // setup drop listener
         mTreeViewer.addDropSupport(DND.DROP_COPY | DND.DROP_MOVE,
                 new Transfer[] { FileTransfer.getInstance() },
@@ -392,98 +332,6 @@
     }
 
     /**
-     * Processes a double click on a trace file
-     * @param baseName the base name of the 2 files.
-     * @param keyEntry The FileEntry for the .key file.
-     * @param dataEntry The FileEntry for the .data file.
-     */
-    private void handleTraceDoubleClick(String baseName, FileEntry keyEntry,
-            FileEntry dataEntry) {
-        // first we need to download the files.
-        File keyFile;
-        File dataFile;
-        String path;
-        try {
-            // create a temp file for keyFile
-            File f = File.createTempFile(baseName, DdmConstants.DOT_TRACE);
-            f.delete();
-            f.mkdir();
-
-            path = f.getAbsolutePath();
-
-            keyFile = new File(path + File.separator + keyEntry.getName());
-            dataFile = new File(path + File.separator + dataEntry.getName());
-        } catch (IOException e) {
-            return;
-        }
-
-        // download the files
-        try {
-            SyncService sync = mCurrentDevice.getSyncService();
-            if (sync != null) {
-                ISyncProgressMonitor monitor = SyncService.getNullProgressMonitor();
-                sync.pullFile(keyEntry, keyFile.getAbsolutePath(), monitor);
-                sync.pullFile(dataEntry, dataFile.getAbsolutePath(), monitor);
-
-                // now that we have the file, we need to launch traceview
-                String[] command = new String[2];
-                command[0] = DdmUiPreferences.getTraceview();
-                command[1] = path + File.separator + baseName;
-
-                try {
-                    final Process p = Runtime.getRuntime().exec(command);
-
-                    // create a thread for the output
-                    new Thread("Traceview output") {
-                        @Override
-                        public void run() {
-                            // create a buffer to read the stderr output
-                            InputStreamReader is = new InputStreamReader(p.getErrorStream());
-                            BufferedReader resultReader = new BufferedReader(is);
-
-                            // read the lines as they come. if null is returned, it's
-                            // because the process finished
-                            try {
-                                while (true) {
-                                    String line = resultReader.readLine();
-                                    if (line != null) {
-                                        DdmConsole.printErrorToConsole("Traceview: " + line);
-                                    } else {
-                                        break;
-                                    }
-                                }
-                                // get the return code from the process
-                                p.waitFor();
-                            } catch (IOException e) {
-                            } catch (InterruptedException e) {
-
-                            }
-                        }
-                    }.start();
-
-                } catch (IOException e) {
-                }
-            }
-        } catch (IOException e) {
-            DdmConsole.printErrorToConsole(String.format(
-                    "Failed to pull %1$s: %2$s", keyEntry.getName(), e.getMessage()));
-            return;
-        } catch (SyncException e) {
-            if (e.wasCanceled() == false) {
-                DdmConsole.printErrorToConsole(String.format(
-                        "Failed to pull %1$s: %2$s", keyEntry.getName(), e.getMessage()));
-                return;
-            }
-        } catch (TimeoutException e) {
-            DdmConsole.printErrorToConsole(String.format(
-                    "Failed to pull %1$s: timeout", keyEntry.getName()));
-        } catch (AdbCommandRejectedException e) {
-            DdmConsole.printErrorToConsole(String.format(
-                    "Failed to pull %1$s: %2$s", keyEntry.getName(), e.getMessage()));
-        }
-    }
-
-    /**
      * Pull the current selection on the local drive. This method displays
      * a dialog box to let the user select where to store the file(s) and
      * folder(s).
diff --git a/ddms/ddmuilib/src/main/java/com/android/ddmuilib/handler/MethodProfilingHandler.java b/ddms/ddmuilib/src/main/java/com/android/ddmuilib/handler/MethodProfilingHandler.java
index ab1b5f7..bcefc23 100644
--- a/ddms/ddmuilib/src/main/java/com/android/ddmuilib/handler/MethodProfilingHandler.java
+++ b/ddms/ddmuilib/src/main/java/com/android/ddmuilib/handler/MethodProfilingHandler.java
@@ -154,42 +154,6 @@
     }
 
     protected void open(String tempPath) {
-        // now that we have the file, we need to launch traceview
-        String[] command = new String[2];
-        command[0] = DdmUiPreferences.getTraceview();
-        command[1] = tempPath;
-
-        try {
-            final Process p = Runtime.getRuntime().exec(command);
-
-            // create a thread for the output
-            new Thread("Traceview output") {
-                @Override
-                public void run() {
-                    // create a buffer to read the stderr output
-                    InputStreamReader is = new InputStreamReader(p.getErrorStream());
-                    BufferedReader resultReader = new BufferedReader(is);
-
-                    // read the lines as they come. if null is returned, it's
-                    // because the process finished
-                    try {
-                        while (true) {
-                            String line = resultReader.readLine();
-                            if (line != null) {
-                                DdmConsole.printErrorToConsole("Traceview: " + line);
-                            } else {
-                                break;
-                            }
-                        }
-                        // get the return code from the process
-                        p.waitFor();
-                    } catch (Exception e) {
-                        Log.e("traceview", e);
-                    }
-                }
-            }.start();
-        } catch (IOException e) {
-            Log.e("traceview", e);
-        }
+        // Nothing, implemented in DeviceView
     }
 }