[Gsmmap] [PATCH] MsdService: fix crash due to missing java.lang.ProcessManager$ProcessImpl in Android 7.0

Vedant Lath vedant at lath.in
Thu Dec 15 13:41:10 CET 2016


Android 7.0 shifted to using OpenJDK class library which has
java.lang.UNIXProcess instead of java.lang.ProcessManager$ProcessImpl
---
 SnoopSnitch/src/de/srlabs/snoopsnitch/qdmon/MsdService.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/SnoopSnitch/src/de/srlabs/snoopsnitch/qdmon/MsdService.java b/SnoopSnitch/src/de/srlabs/snoopsnitch/qdmon/MsdService.java
index 3e95716..e9a9a09 100644
--- a/SnoopSnitch/src/de/srlabs/snoopsnitch/qdmon/MsdService.java
+++ b/SnoopSnitch/src/de/srlabs/snoopsnitch/qdmon/MsdService.java
@@ -1992,7 +1992,7 @@ public class MsdService extends Service{
 		// data like the process id). However, the actual class of the
 		// process does contain a pid field (declared as private), which can be
 		// accessed via reflection.
-		if(parser.getClass().getName().equals("java.lang.ProcessManager$ProcessImpl")) {
+		if(parser.getClass().getName().equals("java.lang.ProcessManager$ProcessImpl") || parser.getClass().getName().equals("java.lang.UNIXProcess")) {
 			try {
 				Field f = parser.getClass().getDeclaredField("pid");
 				f.setAccessible(true);
@@ -2049,7 +2049,7 @@ public class MsdService extends Service{
 				ok = false;
 			}
 		} else{
-			handleFatalError("Failed to get parser pid, parser class name is " + parser.getClass().getName() + " instead of java.lang.ProcessManager$ProcessImpl");
+			handleFatalError("Failed to get parser pid, parser class name is " + parser.getClass().getName() + " instead of java.lang.ProcessManager$ProcessImpl or java.lang.UNIXProcess");
 			ok = false;
 		}
 		// TODO: Maybe check memory usage of this Service process as well.
-- 
2.1.4



More information about the Gsmmap mailing list