Skip to content
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

fix /data/local/tmp/stethox_suspend file not exist return #4

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ private synchronized void initializeStetho(Context context) throws InterruptedEx
initialized = true;
return;
}

var processName = Utils.getProcessName();
Logger.d("Install Stetho: " + packageName + " proc=" + processName);
var suspendRequested = false;
Expand All @@ -79,18 +80,18 @@ private synchronized void initializeStetho(Context context) throws InterruptedEx
}

if (!suspendRequested) {

try {
var file = new File("/data/local/tmp/stethox_suspend");
if (!file.canRead()) return;
var bytes = new byte[(int) file.length()];
try (var is = new FileInputStream(file)) {
is.read(bytes);
}
var str = new String(bytes, StandardCharsets.UTF_8);
if (Arrays.asList(str.split("\n")).contains(processName)) {
suspendRequested = true;
Logger.d("suspend requested by file");
if (file.canRead()) {
var bytes = new byte[(int) file.length()];
try (var is = new FileInputStream(file)) {
is.read(bytes);
}
var str = new String(bytes, StandardCharsets.UTF_8);
if (Arrays.asList(str.split("\n")).contains(processName)) {
suspendRequested = true;
Logger.d("suspend requested by file");
}
}
} catch (Throwable t) {
Logger.e("get suspend file", t);
Expand Down
Loading