按照alps\vendor\mediatek\release_note\MT8321\ReleaseNote_for_MT8321_alps-mp-o1.mp2.xlsx文档要求修改
第一步完成之后。会出现com.andoid.phone报错,进行GMS测试的时候也会测试中断,修改方法如下:
frameworks/base/telephony/java/android/telephony/ServiceState.java
protected void setFromNotifierBundle(Bundle m) {
if(m == null) return; //add chenhao
mVoiceRegState = m.getInt("voiceRegState");
mDataRegState = m.getInt("dataRegState");
mVoiceRoamingType = m.getInt("voiceRoamingType");
frameworks/opt/telephony/src/java/com/android/internal/telephony/CarrierServiceBindHelper.java
void updateForPhoneId(int phoneId, String simState) {
log("update binding for phoneId: " + phoneId + " simState: " + simState);
if (!SubscriptionManager.isValidPhoneId(phoneId)) {
return;
}
//add chenhao
int numPhones = TelephonyManager.from(mContext).getPhoneCount();
if (numPhones == 0) return;
//end
vendor/mediatek/proprietary/packages/services/Telephony/src/com/android/phone/CarrierConfigLoader.java
public void handleMessage(Message msg) {
int phoneId = msg.arg1;
log("mHandler: " + msg.what + " phoneId: " + phoneId);
String iccid;
CarrierIdentifier carrierId;
String carrierPackageName;
CarrierServiceConnection conn;
PersistableBundle config;
int numPhones ;//add chenhao
switch (msg.what) {
case EVENT_CLEAR_CONFIG:
/* Ignore clear configuration request if device is being shutdown. */
Phone phone = PhoneFactory.getPhone(phoneId);
if (phone != null) {
if (phone.isShuttingDown()) {
break;
}
}
//add chenhao
/*if (mConfigFromDefaultApp[phoneId] == null &&
mConfigFromCarrierApp[phoneId] == null)
break;*/
///M: No need clear config in wifi only project
numPhones= TelephonyManager.from(mContext).getPhoneCount();
if (numPhones ==0 || (mConfigFromDefaultApp[phoneId] == null
&& mConfigFromCarrierApp[phoneId] == null)) break;
//end
mConfigFromDefaultApp[phoneId] = null;
mConfigFromCarrierApp[phoneId] = null;
mServiceConnection[phoneId] = null;
broadcastConfigChangedIntent(phoneId);
break;
case EVENT_PACKAGE_CHANGED:
carrierPackageName = (String) msg.obj;
// Only update if there are cached config removed to avoid updating config
// for unrelated packages.
if (clearCachedConfigForPackage(carrierPackageName)) {
//chenhao add
//int numPhones = TelephonyManager.from(mContext).getPhoneCount();
numPhones = TelephonyManager.from(mContext).getPhoneCount();
//chenhao end
for (int i = 0; i < numPhones; ++i) {
updateConfigForPhoneId(i);
}
}
break;
PersistableBundle getConfigForSubId(int subId) {
try {
mContext.enforceCallingOrSelfPermission(READ_PRIVILEGED_PHONE_STATE, null);
// SKIP checking run-time READ_PHONE_STATE since using PRIVILEGED
} catch (SecurityException e) {
mContext.enforceCallingOrSelfPermission(READ_PHONE_STATE, null);
}
int phoneId = SubscriptionManager.getPhoneId(subId);
PersistableBundle retConfig = CarrierConfigManager.getDefaultConfig();
// add chenhao
int numPhones = TelephonyManager.from(mContext).getPhoneCount();
//if (SubscriptionManager.isValidPhoneId(phoneId)) {
if (numPhones > 0 &&
SubscriptionManager.isValidPhoneId(phoneId)) {
//chenhao
PersistableBundle config = mConfigFromDefaultApp[phoneId];
if (config != null)
retConfig.putAll(config);
config = mConfigFromCarrierApp[phoneId];
if (config != null)
retConfig.putAll(config);
}
return retConfig;
}
vendor/mediatek/proprietary/frameworks/opt/telephony/src/java/com/mediatek/internal/telephony/MtkRIL.java
public IMtkRilOp getRilOp()直接return null即可。
3.注意不能删除联系人 会出现GMS ==FAIL项