从android 4.1.1 到android 4.2 telephony的变化
16lz
2021-01-23
首先,最大的变化是代码路径的变化:
从原来的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 intgetPhoneType( intnetworkMode){switch(networkMode){
caseRILConstants.NETWORK_MODE_CDMA:
caseRILConstants.NETWORK_MODE_CDMA_NO_EVDO:
caseRILConstants.NETWORK_MODE_EVDO_NO_CDMA:
returnPhone.PHONE_TYPE_CDMA;
caseRILConstants.NETWORK_MODE_WCDMA_PREF:
caseRILConstants.NETWORK_MODE_GSM_ONLY:
caseRILConstants.NETWORK_MODE_WCDMA_ONLY:
caseRILConstants.NETWORK_MODE_GSM_UMTS:
returnPhone.PHONE_TYPE_GSM;
// UseCDMAPhonefortheglobalmodeincludingCDMA
caseRILConstants.NETWORK_MODE_GLOBAL:
caseRILConstants.NETWORK_MODE_LTE_CDMA_EVDO:
caseRILConstants.NETWORK_MODE_LTE_CMDA_EVDO_GSM_WCDMA:
returnPhone.PHONE_TYPE_CDMA;
caseRILConstants.NETWORK_MODE_LTE_ONLY:
if(BaseCommands.getLteOnCdmaModeStatic()==Phone.LTE_ON_CDMA_TRUE){
returnPhone.PHONE_TYPE_CDMA;
} else{
returnPhone.PHONE_TYPE_GSM;
}
default:
returnPhone.PHONE_TYPE_GSM;
}
Move the following code from both of CDMAPhone and GSMPhone to PhoneBase.
publicSignalStrengthgetSignalStrength(){returnmSST.mSignalStrength;
}
voidnotifySignalStrength(){
mNotifier.notifySignalStrength( this);
}
Move the following code from CommandsInterface.java to TelephonyManager.java
public static intgetLteOnCdmaModeStatic(){intretVal;
intcurVal;
StringproductType="";
curVal=SystemProperties.getInt(TelephonyProperties.PROPERTY_LTE_ON_CDMA_DEVICE,
Phone.LTE_ON_CDMA_UNKNOWN);
retVal=curVal;
if(retVal==Phone.LTE_ON_CDMA_UNKNOWN){
Matchermatcher=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+"'");
returnretVal;
}
private staticStringgetProcCmdLine()
{
Stringcmdline="";
FileInputStreamis= null;
try{
is= newFileInputStream("/proc/cmdline");
byte[]buffer= new byte[2048];
intcount=is.read(buffer);
if(count>0){
cmdline= newString(buffer,0,count);
}
} catch(IOExceptione){
Log.d(LOG_TAG,"No/proc/cmdlineexception="+e);
} finally{
if(is!= null){
try{
is.close();
} catch(IOExceptione){
}
}
}
Log.d(LOG_TAG,"/proc/cmdline="+cmdline);
returncmdline;
}
更多相关文章
- Android x86 4.4-r5 分支修改笔记——系统定制
- Android WifiManager 常量
- 【Android 开发教程】经过预定义的查询字符串常量
- iOS开发周报:Swift 项目合并 Android 分支,App Store 开展 “Apps
- Android Wifi模块相关常量定义.
- Blog-06-《一周快速上手Kotlin For Android》-之When分支