Merge "Trigger PhoneStateListener onCallAttributesChanged"

am: cd4ca49b18

Change-Id: Ia0729cbae8047cfb866d4c605d0030ddf34060b7
This commit is contained in:
Jordan Liu
2019-01-18 23:02:44 -08:00
committed by android-build-merger
8 changed files with 162 additions and 12 deletions

View File

@@ -6133,6 +6133,7 @@ package android.telephony.ims {
} }
public class ImsCallSessionListener { public class ImsCallSessionListener {
method public void callQualityChanged(android.telephony.CallQuality);
method public void callSessionConferenceExtendFailed(android.telephony.ims.ImsReasonInfo); method public void callSessionConferenceExtendFailed(android.telephony.ims.ImsReasonInfo);
method public void callSessionConferenceExtendReceived(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile); method public void callSessionConferenceExtendReceived(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile);
method public void callSessionConferenceExtended(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile); method public void callSessionConferenceExtended(android.telephony.ims.stub.ImsCallSessionImplBase, android.telephony.ims.ImsCallProfile);

View File

@@ -32,6 +32,8 @@ import android.os.IBinder;
import android.os.Message; import android.os.Message;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.UserHandle; import android.os.UserHandle;
import android.telephony.CallAttributes;
import android.telephony.CallQuality;
import android.telephony.CellInfo; import android.telephony.CellInfo;
import android.telephony.CellLocation; import android.telephony.CellLocation;
import android.telephony.DataFailCause; import android.telephony.DataFailCause;
@@ -173,6 +175,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private ServiceState[] mServiceState; private ServiceState[] mServiceState;
private int[] mNetworkType;
private int[] mVoiceActivationState; private int[] mVoiceActivationState;
private int[] mDataActivationState; private int[] mDataActivationState;
@@ -202,6 +206,10 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private Map<Integer, List<EmergencyNumber>> mEmergencyNumberList; private Map<Integer, List<EmergencyNumber>> mEmergencyNumberList;
private CallQuality mCallQuality;
private CallAttributes mCallAttributes;
private int[] mSrvccState; private int[] mSrvccState;
private int mDefaultSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; private int mDefaultSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
@@ -358,6 +366,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mDataConnectionNetworkType = new int[numPhones]; mDataConnectionNetworkType = new int[numPhones];
mCallIncomingNumber = new String[numPhones]; mCallIncomingNumber = new String[numPhones];
mServiceState = new ServiceState[numPhones]; mServiceState = new ServiceState[numPhones];
mNetworkType = new int[numPhones];
mVoiceActivationState = new int[numPhones]; mVoiceActivationState = new int[numPhones];
mDataActivationState = new int[numPhones]; mDataActivationState = new int[numPhones];
mUserMobileDataState = new boolean[numPhones]; mUserMobileDataState = new boolean[numPhones];
@@ -377,6 +386,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mDataActivationState[i] = TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN; mDataActivationState[i] = TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN;
mCallIncomingNumber[i] = ""; mCallIncomingNumber[i] = "";
mServiceState[i] = new ServiceState(); mServiceState[i] = new ServiceState();
mNetworkType[i] = mServiceState[i].getVoiceNetworkType();
mSignalStrength[i] = new SignalStrength(); mSignalStrength[i] = new SignalStrength();
mUserMobileDataState[i] = false; mUserMobileDataState[i] = false;
mMessageWaiting[i] = false; mMessageWaiting[i] = false;
@@ -807,6 +817,13 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
remove(r.binder); remove(r.binder);
} }
} }
if ((events & PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED) != 0) {
try {
r.callback.onCallAttributesChanged(mCallAttributes);
} catch (RemoteException ex) {
remove(r.binder);
}
}
} }
} }
} else { } else {
@@ -957,6 +974,21 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
if (validatePhoneId(phoneId)) { if (validatePhoneId(phoneId)) {
mServiceState[phoneId] = state; mServiceState[phoneId] = state;
boolean notifyCallAttributes = true;
if (mNetworkType[phoneId] != mServiceState[phoneId].getVoiceNetworkType()) {
mNetworkType[phoneId] = state.getVoiceNetworkType();
mCallAttributes = new CallAttributes(mPreciseCallState, mNetworkType[phoneId],
mCallQuality);
} else {
// No change to network type, so no need to notify call attributes
notifyCallAttributes = false;
}
if (mCallQuality == null) {
// No call quality reported yet, so no need to notify call attributes
notifyCallAttributes = false;
}
for (Record r : mRecords) { for (Record r : mRecords) {
if (VDBG) { if (VDBG) {
log("notifyServiceStateForSubscriber: r=" + r + " subId=" + subId log("notifyServiceStateForSubscriber: r=" + r + " subId=" + subId
@@ -975,6 +1007,14 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mRemoveList.add(r.binder); mRemoveList.add(r.binder);
} }
} }
if (notifyCallAttributes && r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED)) {
try {
r.callback.onCallAttributesChanged(mCallAttributes);
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
}
} }
} else { } else {
log("notifyServiceStateForSubscriber: INVALID phoneId=" + phoneId); log("notifyServiceStateForSubscriber: INVALID phoneId=" + phoneId);
@@ -1484,7 +1524,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
} }
public void notifyPreciseCallState(int ringingCallState, int foregroundCallState, public void notifyPreciseCallState(int ringingCallState, int foregroundCallState,
int backgroundCallState) { int backgroundCallState, int phoneId) {
if (!checkNotifyPermission("notifyPreciseCallState()")) { if (!checkNotifyPermission("notifyPreciseCallState()")) {
return; return;
} }
@@ -1496,6 +1536,15 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
backgroundCallState, backgroundCallState,
DisconnectCause.NOT_VALID, DisconnectCause.NOT_VALID,
PreciseDisconnectCause.NOT_VALID); PreciseDisconnectCause.NOT_VALID);
boolean notifyCallAttributes = true;
if (mCallQuality == null) {
log("notifyPreciseCallState: mCallQuality is null, skipping call attributes");
notifyCallAttributes = false;
} else {
mCallAttributes = new CallAttributes(mPreciseCallState, mNetworkType[phoneId],
mCallQuality);
}
for (Record r : mRecords) { for (Record r : mRecords) {
if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_PRECISE_CALL_STATE)) { if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_PRECISE_CALL_STATE)) {
try { try {
@@ -1504,6 +1553,14 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mRemoveList.add(r.binder); mRemoveList.add(r.binder);
} }
} }
if (notifyCallAttributes && r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED)) {
try {
r.callback.onCallAttributesChanged(mCallAttributes);
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
}
} }
handleRemoveListLocked(); handleRemoveListLocked();
} }
@@ -1722,6 +1779,36 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
} }
} }
@Override
public void notifyCallQualityChanged(CallQuality callQuality, int phoneId) {
if (!checkNotifyPermission("notifyCallQualityChanged()")) {
return;
}
// merge CallQuality with PreciseCallState and network type
mCallQuality = callQuality;
mCallAttributes = new CallAttributes(mPreciseCallState,
mNetworkType[phoneId],
callQuality);
synchronized (mRecords) {
TelephonyManager tm = (TelephonyManager) mContext.getSystemService(
Context.TELEPHONY_SERVICE);
for (Record r : mRecords) {
if (r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED)) {
try {
r.callback.onCallAttributesChanged(mCallAttributes);
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
}
}
handleRemoveListLocked();
}
}
@Override @Override
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) { public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
@@ -1739,6 +1826,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
pw.println("mCallState=" + mCallState[i]); pw.println("mCallState=" + mCallState[i]);
pw.println("mCallIncomingNumber=" + mCallIncomingNumber[i]); pw.println("mCallIncomingNumber=" + mCallIncomingNumber[i]);
pw.println("mServiceState=" + mServiceState[i]); pw.println("mServiceState=" + mServiceState[i]);
pw.println("mNetworkType=" + mNetworkType[i]);
pw.println("mVoiceActivationState= " + mVoiceActivationState[i]); pw.println("mVoiceActivationState= " + mVoiceActivationState[i]);
pw.println("mDataActivationState= " + mDataActivationState[i]); pw.println("mDataActivationState= " + mDataActivationState[i]);
pw.println("mUserMobileDataState= " + mUserMobileDataState[i]); pw.println("mUserMobileDataState= " + mUserMobileDataState[i]);
@@ -1764,6 +1852,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
pw.println("mPreferredDataSubId=" + mPreferredDataSubId); pw.println("mPreferredDataSubId=" + mPreferredDataSubId);
pw.println("mRadioPowerState=" + mRadioPowerState); pw.println("mRadioPowerState=" + mRadioPowerState);
pw.println("mEmergencyNumberList=" + mEmergencyNumberList); pw.println("mEmergencyNumberList=" + mEmergencyNumberList);
pw.println("mCallQuality=" + mCallQuality);
pw.println("mCallAttributes=" + mCallAttributes);
pw.decreaseIndent(); pw.decreaseIndent();
@@ -2021,6 +2111,11 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
android.Manifest.permission.READ_PRECISE_PHONE_STATE, null); android.Manifest.permission.READ_PRECISE_PHONE_STATE, null);
} }
if ((events & PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED) != 0) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.READ_PRECISE_PHONE_STATE, null);
}
return true; return true;
} }

View File

@@ -18,6 +18,7 @@ package android.telephony.ims;
import android.os.Message; import android.os.Message;
import android.os.RemoteException; import android.os.RemoteException;
import android.telephony.CallQuality;
import android.telephony.ims.aidl.IImsCallSessionListener; import android.telephony.ims.aidl.IImsCallSessionListener;
import android.util.Log; import android.util.Log;
@@ -450,6 +451,13 @@ public class ImsCallSession {
public void callSessionRttAudioIndicatorChanged(ImsStreamMediaProfile profile) { public void callSessionRttAudioIndicatorChanged(ImsStreamMediaProfile profile) {
// no-op // no-op
} }
/**
* Called when the IMS service reports a change to the call quality.
*/
public void callQualityChanged(CallQuality callQuality) {
// no-op
}
} }
private final IImsCallSession miSession; private final IImsCallSession miSession;
@@ -1414,6 +1422,16 @@ public class ImsCallSession {
mListener.callSessionRttAudioIndicatorChanged(profile); mListener.callSessionRttAudioIndicatorChanged(profile);
} }
} }
/**
* Call quality updated
*/
@Override
public void callQualityChanged(CallQuality callQuality) {
if (mListener != null) {
mListener.callQualityChanged(callQuality);
}
}
} }
/** /**

View File

@@ -18,6 +18,7 @@ package android.telephony.ims;
import android.annotation.SystemApi; import android.annotation.SystemApi;
import android.os.RemoteException; import android.os.RemoteException;
import android.telephony.CallQuality;
import android.telephony.ims.aidl.IImsCallSessionListener; import android.telephony.ims.aidl.IImsCallSessionListener;
import android.telephony.ims.stub.ImsCallSessionImplBase; import android.telephony.ims.stub.ImsCallSessionImplBase;
@@ -612,5 +613,18 @@ public class ImsCallSessionListener {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
/**
* The call quality has changed.
*
* @param callQuality The new call quality
*/
public void callQualityChanged(CallQuality callQuality) {
try {
mListener.callQualityChanged(callQuality);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
}
} }

View File

@@ -16,6 +16,7 @@
package android.telephony.ims.aidl; package android.telephony.ims.aidl;
import android.telephony.CallQuality;
import android.telephony.ims.ImsStreamMediaProfile; import android.telephony.ims.ImsStreamMediaProfile;
import android.telephony.ims.ImsCallProfile; import android.telephony.ims.ImsCallProfile;
import android.telephony.ims.ImsReasonInfo; import android.telephony.ims.ImsReasonInfo;
@@ -126,22 +127,29 @@ oneway interface IImsCallSessionListener {
*/ */
void callSessionRttModifyRequestReceived(in ImsCallProfile callProfile); void callSessionRttModifyRequestReceived(in ImsCallProfile callProfile);
/* Device issued RTT modify request and inturn received response /**
* Device issued RTT modify request and inturn received response
* from Remote UE * from Remote UE
* @param status Will be one of the following values from: * @param status Will be one of the following values from:
* - {@link Connection.RttModifyStatus} * - {@link Connection.RttModifyStatus}
*/ */
void callSessionRttModifyResponseReceived(int status); void callSessionRttModifyResponseReceived(int status);
/* /**
* While in call, device received RTT message from Remote UE * While in call, device received RTT message from Remote UE
* @param rttMessage Received RTT message * @param rttMessage Received RTT message
*/ */
void callSessionRttMessageReceived(in String rttMessage); void callSessionRttMessageReceived(in String rttMessage);
/* /**
* While in call, there has been a change in RTT audio indicator. * While in call, there has been a change in RTT audio indicator.
* @param profile updated ImsStreamMediaProfile * @param profile updated ImsStreamMediaProfile
*/ */
void callSessionRttAudioIndicatorChanged(in ImsStreamMediaProfile profile); void callSessionRttAudioIndicatorChanged(in ImsStreamMediaProfile profile);
/**
* Notifies of a change to the call quality.
* @param callQuality then updated call quality
*/
void callQualityChanged(in CallQuality callQuality);
} }

View File

@@ -18,19 +18,18 @@ package android.telephony.ims.compat.stub;
import android.os.Message; import android.os.Message;
import android.os.RemoteException; import android.os.RemoteException;
import android.telephony.CallQuality;
import android.telephony.ims.ImsCallProfile; import android.telephony.ims.ImsCallProfile;
import android.telephony.ims.ImsCallSession;
import android.telephony.ims.ImsConferenceState; import android.telephony.ims.ImsConferenceState;
import android.telephony.ims.ImsReasonInfo; import android.telephony.ims.ImsReasonInfo;
import android.telephony.ims.ImsStreamMediaProfile; import android.telephony.ims.ImsStreamMediaProfile;
import android.telephony.ims.ImsSuppServiceNotification; import android.telephony.ims.ImsSuppServiceNotification;
import android.telephony.ims.aidl.IImsCallSessionListener; import android.telephony.ims.aidl.IImsCallSessionListener;
import com.android.ims.internal.IImsCallSession; import com.android.ims.internal.IImsCallSession;
import com.android.ims.internal.IImsVideoCallProvider; import com.android.ims.internal.IImsVideoCallProvider;
import android.annotation.UnsupportedAppUsage;
import android.telephony.ims.ImsCallSession;
/** /**
* Compat implementation of ImsCallSessionImplBase for older implementations. * Compat implementation of ImsCallSessionImplBase for older implementations.
* *
@@ -597,5 +596,10 @@ public class ImsCallSessionImplBase extends IImsCallSession.Stub {
throws RemoteException { throws RemoteException {
mNewListener.callSessionRttAudioIndicatorChanged(profile); mNewListener.callSessionRttAudioIndicatorChanged(profile);
} }
@Override
public void callQualityChanged(CallQuality callQuality) throws RemoteException {
mNewListener.callQualityChanged(callQuality);
}
} }
} }

View File

@@ -16,6 +16,7 @@
package com.android.ims.internal; package com.android.ims.internal;
import android.telephony.CallQuality;
import android.telephony.ims.ImsStreamMediaProfile; import android.telephony.ims.ImsStreamMediaProfile;
import android.telephony.ims.ImsCallProfile; import android.telephony.ims.ImsCallProfile;
import android.telephony.ims.ImsReasonInfo; import android.telephony.ims.ImsReasonInfo;
@@ -140,22 +141,29 @@ oneway interface IImsCallSessionListener {
void callSessionRttModifyRequestReceived(in IImsCallSession session, void callSessionRttModifyRequestReceived(in IImsCallSession session,
in ImsCallProfile callProfile); in ImsCallProfile callProfile);
/* Device issued RTT modify request and inturn received response /**
* Device issued RTT modify request and inturn received response
* from Remote UE * from Remote UE
* @param status Will be one of the following values from: * @param status Will be one of the following values from:
* - {@link Connection.RttModifyStatus} * - {@link Connection.RttModifyStatus}
*/ */
void callSessionRttModifyResponseReceived(in int status); void callSessionRttModifyResponseReceived(in int status);
/* /**
* While in call, device received RTT message from Remote UE * While in call, device received RTT message from Remote UE
* @param rttMessage Received RTT message * @param rttMessage Received RTT message
*/ */
void callSessionRttMessageReceived(in String rttMessage); void callSessionRttMessageReceived(in String rttMessage);
/* /**
* While in call, there has been a change in RTT audio indicator. * While in call, there has been a change in RTT audio indicator.
* @param profile updated ImsStreamMediaProfile * @param profile updated ImsStreamMediaProfile
*/ */
void callSessionRttAudioIndicatorChanged(in ImsStreamMediaProfile profile); void callSessionRttAudioIndicatorChanged(in ImsStreamMediaProfile profile);
/**
* Notifies of a change to the call quality.
* @param callQuality then updated call quality
*/
void callQualityChanged(in CallQuality callQuality);
} }

View File

@@ -20,6 +20,7 @@ import android.content.Intent;
import android.net.LinkProperties; import android.net.LinkProperties;
import android.net.NetworkCapabilities; import android.net.NetworkCapabilities;
import android.os.Bundle; import android.os.Bundle;
import android.telephony.CallQuality;
import android.telephony.CellInfo; import android.telephony.CellInfo;
import android.telephony.PhoneCapability; import android.telephony.PhoneCapability;
import android.telephony.PhysicalChannelConfig; import android.telephony.PhysicalChannelConfig;
@@ -65,7 +66,7 @@ interface ITelephonyRegistry {
void notifyPhysicalChannelConfigurationForSubscriber(in int subId, void notifyPhysicalChannelConfigurationForSubscriber(in int subId,
in List<PhysicalChannelConfig> configs); in List<PhysicalChannelConfig> configs);
void notifyPreciseCallState(int ringingCallState, int foregroundCallState, void notifyPreciseCallState(int ringingCallState, int foregroundCallState,
int backgroundCallState); int backgroundCallState, int phoneId);
void notifyDisconnectCause(int disconnectCause, int preciseDisconnectCause); void notifyDisconnectCause(int disconnectCause, int preciseDisconnectCause);
void notifyPreciseDataConnectionFailed(String apnType, String apn, void notifyPreciseDataConnectionFailed(String apnType, String apn,
int failCause); int failCause);
@@ -82,4 +83,5 @@ interface ITelephonyRegistry {
void notifyPreferredDataSubIdChanged(int preferredSubId); void notifyPreferredDataSubIdChanged(int preferredSubId);
void notifyRadioPowerStateChanged(in int state); void notifyRadioPowerStateChanged(in int state);
void notifyEmergencyNumberList(); void notifyEmergencyNumberList();
void notifyCallQualityChanged(in CallQuality callQuality, int phoneId);
} }