aboutsummaryrefslogtreecommitdiffstats
path: root/hierarchyviewer2/app/src/com/android/hierarchyviewer/HierarchyViewerApplicationDirector.java
diff options
context:
space:
mode:
authorKonstantin Lopyrev <klopyrev@google.com>2010-07-22 14:23:47 -0700
committerKonstantin Lopyrev <klopyrev@google.com>2010-07-23 15:28:02 -0700
commit506d3f2ab9f2ec561a0b3ccd48fa017c24b9cefd (patch)
tree651fa0e662355c9b2358541e8ae90480554001f6 /hierarchyviewer2/app/src/com/android/hierarchyviewer/HierarchyViewerApplicationDirector.java
parented87346d73dd057a76f95d0ea2238c2a0aed5338 (diff)
downloadsdk-506d3f2ab9f2ec561a0b3ccd48fa017c24b9cefd.zip
sdk-506d3f2ab9f2ec561a0b3ccd48fa017c24b9cefd.tar.gz
sdk-506d3f2ab9f2ec561a0b3ccd48fa017c24b9cefd.tar.bz2
Device Selector code.
Change-Id: I944315e75b72ef285bed53e5801761886f48cb24
Diffstat (limited to 'hierarchyviewer2/app/src/com/android/hierarchyviewer/HierarchyViewerApplicationDirector.java')
-rw-r--r--hierarchyviewer2/app/src/com/android/hierarchyviewer/HierarchyViewerApplicationDirector.java66
1 files changed, 66 insertions, 0 deletions
diff --git a/hierarchyviewer2/app/src/com/android/hierarchyviewer/HierarchyViewerApplicationDirector.java b/hierarchyviewer2/app/src/com/android/hierarchyviewer/HierarchyViewerApplicationDirector.java
new file mode 100644
index 0000000..5321ce7
--- /dev/null
+++ b/hierarchyviewer2/app/src/com/android/hierarchyviewer/HierarchyViewerApplicationDirector.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.hierarchyviewer;
+
+import com.android.hierarchyviewerlib.HierarchyViewerDirector;
+import com.android.sdklib.SdkConstants;
+
+import java.io.File;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * This is the application version of the director.
+ */
+public class HierarchyViewerApplicationDirector extends HierarchyViewerDirector {
+
+ private final ExecutorService executor = Executors.newSingleThreadExecutor();
+
+ @Override
+ public void terminate() {
+ super.terminate();
+ executor.shutdown();
+ }
+
+ /*
+ * Gets the location of adb. The script that runs the hierarchy viewer
+ * defines com.android.hierarchyviewer.bindir.
+ */
+ @Override
+ public String getAdbLocation() {
+ String hvParentLocation = System.getProperty("com.android.hierarchyviewer.bindir");
+ if (hvParentLocation != null && hvParentLocation.length() != 0) {
+ return hvParentLocation + File.separator + SdkConstants.FN_ADB;
+ }
+ return SdkConstants.FN_ADB;
+ }
+
+ /*
+ * In the application, we handle background tasks using a single thread,
+ * just to get rid of possible race conditions that can occur. We update the
+ * progress bar to show that we are doing something in the background.
+ */
+ @Override
+ public void executeInBackground(final Runnable task) {
+ executor.execute(new Runnable() {
+ public void run() {
+ task.run();
+ }
+ });
+ }
+
+}