Skip to content

fix: connectivity service#16232

Open
alperozturk96 wants to merge 28 commits into
masterfrom
fix/connectivity-serv
Open

fix: connectivity service#16232
alperozturk96 wants to merge 28 commits into
masterfrom
fix/connectivity-serv

Conversation

@alperozturk96

@alperozturk96 alperozturk96 commented Jan 2, 2026

Copy link
Copy Markdown
Collaborator
  • Tests written, or not not needed

Fixes: #14681

Deduplicates isNetworkAndServerAvailable logic

Implements ConnectivityManager.NetworkCallback for better network state listening

Removes deprecated logics

Adds better documentation

Adds exception handling for http call to prevent temporary issues thus we don't inform user with incorrect availability state

Uses for metered detection NET_CAPABILITY_NOT_METERED instead of NET_CAPABILITY_NOT_RESTRICTED

Removes network change receiver uses listener for much better reaction to network change

Converts to Kotlin

Stores current connectivity per account since current connectivity change via account thus we should not treat new account as disconnected. Current connectivity is used for detect wifi enabled or not, server available, metered etc.

Adds smart current connectivity checker, compares previous and new one and only updates if necessary.

ZetaTom

This comment was marked as resolved.

@TheCrowned

This comment was marked as resolved.

@alperozturk96

Copy link
Copy Markdown
Collaborator Author

@TheCrowned Hello. Thank you for the feedback. I updated the PR. Could you please check via latest APK file once its generated?

@nextcloud nextcloud deleted a comment from github-actions Bot Apr 7, 2026
@nextcloud nextcloud deleted a comment from github-actions Bot Apr 7, 2026
@alperozturk96 alperozturk96 force-pushed the fix/connectivity-serv branch 2 times, most recently from 2181611 to 1fb36f6 Compare April 8, 2026 09:59
@alperozturk96 alperozturk96 added performance 🚀 Performance improvement opportunities (non-crash related) 2. developing and removed 3. to review labels Apr 8, 2026
alperozturk96 and others added 21 commits June 17, 2026 08:55
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
…vice.java

Co-authored-by: Tom <70907959+ZetaTom@users.noreply.github.com>
Signed-off-by: Alper Öztürk <67455295+alperozturk96@users.noreply.github.com>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>

# Conflicts:
#	gradle/libs.versions.toml
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>

# Conflicts:
#	gradle/libs.versions.toml
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>

# Conflicts:
#	gradle/libs.versions.toml
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Alper Öztürk <67455295+alperozturk96@users.noreply.github.com>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
@alperozturk96 alperozturk96 force-pushed the fix/connectivity-serv branch from 7fa9c9e to 78d6555 Compare June 17, 2026 06:58
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
@github-actions

Copy link
Copy Markdown

APK file: https://github.com/nextcloud/android/actions/runs/27671569257/artifacts/7688293038
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
@github-actions

Copy link
Copy Markdown

APK file: https://github.com/nextcloud/android/actions/runs/27672039480/artifacts/7688457471
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

@github-actions

Copy link
Copy Markdown

Codacy

SpotBugs

CategoryBaseNew
Bad practice3333
Correctness6767
Dodgy code215214
Experimental11
Internationalization77
Malicious code vulnerability22
Multithreaded correctness3131
Performance4141
Security1616
Total413412

@github-actions

Copy link
Copy Markdown

blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed.

val baseServerAddress = accountManager.user.server.uri.toString()
if (baseServerAddress.isEmpty()) {
Log_OC.e(TAG, "no base server address, internet is walled")
return true

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Shall we cache if base server address empty and rely on result of current connectivity connected or just assume as walled?

Old behaviour: relies on current connectivity connected and caches

@tobiasKaminsky tobiasKaminsky Jun 17, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if base address is empty -> return c.isConnected()
no caching

val resolvedCapabilities = resolveNetworkCapabilities()
if (resolvedCapabilities == null || !isSupportedTransport(resolvedCapabilities)) {
Log_OC.e(TAG, "no usable network transport at check time, treating as walled")
return true

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Old: if connectivity is null set as walled cache false basically treat as connected.
New: not caches since less than 10 mins device's connectivity can change and we should not cache it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review performance 🚀 Performance improvement opportunities (non-crash related)

Projects

None yet

6 participants