Loading src/java/com/android/internal/telephony/CarrierPrivilegesTracker.java +15 −8 Original line number Diff line number Diff line Loading @@ -217,14 +217,21 @@ public class CarrierPrivilegesTracker extends Handler { mPhone = phone; mLocalLog = new LocalLog(100); IntentFilter filter = new IntentFilter(); filter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED); filter.addAction(TelephonyManager.ACTION_SIM_CARD_STATE_CHANGED); filter.addAction(TelephonyManager.ACTION_SIM_APPLICATION_STATE_CHANGED); filter.addAction(Intent.ACTION_PACKAGE_ADDED); filter.addAction(Intent.ACTION_PACKAGE_REPLACED); filter.addAction(Intent.ACTION_PACKAGE_REMOVED); mContext.registerReceiver(mIntentReceiver, filter); IntentFilter certFilter = new IntentFilter(); certFilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED); certFilter.addAction(TelephonyManager.ACTION_SIM_CARD_STATE_CHANGED); certFilter.addAction(TelephonyManager.ACTION_SIM_APPLICATION_STATE_CHANGED); mContext.registerReceiver(mIntentReceiver, certFilter); IntentFilter packageFilter = new IntentFilter(); packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED); packageFilter.addAction(Intent.ACTION_PACKAGE_REPLACED); packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); // For package-related broadcasts, specify the data scheme for "package" to receive the // package name along with the broadcast packageFilter.addDataScheme("package"); mContext.registerReceiver(mIntentReceiver, packageFilter); mRegistrantList = new RegistrantList(); mCarrierConfigCerts = new ArraySet<>(); Loading src/java/com/android/internal/telephony/uicc/AdnRecord.java +3 −8 Original line number Diff line number Diff line Loading @@ -92,14 +92,9 @@ public class AdnRecord implements Parcelable { recordNumber = source.readInt(); alphaTag = source.readString(); number = source.readString(); final int len = source.readInt(); if (len > 0) { emails = new String[len]; source.readStringArray(emails); emails = source.createStringArray(); return new AdnRecord(efid, recordNumber, alphaTag, number, emails); } else { return new AdnRecord(efid, recordNumber, alphaTag, number, null); } } @Override Loading src/java/com/android/internal/telephony/uicc/IccRecords.java +3 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Pair; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.CommandsInterface; import com.android.internal.telephony.MccTable; import com.android.internal.telephony.util.ArrayUtils; Loading Loading @@ -112,7 +113,8 @@ public abstract class IccRecords extends Handler implements IccConstants { protected boolean mRecordsRequested = false; // true if we've made requests for the sim records protected int mLockedRecordsReqReason = LOCKED_RECORDS_REQ_REASON_NONE; protected String mIccId; // Includes only decimals (no hex) @VisibleForTesting(visibility = VisibleForTesting.Visibility.PROTECTED) public String mIccId; // Includes only decimals (no hex) protected String mFullIccId; // Includes hex characters in ICCID protected String mMsisdn = null; // My mobile number Loading src/java/com/android/internal/telephony/uicc/UiccProfile.java +19 −0 Original line number Diff line number Diff line Loading @@ -1665,6 +1665,21 @@ public class UiccProfile extends IccCard { } } /** * Make sure the iccid in SIM record matches the current active subId. If not, return false. * When SIM switching in eSIM is happening, there are rare cases that setOperatorBrandOverride * is called on old subId while new iccid is already loaded on SIM record. For those cases * setOperatorBrandOverride would apply to the wrong (new) iccid. This check is to avoid it. */ private boolean checkSubIdAndIccIdMatch(String iccid) { if (TextUtils.isEmpty(iccid)) return false; SubscriptionInfo subInfo = SubscriptionController.getInstance() .getActiveSubscriptionInfoForSimSlotIndex( getPhoneId(), mContext.getOpPackageName(), null); return subInfo != null && IccUtils.stripTrailingFs(subInfo.getIccId()).equals( IccUtils.stripTrailingFs(iccid)); } /** * Sets the overridden operator brand. */ Loading @@ -1676,6 +1691,10 @@ public class UiccProfile extends IccCard { if (TextUtils.isEmpty(iccId)) { return false; } if (!checkSubIdAndIccIdMatch(iccId)) { loge("iccId doesn't match current active subId."); return false; } SharedPreferences.Editor spEditor = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); Loading src/java/com/android/internal/telephony/vendor/VendorPhoneSwitcher.java +31 −23 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.internal.telephony.vendor; import static android.telephony.SubscriptionManager.DEFAULT_SUBSCRIPTION_ID; import static android.telephony.SubscriptionManager.INVALID_PHONE_INDEX; import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID; import static android.telephony.TelephonyManager.RADIO_POWER_UNAVAILABLE; import android.content.BroadcastReceiver; import android.content.Context; Loading @@ -42,6 +43,7 @@ import com.android.internal.telephony.CallManager; import com.android.internal.telephony.Call; import com.android.internal.telephony.CommandsInterface; import com.android.internal.telephony.dataconnection.DcRequest; import com.android.internal.telephony.dataconnection.DataEnabledSettings; import com.android.internal.telephony.GsmCdmaCall; import com.android.internal.telephony.imsphone.ImsPhone; import com.android.internal.telephony.imsphone.ImsPhoneCall; Loading Loading @@ -257,6 +259,7 @@ public class VendorPhoneSwitcher extends PhoneSwitcher { // Check to see if there is any active subscription on any phone boolean hasAnyActiveSubscription = false; boolean hasSubRefreshedOnThePreferredPhone = false; // Check if phoneId to subId mapping is changed. for (int i = 0; i < mActiveModemCount; i++) { Loading @@ -267,6 +270,11 @@ public class VendorPhoneSwitcher extends PhoneSwitcher { if (sub != mPhoneSubscriptions[i]) { sb.append(" phone[").append(i).append("] ").append(mPhoneSubscriptions[i]); sb.append("->").append(sub); if (SubscriptionManager.isValidSubscriptionId(mPreferredDataSubId.get()) && mPhoneSubscriptions[i] == mPreferredDataSubId.get()) { sb.append("sub refreshed"); hasSubRefreshedOnThePreferredPhone = true; } mPhoneSubscriptions[i] = sub; diffDetected = true; } Loading Loading @@ -307,6 +315,9 @@ public class VendorPhoneSwitcher extends PhoneSwitcher { } mDdsSwitchState = DdsSwitchState.REQUIRED; diffDetected = true; } else if (hasSubRefreshedOnThePreferredPhone) { // Tell connectivity the real active data phone notifyPreferredDataSubIdChanged(); } if (diffDetected) { Loading Loading @@ -405,10 +416,9 @@ public class VendorPhoneSwitcher extends PhoneSwitcher { return phoneId; } private boolean isUiccProvisioned(int phoneId) { protected boolean isUiccProvisioned(int phoneId) { boolean isUiccApplicationEnabled = true; // FIXME get the SubscriptionManager.UICC_APPLICATIONS_ENABLED value and use it here log("isUiccProvisioned: status= " + isUiccApplicationEnabled + " phoneid=" + phoneId); return mSubscriptionController.isActiveSubId(mPhoneSubscriptions[phoneId]) && isUiccApplicationEnabled; } Loading Loading @@ -475,27 +485,25 @@ public class VendorPhoneSwitcher extends PhoneSwitcher { */ @Override protected boolean isPhoneInVoiceCall(Phone phone) { if (!SystemProperties.getBoolean(PROPERTY_TEMP_DDSSWITCH, false)) { return false; } else { if (phone == null) { return false; } int phoneId = phone.getPhoneId(); return ((mFgCsCalls[phoneId].getState() != Call.State.IDLE && mFgCsCalls[phoneId].getState() != Call.State.DISCONNECTED) || (mBgCsCalls[phoneId].getState() != Call.State.IDLE && mBgCsCalls[phoneId].getState() != Call.State.DISCONNECTED) || (mRiCsCalls[phoneId].getState() != Call.State.IDLE && mRiCsCalls[phoneId].getState() != Call.State.DISCONNECTED) || (mFgImsCalls[phoneId].getState() != Call.State.IDLE && mFgImsCalls[phoneId].getState() != Call.State.DISCONNECTED) || (mBgImsCalls[phoneId].getState() != Call.State.IDLE && mBgImsCalls[phoneId].getState() != Call.State.DISCONNECTED) || (mRiImsCalls[phoneId].getState() != Call.State.IDLE && mRiImsCalls[phoneId].getState() != Call.State.DISCONNECTED)); boolean dataDuringCallsEnabled = false; DataEnabledSettings dataEnabledSettings = phone.getDataEnabledSettings(); if (dataEnabledSettings != null) { dataDuringCallsEnabled = dataEnabledSettings.isDataAllowedInVoiceCall(); } if (!dataDuringCallsEnabled) { log("isPhoneInVoiceCall: dataDuringCallsEnabled=" + dataDuringCallsEnabled); return false; } int phoneId = phone.getPhoneId(); return (mFgCsCalls[phoneId].getState().isAlive() || mBgCsCalls[phoneId].getState().isAlive() || mRiCsCalls[phoneId].getState().isAlive() || mFgImsCalls[phoneId].getState().isAlive() || mBgImsCalls[phoneId].getState().isAlive() || mRiImsCalls[phoneId].getState().isAlive()); } private void resetConnectFailureCount(int phoneId) { Loading Loading
src/java/com/android/internal/telephony/CarrierPrivilegesTracker.java +15 −8 Original line number Diff line number Diff line Loading @@ -217,14 +217,21 @@ public class CarrierPrivilegesTracker extends Handler { mPhone = phone; mLocalLog = new LocalLog(100); IntentFilter filter = new IntentFilter(); filter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED); filter.addAction(TelephonyManager.ACTION_SIM_CARD_STATE_CHANGED); filter.addAction(TelephonyManager.ACTION_SIM_APPLICATION_STATE_CHANGED); filter.addAction(Intent.ACTION_PACKAGE_ADDED); filter.addAction(Intent.ACTION_PACKAGE_REPLACED); filter.addAction(Intent.ACTION_PACKAGE_REMOVED); mContext.registerReceiver(mIntentReceiver, filter); IntentFilter certFilter = new IntentFilter(); certFilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED); certFilter.addAction(TelephonyManager.ACTION_SIM_CARD_STATE_CHANGED); certFilter.addAction(TelephonyManager.ACTION_SIM_APPLICATION_STATE_CHANGED); mContext.registerReceiver(mIntentReceiver, certFilter); IntentFilter packageFilter = new IntentFilter(); packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED); packageFilter.addAction(Intent.ACTION_PACKAGE_REPLACED); packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); // For package-related broadcasts, specify the data scheme for "package" to receive the // package name along with the broadcast packageFilter.addDataScheme("package"); mContext.registerReceiver(mIntentReceiver, packageFilter); mRegistrantList = new RegistrantList(); mCarrierConfigCerts = new ArraySet<>(); Loading
src/java/com/android/internal/telephony/uicc/AdnRecord.java +3 −8 Original line number Diff line number Diff line Loading @@ -92,14 +92,9 @@ public class AdnRecord implements Parcelable { recordNumber = source.readInt(); alphaTag = source.readString(); number = source.readString(); final int len = source.readInt(); if (len > 0) { emails = new String[len]; source.readStringArray(emails); emails = source.createStringArray(); return new AdnRecord(efid, recordNumber, alphaTag, number, emails); } else { return new AdnRecord(efid, recordNumber, alphaTag, number, null); } } @Override Loading
src/java/com/android/internal/telephony/uicc/IccRecords.java +3 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Pair; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.CommandsInterface; import com.android.internal.telephony.MccTable; import com.android.internal.telephony.util.ArrayUtils; Loading Loading @@ -112,7 +113,8 @@ public abstract class IccRecords extends Handler implements IccConstants { protected boolean mRecordsRequested = false; // true if we've made requests for the sim records protected int mLockedRecordsReqReason = LOCKED_RECORDS_REQ_REASON_NONE; protected String mIccId; // Includes only decimals (no hex) @VisibleForTesting(visibility = VisibleForTesting.Visibility.PROTECTED) public String mIccId; // Includes only decimals (no hex) protected String mFullIccId; // Includes hex characters in ICCID protected String mMsisdn = null; // My mobile number Loading
src/java/com/android/internal/telephony/uicc/UiccProfile.java +19 −0 Original line number Diff line number Diff line Loading @@ -1665,6 +1665,21 @@ public class UiccProfile extends IccCard { } } /** * Make sure the iccid in SIM record matches the current active subId. If not, return false. * When SIM switching in eSIM is happening, there are rare cases that setOperatorBrandOverride * is called on old subId while new iccid is already loaded on SIM record. For those cases * setOperatorBrandOverride would apply to the wrong (new) iccid. This check is to avoid it. */ private boolean checkSubIdAndIccIdMatch(String iccid) { if (TextUtils.isEmpty(iccid)) return false; SubscriptionInfo subInfo = SubscriptionController.getInstance() .getActiveSubscriptionInfoForSimSlotIndex( getPhoneId(), mContext.getOpPackageName(), null); return subInfo != null && IccUtils.stripTrailingFs(subInfo.getIccId()).equals( IccUtils.stripTrailingFs(iccid)); } /** * Sets the overridden operator brand. */ Loading @@ -1676,6 +1691,10 @@ public class UiccProfile extends IccCard { if (TextUtils.isEmpty(iccId)) { return false; } if (!checkSubIdAndIccIdMatch(iccId)) { loge("iccId doesn't match current active subId."); return false; } SharedPreferences.Editor spEditor = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); Loading
src/java/com/android/internal/telephony/vendor/VendorPhoneSwitcher.java +31 −23 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.internal.telephony.vendor; import static android.telephony.SubscriptionManager.DEFAULT_SUBSCRIPTION_ID; import static android.telephony.SubscriptionManager.INVALID_PHONE_INDEX; import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID; import static android.telephony.TelephonyManager.RADIO_POWER_UNAVAILABLE; import android.content.BroadcastReceiver; import android.content.Context; Loading @@ -42,6 +43,7 @@ import com.android.internal.telephony.CallManager; import com.android.internal.telephony.Call; import com.android.internal.telephony.CommandsInterface; import com.android.internal.telephony.dataconnection.DcRequest; import com.android.internal.telephony.dataconnection.DataEnabledSettings; import com.android.internal.telephony.GsmCdmaCall; import com.android.internal.telephony.imsphone.ImsPhone; import com.android.internal.telephony.imsphone.ImsPhoneCall; Loading Loading @@ -257,6 +259,7 @@ public class VendorPhoneSwitcher extends PhoneSwitcher { // Check to see if there is any active subscription on any phone boolean hasAnyActiveSubscription = false; boolean hasSubRefreshedOnThePreferredPhone = false; // Check if phoneId to subId mapping is changed. for (int i = 0; i < mActiveModemCount; i++) { Loading @@ -267,6 +270,11 @@ public class VendorPhoneSwitcher extends PhoneSwitcher { if (sub != mPhoneSubscriptions[i]) { sb.append(" phone[").append(i).append("] ").append(mPhoneSubscriptions[i]); sb.append("->").append(sub); if (SubscriptionManager.isValidSubscriptionId(mPreferredDataSubId.get()) && mPhoneSubscriptions[i] == mPreferredDataSubId.get()) { sb.append("sub refreshed"); hasSubRefreshedOnThePreferredPhone = true; } mPhoneSubscriptions[i] = sub; diffDetected = true; } Loading Loading @@ -307,6 +315,9 @@ public class VendorPhoneSwitcher extends PhoneSwitcher { } mDdsSwitchState = DdsSwitchState.REQUIRED; diffDetected = true; } else if (hasSubRefreshedOnThePreferredPhone) { // Tell connectivity the real active data phone notifyPreferredDataSubIdChanged(); } if (diffDetected) { Loading Loading @@ -405,10 +416,9 @@ public class VendorPhoneSwitcher extends PhoneSwitcher { return phoneId; } private boolean isUiccProvisioned(int phoneId) { protected boolean isUiccProvisioned(int phoneId) { boolean isUiccApplicationEnabled = true; // FIXME get the SubscriptionManager.UICC_APPLICATIONS_ENABLED value and use it here log("isUiccProvisioned: status= " + isUiccApplicationEnabled + " phoneid=" + phoneId); return mSubscriptionController.isActiveSubId(mPhoneSubscriptions[phoneId]) && isUiccApplicationEnabled; } Loading Loading @@ -475,27 +485,25 @@ public class VendorPhoneSwitcher extends PhoneSwitcher { */ @Override protected boolean isPhoneInVoiceCall(Phone phone) { if (!SystemProperties.getBoolean(PROPERTY_TEMP_DDSSWITCH, false)) { return false; } else { if (phone == null) { return false; } int phoneId = phone.getPhoneId(); return ((mFgCsCalls[phoneId].getState() != Call.State.IDLE && mFgCsCalls[phoneId].getState() != Call.State.DISCONNECTED) || (mBgCsCalls[phoneId].getState() != Call.State.IDLE && mBgCsCalls[phoneId].getState() != Call.State.DISCONNECTED) || (mRiCsCalls[phoneId].getState() != Call.State.IDLE && mRiCsCalls[phoneId].getState() != Call.State.DISCONNECTED) || (mFgImsCalls[phoneId].getState() != Call.State.IDLE && mFgImsCalls[phoneId].getState() != Call.State.DISCONNECTED) || (mBgImsCalls[phoneId].getState() != Call.State.IDLE && mBgImsCalls[phoneId].getState() != Call.State.DISCONNECTED) || (mRiImsCalls[phoneId].getState() != Call.State.IDLE && mRiImsCalls[phoneId].getState() != Call.State.DISCONNECTED)); boolean dataDuringCallsEnabled = false; DataEnabledSettings dataEnabledSettings = phone.getDataEnabledSettings(); if (dataEnabledSettings != null) { dataDuringCallsEnabled = dataEnabledSettings.isDataAllowedInVoiceCall(); } if (!dataDuringCallsEnabled) { log("isPhoneInVoiceCall: dataDuringCallsEnabled=" + dataDuringCallsEnabled); return false; } int phoneId = phone.getPhoneId(); return (mFgCsCalls[phoneId].getState().isAlive() || mBgCsCalls[phoneId].getState().isAlive() || mRiCsCalls[phoneId].getState().isAlive() || mFgImsCalls[phoneId].getState().isAlive() || mBgImsCalls[phoneId].getState().isAlive() || mRiImsCalls[phoneId].getState().isAlive()); } private void resetConnectFailureCount(int phoneId) { Loading