diff options
7 files changed, 83 insertions, 9 deletions
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index f5d37bb6d6c4..095069d5386c 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -826,6 +826,8 @@ public abstract class Connection extends Conferenceable { public void onRttInitiationFailure(Connection c, int reason) {} public void onRttSessionRemotelyTerminated(Connection c) {} public void onRemoteRttRequest(Connection c) {} + /** @hide */ + public void onPhoneAccountChanged(Connection c, PhoneAccountHandle pHandle) {} } /** @@ -3033,6 +3035,18 @@ public abstract class Connection extends Conferenceable { } /** + * Notifies listeners when phone account is changed. For example, when the PhoneAccount is + * changed due to an emergency call being redialed. + * @param pHandle The new PhoneAccountHandle for this connection. + * @hide + */ + public void notifyPhoneAccountChanged(PhoneAccountHandle pHandle) { + for (Listener l : mListeners) { + l.onPhoneAccountChanged(this, pHandle); + } + } + + /** * Sends an event associated with this {@code Connection} with associated event extras to the * {@link InCallService}. * <p> diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index f78e427663c6..4421f1375df5 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -1332,6 +1332,14 @@ public abstract class ConnectionService extends Service { mAdapter.onRemoteRttRequest(id); } } + + @Override + public void onPhoneAccountChanged(Connection c, PhoneAccountHandle pHandle) { + String id = mIdByConnection.get(c); + if (id != null) { + mAdapter.onPhoneAccountChanged(id, pHandle); + } + } }; /** {@inheritDoc} */ diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java index 63bdf74d383c..111fcc7869b4 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java @@ -609,4 +609,20 @@ final class ConnectionServiceAdapter implements DeathRecipient { } } } + + /** + * Notifies Telecom that a call's PhoneAccountHandle has changed. + * + * @param callId The unique ID of the call. + * @param pHandle The new PhoneAccountHandle associated with the call. + */ + void onPhoneAccountChanged(String callId, PhoneAccountHandle pHandle) { + for (IConnectionServiceAdapter adapter : mAdapters) { + try { + Log.d(this, "onPhoneAccountChanged %s", callId); + adapter.onPhoneAccountChanged(callId, pHandle, Log.getExternalSession()); + } catch (RemoteException ignored) { + } + } + } } diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java index 80e3c33a443d..b1617f4db801 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java @@ -72,6 +72,7 @@ final class ConnectionServiceAdapterServant { private static final int MSG_ON_RTT_INITIATION_FAILURE = 31; private static final int MSG_ON_RTT_REMOTELY_TERMINATED = 32; private static final int MSG_ON_RTT_UPGRADE_REQUEST = 33; + private static final int MSG_SET_PHONE_ACCOUNT_CHANGED = 34; private final IConnectionServiceAdapter mDelegate; @@ -318,6 +319,16 @@ final class ConnectionServiceAdapterServant { case MSG_ON_RTT_UPGRADE_REQUEST: mDelegate.onRemoteRttRequest((String) msg.obj, null /*Session.Info*/); break; + case MSG_SET_PHONE_ACCOUNT_CHANGED: { + SomeArgs args = (SomeArgs) msg.obj; + try { + mDelegate.onPhoneAccountChanged((String) args.arg1, + (PhoneAccountHandle) args.arg2, null /*Session.Info*/); + } finally { + args.recycle(); + } + break; + } } } }; @@ -581,6 +592,15 @@ final class ConnectionServiceAdapterServant { throws RemoteException { mHandler.obtainMessage(MSG_ON_RTT_UPGRADE_REQUEST, connectionId).sendToTarget(); } + + @Override + public void onPhoneAccountChanged(String callId, PhoneAccountHandle pHandle, + Session.Info sessionInfo) { + SomeArgs args = SomeArgs.obtain(); + args.arg1 = callId; + args.arg2 = pHandle; + mHandler.obtainMessage(MSG_SET_PHONE_ACCOUNT_CHANGED, args).sendToTarget(); + } }; public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) { diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java index 06cdd1aa7c3c..2cc431436acb 100644 --- a/telecomm/java/android/telecom/RemoteConnectionService.java +++ b/telecomm/java/android/telecom/RemoteConnectionService.java @@ -208,6 +208,11 @@ final class RemoteConnectionService { } @Override + public void onPhoneAccountChanged(String callId, PhoneAccountHandle pHandle, + Session.Info sessionInfo) { + } + + @Override public void addConferenceCall( final String callId, ParcelableConference parcel, Session.Info sessionInfo) { RemoteConference conference = new RemoteConference(callId, diff --git a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl index ac9da2ef9df4..d20da1862a28 100644 --- a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl +++ b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl @@ -24,6 +24,7 @@ import android.telecom.DisconnectCause; import android.telecom.Logging.Session; import android.telecom.ParcelableConnection; import android.telecom.ParcelableConference; +import android.telecom.PhoneAccountHandle; import android.telecom.StatusHints; import com.android.internal.telecom.IVideoProvider; @@ -114,4 +115,7 @@ oneway interface IConnectionServiceAdapter { void onRttSessionRemotelyTerminated(String callId, in Session.Info sessionInfo); void onRemoteRttRequest(String callId, in Session.Info sessionInfo); + + void onPhoneAccountChanged(String callId, in PhoneAccountHandle pHandle, + in Session.Info sessionInfo); } diff --git a/telephony/java/android/telephony/DisconnectCause.java b/telephony/java/android/telephony/DisconnectCause.java index 3f0acde43d30..98fb65343485 100644 --- a/telephony/java/android/telephony/DisconnectCause.java +++ b/telephony/java/android/telephony/DisconnectCause.java @@ -227,13 +227,6 @@ public class DisconnectCause { public static final int DATA_LIMIT_REACHED = 55; /** - * The emergency call was terminated because it was dialed on the wrong SIM slot. - * The call needs to be redialed the other slot. - * {@hide} - */ - public static final int DIALED_ON_WRONG_SLOT = 56; - - /** * The call being placed was detected as a call forwarding number and was being dialed while * roaming on a carrier that does not allow this. */ @@ -268,6 +261,18 @@ public class DisconnectCause { */ public static final int DIAL_LOW_BATTERY = 62; + /** + * Emergency call failed with a temporary fail cause and can be redialed on this slot. + * {@hide} + */ + public static final int EMERGENCY_TEMP_FAILURE = 63; + + /** + * Emergency call failed with a permanent fail cause and should not be redialed on this + * slot. + * {@hide} + */ + public static final int EMERGENCY_PERM_FAILURE = 64; //********************************************************************************************* // When adding a disconnect type: // 1) Update toString() with the newly added disconnect type. @@ -392,8 +397,6 @@ public class DisconnectCause { return "DATA_DISABLED"; case DATA_LIMIT_REACHED: return "DATA_LIMIT_REACHED"; - case DIALED_ON_WRONG_SLOT: - return "DIALED_ON_WRONG_SLOT"; case DIALED_CALL_FORWARDING_WHILE_ROAMING: return "DIALED_CALL_FORWARDING_WHILE_ROAMING"; case IMEI_NOT_ACCEPTED: @@ -406,6 +409,10 @@ public class DisconnectCause { return "LOW_BATTERY"; case DIAL_LOW_BATTERY: return "DIAL_LOW_BATTERY"; + case EMERGENCY_TEMP_FAILURE: + return "EMERGENCY_TEMP_FAILURE"; + case EMERGENCY_PERM_FAILURE: + return "EMERGENCY_PERM_FAILURE"; default: return "INVALID: " + cause; } |