• 从android 4.1.1 到android 4.2 telephony的变化


     首先,最大的变化是代码路径的变化:

    从原来的frameworks/base/telephony 到 frameworks/opt/telephony, 这样,telephony就可以有独立的分支(branch).

    把常量放到一个类文件中

    例如把GsmDataConnectionTracker.java中的常量放到DctConstants.java中。
    把Phone.java中的常量放到PhoneConstants.java中。

    Move the following code from PhoneFactory.java to TelephonyManager.java.

    public static int getPhoneType(int networkMode) {
            switch(networkMode) {
            case RILConstants.NETWORK_MODE_CDMA:
            case RILConstants.NETWORK_MODE_CDMA_NO_EVDO:
            case RILConstants.NETWORK_MODE_EVDO_NO_CDMA:
                return Phone.PHONE_TYPE_CDMA;

            case RILConstants.NETWORK_MODE_WCDMA_PREF:
            case RILConstants.NETWORK_MODE_GSM_ONLY:
            case RILConstants.NETWORK_MODE_WCDMA_ONLY:
            case RILConstants.NETWORK_MODE_GSM_UMTS:
                return Phone.PHONE_TYPE_GSM;

            // Use CDMA Phone for the global mode including CDMA
            case RILConstants.NETWORK_MODE_GLOBAL:
            case RILConstants.NETWORK_MODE_LTE_CDMA_EVDO:
            case RILConstants.NETWORK_MODE_LTE_CMDA_EVDO_GSM_WCDMA:
                return Phone.PHONE_TYPE_CDMA;

            case RILConstants.NETWORK_MODE_LTE_ONLY:
                if (BaseCommands.getLteOnCdmaModeStatic() == Phone.LTE_ON_CDMA_TRUE) {
                    return Phone.PHONE_TYPE_CDMA;
                } else {
                    return Phone.PHONE_TYPE_GSM;
                }
            default:
                return Phone.PHONE_TYPE_GSM;
            }

    Move the following code from both of CDMAPhone and GSMPhone to PhoneBase.

    public SignalStrength getSignalStrength() {
            return mSST.mSignalStrength;
        }
    void  notifySignalStrength() {
            mNotifier.notifySignalStrength(this);
        }

    Move the following code from CommandsInterface.java to TelephonyManager.java

    public static int getLteOnCdmaModeStatic() {
            int retVal;
            int curVal;
            String productType = "";

            curVal = SystemProperties.getInt(TelephonyProperties.PROPERTY_LTE_ON_CDMA_DEVICE,
                        Phone.LTE_ON_CDMA_UNKNOWN);
            retVal = curVal;
            if (retVal == Phone.LTE_ON_CDMA_UNKNOWN) {
                Matcher matcher = sProductTypePattern.matcher(sKernelCmdLine);
                if (matcher.find()) {
                    productType = matcher.group(1);
                    if (sLteOnCdmaProductType.equals(productType)) {
                        retVal = Phone.LTE_ON_CDMA_TRUE;
                    } else {
                        retVal = Phone.LTE_ON_CDMA_FALSE;
                    }
                } else {
                    retVal = Phone.LTE_ON_CDMA_FALSE;
                }
            }

            Log.d(LOG_TAG, "getLteOnCdmaMode=" + retVal + " curVal=" + curVal +
                    " product_type='" + productType +
                    "' lteOnCdmaProductType='" + sLteOnCdmaProductType + "'");
            return retVal;
        }

    private static String getProcCmdLine()
        {
            String cmdline = "";
            FileInputStream is = null;
            try {
                is = new FileInputStream("/proc/cmdline");
                byte [] buffer = new byte[2048];
                int count = is.read(buffer);
                if (count > 0) {
                    cmdline = new String(buffer, 0, count);
                }
            } catch (IOException e) {
                Log.d(LOG_TAG, "No /proc/cmdline exception=" + e);
            } finally {
                if (is != null) {
                    try {
                        is.close();
                    } catch (IOException e) {
                    }
                }
            }
            Log.d(LOG_TAG, "/proc/cmdline=" + cmdline);
            return cmdline;
        }
  • 相关阅读:
    hdu 6435 Problem J. CSGO 最长曼哈顿距离+二进制枚举
    UVA11419 SAM I AM 二分图最小点覆盖
    数论入门基础整理
    [算法导论]#1 摊还分析
    [转载]markown语法
    [AC自动机]玄武密码
    [学习笔记]AC自动机
    分火腿
    [学习笔记]二分与分治
    [学习笔记]二项式反演
  • 原文地址:https://www.cnblogs.com/kangyi/p/2781040.html
Copyright © 2020-2023  润新知