最终通过:
C++层:::
frameworks/base/core/jni/Android.mk
LOCAL_SRC_FILES:= android_net_wifi_Wifi.cpp 。。。。。
//包括该目录下所有文件C++
LOCAL_SHARED_LIBRARIES += libwifi,libwpa_client,libhardware_legacy。。。。。
//链接相关动态库(几乎所有)
LOCAL_MODULE:= libandroid_runtime
//生成共享库名称:include $(BUILD_SHARED_LIBRARY)
include $(call all-makefiles-under,$(LOCAL_PATH))
wifinative 调用下层JNI,
wifi.c链接动态库libwpa_client.so 被添加到libnetutils.so
hardware/libhardware_legacy/Android.mk
SAVE_MAKEFILES := $(call all-subdir-makefiles)
LOCAL_SHARED_LIBRARIES := libutils libbinder libcutilslibwpa_clientinclude $(SAVE_MAKEFILES)
LOCAL_MODULE:= libhardware_legacyinclude $(BUILD_SHARED_LIBRARY)
./hardware/libhardware_legacy/wifi/Android.mk
ifdef WIFI_DRIVER_MODULE_PATH
LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_PATH=\"$(WIFI_DRIVER_MODULE_PATH)\"
endif
ifdef WIFI_DRIVER_MODULE_ARG
LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_ARG=\"$(WIFI_DRIVER_MODULE_ARG)\"
endif
ifdef WIFI_DRIVER_MODULE_NAME
LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_NAME=\"$(WIFI_DRIVER_MODULE_NAME)\"
endif
ifdef WIFI_FIRMWARE_LOADER
LOCAL_CFLAGS += -DWIFI_FIRMWARE_LOADER=\"$(WIFI_FIRMWARE_LOADER)\"
endif
ifneq ($(BOARD_HAVE_LIBWIFI),true)
LOCAL_SRC_FILES += wifi/wifi.c
LOCAL_SHARED_LIBRARIES += libnetutils
endif