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

Android/tv-casting-app: Fix for issue in finding handleInternal() on some Android phones #165

Merged
merged 6 commits into from
May 22, 2023

Conversation

sharadb-amazon
Copy link
Owner

@sharadb-amazon sharadb-amazon commented May 9, 2023

Problem

On Android OS 8, we encountered the following errors (not seen before on other phones/versions of Android):

05-08 13:00:16.245 20360 20637 D SVR : JNI_METHOD openBasicCommissioningWindow called with duration 60
05-08 13:00:16.245 20360 20637 D SVR : CallbackBaseJNI::SetUp called
05-08 13:00:16.245 20360 20637 E SVR : Failed to access 'handleInternal' method with signature (ILjava/lang/String;)V
05-08 13:00:16.245 20360 20637 D SVR : CallbackBaseJNI::SetUp called
05-08 13:00:16.245 20360 20637 E SVR : Failed to access 'handleInternal' method with signature (Ljava/lang/Object;)V
05-08 13:00:16.245 20360 20637 D SVR : CallbackBaseJNI::SetUp called
05-08 13:00:16.245 20360 20637 E SVR : Failed to access 'handleInternal' method with signature (ILjava/lang/String;)V
05-08 13:00:16.245 20360 20637 D SVR : CallbackBaseJNI::SetUp called
05-08 13:00:16.245 20360 20637 E SVR : Failed to access 'handleInternal' method with signature (Ljava/lang/Object;)V

Solution

The error is logged here in the SDK because the call to GetMethodId failed to find the method with the signatures mentioned above: https://github.com/project-chip/connectedhomeip/blob/master/examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.cpp#L34-L39

This change makes the handleInternal methods public (instead of private) which seems to fix the issue.

This change fetches the superclass of the Callback instance passed in by the tv-casting-app code and calls GetMethodId on that Superclass, rather than the Callback class itself. It also marks the handleInternal methods as "protected" instead of "private".

Testing

Verified on the Android 8 test phone where the issue was encountered, by opening the commissioning window

@github-actions
Copy link

github-actions bot commented May 9, 2023

All PRs require an issue to be accepted, please link an issue or mention it in the body using #<issue_id>

@github-actions
Copy link

All PRs require an issue to be accepted, please link an issue or mention it in the body using #<issue_id>

@sharadb-amazon sharadb-amazon changed the title Android/tv-casting-app: Making handleInternal() public Android/tv-casting-app: Fix for issue in finding handleInternal() on some Android phones May 16, 2023
@github-actions
Copy link

All PRs require an issue to be accepted, please link an issue or mention it in the body using #<issue_id>

4 similar comments
@github-actions
Copy link

All PRs require an issue to be accepted, please link an issue or mention it in the body using #<issue_id>

@github-actions
Copy link

All PRs require an issue to be accepted, please link an issue or mention it in the body using #<issue_id>

@github-actions
Copy link

All PRs require an issue to be accepted, please link an issue or mention it in the body using #<issue_id>

@github-actions
Copy link

All PRs require an issue to be accepted, please link an issue or mention it in the body using #<issue_id>

@sharadb-amazon sharadb-amazon merged commit 9022f61 into v1.0.0-branch May 22, 2023
sharadb-amazon added a commit that referenced this pull request May 23, 2023
sharadb-amazon added a commit that referenced this pull request Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants