Buggy code:
private static final int MSG_SET_REMOTE_VIDEO_CAPABILITY = 11 ; private static final int MSG_SET_VIDEO_PROVIDER = 12 ; private static final int MSG_SET_AUDIO_QUALITY = 13 ; private static final int MSG_SET_CONFERENCE_PARTICIPANTS = 14 ; private static final int MSG_PHONE_VP_ON = 15 ; private static final int MSG_PHONE_VP_OFF = 16 ; private static final int MSG_SET_CONNECTION_CAPABILITY = 17 ; private boolean mIsVoicePrivacyOn = false ; private String [ ] mSubName = new String [ ] { "SIM1" , "SIM2" , "SIM3" } ; private String mDisplayName ; private boolean mIsEmergencyNumber = false ; private boolean [ ] mIsPermDiscCauseReceived = new boolean [ TelephonyManager . getDefault ( ) . getPhoneCount ( ) ] ; private static final Map < String , String > sExtrasMap = TelephonyConnection . createExtrasMap ( ) ; private final Handler mHandler = new Handler ( ) { @ Override public void handleMessage ( Message msg ) { } } ; public static abstract class TelephonyConnectionListener { public void onOriginalConnectionConfigured ( TelephonyConnection c ) { } public void onEmergencyRedial ( TelephonyConnection c , PhoneAccountHandle pHandle , int phoneId ) { } } private final PostDialListener mPostDialListener = new PostDialListener ( ) { @ Override public void onPostDialWait ( ) { } @ Override public void onPostDialChar ( char c ) { } } ; private final Listener mOriginalConnectionListener = new ListenerBase ( ) { @ Override public void onVideoStateChanged ( int videoState ) { } @ Override public void onConnectionCapabilitiesChanged ( int capabilities ) { } @ Override public void onVideoProviderChanged ( VideoProvider videoProvider ) { } @ Override public void onWifiChanged ( boolean isWifi ) { } @ Override public void onAudioQualityChanged ( int audioQuality ) { } @ Override public void onConferenceParticipantsChanged ( List < ConferenceParticipant > participants ) { } @ Override public void onMultipartyStateChanged ( boolean isMultiParty ) { } @ Override public void onConferenceMergedFailed ( ) { } @ Override public void onExtrasChanged ( Bundle extras ) { } } ; Connection mOriginalConnection ; private State mOriginalConnectionState = State . IDLE ; private Bundle mOriginalConnectionExtras = new Bundle ( ) ; private boolean mWasImsConnection ; private boolean mIsMultiParty = false ; private int mConnectionCapability ; private boolean mIsWifi ; private boolean mHasHighDefAudio ; private boolean mIsVideoPauseSupported ; private boolean mIsConferenceSupported ; private final Set < TelephonyConnection . TelephonyConnectionListener > mTelephonyListeners = Collections . newSetFromMap ( new ConcurrentHashMap < TelephonyConnection . TelephonyConnectionListener , Boolean > ( 8 , 0.9F , 1 ) ) ; protected TelephonyConnection ( com . android . internal . telephony . Connection originalConnection ) { } public abstract TelephonyConnection cloneConnection ( ) { } @ Override public void onCallAudioStateChanged ( CallAudioState audioState ) { } @ Override public void onStateChanged ( int state ) { } @ Override public void onDisconnect ( ) { } @ Override public void onDisconnectConferenceParticipant ( Uri endpoint ) { } @ Override public void onSeparate ( ) { } @ Override public void onAbort ( ) { } @ Override public void setLocalCallHold ( boolean lchStatus ) { } @ Override public void onHold ( ) { } @ Override public void onUnhold ( ) { } @ Override public void onAnswer ( int videoState ) { } @ Override public void onReject ( ) { } @ Override public void onPostDialContinue ( boolean proceed ) { } public void performHold ( ) { } public void performUnhold ( ) { } public void performConference ( TelephonyConnection otherConnection ) { } public void performAddParticipant ( String participant ) { } protected int buildConnectionCapabilities ( ) { } protected int buildConnectionProperties ( ) { } protected final void updateConnectionCapabilities ( ) { } protected final void updateConnectionProperties ( ) { } protected final void updateAddress ( ) { updateConnectionCapabilities ( ) ; Uri address ; if ( ( mOriginalConnection ) != null ) { <START_BUG> if ( ( ( ( getAddress ( ) ) != null ) && ( ( getPhone ( ) . getPhoneType ( ) ) == ( TelephonyManager . PHONE_TYPE_CDMA ) ) ) && ( ! ( isValidRingingCall ( ) ) ) ) { <END_BUG> address = TelephonyConnection . getAddressFromNumber ( mOriginalConnection . getOrigDialString ( ) ) ; } else { address = TelephonyConnection . getAddressFromNumber ( mOriginalConnection . getAddress ( ) ) ; } int presentation = mOriginalConnection . getNumberPresentation ( ) ; if ( ( ! ( Objects . equals ( address , getAddress ( ) ) ) ) || ( presentation != ( getAddressPresentation ( ) ) ) ) { Log . v ( this , "updateAddress,<seq2seq4repair_space>address<seq2seq4repair_space>changed" ) ; setAddress ( address , presentation ) ; } String name = mOriginalConnection . getCnapName ( ) ; int namePresentation = mOriginalConnection . getCnapNamePresentation ( ) ; if ( ( ! ( Objects . equals ( name , getCallerDisplayName ( ) ) ) ) || ( namePresentation != ( getCallerDisplayNamePresentation ( ) ) ) ) { Log . v ( this , "updateAddress,<seq2seq4repair_space>caller<seq2seq4repair_space>display<seq2seq4repair_space>name<seq2seq4repair_space>changed" ) ; setCallerDisplayName ( name , namePresentation ) ; } } } void onRemovedFromCallService ( ) { } void setOriginalConnection ( com . android . internal . telephony . Connection originalConnection ) { } void clearOriginalConnection ( ) { } protected void hangup ( int telephonyDisconnectCode ) { } Connection getOriginalConnection ( ) { } protected Call getCall ( ) { } Phone getPhone ( ) { } private boolean hasMultipleTopLevelCalls ( ) { } private Connection getForegroundConnection ( ) { } public List < ConferenceParticipant > getConferenceParticipants ( ) { } private boolean isValidRingingCall ( ) { } protected void updateExtras ( Bundle extras ) { } private static boolean areBundlesEqual ( Bundle extras , Bundle newExtras ) { } void updateState ( ) { } void updateState ( boolean force ) { } private void updateMultiparty ( ) { } private void handleConferenceMergeFailed ( ) { } private void handleMultipartyStateChange ( boolean isMultiParty ) { } private void emergencyRedial ( int cause , Phone phone ) { } private int getNextPhoneId ( int curId ) { }

Fix:
if ( ( ( ( getAddress ( ) ) != null ) && ( ( getPhone ( ) . getPhoneType ( ) ) == ( TelephonyManager . PHONE_TYPE_CDMA ) ) ) && ( ! ( mOriginalConnection . isIncoming ( ) ) ) ) {