• 从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;
        }
  • 相关阅读:
    省选D2T2 滚榜
    CF1516E(第一类斯特林数)
    Atcoder ZEP F题
    Atcoder ARC 115 A~D
    Atcoder ARC 117
    「舞蹈链 DLX 」学习笔记
    「FJOI-2021」仰视那片离我远去了的天空。
    「UVA1603」破坏正方形 Square Destroyer
    「网络流」学习笔记
    博客搬家
  • 原文地址:https://www.cnblogs.com/kangyi/p/2781040.html
Copyright © 2020-2023  润新知