Reserve negative id's for DDMS. am: 9b7f958d5d
am: 05b7c1bcfe
Change-Id: I11d93b08fb50338ff65bdd628f0fc3ced266dd9c
diff --git a/src/share/back/util.c b/src/share/back/util.c
index 9b8e78b..f99f0b4 100644
--- a/src/share/back/util.c
+++ b/src/share/back/util.c
@@ -630,6 +630,14 @@
uniqueID(void)
{
static jint currentID = 0;
+ // ANDROID-CHANGED: on android we sometimes need to share these id's with DDMS traffic that is
+ // multiplexed on the same connection. Since we don't have any way to know which id's are taken
+ // by DDMS we will instead partition the ids between them. All positive ids (sign-bit == 0) are
+ // reserved for libjdwp. DDMS will take ids with sign-bit == 1. This condition is not expected
+ // to ever be true on a normal debugging session.
+ if (currentID < 0) {
+ currentID = 0;
+ }
return currentID++;
}