CallAttributes uses the call network type

Instead of the ServiceState.getNetworkType(), since the service state
might not match the RAT of the specific call, we use the radio type from
the ImsCall.

Bug: 124785734
Test: manual
Change-Id: I33f84bb415c943d5b766fcd3a4e8257d8f7c1cfe
This commit is contained in:
Jordan Liu
2019-02-19 14:42:07 -08:00
parent 0dddb902ae
commit 65ed9d9227
2 changed files with 10 additions and 34 deletions

View File

@@ -177,8 +177,6 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private ServiceState[] mServiceState;
private int[] mNetworkType;
private int[] mVoiceActivationState;
private int[] mDataActivationState;
@@ -213,6 +211,9 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private CallAttributes mCallAttributes = new CallAttributes(new PreciseCallState(),
TelephonyManager.NETWORK_TYPE_UNKNOWN, new CallQuality());
// network type of the call associated with the mCallAttributes and mCallQuality
private int mCallNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
private int[] mSrvccState;
private int mDefaultSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
@@ -374,7 +375,6 @@ 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];
@@ -395,7 +395,6 @@ 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;
@@ -997,21 +996,6 @@ 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
@@ -1039,14 +1023,6 @@ 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);
@@ -1573,7 +1549,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
log("notifyPreciseCallState: mCallQuality is null, skipping call attributes");
notifyCallAttributes = false;
} else {
mCallAttributes = new CallAttributes(mPreciseCallState, mNetworkType[phoneId],
mCallAttributes = new CallAttributes(mPreciseCallState, mCallNetworkType,
mCallQuality);
}
@@ -1840,16 +1816,16 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
}
@Override
public void notifyCallQualityChanged(CallQuality callQuality, int phoneId) {
public void notifyCallQualityChanged(CallQuality callQuality, int phoneId,
int callNetworkType) {
if (!checkNotifyPermission("notifyCallQualityChanged()")) {
return;
}
// merge CallQuality with PreciseCallState and network type
mCallQuality = callQuality;
mCallAttributes = new CallAttributes(mPreciseCallState,
mNetworkType[phoneId],
callQuality);
mCallNetworkType = callNetworkType;
mCallAttributes = new CallAttributes(mPreciseCallState, callNetworkType, callQuality);
synchronized (mRecords) {
TelephonyManager tm = (TelephonyManager) mContext.getSystemService(
@@ -1886,7 +1862,6 @@ 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]);
@@ -1900,6 +1875,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
pw.println("mImsCallDisconnectCause=" + mImsReasonInfo.get(i).toString());
pw.decreaseIndent();
}
pw.println("mCallNetworkType=" + mCallNetworkType);
pw.println("mPreciseDataConnectionState=" + mPreciseDataConnectionState);
pw.println("mPreciseCallState=" + mPreciseCallState);
pw.println("mCallDisconnectCause=" + mCallDisconnectCause);

View File

@@ -84,6 +84,6 @@ interface ITelephonyRegistry {
void notifyPreferredDataSubIdChanged(int preferredSubId);
void notifyRadioPowerStateChanged(in int state);
void notifyEmergencyNumberList();
void notifyCallQualityChanged(in CallQuality callQuality, int phoneId);
void notifyCallQualityChanged(in CallQuality callQuality, int phoneId, int callNetworkType);
void notifyImsDisconnectCause(int subId, in ImsReasonInfo imsReasonInfo);
}