-
Notifications
You must be signed in to change notification settings - Fork 10
speedup jailbreak monkey (-700ms) #3289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Szymon20000
wants to merge
4
commits into
ava-labs:main
Choose a base branch
from
Szymon20000:@szymon/fix_monkey
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f949be6
fix jailbreak monkey
Szymon20000 210b334
Update JailMonkey patch and RootedCheck implementation
Szymon20000 f2f3b72
Update patches.md with jail-monkey information
Szymon20000 313b8b4
Update jail-monkey-npm-2.8.0-77e4d06b40.patch
Szymon20000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| diff --git a/android/src/main/java/com/gantix/JailMonkey/JailMonkeyModule.java b/android/src/main/java/com/gantix/JailMonkey/JailMonkeyModule.java | ||
| index 018d7051a57a2250c738e018ba8e1518d1b9525a..e89a135c10edc50174315c5cf0a3c9871fe65e6a 100644 | ||
| --- a/android/src/main/java/com/gantix/JailMonkey/JailMonkeyModule.java | ||
| +++ b/android/src/main/java/com/gantix/JailMonkey/JailMonkeyModule.java | ||
| @@ -74,11 +74,7 @@ public class JailMonkeyModule extends ReactContextBaseJavaModule { | ||
| final Map<String, Object> constants = new HashMap<>(); | ||
|
|
||
| constants.put("isJailBroken", rootedCheck.isJailBroken()); | ||
| - constants.put("rootedDetectionMethods", rootedCheck.getResultByDetectionMethod()); | ||
| - constants.put("hookDetected", hookDetected(context)); | ||
| - constants.put("canMockLocation", isMockLocationOn(context)); | ||
| - constants.put("isOnExternalStorage", isOnExternalStorage(context)); | ||
| - constants.put("AdbEnabled", AdbEnabled(context)); | ||
| return constants; | ||
| } | ||
| } | ||
| + | ||
| diff --git a/android/src/main/java/com/gantix/JailMonkey/Rooted/RootedCheck.java b/android/src/main/java/com/gantix/JailMonkey/Rooted/RootedCheck.java | ||
| index bf75f27fd11293205bf6d58de4f8069ea0a155fe..2151858623d5be0f58aa752a1d8b16bafc133dd0 100644 | ||
| --- a/android/src/main/java/com/gantix/JailMonkey/Rooted/RootedCheck.java | ||
| +++ b/android/src/main/java/com/gantix/JailMonkey/Rooted/RootedCheck.java | ||
| @@ -4,6 +4,7 @@ import android.content.Context; | ||
| import com.scottyab.rootbeer.RootBeer; | ||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
| +import java.util.concurrent.CountDownLatch; | ||
|
|
||
| public class RootedCheck { | ||
| private static boolean checkWithJailMonkeyMethod() { | ||
| @@ -17,12 +18,23 @@ public class RootedCheck { | ||
| return check.checkRooted(); | ||
| } | ||
|
|
||
| - private final boolean jailMonkeyResult; | ||
| - private final RootBeerResults rootBeerResults; | ||
| + private static boolean jailMonkeyResult; | ||
| + private static RootBeerResults rootBeerResults; | ||
| + private static CountDownLatch latch = new CountDownLatch(1); | ||
| + public static void precompute(Context context) { | ||
| + new Thread(() -> { | ||
| + jailMonkeyResult = checkWithJailMonkeyMethod(); | ||
| + rootBeerResults = new RootBeerResults(context); | ||
| + latch.countDown(); | ||
| + }).start(); | ||
| + } | ||
|
|
||
| public RootedCheck(Context context) { | ||
| - jailMonkeyResult = checkWithJailMonkeyMethod(); | ||
| - rootBeerResults = new RootBeerResults(context); | ||
| + try { | ||
| + latch.await(); | ||
| + } catch (InterruptedException e) { | ||
| + throw new RuntimeException(e); | ||
| + } | ||
| } | ||
|
|
||
| public boolean isJailBroken() { | ||
| @@ -87,3 +99,4 @@ public class RootedCheck { | ||
| } | ||
| } | ||
| } | ||
| + | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,7 +51,8 @@ | |
| "@scure/bip39/@noble/hashes": "1.8.0", | ||
| "@scure/btc-signer/@noble/hashes": "1.8.0", | ||
| "[email protected]": "4.17.21", | ||
| "@ledgerhq/hw-transport": "6.31.0" | ||
| "@ledgerhq/hw-transport": "6.31.0", | ||
| "[email protected]": "patch:jail-monkey@npm%3A2.8.0#./.yarn/patches/jail-monkey-npm-2.8.0-77e4d06b40.patch" | ||
| }, | ||
| "engines": { | ||
| "node": ">=20.18.0", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you also drop a quick comment in packages/core-mobile/docs/patches.md about this patch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done