方法一(在firefly sdk上测试,存在诸多问题)
1 新建文件夹test
2 参考原路径,在其中新建android/net
3 修改ConnectivityManager.java,将TETHERING_WIFI字段、startTethering方法及OnStartTetheringCallback类中隐藏相关的标志去掉,并添加
/**
* Callback for use with {@link #startTethering} to find out whether tethering succeeded.
*/
@SystemApi
public abstract static class OnStartTetheringCallback {
//howard added
public OnStartTetheringCallback() {
}
public void onTetheringStarted() {
}
public void onTetheringFailed() {
}
}
4 在android源码根目录上执行make update-api
5 cd framework/base/
mmm, 生新ConnectivityManager.class
6 将/mnt/nctsdc2/selfrk3399sys/android-7.1_src/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes/android/net$ 中编译过的ConnectivityManager.class拷贝到test/android/net目录下
7 在test目录下执行 jar -cvf WifiAp8.jar *,生成WifiAp8.jar
方法二(在firefly sdk上测试,存在诸多问题,在自制sdk上测试,可行)
1 在/mnt/nctsdc2/selfrk3399sys/android-7.1_src/frameworks/base/core/java/android/net下新建Android.mk
LOCAL_PATH:= $(call my-dir)
#make jar
include $(CLEAR_VARS)
#LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_SRC_FILES :=ConnectivityManager.java
LOCAL_MODULE :=WifiAp8
#include $(BUILD_JAVA_LIBRARY)
LOCAL_JACK_ENABLED := disabled
include $(BUILD_STATIC_JAVA_LIBRARY)
2 执行mm
3 会在/mnt/nctsdc2/selfrk3399sys/android-7.1_src/out/target/product/nct_zz/obj/JAVA_LIBRARIES/WifiAp8_intermediates 下生成javalib.jar,重命名为WifiAp8.jar,导入AS工程使用