Loading src/java/com/android/internal/telephony/SubscriptionController.java +24 −0 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,8 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager; import android.os.UserHandle; import android.os.UserHandle; import android.provider.Settings; import android.provider.Settings; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; import android.telephony.RadioAccessFamily; import android.telephony.RadioAccessFamily; import android.telephony.Rlog; import android.telephony.Rlog; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionInfo; Loading Loading @@ -2053,9 +2055,31 @@ public class SubscriptionController extends ISub.Stub { throw new RuntimeException("setDefaultVoiceSubId called with DEFAULT_SUB_ID"); throw new RuntimeException("setDefaultVoiceSubId called with DEFAULT_SUB_ID"); } } if (DBG) logdl("[setDefaultVoiceSubId] subId=" + subId); if (DBG) logdl("[setDefaultVoiceSubId] subId=" + subId); int previousSetting = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION, SubscriptionManager.DEFAULT_SUBSCRIPTION_ID); Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION, subId); Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION, subId); broadcastDefaultVoiceSubIdChanged(subId); broadcastDefaultVoiceSubIdChanged(subId); if (previousSetting != subId) { PhoneAccountHandle newHandle = subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID ? null : mTelephonyManager.getPhoneAccountHandleForSubscriptionId( subId); TelecomManager telecomManager = mContext.getSystemService(TelecomManager.class); PhoneAccountHandle currentHandle = telecomManager.getUserSelectedOutgoingPhoneAccount(); if (!Objects.equals(currentHandle, newHandle)) { telecomManager.setUserSelectedOutgoingPhoneAccount(newHandle); logd("[setDefaultVoiceSubId] change to phoneAccountHandle=" + newHandle); } else { logd("[setDefaultVoiceSubId] default phone account not changed"); } } } } /** /** Loading tests/telephonytests/src/com/android/internal/telephony/ContextFixture.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -263,6 +263,8 @@ public class ContextFixture implements TestFixture<Context> { return Context.TELEPHONY_SUBSCRIPTION_SERVICE; return Context.TELEPHONY_SUBSCRIPTION_SERVICE; } else if (serviceClass == AppOpsManager.class) { } else if (serviceClass == AppOpsManager.class) { return Context.APP_OPS_SERVICE; return Context.APP_OPS_SERVICE; } else if (serviceClass == TelecomManager.class) { return Context.TELECOM_SERVICE; } } return super.getSystemServiceName(serviceClass); return super.getSystemServiceName(serviceClass); } } Loading Loading
src/java/com/android/internal/telephony/SubscriptionController.java +24 −0 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,8 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager; import android.os.UserHandle; import android.os.UserHandle; import android.provider.Settings; import android.provider.Settings; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; import android.telephony.RadioAccessFamily; import android.telephony.RadioAccessFamily; import android.telephony.Rlog; import android.telephony.Rlog; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionInfo; Loading Loading @@ -2053,9 +2055,31 @@ public class SubscriptionController extends ISub.Stub { throw new RuntimeException("setDefaultVoiceSubId called with DEFAULT_SUB_ID"); throw new RuntimeException("setDefaultVoiceSubId called with DEFAULT_SUB_ID"); } } if (DBG) logdl("[setDefaultVoiceSubId] subId=" + subId); if (DBG) logdl("[setDefaultVoiceSubId] subId=" + subId); int previousSetting = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION, SubscriptionManager.DEFAULT_SUBSCRIPTION_ID); Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION, subId); Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION, subId); broadcastDefaultVoiceSubIdChanged(subId); broadcastDefaultVoiceSubIdChanged(subId); if (previousSetting != subId) { PhoneAccountHandle newHandle = subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID ? null : mTelephonyManager.getPhoneAccountHandleForSubscriptionId( subId); TelecomManager telecomManager = mContext.getSystemService(TelecomManager.class); PhoneAccountHandle currentHandle = telecomManager.getUserSelectedOutgoingPhoneAccount(); if (!Objects.equals(currentHandle, newHandle)) { telecomManager.setUserSelectedOutgoingPhoneAccount(newHandle); logd("[setDefaultVoiceSubId] change to phoneAccountHandle=" + newHandle); } else { logd("[setDefaultVoiceSubId] default phone account not changed"); } } } } /** /** Loading
tests/telephonytests/src/com/android/internal/telephony/ContextFixture.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -263,6 +263,8 @@ public class ContextFixture implements TestFixture<Context> { return Context.TELEPHONY_SUBSCRIPTION_SERVICE; return Context.TELEPHONY_SUBSCRIPTION_SERVICE; } else if (serviceClass == AppOpsManager.class) { } else if (serviceClass == AppOpsManager.class) { return Context.APP_OPS_SERVICE; return Context.APP_OPS_SERVICE; } else if (serviceClass == TelecomManager.class) { return Context.TELECOM_SERVICE; } } return super.getSystemServiceName(serviceClass); return super.getSystemServiceName(serviceClass); } } Loading