Loading src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java +47 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.os.AsyncResult; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.PersistableBundle; import android.os.Registrant; import android.os.RegistrantList; import android.os.RemoteException; Loading @@ -40,10 +41,12 @@ import android.widget.Toast; import android.preference.PreferenceManager; import android.telecom.ConferenceParticipant; import android.telecom.VideoProfile; import android.telephony.CarrierConfigManager; import android.telephony.DisconnectCause; import android.telephony.PhoneNumberUtils; import android.telephony.Rlog; import android.telephony.ServiceState; import android.telephony.SubscriptionManager; import com.android.ims.ImsCall; import com.android.ims.ImsCallProfile; Loading Loading @@ -137,6 +140,15 @@ public final class ImsPhoneCallTracker extends CallTracker { loge("onReceive : exception " + e); } catch (RemoteException e) { } } else if (intent.getAction().equals( CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED)) { int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY, SubscriptionManager.INVALID_SUBSCRIPTION_ID); if (subId == mPhone.getSubId()) { mAllowEmergencyVideoCalls = isEmergencyVtCallAllowed(subId); log("onReceive : Updating mAllowEmergencyVideoCalls = " + mAllowEmergencyVideoCalls); } } } }; Loading Loading @@ -188,6 +200,7 @@ public final class ImsPhoneCallTracker extends CallTracker { private boolean pendingCallInEcm = false; private boolean mSwitchingFgAndBgCalls = false; private ImsCall mCallExpectedToResume = null; private boolean mAllowEmergencyVideoCalls = false; //***** Events Loading @@ -199,7 +212,9 @@ public final class ImsPhoneCallTracker extends CallTracker { IntentFilter intentfilter = new IntentFilter(); intentfilter.addAction(ImsManager.ACTION_IMS_INCOMING_CALL); intentfilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED); mPhone.getContext().registerReceiver(mReceiver, intentfilter); mAllowEmergencyVideoCalls = isEmergencyVtCallAllowed(mPhone.getSubId()); Thread t = new Thread() { public void run() { Loading Loading @@ -318,6 +333,14 @@ public final class ImsPhoneCallTracker extends CallTracker { handleEcmTimer(ImsPhone.CANCEL_ECM_TIMER); } // If the call is to an emergency number and the carrier does not support video emergency // calls, dial as an audio-only call. if (isEmergencyNumber && VideoProfile.isVideo(videoState) && !mAllowEmergencyVideoCalls) { loge("dial: carrier does not support video emergency calls; downgrade to audio-only"); videoState = VideoProfile.STATE_AUDIO_ONLY; } boolean holdBeforeDial = false; // The new call must be assigned to the foreground call. Loading Loading @@ -384,6 +407,30 @@ public final class ImsPhoneCallTracker extends CallTracker { return mPendingMO; } /** * Determines if the carrier associated with the specified SubId supports making video emergency * calls. * * @param subId The sub id. * @return {@code true} if video emergency calls are supported, {@code false} otherwise. */ private boolean isEmergencyVtCallAllowed(int subId) { CarrierConfigManager carrierConfigManager = (CarrierConfigManager) mPhone.getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE); if (carrierConfigManager == null) { loge("isEmergencyVideoCallsSupported: No carrier config service found."); return false; } PersistableBundle carrierConfig = carrierConfigManager.getConfigForSubId(subId); if (carrierConfig == null) { loge("isEmergencyVideoCallsSupported: Empty carrier config."); return false; } return carrierConfig.getBoolean(CarrierConfigManager.BOOL_ALLOW_EMERGENCY_VIDEO_CALLS); } private void handleEcmTimer(int action) { mPhone.handleTimerInEmergencyCallbackMode(action); switch (action) { Loading Loading
src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java +47 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.os.AsyncResult; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.PersistableBundle; import android.os.Registrant; import android.os.RegistrantList; import android.os.RemoteException; Loading @@ -40,10 +41,12 @@ import android.widget.Toast; import android.preference.PreferenceManager; import android.telecom.ConferenceParticipant; import android.telecom.VideoProfile; import android.telephony.CarrierConfigManager; import android.telephony.DisconnectCause; import android.telephony.PhoneNumberUtils; import android.telephony.Rlog; import android.telephony.ServiceState; import android.telephony.SubscriptionManager; import com.android.ims.ImsCall; import com.android.ims.ImsCallProfile; Loading Loading @@ -137,6 +140,15 @@ public final class ImsPhoneCallTracker extends CallTracker { loge("onReceive : exception " + e); } catch (RemoteException e) { } } else if (intent.getAction().equals( CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED)) { int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY, SubscriptionManager.INVALID_SUBSCRIPTION_ID); if (subId == mPhone.getSubId()) { mAllowEmergencyVideoCalls = isEmergencyVtCallAllowed(subId); log("onReceive : Updating mAllowEmergencyVideoCalls = " + mAllowEmergencyVideoCalls); } } } }; Loading Loading @@ -188,6 +200,7 @@ public final class ImsPhoneCallTracker extends CallTracker { private boolean pendingCallInEcm = false; private boolean mSwitchingFgAndBgCalls = false; private ImsCall mCallExpectedToResume = null; private boolean mAllowEmergencyVideoCalls = false; //***** Events Loading @@ -199,7 +212,9 @@ public final class ImsPhoneCallTracker extends CallTracker { IntentFilter intentfilter = new IntentFilter(); intentfilter.addAction(ImsManager.ACTION_IMS_INCOMING_CALL); intentfilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED); mPhone.getContext().registerReceiver(mReceiver, intentfilter); mAllowEmergencyVideoCalls = isEmergencyVtCallAllowed(mPhone.getSubId()); Thread t = new Thread() { public void run() { Loading Loading @@ -318,6 +333,14 @@ public final class ImsPhoneCallTracker extends CallTracker { handleEcmTimer(ImsPhone.CANCEL_ECM_TIMER); } // If the call is to an emergency number and the carrier does not support video emergency // calls, dial as an audio-only call. if (isEmergencyNumber && VideoProfile.isVideo(videoState) && !mAllowEmergencyVideoCalls) { loge("dial: carrier does not support video emergency calls; downgrade to audio-only"); videoState = VideoProfile.STATE_AUDIO_ONLY; } boolean holdBeforeDial = false; // The new call must be assigned to the foreground call. Loading Loading @@ -384,6 +407,30 @@ public final class ImsPhoneCallTracker extends CallTracker { return mPendingMO; } /** * Determines if the carrier associated with the specified SubId supports making video emergency * calls. * * @param subId The sub id. * @return {@code true} if video emergency calls are supported, {@code false} otherwise. */ private boolean isEmergencyVtCallAllowed(int subId) { CarrierConfigManager carrierConfigManager = (CarrierConfigManager) mPhone.getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE); if (carrierConfigManager == null) { loge("isEmergencyVideoCallsSupported: No carrier config service found."); return false; } PersistableBundle carrierConfig = carrierConfigManager.getConfigForSubId(subId); if (carrierConfig == null) { loge("isEmergencyVideoCallsSupported: Empty carrier config."); return false; } return carrierConfig.getBoolean(CarrierConfigManager.BOOL_ALLOW_EMERGENCY_VIDEO_CALLS); } private void handleEcmTimer(int action) { mPhone.handleTimerInEmergencyCallbackMode(action); switch (action) { Loading