Skip to content

wfbng: take the files dir from the Context - #141

Merged
vertexodessa merged 1 commit into
OpenIPC:masterfrom
vertexodessa:fix/files-dir-from-context
Oct 31, 2026
Merged

vertexodessa merged 1 commit into
OpenIPC:masterfrom
vertexodessa:fix/files-dir-from-context

Conversation

@vertexodessa

Copy link
Copy Markdown
Collaborator

gs.key and devourer's adapter lock were opened from a hard-coded /data/user/0/com.openipc.pixelpilot/files. Any other applicationId (a debug suffix, a fork) aborted at start because the key couldn't be opened. WfbngLink now gets the dir from Context.getFilesDir(), which is where VideoActivity copies gs.key anyway.

Tested by building with applicationIdSuffix ".prtest" on a Pixel 7 Pro: master aborts at start, with this change the app starts, opens the adapter, and gs.key and the lock file end up in the package's own files dir.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Resolve WFB-NG files directory from Android Context

🐞 Bug fix 📝 Documentation 🕐 10-20 Minutes

Grey Divider

AI Description

• Use the app’s files directory for WFB-NG keys and adapter locks instead of a package-specific
 path.
• Allow debug-suffixed and forked application IDs to start without failing to open gs.key.
• Update architecture notes to describe the Context-derived path.
Diagram

graph TD
  Context["Android Context"] -->|getFilesDir| Link["WfbngLink"] --> Aggregators["UDP aggregators"] --> Key["gs.key"]
  Activity["VideoActivity"] -->|copies key| Key
  Link -->|sets lock dir| Devourer["Devourer USB"] --> Lock["Adapter lock"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Pass the files path from Java
  • ➕ Avoids looking up Context methods through JNI in C++.
  • ➖ Requires changing the existing Java-to-native constructor contract and keeping path ownership coordinated across layers.

Recommendation: Keep the PR’s approach: native construction already receives a Context, so resolving its files directory there fixes both consumers without changing the Java API.

Files changed (3) +23 / -5

Bug fix (2) +21 / -2
WfbngLink.cppResolve key and adapter-lock paths from Context +19/-1

Resolve key and adapter-lock paths from Context

• Adds a JNI helper to obtain the absolute files-directory path when WfbngLink is constructed. Builds the gs.key path from it and uses the same directory for devourer’s per-adapter locks.

app/wfbngrtl8812/src/main/cpp/WfbngLink.cpp

WfbngLink.hppStore package-specific files and key paths +2/-1

Store package-specific files and key paths

• Replaces the hard-coded gs.key pointer with string members for the Context-derived files directory and resulting key path.

app/wfbngrtl8812/src/main/cpp/WfbngLink.hpp

Documentation (1) +2 / -3
CLAUDE.mdDocument Context-derived WFB-NG file paths +2/-3

Document Context-derived WFB-NG file paths

• Replaces the warning about a hard-coded package path with an explanation that WfbngLink obtains the files directory from Context. Retains the rationale for locating adapter locks there.

CLAUDE.md

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Informational

1. JNI path lookup exceeds style width ✓ Resolved
Description
appFilesDir keeps the getAbsolutePath JNI call on a 122-column line. The added helper is covered
by the project formatter, so this changed C++ file fails the configured 120-column style check.
Code

app/wfbngrtl8812/src/main/cpp/WfbngLink.cpp[56]

+    auto path = (jstring) env->CallObjectMethod(dir, env->GetMethodID(fileClass, "getAbsolutePath", "()Ljava/lang/String;"));
Evidence
The changed line is 122 columns long, exceeding the repository's .clang-format ColumnLimit: 120;
scripts/format_sources.sh applies clang-format to changed project C++ files.

CLAUDE.md: Format Project C and C++ Sources Without Modifying Generated or Vendored Code: CLAUDE.md: Format Project C and C++ Sources Without Modifying Generated or Vendored Code: CLAUDE.md: Format Project C and C++ Sources Without Modifying Generated or Vendored Code: CLAUDE.md: Format Project C and C++ Sources Without Modifying Generated or Vendored Code: CLAUDE.md: Format Project C and C++ Sources Without Modifying Generated or Vendored Code: CLAUDE.md: Format Project C and C++ Sources Without Modifying Generated or Vendored Code: CLAUDE.md: Format Project C and C++ Sources Without Modifying Generated or Vendored Code: CLAUDE.md: Format Project C and C++ Sources Without Modifying Generated or Vendored Code
app/wfbngrtl8812/src/main/cpp/WfbngLink.cpp[56-56]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
Issue description
The new `getAbsolutePath` JNI call exceeds the repository's configured 120-column clang-format limit.
Fix Focus Areas
- app/wfbngrtl8812/src/main/cpp/WfbngLink.cpp[56-56]
Recommended Fix
Format the long JNI call using the repository's clang-format configuration, keeping the resulting C++ within the configured column limit.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can keep summaries lean with Findings visible per group, which tucks the rest behind a View link

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

gs.key and devourer's adapter lock lived at a hard-coded
/data/user/0/com.openipc.pixelpilot/files, so any other applicationId (a
debug suffix, a fork) aborted at start: the aggregator could not open the
key. WfbngLink now asks Context.getFilesDir(), the same dir VideoActivity
copies gs.key into.
@vertexodessa
vertexodessa force-pushed the fix/files-dir-from-context branch from 6a56b8f to ecd9b16 Compare October 31, 2026 14:17
@vertexodessa
vertexodessa merged commit bd99939 into OpenIPC:master Oct 31, 2026
4 checks passed
@vertexodessa
vertexodessa deleted the fix/files-dir-from-context branch October 31, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant