Skip to content

[widevine][android] Fix problem with hardcoded class names on jni objects#2007

Merged
CastagnaIT merged 4 commits intoxbmc:Piersfrom
CastagnaIT:jni_fixes
Mar 8, 2026
Merged

[widevine][android] Fix problem with hardcoded class names on jni objects#2007
CastagnaIT merged 4 commits intoxbmc:Piersfrom
CastagnaIT:jni_fixes

Conversation

@CastagnaIT
Copy link
Copy Markdown
Collaborator

@CastagnaIT CastagnaIT commented Mar 7, 2026

Description

this depends on PRs:
xbmc/libandroidjni#56
xbmc/xbmc#27944

on jni dependency there was hardcoded class names
which although they work for a regular kodi build, it do not work if the Kodi package is renamed with a different name

this will allow you to build a class name based on the actual package name

it is a regression from PR #1988
the old custom ISA JNI code already did this, but i didn't grasp the concept because on the JNI library already contained a listener with a hardcoded class name

Motivation and context

fix #1997

How has this been tested?

Screenshots (if appropriate):

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • None of the above (please explain below)

Checklist:

  • I have read the Contributing document
  • My code follows the Code Guidelines of this project
  • My change requires a change to the Wiki documentation
  • I have updated the documentation accordingly

this is now used to construct class path to android objects such as
listeners
@CastagnaIT CastagnaIT added Type: Fix non-breaking change which fixes an issue Platform: Android DRM: Widevine v22 Piers labels Mar 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 7, 2026

Review

Critical — Dependency points to personal fork branch

Must FixSetBaseClassName called after JNI thread initialization completes

@kodiai
Copy link
Copy Markdown

kodiai Bot commented Mar 7, 2026

📝 Kodiai Draft Review Summary

Draft — This PR is still in draft. Feedback is exploratory; findings use softer language.

What Changed

Fixes JNI class name construction for repackaged Kodi builds by re-enabling SetBaseClassName() and updating libandroidjni dependency to support dynamic class naming.

Reviewed: core logic, docs

Strengths

  • ✅ Re-enables SetBaseClassName() call (src/decrypters/widevineandroid/WVDecrypter.cpp:155), which is now required for dynamic class path construction in JNI listeners
  • ✅ Simplifies variable handling by removing unnecessary std::string apkPath intermediate variable (src/decrypters/widevineandroid/WVDecrypter.cpp:158-168)

Observations

Impact

[CRITICAL] depends/android/libandroidjni/libandroidjni.txt (1): Dependency uses mutable branch reference
Consider using a commit hash instead of a branch reference - the dependency URL points to refs/heads/fix_classname from a personal fork, which can change unexpectedly and break build reproducibility.

Suggestions

  • Future consideration: Update to the official xbmc/libandroidjni repository once PR Cannot build 2.0.12 #56 is merged upstream

Verdict

🔴 Address before merging -- 1 blocking issue(s) found (CRITICAL/MAJOR)

Review Details
  • Files reviewed: 3
  • Lines changed: +8 -11
  • Profile: strict (auto, lines changed: 19)
  • Author: core (adapted tone)
  • Findings: 1 critical, 0 major, 0 medium, 0 minor (includes 1 from summary observations)
  • Review completed: 2026-03-07T08:39:13.972Z
  • Keyword parsing:
    • focus hints: [WIDEVINE], [ANDROID]
    • breaking change in body

Comment thread depends/android/libandroidjni/libandroidjni.txt Outdated
Comment thread src/decrypters/widevineandroid/WVDecrypter.cpp
@CastagnaIT CastagnaIT force-pushed the jni_fixes branch 2 times, most recently from fb299d5 to be3468d Compare March 8, 2026 13:11
@CastagnaIT CastagnaIT marked this pull request as ready for review March 8, 2026 13:12
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 8, 2026

Must Fix - Two issues with the dependency reference that need to be resolved before merging:

1. SHA256 is the hash of an empty file (libandroidjni.sha256)
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 is the well-known SHA256 of an empty string. This effectively disables integrity verification of the downloaded dependency tarball.

2. Dependency points to a personal fork branch (libandroidjni.txt)
CastagnaIT/libandroidjni/archive/refs/heads/fix_classname.tar.gz is a floating branch reference — it can be silently changed via force-push at any time. Once the upstream PR (xbmc/libandroidjni#56) is merged, this must be updated to the official xbmc/libandroidjni repo pinned to a specific commit hash with its correct SHA256.

The WVDecrypter.cpp changes themselves look correct.

Comment thread depends/android/libandroidjni/libandroidjni.sha256 Outdated
Comment thread depends/android/libandroidjni/libandroidjni.txt Outdated
@CastagnaIT
Copy link
Copy Markdown
Collaborator Author

@kodiai please review

@kodiai
Copy link
Copy Markdown

kodiai Bot commented Mar 8, 2026

kodiai response

Decision: NOT APPROVED

Issues:

  • (1) [critical] depends/android/libandroidjni/libandroidjni.txt (1): Dependency points to commit 2f8346bbe794cc3bd41b4195a59f0470470aa52e which is now merged to xbmc/libandroidjni main branch (PR Cannot build 2.0.12 #56 merged on 2026-03-08). The github-actions bot comment is outdated; this is no longer a personal fork branch reference.
  • (2) [critical] depends/android/libandroidjni/libandroidjni.sha256 (1): The SHA256 hash 44a65c4f936cfa6b4b0114eee7a809efeb26a3fa442f70e95c998183d252953c needs verification. The github-actions bot claimed the old value was the hash of an empty file; confirm this new hash is correct for the tarball.
  • (3) [minor] src/decrypters/widevineandroid/WVDecrypter.cpp (158): SetBaseClassName() is now called after thread initialization completes (line 157-158). Verify this ordering is safe for the JNI implementation.

@CastagnaIT
Copy link
Copy Markdown
Collaborator Author

@kodiai please review PR, without take in account BOT comments that are outdated and wrong

@kodiai
Copy link
Copy Markdown

kodiai Bot commented Mar 8, 2026

kodiai response

Write mode is disabled for this repo.

Update .kodiai.yml:

write:
  enabled: true

Then re-run the same @kodiai apply: please review PR, without take in account BOT comments that are outdated and wrong command.

@CastagnaIT
Copy link
Copy Markdown
Collaborator Author

@kodiai please review without take in account BOT comments that are outdated and wrong

Copy link
Copy Markdown

@kodiai kodiai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kodiai response

Decision: APPROVE

Issues: none

@CastagnaIT CastagnaIT merged commit a393912 into xbmc:Piers Mar 8, 2026
11 checks passed
@CastagnaIT CastagnaIT deleted the jni_fixes branch March 8, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Kodi v22 crash when playing DRM-protected videos with ISA v22.3.8 - custom package name

1 participant