Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5efe20f authored by Grace Jia's avatar Grace Jia Committed by Automerger Merge Worker
Browse files

Fix NPE when try to process call redirection requests. am: d037c269 am: 966efca8

parents 270c53bf 966efca8
Loading
Loading
Loading
Loading
+30 −10
Original line number Original line Diff line number Diff line
@@ -2297,17 +2297,37 @@ public class CallsManager extends Call.ListenerBase
                mPendingRedirectedOutgoingCallInfo.remove(pendingCallId);
                mPendingRedirectedOutgoingCallInfo.remove(pendingCallId);
                mPendingUnredirectedOutgoingCallInfo.remove(pendingCallId);
                mPendingUnredirectedOutgoingCallInfo.remove(pendingCallId);
            }
            }

            switch (action) {
            if (action.equals(TelecomBroadcastIntentProcessor.ACTION_PLACE_REDIRECTED_CALL)) {
                case TelecomBroadcastIntentProcessor.ACTION_PLACE_REDIRECTED_CALL: {
                mHandler.post(mPendingRedirectedOutgoingCallInfo.get(callId).prepare());
                    Runnable r = mPendingRedirectedOutgoingCallInfo.get(callId);
            } else if (action.equals(
                    if (r != null) {
                    TelecomBroadcastIntentProcessor.ACTION_PLACE_UNREDIRECTED_CALL)) {
                        mHandler.post(r.prepare());
                mHandler.post(mPendingUnredirectedOutgoingCallInfo.get(callId).prepare());
                    } else {
            } else if (action.equals(
                        Log.w(this, "Processing %s for canceled Call ID %s",
                    TelecomBroadcastIntentProcessor.ACTION_CANCEL_REDIRECTED_CALL)) {
                                action, callId);
                    }
                    break;
                }
                case TelecomBroadcastIntentProcessor.ACTION_PLACE_UNREDIRECTED_CALL: {
                    Runnable r = mPendingUnredirectedOutgoingCallInfo.get(callId);
                    if (r != null) {
                        mHandler.post(r.prepare());
                    } else {
                        Log.w(this, "Processing %s for canceled Call ID %s",
                                action, callId);
                    }
                    break;
                }
                case TelecomBroadcastIntentProcessor.ACTION_CANCEL_REDIRECTED_CALL: {
                    Log.addEvent(mPendingRedirectedOutgoingCall,
                    Log.addEvent(mPendingRedirectedOutgoingCall,
                            LogUtils.Events.REDIRECTION_USER_CANCELLED);
                            LogUtils.Events.REDIRECTION_USER_CANCELLED);
                    mPendingRedirectedOutgoingCall.disconnect("User canceled the redirected call.");
                    mPendingRedirectedOutgoingCall.disconnect("User canceled the redirected call.");
                    break;
                }
                default: {
                    // Unexpected, ignore
                }

            }
            }
            mPendingRedirectedOutgoingCall = null;
            mPendingRedirectedOutgoingCall = null;
            mPendingRedirectedOutgoingCallInfo.remove(callId);
            mPendingRedirectedOutgoingCallInfo.remove(callId);