找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1360|回复: 0
打印 上一主题 下一主题
收起左侧

VS-RK3399 板卡调试4G模块的资料

[复制链接]
跳转到指定楼层
楼主
ID:959225 发表于 2021-12-15 15:33 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
android 7.1 "移动网络" 选项 不存在问题。
1、celluar networks 字符串定义
首先在设置APK的资源文件去找到这一串字符
  <!-- Wireless controls, item title to go into the network settings -->   
<string name="network_settings_title">Mobile networks</string>  
2、network_settings_title引用
packages/apps/Settings/src/com/android/settings/WirelessSettings.java中找到:"mobile_network_settings"  
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.Java中找到
.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

     <!-- the 6th element indicates boot-time dependency-met value. -->
     <string-array translatable="false" name="networkAttributes">
         <item>"wifi,1,1,2,-1,true"</item>
         <item>"mobile,0,0,0,-1,true"</item>
         <item>"mobile_mms,2,0,2,60000,true"</item>
         <item>"mobile_supl,3,0,2,60000,true"</item>
         <item>"mobile_dun,4,0,2,60000,true"</item>
         <item>"mobile_hipri,5,0,3,60000,true"</item>
         <item>"mobile_fota,10,0,2,60000,true"</item>
         <item>"mobile_ims,11,0,2,60000,true"</item>
         <item>"mobile_cbs,12,0,2,60000,true"</item>
         
         <item>"bluetooth,7,7,0,-1,true"</item>
         
         <item>"ethernet,9,9,9,-1,true"</item>  要注意这里
    </string-array>

     <!-- This string array should be overridden by the device to present a list of radio
          attributes.  This is used by the connectivity manager to decide which networks can coexist
          based on the hardware -->
     <!-- An Array of "[ConnectivityManager connectionType],
          [# simultaneous connection types]"  -->
     <string-array translatable="false" name="radioAttributes">
         <item>"0,1"</item>
         <item>"1,1"</item>
         <item>"7,1"</item>
         <item>"9,1"</item> 注意这里
    </string-array>
7、最好要开启rild相关的资源,这是4G模块就可以加载成功。
在boardconfig.mk文件增加此功能
BOARD_HAVE_DONGLE:=true
在android7.1可以成功利用4G模块上网
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表