Merge "Emergency redial implementation"

This commit is contained in:
Brad Ebinger
2017-08-25 20:05:53 +00:00
committed by Gerrit Code Review
7 changed files with 83 additions and 9 deletions

View File

@@ -806,6 +806,8 @@ public abstract class Connection extends Conferenceable {
public void onRttInitiationFailure(Connection c, int reason) {} public void onRttInitiationFailure(Connection c, int reason) {}
public void onRttSessionRemotelyTerminated(Connection c) {} public void onRttSessionRemotelyTerminated(Connection c) {}
public void onRemoteRttRequest(Connection c) {} public void onRemoteRttRequest(Connection c) {}
/** @hide */
public void onPhoneAccountChanged(Connection c, PhoneAccountHandle pHandle) {}
} }
/** /**
@@ -3043,6 +3045,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 * Sends an event associated with this {@code Connection} with associated event extras to the
* {@link InCallService}. * {@link InCallService}.

View File

@@ -1314,6 +1314,14 @@ public abstract class ConnectionService extends Service {
mAdapter.onRemoteRttRequest(id); mAdapter.onRemoteRttRequest(id);
} }
} }
@Override
public void onPhoneAccountChanged(Connection c, PhoneAccountHandle pHandle) {
String id = mIdByConnection.get(c);
if (id != null) {
mAdapter.onPhoneAccountChanged(id, pHandle);
}
}
}; };
/** {@inheritDoc} */ /** {@inheritDoc} */

View File

@@ -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) {
}
}
}
} }

View File

@@ -72,6 +72,7 @@ final class ConnectionServiceAdapterServant {
private static final int MSG_ON_RTT_INITIATION_FAILURE = 31; 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_REMOTELY_TERMINATED = 32;
private static final int MSG_ON_RTT_UPGRADE_REQUEST = 33; private static final int MSG_ON_RTT_UPGRADE_REQUEST = 33;
private static final int MSG_SET_PHONE_ACCOUNT_CHANGED = 34;
private final IConnectionServiceAdapter mDelegate; private final IConnectionServiceAdapter mDelegate;
@@ -318,6 +319,16 @@ final class ConnectionServiceAdapterServant {
case MSG_ON_RTT_UPGRADE_REQUEST: case MSG_ON_RTT_UPGRADE_REQUEST:
mDelegate.onRemoteRttRequest((String) msg.obj, null /*Session.Info*/); mDelegate.onRemoteRttRequest((String) msg.obj, null /*Session.Info*/);
break; 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 { throws RemoteException {
mHandler.obtainMessage(MSG_ON_RTT_UPGRADE_REQUEST, connectionId).sendToTarget(); 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) { public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {

View File

@@ -207,6 +207,11 @@ final class RemoteConnectionService {
// in the underlying connection or conference objects // in the underlying connection or conference objects
} }
@Override
public void onPhoneAccountChanged(String callId, PhoneAccountHandle pHandle,
Session.Info sessionInfo) {
}
@Override @Override
public void addConferenceCall( public void addConferenceCall(
final String callId, ParcelableConference parcel, Session.Info sessionInfo) { final String callId, ParcelableConference parcel, Session.Info sessionInfo) {

View File

@@ -24,6 +24,7 @@ import android.telecom.DisconnectCause;
import android.telecom.Logging.Session; import android.telecom.Logging.Session;
import android.telecom.ParcelableConnection; import android.telecom.ParcelableConnection;
import android.telecom.ParcelableConference; import android.telecom.ParcelableConference;
import android.telecom.PhoneAccountHandle;
import android.telecom.StatusHints; import android.telecom.StatusHints;
import com.android.internal.telecom.IVideoProvider; import com.android.internal.telecom.IVideoProvider;
@@ -114,4 +115,7 @@ oneway interface IConnectionServiceAdapter {
void onRttSessionRemotelyTerminated(String callId, in Session.Info sessionInfo); void onRttSessionRemotelyTerminated(String callId, in Session.Info sessionInfo);
void onRemoteRttRequest(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);
} }

View File

@@ -226,13 +226,6 @@ public class DisconnectCause {
*/ */
public static final int DATA_LIMIT_REACHED = 55; 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 * 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. * roaming on a carrier that does not allow this.
@@ -268,6 +261,18 @@ public class DisconnectCause {
*/ */
public static final int DIAL_LOW_BATTERY = 62; 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: // When adding a disconnect type:
// 1) Update toString() with the newly added disconnect type. // 1) Update toString() with the newly added disconnect type.
@@ -392,8 +397,6 @@ public class DisconnectCause {
return "DATA_DISABLED"; return "DATA_DISABLED";
case DATA_LIMIT_REACHED: case DATA_LIMIT_REACHED:
return "DATA_LIMIT_REACHED"; return "DATA_LIMIT_REACHED";
case DIALED_ON_WRONG_SLOT:
return "DIALED_ON_WRONG_SLOT";
case DIALED_CALL_FORWARDING_WHILE_ROAMING: case DIALED_CALL_FORWARDING_WHILE_ROAMING:
return "DIALED_CALL_FORWARDING_WHILE_ROAMING"; return "DIALED_CALL_FORWARDING_WHILE_ROAMING";
case IMEI_NOT_ACCEPTED: case IMEI_NOT_ACCEPTED:
@@ -406,6 +409,10 @@ public class DisconnectCause {
return "LOW_BATTERY"; return "LOW_BATTERY";
case DIAL_LOW_BATTERY: case DIAL_LOW_BATTERY:
return "DIAL_LOW_BATTERY"; return "DIAL_LOW_BATTERY";
case EMERGENCY_TEMP_FAILURE:
return "EMERGENCY_TEMP_FAILURE";
case EMERGENCY_PERM_FAILURE:
return "EMERGENCY_PERM_FAILURE";
default: default:
return "INVALID: " + cause; return "INVALID: " + cause;
} }