@@ -29,23 +29,6 @@ namespace android {
2929
3030static jboolean sScanModeActive = false ;
3131
32- /*
33- * The following remembers the jfieldID's of the fields
34- * of the DhcpInfo Java object, so that we don't have
35- * to look them up every time.
36- */
37- static struct fieldIds {
38- jclass dhcpInfoClass;
39- jmethodID constructorId;
40- jfieldID ipaddress;
41- jfieldID gateway;
42- jfieldID netmask;
43- jfieldID dns1;
44- jfieldID dns2;
45- jfieldID serverAddress;
46- jfieldID leaseDuration;
47- } dhcpInfoFieldIds;
48-
4932static int doCommand (const char *cmd, char *replybuf, int replybuflen)
5033{
5134 size_t reply_len = replybuflen - 1 ;
@@ -491,28 +474,6 @@ static jboolean android_net_wifi_clearBlacklistCommand(JNIEnv* env, jobject claz
491474 return doBooleanCommand (" BLACKLIST clear" , " OK" );
492475}
493476
494- static jboolean android_net_wifi_doDhcpRequest (JNIEnv* env, jobject clazz, jobject info)
495- {
496- jint ipaddr, gateway, mask, dns1, dns2, server, lease;
497- jboolean succeeded = ((jboolean)::do_dhcp_request (&ipaddr, &gateway, &mask,
498- &dns1, &dns2, &server, &lease) == 0 );
499- if (succeeded && dhcpInfoFieldIds.dhcpInfoClass != NULL ) {
500- env->SetIntField (info, dhcpInfoFieldIds.ipaddress , ipaddr);
501- env->SetIntField (info, dhcpInfoFieldIds.gateway , gateway);
502- env->SetIntField (info, dhcpInfoFieldIds.netmask , mask);
503- env->SetIntField (info, dhcpInfoFieldIds.dns1 , dns1);
504- env->SetIntField (info, dhcpInfoFieldIds.dns2 , dns2);
505- env->SetIntField (info, dhcpInfoFieldIds.serverAddress , server);
506- env->SetIntField (info, dhcpInfoFieldIds.leaseDuration , lease);
507- }
508- return succeeded;
509- }
510-
511- static jstring android_net_wifi_getDhcpError (JNIEnv* env, jobject clazz)
512- {
513- return env->NewStringUTF (::get_dhcp_error_string ());
514- }
515-
516477// ----------------------------------------------------------------------------
517478
518479/*
@@ -569,28 +530,13 @@ static JNINativeMethod gWifiMethods[] = {
569530 { " setScanResultHandlingCommand" , " (I)Z" , (void *) android_net_wifi_setScanResultHandlingCommand },
570531 { " addToBlacklistCommand" , " (Ljava/lang/String;)Z" , (void *) android_net_wifi_addToBlacklistCommand },
571532 { " clearBlacklistCommand" , " ()Z" , (void *) android_net_wifi_clearBlacklistCommand },
572-
573- { " doDhcpRequest" , " (Landroid/net/DhcpInfo;)Z" , (void *) android_net_wifi_doDhcpRequest },
574- { " getDhcpError" , " ()Ljava/lang/String;" , (void *) android_net_wifi_getDhcpError },
575533};
576534
577535int register_android_net_wifi_WifiManager (JNIEnv* env)
578536{
579537 jclass wifi = env->FindClass (WIFI_PKG_NAME);
580538 LOG_FATAL_IF (wifi == NULL , " Unable to find class " WIFI_PKG_NAME);
581539
582- dhcpInfoFieldIds.dhcpInfoClass = env->FindClass (" android/net/DhcpInfo" );
583- if (dhcpInfoFieldIds.dhcpInfoClass != NULL ) {
584- dhcpInfoFieldIds.constructorId = env->GetMethodID (dhcpInfoFieldIds.dhcpInfoClass , " <init>" , " ()V" );
585- dhcpInfoFieldIds.ipaddress = env->GetFieldID (dhcpInfoFieldIds.dhcpInfoClass , " ipAddress" , " I" );
586- dhcpInfoFieldIds.gateway = env->GetFieldID (dhcpInfoFieldIds.dhcpInfoClass , " gateway" , " I" );
587- dhcpInfoFieldIds.netmask = env->GetFieldID (dhcpInfoFieldIds.dhcpInfoClass , " netmask" , " I" );
588- dhcpInfoFieldIds.dns1 = env->GetFieldID (dhcpInfoFieldIds.dhcpInfoClass , " dns1" , " I" );
589- dhcpInfoFieldIds.dns2 = env->GetFieldID (dhcpInfoFieldIds.dhcpInfoClass , " dns2" , " I" );
590- dhcpInfoFieldIds.serverAddress = env->GetFieldID (dhcpInfoFieldIds.dhcpInfoClass , " serverAddress" , " I" );
591- dhcpInfoFieldIds.leaseDuration = env->GetFieldID (dhcpInfoFieldIds.dhcpInfoClass , " leaseDuration" , " I" );
592- }
593-
594540 return AndroidRuntime::registerNativeMethods (env,
595541 WIFI_PKG_NAME, gWifiMethods , NELEM (gWifiMethods ));
596542}
0 commit comments