From 0b5b3edc79c75602b269fa9a0fdca842b408c4d5 Mon Sep 17 00:00:00 2001 From: Xavier Ducrohet Date: Tue, 31 Aug 2010 10:36:01 -0700 Subject: Make the HierarchyViewer plug-in not screw up DDMS. The HV plug-in behaved like the standalone app and initialized the AndroidDebugBridge with no client support (even though this init is handled by DDMS) and would recreate the bridge object destroying the one created by DDMS. This completely broke DDMS. Change-Id: Ife1187c74daef69607d508aabb1f7234507a170f --- ddms/libs/ddmlib/src/com/android/ddmlib/AndroidDebugBridge.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ddms') diff --git a/ddms/libs/ddmlib/src/com/android/ddmlib/AndroidDebugBridge.java b/ddms/libs/ddmlib/src/com/android/ddmlib/AndroidDebugBridge.java index c62ce42..01cdf0a 100644 --- a/ddms/libs/ddmlib/src/com/android/ddmlib/AndroidDebugBridge.java +++ b/ddms/libs/ddmlib/src/com/android/ddmlib/AndroidDebugBridge.java @@ -61,6 +61,7 @@ public final class AndroidDebugBridge { private static InetSocketAddress sSocketAddr; private static AndroidDebugBridge sThis; + private static boolean sInitialized = false; private static boolean sClientSupport; /** Full path to adb. */ @@ -173,7 +174,11 @@ public final class AndroidDebugBridge { * @see AndroidDebugBridge#createBridge(String, boolean) * @see DdmPreferences */ - public static void init(boolean clientSupport) { + public static synchronized void init(boolean clientSupport) { + if (sInitialized) { + throw new IllegalStateException("AndroidDebugBridge.init() has already been called."); + } + sInitialized = true; sClientSupport = clientSupport; // Determine port and instantiate socket address. -- cgit v1.1