8000 android: disable network interface monitoring on ANDROID_API >= 30 by Danielius1922 · Pull Request #477 · iotivity/iotivity-lite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

android: disable network interface monitoring on ANDROID_API >= 30 #477

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

Merged
merged 2 commits into from
Jul 6, 2023

Conversation

Danielius1922
Copy link
Member

No description provided.

@Danielius1922 Danielius1922 force-pushed the adam/hotfix/android-network-monitor branch 6 times, most recently from 246e712 to 5c62cf9 Compare June 29, 2023 12:43
@Danielius1922 Danielius1922 changed the title Build android with various api levels android: disable network interface monitoring on ANDROID_API >= 30 Jun 29, 2023
@baabel
Copy link
baabel commented Jul 1, 2023

Not necessarily related to this change but....

api/cloud/oc_cloud.c

when OC_NETWORK_MONITOR is not defined, the code in oc_cloud.c calls some undefined functions...(ex: oc_remove_network_interface_event_callback) and they end up as UNDEFINED in the .so library and loadLibrary() fails to load libiotivity-lite-jni.so. This is because the implementation is conditional in ipadapter.c based on OC_NETWORK_MONITOR.

potential fix:
include the OC_NETWORK_MONITOR directive around calls line #342 and #359
example:
#if defined(OC_SESSION_EVENTS) && defined(OC_NETWORK_MONITOR)
oc_remove_session_event_callback_v1(cloud_ep_session_event_handler, ctx,
false);
oc_remove_network_interface_event_callback(cloud_interface_event_handler);
oc_add_session_event_callback_v1(cloud_ep_session_event_handler, ctx);
oc_add_network_interface_event_callback(cloud_interface_event_handler);
#endif /* OC_SESSION_EVENTS */

@Danielius1922
Copy link
Member Author

Yeah, the ifdefs are wrong, seems like OC_SESSION_EVENTS and OC_NETWORK_MONITOR got mixed up, I'll clean it up.

@Danielius1922 Danielius1922 force-pushed the adam/hotfix/android-network-monitor branch 9 times, most recently from 931a8ca to 7cef58b Compare July 4, 2023 07:37
@baabel
Copy link
baabel commented Jul 5, 2023

@Danielius1922 Hi, I tested latest change. Looks like only 1 more undefined symbol remaining, so when launching android app ...dlopen failed: cannot locate symbol "oc_resource_set_access_in_RFOTM" referenced by...

Also ran nm on the .so librar 8000 y and that seems to be the only undefined symbol in iotivity lib

The current implementation of network interface changes notifications
is based on binding to a NETLINK socket and using select to monitor
changes. However, from ANDROID_API=30 the binding to a NETLINK socket
is restricted and the bind call will fail, which ultimately causes
the device to abort during initialization.
This commit simply disables the feature when ANDROID_API>=30 is
detected.

For ANDROID_API>=30 this feature needs to be reimplemented using a
non-restricted API.
@Danielius1922 Danielius1922 force-pushed the adam/hotfix/android-network-monitor branch from 7cef58b to 24f8985 Compare July 6, 2023 08:15
@Danielius1922
Copy link
Member Author

@baabel Should be all good now!

@sonarqubecloud
Copy link
sonarqubecloud bot commented Jul 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
2.7% 2.7% Duplication

@baabel
Copy link
baabel commented Jul 6, 2023

thanks. lgtm, android app launches.

@Danielius1922 Danielius1922 added the OCF Conformance Testing OCF Conformance Testing required label Jul 6, 2023
@Danielius1922
Copy link
Member Author

Great, I've fired up the Conformance tests, if they all pass I'll merge the fixes to master (they usually take from 3 to 4 hours...)

@Danielius1922 Danielius1922 marked this pull request as ready for review July 6, 2023 22:54
@Danielius1922 Danielius1922 merged commit b3de267 into master Jul 6, 2023
@Danielius1922 Danielius1922 deleted the adam/hotfix/android-network-monitor branch July 6, 2023 22:55
@github-actions github-actions bot locked and limited conversation to collaborators Jul 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
OCF Conformance Testing OCF Conformance Testing required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0