Skip to content
Snippets Groups Projects
Unverified Commit a94f31f4 authored by Matthias Urhahn's avatar Matthias Urhahn Committed by GitHub
Browse files

Catch unexpected SecurityException on Samsung devices. (#2926)

parent 2733d379
No related branches found
No related tags found
No related merge requests found
......@@ -49,7 +49,23 @@ class NetworkStateProvider @Inject constructor(
val request = networkRequestBuilderProvider.get()
.addCapability(NET_CAPABILITY_INTERNET)
.build()
manager.registerNetworkCallback(request, callback)
try {
/**
* This may throw java.lang.SecurityException on Samsung devices
* java.lang.SecurityException:
* at android.os.Parcel.createExceptionOrNull (Parcel.java:2385)
* at android.net.ConnectivityManager.registerNetworkCallback (ConnectivityManager.java:4564)
*/
manager.registerNetworkCallback(request, callback)
} catch (e: SecurityException) {
Timber.e(e, "registerNetworkCallback() threw an undocumented SecurityException, Just Samsung Things™️")
State(
activeNetwork = null,
capabilities = null,
linkProperties = null,
).run { send(this) }
}
val fakeConnectionSubscriber = launch {
testSettings.fakeMeteredConnection.flow.drop(1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment