|
| 1 | +diff --git a/android/src/main/java/com/gantix/JailMonkey/JailMonkeyModule.java b/android/src/main/java/com/gantix/JailMonkey/JailMonkeyModule.java |
| 2 | +index 018d7051a57a2250c738e018ba8e1518d1b9525a..e89a135c10edc50174315c5cf0a3c9871fe65e6a 100644 |
| 3 | +--- a/android/src/main/java/com/gantix/JailMonkey/JailMonkeyModule.java |
| 4 | ++++ b/android/src/main/java/com/gantix/JailMonkey/JailMonkeyModule.java |
| 5 | +@@ -74,11 +74,7 @@ public class JailMonkeyModule extends ReactContextBaseJavaModule { |
| 6 | + final Map<String, Object> constants = new HashMap<>(); |
| 7 | + |
| 8 | + constants.put("isJailBroken", rootedCheck.isJailBroken()); |
| 9 | +- constants.put("rootedDetectionMethods", rootedCheck.getResultByDetectionMethod()); |
| 10 | +- constants.put("hookDetected", hookDetected(context)); |
| 11 | +- constants.put("canMockLocation", isMockLocationOn(context)); |
| 12 | +- constants.put("isOnExternalStorage", isOnExternalStorage(context)); |
| 13 | +- constants.put("AdbEnabled", AdbEnabled(context)); |
| 14 | + return constants; |
| 15 | + } |
| 16 | + } |
| 17 | ++ |
| 18 | +diff --git a/android/src/main/java/com/gantix/JailMonkey/Rooted/RootedCheck.java b/android/src/main/java/com/gantix/JailMonkey/Rooted/RootedCheck.java |
| 19 | +index bf75f27fd11293205bf6d58de4f8069ea0a155fe..d63ac51b87e456bd13e252c7ca691c07e28704a5 100644 |
| 20 | +--- a/android/src/main/java/com/gantix/JailMonkey/Rooted/RootedCheck.java |
| 21 | ++++ b/android/src/main/java/com/gantix/JailMonkey/Rooted/RootedCheck.java |
| 22 | +@@ -4,25 +4,44 @@ import android.content.Context; |
| 23 | + import com.scottyab.rootbeer.RootBeer; |
| 24 | + import java.util.HashMap; |
| 25 | + import java.util.Map; |
| 26 | ++import java.util.concurrent.CountDownLatch; |
| 27 | ++ |
| 28 | ++import androidx.tracing.Trace; |
| 29 | + |
| 30 | + public class RootedCheck { |
| 31 | + private static boolean checkWithJailMonkeyMethod() { |
| 32 | +- CheckApiVersion check; |
| 33 | +- |
| 34 | +- if (android.os.Build.VERSION.SDK_INT >= 23) { |
| 35 | +- check = new GreaterThan23(); |
| 36 | +- } else { |
| 37 | +- check = new LessThan23(); |
| 38 | ++ Trace.beginSection("[JailMonkey] checkWithJailMonkeyMethod"); |
| 39 | ++ try { |
| 40 | ++ CheckApiVersion check; |
| 41 | ++ |
| 42 | ++ if (android.os.Build.VERSION.SDK_INT >= 23) { |
| 43 | ++ check = new GreaterThan23(); |
| 44 | ++ } else { |
| 45 | ++ check = new LessThan23(); |
| 46 | ++ } |
| 47 | ++ return check.checkRooted(); |
| 48 | ++ } finally { |
| 49 | ++ Trace.endSection(); |
| 50 | + } |
| 51 | +- return check.checkRooted(); |
| 52 | + } |
| 53 | + |
| 54 | +- private final boolean jailMonkeyResult; |
| 55 | +- private final RootBeerResults rootBeerResults; |
| 56 | ++ private static boolean jailMonkeyResult; |
| 57 | ++ private static RootBeerResults rootBeerResults; |
| 58 | ++ private static CountDownLatch latch = new CountDownLatch(1); |
| 59 | ++ public static void precompute(Context context) { |
| 60 | ++ new Thread(() -> { |
| 61 | ++ jailMonkeyResult = checkWithJailMonkeyMethod(); |
| 62 | ++ rootBeerResults = new RootBeerResults(context); |
| 63 | ++ latch.countDown(); |
| 64 | ++ }).start(); |
| 65 | ++ } |
| 66 | + |
| 67 | + public RootedCheck(Context context) { |
| 68 | +- jailMonkeyResult = checkWithJailMonkeyMethod(); |
| 69 | +- rootBeerResults = new RootBeerResults(context); |
| 70 | ++ try { |
| 71 | ++ latch.await(); |
| 72 | ++ } catch (InterruptedException e) { |
| 73 | ++ throw new RuntimeException(e); |
| 74 | ++ } |
| 75 | + } |
| 76 | + |
| 77 | + public boolean isJailBroken() { |
| 78 | +@@ -87,3 +106,4 @@ public class RootedCheck { |
| 79 | + } |
| 80 | + } |
| 81 | + } |
| 82 | ++ |
0 commit comments