Skip to content
Merged
Show file tree
Hide file tree
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 numberDiff line numberDiff line change
Expand Up@@ -102,10 +102,17 @@ object VectorDaemon {

applyNotificationWorkaround()

// Read this before `sendToBridge`, which leaves the main thread at euid 1000: the config
// database lives under a directory only root can enter, so the first process to open it has
// to do so while we still have root. On a successful injection a binder thread opens it for
// us during specialization, but when the injection fails nothing else has, and the daemon
// used to die here on an unreadable preference.
val isVerboseLog = ManagerService.isVerboseLog()

// Setup IPC channel for applications by injecting DaemonService binder
sendToBridge(VectorService.asBinder(), false, systemServerMaxRetry)

if (!ManagerService.isVerboseLog()) {
if (!isVerboseLog) {
LogcatMonitor.stopVerbose()
}

Expand Down
4 changes: 2 additions & 2 deletions zygisk/src/main/cpp/ipc_bridge.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -290,9 +290,9 @@ lsplant::ScopedLocalRef<jobject> IPCBridge::RequestAppBinder(JNIEnv *env, jstrin
env->NewGlobalRef(heartbeat_binder.get());
}
}
} else {
LOGD("Transact call to request app binder failed.");
}
// No else: a false transaction is the daemon declining, which is the ordinary answer for a
// process no module has in scope. The caller logs that outcome, with the process name.

return result_binder;
}
Expand Down
6 changes: 4 additions & 2 deletions zygisk/src/main/cpp/module.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -324,12 +324,14 @@ void VectorModule::postAppSpecialize(const zygisk::AppSpecializeArgs *args) {

// --- Framework Injection ---
lsplant::JUTFString nice_name_str(env_, args->nice_name);
LOGD("Attempting injection into '{}'.", nice_name_str.get());
LOGD("Asking the daemon about '{}'.", nice_name_str.get());

auto &ipc_bridge = IPCBridge::GetInstance();
auto binder = ipc_bridge.RequestAppBinder(env_, args->nice_name);
if (!binder) {
LOGD("No IPC binder obtained for '{}'. Skipping injection.", nice_name_str.get());
// Usually because nothing has it in scope, but the daemon may also not be up yet or have
// registered this process already. Only it knows which, and it logs the reason itself.
LOGD("Not injecting '{}': the daemon has no binder for it.", nice_name_str.get());
SetAllowUnload(true);
return;
}
Expand Down
Loading