fix unregisterNetworkCallback throwing exception when the callback has not been registered

todo: squash
This commit is contained in:
Linus789 2023-01-31 15:02:16 +01:00
parent 84257a7348
commit dc1faa94e0

View File

@ -330,6 +330,22 @@ public class SpoofWifiPatch {
);
}
public static void unregisterNetworkCallback(ConnectivityManager connectivityManager, ConnectivityManager.NetworkCallback networkCallback) {
try {
connectivityManager.unregisterNetworkCallback(networkCallback);
} catch (IllegalArgumentException ignore) {
// ignore: NetworkCallback was not registered
}
}
public static void unregisterNetworkCallback(ConnectivityManager connectivityManager, PendingIntent operation) {
try {
connectivityManager.unregisterNetworkCallback(operation);
} catch (IllegalArgumentException ignore) {
// ignore: PendingIntent was not registered
}
}
private static class Utils {
private static class Option<T> {
private final T value;