Merge "Emergency redial implementation"

am: b3b09849bc

Change-Id: If7fe179da4eb4c639dad1e2957f091bbee9e54f9
This commit is contained in:
Brad Ebinger
2017-08-25 20:31:26 +00:00
committed by android-build-merger
7 changed files with 83 additions and 9 deletions

View File

@@ -824,6 +824,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) {}
}
/**
@@ -3061,6 +3063,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}.

View File

@@ -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} */

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_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) {

View File

@@ -207,6 +207,11 @@ final class RemoteConnectionService {
// in the underlying connection or conference objects
}
@Override
public void onPhoneAccountChanged(String callId, PhoneAccountHandle pHandle,
Session.Info sessionInfo) {
}
@Override
public void addConferenceCall(
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.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);
}

View File

@@ -226,13 +226,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;
}