extern jclass *android_simple_fetcher_class;
/**
- * Currently known (supported) SDK versions
+ * SDK versions for which we need some special handling.
*
* see android.os.Build.VERSION_CODES for definitions
*/
typedef enum {
- ANDROID_ICE_CREAM_SANDWICH = 14,
- ANDROID_ICE_CREAM_SANDWICH_MR1 = 15,
- ANDROID_JELLY_BEAN = 16,
- ANDROID_JELLY_BEAN_MR1 = 17,
- ANDROID_JELLY_BEAN_MR2 = 18,
- ANDROID_LOLLIPOP = 21,
ANDROID_MARSHMALLOW = 23,
} android_sdk_version_t;
JNIEnv *env;
androidjni_attach_thread(&env);
- if (android_sdk_version == ANDROID_JELLY_BEAN)
- { /* there is a bug in JB that causes a SIGSEGV if the key object is
- * garbage collected so we intentionally leak the reference to it */
- DBG1(DBG_LIB, "intentionally leaking private key reference due to "
- "a bug in the framework");
- }
- else
- {
- (*env)->DeleteGlobalRef(env, this->key);
- }
+ (*env)->DeleteGlobalRef(env, this->key);
(*env)->DeleteGlobalRef(env, this->signature_class);
androidjni_detach_thread();
this->pubkey->destroy(this->pubkey);
}
charonservice->bypass_socket(charonservice, skt, dst->get_family(dst));
- if (android_sdk_version <= ANDROID_JELLY_BEAN_MR2)
- { /* this seems to help avoiding the VIP, unless there is no connectivity
- * at all */
- charonservice->bypass_socket(charonservice, -1, 0);
- }
if (connect(skt, dst->get_sockaddr(dst), addrlen) < 0)
{
/* don't report an error if we are not connected (ENETUNREACH) */
return host->ip_equals(host, vip);
}
-METHOD(kernel_net_t, get_source_addr_old, host_t*,
- private_android_net_t *this, host_t *dest, host_t *src)
-{
- host_t *host;
-
- /* on older Android versions we might get the virtual IP back because
- * the protect() implementation there and connect() don't properly work
- * together, on newer releases (using fwmarks) that's not a problem */
- host = get_source_addr(this, dest, src);
- if (host)
- {
- this->mutex->lock(this->mutex);
- if (this->vips->find_first(this->vips, vip_equals, NULL, host))
- {
- host->destroy(host);
- host = NULL;
- }
- this->mutex->unlock(this->mutex);
- }
- return host;
-}
-
METHOD(kernel_net_t, get_nexthop, host_t*,
private_android_net_t *this, host_t *dest, int prefix, host_t *src,
char **iface)
);
timerclear(&this->next_roam);
- if (android_sdk_version <= ANDROID_JELLY_BEAN_MR2)
- {
- this->public.get_source_addr = _get_source_addr_old;
- }
-
this->mutex->lock(this->mutex);
this->network_manager->add_connectivity_cb(
this->network_manager, (void*)connectivity_cb, this);