查看: 1611|回复: 0

视壮RK3399 板卡调试4G模块的资料分享

[复制链接]
  • TA的每日心情

    2018-11-30 11:03
  • 签到天数: 53 天

    连续签到: 1 天

    [LV.5]常住居民I

    发表于 2018-7-13 09:56:28 | 显示全部楼层 |阅读模式
    分享到:
    视壮RK3399 板卡调试4G模块的资料分享
    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模块上网

    回复

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /2 下一条

    手机版|小黑屋|与非网

    GMT+8, 2024-4-19 22:29 , Processed in 0.122653 second(s), 17 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.