RK3399 板卡调试4G模块的资料分享
android 7.1 "移动网络" 选项 不存在问题。
1、celluar networks 字符串定义
首先在设置APK的资源文件去找到这一串字符
Mobile networks
2、network_settings_title引用
packages/apps/Settings/src/com/android/settings/WirelessSettings.;" /> private static final String KEY_MOBILE_NETWORK_SETTINGS = "mobile_network_settings";
把 network_settings_title赋值给 KEY_MOBILE_NETWORK_SETTINGS,再跟进一下 KEY_MOBILE_NETWORK_SETTINGS这个变量吧。
在相同的文件中我们找到:
RemovMobile Network Settings if it's a wifi-only device.
if (Utils.isWifiOnly(getActivity())) {
getPreferenceScreen().removePreference(findPreference(KEY_MOBILE_NETWORK_SETTINGS));
}
getSystemService(Context.CONNECTIVITY_SERVICE);获得网络连接服务,然后判断是否支持TYPE_MOBILE,现在判断应该是不支持,也就是if判断中:Utils.isWifiOnly(getActivity())=1
所以把“移动网络”的选项移除,现在我们就重点去分析Utils.isWifiOnly(getActivity()),找到不显示的原因,也就是if()中的判断条件,跟进这段代码
3、我们去看下ifWifiOnly()是何方神圣?
packages/apps/Settings/src/com/android/settings/Utils.;" /> .import android.net.ConnectivityManager;
.public static boolean isWifiOnly(Context context) {
ConnectivityManager cm = (ConnectivityManager)context.getSystemService(
Context.CONNECTIVITY_SERVICE);
return (cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE) == false);
.}
Utils.isWifiOnly(getActivity())=1也就是
cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE) = false,可是我们现在要的值是true,为什么会出现false呢,我们继续往下看cm.isNetworkSupported
4、 再分析isNetworkSupported
frameworks/base/core/java/android/net/ ConnectivityManager.java
.public boolean isNetworkSupported(int networkType) {
.try {
.return mService.isNetworkSupported(networkType);
.} catch (RemoteException e) {}
.return false;
.}
07.}
继续跟进 mService.isNetworkSupported这个函数的实现
5、 mService.isNetworkSupported的实现
\frameworks\base\core\java\android\net
public boolean isNetworkSupported(int networkType) {
try {
return mService.isNetworkSupported(networkType);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
6、到最后是device\rockchip\common\overlay\frameworks\base\core\res\res\values\config.xml
"wifi,1,1,2,-1,true"
"mobile,0,0,0,-1,true"
"mobile_mms,2,0,2,60000,true"
"mobile_supl,3,0,2,60000,true"
"mobile_dun,4,0,2,60000,true"
"mobile_hipri,5,0,3,60000,true"
"mobile_fota,10,0,2,60000,true"
"mobile_ims,11,0,2,60000,true"
"mobile_cbs,12,0,2,60000,true"
"bluetooth,7,7,0,-1,true"
"ethernet,9,9,9,-1,true" 要注意这里
"0,1"
"1,1"
"7,1"
"9,1" 注意这里
7、最好要开启rild相关的资源,这是4G模块就可以加载成功。
在boardconfig.mk文件增加此功能
BOARD_HAVE_DONGLE:=true
在android7.1可以成功利用4G模块上网 |