Loading src/java/com/android/internal/telephony/DefaultPhoneNotifier.java +14 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.net.NetworkCapabilities; import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; import android.telephony.CallQuality; import android.telephony.CellInfo; import android.telephony.CellLocation; import android.telephony.DataFailCause; Loading Loading @@ -270,7 +271,8 @@ public class DefaultPhoneNotifier implements PhoneNotifier { mRegistry.notifyPreciseCallState( convertPreciseCallState(ringingCall.getState()), convertPreciseCallState(foregroundCall.getState()), convertPreciseCallState(backgroundCall.getState())); convertPreciseCallState(backgroundCall.getState()), sender.getPhoneId()); } catch (RemoteException ex) { // system process is dead } Loading Loading @@ -373,6 +375,17 @@ public class DefaultPhoneNotifier implements PhoneNotifier { } } @Override public void notifyCallQualityChanged(Phone sender, CallQuality callQuality) { try { if (mRegistry != null) { mRegistry.notifyCallQualityChanged(callQuality, sender.getPhoneId()); } } catch (RemoteException ex) { // system process is dead } } /** * Convert the {@link Phone.DataActivityState} enum into the TelephonyManager.DATA_* constants * for the public API. Loading src/java/com/android/internal/telephony/PhoneNotifier.java +4 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.telephony; import android.telephony.CallQuality; import android.telephony.CellInfo; import android.telephony.CellLocation; import android.telephony.DataFailCause; Loading Loading @@ -80,4 +81,7 @@ public interface PhoneNotifier { /** Notify of change to EmergencyNumberList. */ void notifyEmergencyNumberList(); /** Notify of a change to the call quality of an active foreground call. */ void notifyCallQualityChanged(Phone sender, CallQuality callQuality); } src/java/com/android/internal/telephony/imsphone/ImsPhoneBase.java +5 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.os.Handler; import android.os.Message; import android.os.RegistrantList; import android.os.SystemProperties; import android.telephony.CallQuality; import android.telephony.NetworkScanRequest; import android.telephony.Rlog; import android.telephony.ServiceState; Loading Loading @@ -133,6 +134,10 @@ abstract class ImsPhoneBase extends Phone { mTtyModeReceivedRegistrants.notifyRegistrants(result); } public void onCallQualityChanged(CallQuality callQuality) { mNotifier.notifyCallQualityChanged(this, callQuality); } @Override public ServiceState getServiceState() { // FIXME: we may need to provide this when data connectivity is lost Loading src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java +10 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.provider.Settings; import android.telecom.ConferenceParticipant; import android.telecom.TelecomManager; import android.telecom.VideoProfile; import android.telephony.CallQuality; import android.telephony.CarrierConfigManager; import android.telephony.DisconnectCause; import android.telephony.PhoneNumberUtils; Loading Loading @@ -2752,6 +2753,15 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { conn.updateMultipartyState(isMultiParty); } } /** * Handles a change to the call quality for an {@code ImsCall}. * Notifies apps through the System API {@link PhoneStateListener#onCallAttributesChanged}. */ @Override public void onCallQualityChanged(ImsCall imsCall, CallQuality callQuality) { mPhone.onCallQualityChanged(callQuality); } }; /** Loading tests/telephonytests/src/com/android/internal/telephony/DefaultPhoneNotifierTest.java +11 −7 Original line number Diff line number Diff line Loading @@ -189,45 +189,49 @@ public class DefaultPhoneNotifierTest extends TelephonyTest { mDefaultPhoneNotifierUT.notifyPreciseCallState(mPhone); verify(mTelephonyRegisteryMock, times(0)).notifyPreciseCallState(anyInt(), anyInt(), anyInt()); anyInt(), anyInt()); doReturn(mForeGroundCall).when(mPhone).getForegroundCall(); mDefaultPhoneNotifierUT.notifyPreciseCallState(mPhone); verify(mTelephonyRegisteryMock, times(0)).notifyPreciseCallState(anyInt(), anyInt(), anyInt()); anyInt(), anyInt()); doReturn(mBackGroundCall).when(mPhone).getBackgroundCall(); mDefaultPhoneNotifierUT.notifyPreciseCallState(mPhone); verify(mTelephonyRegisteryMock, times(0)).notifyPreciseCallState(anyInt(), anyInt(), anyInt()); anyInt(), anyInt()); doReturn(mRingingCall).when(mPhone).getRingingCall(); mDefaultPhoneNotifierUT.notifyPreciseCallState(mPhone); verify(mTelephonyRegisteryMock, times(1)).notifyPreciseCallState( PreciseCallState.PRECISE_CALL_STATE_IDLE, PreciseCallState.PRECISE_CALL_STATE_IDLE, PreciseCallState.PRECISE_CALL_STATE_IDLE); PreciseCallState.PRECISE_CALL_STATE_IDLE, mPhone.getPhoneId()); doReturn(Call.State.ACTIVE).when(mForeGroundCall).getState(); mDefaultPhoneNotifierUT.notifyPreciseCallState(mPhone); verify(mTelephonyRegisteryMock, times(1)).notifyPreciseCallState( PreciseCallState.PRECISE_CALL_STATE_IDLE, PreciseCallState.PRECISE_CALL_STATE_ACTIVE, PreciseCallState.PRECISE_CALL_STATE_IDLE); PreciseCallState.PRECISE_CALL_STATE_IDLE, mPhone.getPhoneId()); doReturn(Call.State.HOLDING).when(mBackGroundCall).getState(); mDefaultPhoneNotifierUT.notifyPreciseCallState(mPhone); verify(mTelephonyRegisteryMock, times(1)).notifyPreciseCallState( PreciseCallState.PRECISE_CALL_STATE_IDLE, PreciseCallState.PRECISE_CALL_STATE_ACTIVE, PreciseCallState.PRECISE_CALL_STATE_HOLDING); PreciseCallState.PRECISE_CALL_STATE_HOLDING, mPhone.getPhoneId()); doReturn(Call.State.ALERTING).when(mRingingCall).getState(); mDefaultPhoneNotifierUT.notifyPreciseCallState(mPhone); verify(mTelephonyRegisteryMock, times(1)).notifyPreciseCallState( PreciseCallState.PRECISE_CALL_STATE_ALERTING, PreciseCallState.PRECISE_CALL_STATE_ACTIVE, PreciseCallState.PRECISE_CALL_STATE_HOLDING); PreciseCallState.PRECISE_CALL_STATE_HOLDING, mPhone.getPhoneId()); } @Test @SmallTest Loading Loading
src/java/com/android/internal/telephony/DefaultPhoneNotifier.java +14 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.net.NetworkCapabilities; import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; import android.telephony.CallQuality; import android.telephony.CellInfo; import android.telephony.CellLocation; import android.telephony.DataFailCause; Loading Loading @@ -270,7 +271,8 @@ public class DefaultPhoneNotifier implements PhoneNotifier { mRegistry.notifyPreciseCallState( convertPreciseCallState(ringingCall.getState()), convertPreciseCallState(foregroundCall.getState()), convertPreciseCallState(backgroundCall.getState())); convertPreciseCallState(backgroundCall.getState()), sender.getPhoneId()); } catch (RemoteException ex) { // system process is dead } Loading Loading @@ -373,6 +375,17 @@ public class DefaultPhoneNotifier implements PhoneNotifier { } } @Override public void notifyCallQualityChanged(Phone sender, CallQuality callQuality) { try { if (mRegistry != null) { mRegistry.notifyCallQualityChanged(callQuality, sender.getPhoneId()); } } catch (RemoteException ex) { // system process is dead } } /** * Convert the {@link Phone.DataActivityState} enum into the TelephonyManager.DATA_* constants * for the public API. Loading
src/java/com/android/internal/telephony/PhoneNotifier.java +4 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.telephony; import android.telephony.CallQuality; import android.telephony.CellInfo; import android.telephony.CellLocation; import android.telephony.DataFailCause; Loading Loading @@ -80,4 +81,7 @@ public interface PhoneNotifier { /** Notify of change to EmergencyNumberList. */ void notifyEmergencyNumberList(); /** Notify of a change to the call quality of an active foreground call. */ void notifyCallQualityChanged(Phone sender, CallQuality callQuality); }
src/java/com/android/internal/telephony/imsphone/ImsPhoneBase.java +5 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.os.Handler; import android.os.Message; import android.os.RegistrantList; import android.os.SystemProperties; import android.telephony.CallQuality; import android.telephony.NetworkScanRequest; import android.telephony.Rlog; import android.telephony.ServiceState; Loading Loading @@ -133,6 +134,10 @@ abstract class ImsPhoneBase extends Phone { mTtyModeReceivedRegistrants.notifyRegistrants(result); } public void onCallQualityChanged(CallQuality callQuality) { mNotifier.notifyCallQualityChanged(this, callQuality); } @Override public ServiceState getServiceState() { // FIXME: we may need to provide this when data connectivity is lost Loading
src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java +10 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.provider.Settings; import android.telecom.ConferenceParticipant; import android.telecom.TelecomManager; import android.telecom.VideoProfile; import android.telephony.CallQuality; import android.telephony.CarrierConfigManager; import android.telephony.DisconnectCause; import android.telephony.PhoneNumberUtils; Loading Loading @@ -2752,6 +2753,15 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { conn.updateMultipartyState(isMultiParty); } } /** * Handles a change to the call quality for an {@code ImsCall}. * Notifies apps through the System API {@link PhoneStateListener#onCallAttributesChanged}. */ @Override public void onCallQualityChanged(ImsCall imsCall, CallQuality callQuality) { mPhone.onCallQualityChanged(callQuality); } }; /** Loading
tests/telephonytests/src/com/android/internal/telephony/DefaultPhoneNotifierTest.java +11 −7 Original line number Diff line number Diff line Loading @@ -189,45 +189,49 @@ public class DefaultPhoneNotifierTest extends TelephonyTest { mDefaultPhoneNotifierUT.notifyPreciseCallState(mPhone); verify(mTelephonyRegisteryMock, times(0)).notifyPreciseCallState(anyInt(), anyInt(), anyInt()); anyInt(), anyInt()); doReturn(mForeGroundCall).when(mPhone).getForegroundCall(); mDefaultPhoneNotifierUT.notifyPreciseCallState(mPhone); verify(mTelephonyRegisteryMock, times(0)).notifyPreciseCallState(anyInt(), anyInt(), anyInt()); anyInt(), anyInt()); doReturn(mBackGroundCall).when(mPhone).getBackgroundCall(); mDefaultPhoneNotifierUT.notifyPreciseCallState(mPhone); verify(mTelephonyRegisteryMock, times(0)).notifyPreciseCallState(anyInt(), anyInt(), anyInt()); anyInt(), anyInt()); doReturn(mRingingCall).when(mPhone).getRingingCall(); mDefaultPhoneNotifierUT.notifyPreciseCallState(mPhone); verify(mTelephonyRegisteryMock, times(1)).notifyPreciseCallState( PreciseCallState.PRECISE_CALL_STATE_IDLE, PreciseCallState.PRECISE_CALL_STATE_IDLE, PreciseCallState.PRECISE_CALL_STATE_IDLE); PreciseCallState.PRECISE_CALL_STATE_IDLE, mPhone.getPhoneId()); doReturn(Call.State.ACTIVE).when(mForeGroundCall).getState(); mDefaultPhoneNotifierUT.notifyPreciseCallState(mPhone); verify(mTelephonyRegisteryMock, times(1)).notifyPreciseCallState( PreciseCallState.PRECISE_CALL_STATE_IDLE, PreciseCallState.PRECISE_CALL_STATE_ACTIVE, PreciseCallState.PRECISE_CALL_STATE_IDLE); PreciseCallState.PRECISE_CALL_STATE_IDLE, mPhone.getPhoneId()); doReturn(Call.State.HOLDING).when(mBackGroundCall).getState(); mDefaultPhoneNotifierUT.notifyPreciseCallState(mPhone); verify(mTelephonyRegisteryMock, times(1)).notifyPreciseCallState( PreciseCallState.PRECISE_CALL_STATE_IDLE, PreciseCallState.PRECISE_CALL_STATE_ACTIVE, PreciseCallState.PRECISE_CALL_STATE_HOLDING); PreciseCallState.PRECISE_CALL_STATE_HOLDING, mPhone.getPhoneId()); doReturn(Call.State.ALERTING).when(mRingingCall).getState(); mDefaultPhoneNotifierUT.notifyPreciseCallState(mPhone); verify(mTelephonyRegisteryMock, times(1)).notifyPreciseCallState( PreciseCallState.PRECISE_CALL_STATE_ALERTING, PreciseCallState.PRECISE_CALL_STATE_ACTIVE, PreciseCallState.PRECISE_CALL_STATE_HOLDING); PreciseCallState.PRECISE_CALL_STATE_HOLDING, mPhone.getPhoneId()); } @Test @SmallTest Loading