Merge "Trigger PhoneStateListener onCallAttributesChanged" am: cd4ca49b18 am: bbd7b9170a

am: 3be2df7b4f

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

View File

@@ -7392,6 +7392,7 @@ package android.telephony.ims {
}
public class ImsCallSessionListener {
method public void callQualityChanged(android.telephony.CallQuality);
method public void callSessionConferenceExtendFailed(android.telephony.ims.ImsReasonInfo);
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);

View File

@@ -32,6 +32,8 @@ import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.os.UserHandle;
import android.telephony.CallAttributes;
import android.telephony.CallQuality;
import android.telephony.CellInfo;
import android.telephony.CellLocation;
import android.telephony.DataFailCause;
@@ -173,6 +175,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private ServiceState[] mServiceState;
private int[] mNetworkType;
private int[] mVoiceActivationState;
private int[] mDataActivationState;
@@ -202,6 +206,10 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private Map<Integer, List<EmergencyNumber>> mEmergencyNumberList;
private CallQuality mCallQuality;
private CallAttributes mCallAttributes;
private int[] mSrvccState;
private int mDefaultSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
@@ -358,6 +366,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mDataConnectionNetworkType = new int[numPhones];
mCallIncomingNumber = new String[numPhones];
mServiceState = new ServiceState[numPhones];
mNetworkType = new int[numPhones];
mVoiceActivationState = new int[numPhones];
mDataActivationState = new int[numPhones];
mUserMobileDataState = new boolean[numPhones];
@@ -377,6 +386,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mDataActivationState[i] = TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN;
mCallIncomingNumber[i] = "";
mServiceState[i] = new ServiceState();
mNetworkType[i] = mServiceState[i].getVoiceNetworkType();
mSignalStrength[i] = new SignalStrength();
mUserMobileDataState[i] = false;
mMessageWaiting[i] = false;
@@ -807,6 +817,13 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
remove(r.binder);
}
}
if ((events & PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED) != 0) {
try {
r.callback.onCallAttributesChanged(mCallAttributes);
} catch (RemoteException ex) {
remove(r.binder);
}
}
}
}
} else {
@@ -957,6 +974,21 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
if (validatePhoneId(phoneId)) {
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) {
if (VDBG) {
log("notifyServiceStateForSubscriber: r=" + r + " subId=" + subId
@@ -975,6 +1007,14 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
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 {
log("notifyServiceStateForSubscriber: INVALID phoneId=" + phoneId);
@@ -1484,7 +1524,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
}
public void notifyPreciseCallState(int ringingCallState, int foregroundCallState,
int backgroundCallState) {
int backgroundCallState, int phoneId) {
if (!checkNotifyPermission("notifyPreciseCallState()")) {
return;
}
@@ -1496,6 +1536,15 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
backgroundCallState,
DisconnectCause.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) {
if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_PRECISE_CALL_STATE)) {
try {
@@ -1504,6 +1553,14 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
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();
}
@@ -1721,6 +1778,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
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
@@ -1738,6 +1825,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
pw.println("mCallState=" + mCallState[i]);
pw.println("mCallIncomingNumber=" + mCallIncomingNumber[i]);
pw.println("mServiceState=" + mServiceState[i]);
pw.println("mNetworkType=" + mNetworkType[i]);
pw.println("mVoiceActivationState= " + mVoiceActivationState[i]);
pw.println("mDataActivationState= " + mDataActivationState[i]);
pw.println("mUserMobileDataState= " + mUserMobileDataState[i]);
@@ -1763,6 +1851,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
pw.println("mPreferredDataSubId=" + mPreferredDataSubId);
pw.println("mRadioPowerState=" + mRadioPowerState);
pw.println("mEmergencyNumberList=" + mEmergencyNumberList);
pw.println("mCallQuality=" + mCallQuality);
pw.println("mCallAttributes=" + mCallAttributes);
pw.decreaseIndent();
@@ -2020,6 +2110,11 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
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;
}

View File

@@ -18,6 +18,7 @@ package android.telephony.ims;
import android.os.Message;
import android.os.RemoteException;
import android.telephony.CallQuality;
import android.telephony.ims.aidl.IImsCallSessionListener;
import android.util.Log;
@@ -450,6 +451,13 @@ public class ImsCallSession {
public void callSessionRttAudioIndicatorChanged(ImsStreamMediaProfile profile) {
// 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;
@@ -1414,6 +1422,16 @@ public class ImsCallSession {
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.os.RemoteException;
import android.telephony.CallQuality;
import android.telephony.ims.aidl.IImsCallSessionListener;
import android.telephony.ims.stub.ImsCallSessionImplBase;
@@ -612,5 +613,18 @@ public class ImsCallSessionListener {
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;
import android.telephony.CallQuality;
import android.telephony.ims.ImsStreamMediaProfile;
import android.telephony.ims.ImsCallProfile;
import android.telephony.ims.ImsReasonInfo;
@@ -126,22 +127,29 @@ oneway interface IImsCallSessionListener {
*/
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
* @param status Will be one of the following values from:
* - {@link Connection.RttModifyStatus}
*/
void callSessionRttModifyResponseReceived(int status);
/*
/**
* While in call, device received RTT message from Remote UE
* @param rttMessage Received RTT message
*/
void callSessionRttMessageReceived(in String rttMessage);
/*
/**
* While in call, there has been a change in RTT audio indicator.
* @param profile updated ImsStreamMediaProfile
*/
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.RemoteException;
import android.telephony.CallQuality;
import android.telephony.ims.ImsCallProfile;
import android.telephony.ims.ImsCallSession;
import android.telephony.ims.ImsConferenceState;
import android.telephony.ims.ImsReasonInfo;
import android.telephony.ims.ImsStreamMediaProfile;
import android.telephony.ims.ImsSuppServiceNotification;
import android.telephony.ims.aidl.IImsCallSessionListener;
import com.android.ims.internal.IImsCallSession;
import com.android.ims.internal.IImsVideoCallProvider;
import android.annotation.UnsupportedAppUsage;
import android.telephony.ims.ImsCallSession;
/**
* Compat implementation of ImsCallSessionImplBase for older implementations.
*
@@ -597,5 +596,10 @@ public class ImsCallSessionImplBase extends IImsCallSession.Stub {
throws RemoteException {
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;
import android.telephony.CallQuality;
import android.telephony.ims.ImsStreamMediaProfile;
import android.telephony.ims.ImsCallProfile;
import android.telephony.ims.ImsReasonInfo;
@@ -140,22 +141,29 @@ oneway interface IImsCallSessionListener {
void callSessionRttModifyRequestReceived(in IImsCallSession session,
in ImsCallProfile callProfile);
/* Device issued RTT modify request and inturn received response
/**
* Device issued RTT modify request and inturn received response
* from Remote UE
* @param status Will be one of the following values from:
* - {@link Connection.RttModifyStatus}
*/
void callSessionRttModifyResponseReceived(in int status);
/*
/**
* While in call, device received RTT message from Remote UE
* @param rttMessage Received RTT message
*/
void callSessionRttMessageReceived(in String rttMessage);
/*
/**
* While in call, there has been a change in RTT audio indicator.
* @param profile updated ImsStreamMediaProfile
*/
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.NetworkCapabilities;
import android.os.Bundle;
import android.telephony.CallQuality;
import android.telephony.CellInfo;
import android.telephony.PhoneCapability;
import android.telephony.PhysicalChannelConfig;
@@ -65,7 +66,7 @@ interface ITelephonyRegistry {
void notifyPhysicalChannelConfigurationForSubscriber(in int subId,
in List<PhysicalChannelConfig> configs);
void notifyPreciseCallState(int ringingCallState, int foregroundCallState,
int backgroundCallState);
int backgroundCallState, int phoneId);
void notifyDisconnectCause(int disconnectCause, int preciseDisconnectCause);
void notifyPreciseDataConnectionFailed(String apnType, String apn,
int failCause);
@@ -82,4 +83,5 @@ interface ITelephonyRegistry {
void notifyPreferredDataSubIdChanged(int preferredSubId);
void notifyRadioPowerStateChanged(in int state);
void notifyEmergencyNumberList();
void notifyCallQualityChanged(in CallQuality callQuality, int phoneId);
}