Add a new, optional "is sensitive thread?" hook.
The Android framework implements this hook in Ie6f58d130a29.
Bug: 3226270
Change-Id: I7342248e5699a22b71647e7cfeec52ec871cefaf
diff --git a/vm/Sync.c b/vm/Sync.c
index 0a0e65a..967a0d0 100644
--- a/vm/Sync.c
+++ b/vm/Sync.c
@@ -408,9 +408,12 @@
len = strlen(procName);
cp = logWriteString(cp, procName, len);
- /* Emit the main thread status, 5 bytes. */
- bool isMainThread = (self->systemTid == getpid());
- cp = logWriteInt(cp, isMainThread);
+ /* Emit the sensitive thread ("main thread") status, 5 bytes. */
+ bool isSensitive = false;
+ if (gDvm.isSensitiveThreadHook != NULL) {
+ isSensitive = gDvm.isSensitiveThreadHook();
+ }
+ cp = logWriteInt(cp, isSensitive);
/* Emit self thread name string, <= 37 bytes. */
selfName = dvmGetThreadName(self);
@@ -431,10 +434,10 @@
/* Emit the lock owner source code file name, <= 37 bytes. */
if (ownerFileName == NULL) {
- ownerFileName = "";
+ ownerFileName = "";
} else if (strcmp(fileName, ownerFileName) == 0) {
- /* Common case, so save on log space. */
- ownerFileName = "-";
+ /* Common case, so save on log space. */
+ ownerFileName = "-";
}
cp = logWriteString(cp, ownerFileName, strlen(ownerFileName));