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

Commit 5da43ce2 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Telecom: Do null check when update dsda service with callState"

parents 9868d757 0a624337
Loading
Loading
Loading
Loading
+47 −11
Original line number Diff line number Diff line
@@ -794,7 +794,6 @@ public final class BluetoothPhoneService extends Service {
        boolean isActive = false;
        boolean allowDsda = false;
        int state = convertCallState(call.getState(), isForeground);
        long subForCall = Long.parseLong(call.getTargetPhoneAccount().getId());
        long activeSub = mTelecomManager.getActiveSubscription();
        if (INVALID_SUBID == activeSub) {
            Log.i(TAG, "Invalid activeSub id, returning");
@@ -813,8 +812,6 @@ public final class BluetoothPhoneService extends Service {
            Log.i(this, "Call setup in progress, allowDsda: " + allowDsda);
        }

        Log.i(this, "CLCC on SUB: " + subForCall + " CallState: " + state);

        if (state == CALL_STATE_IDLE) {
            return;
        }
@@ -1105,15 +1102,34 @@ public final class BluetoothPhoneService extends Service {
        long subscription = INVALID_SUBID;
        if (mBluetoothDsda != null) {
            Log.d(TAG, "Get the Sub on which call state change happened");
            if (!call.isConference()) {
                subscription = Long.parseLong(call.getTargetPhoneAccount().getId());
            } else {
            if (call.getTargetPhoneAccount() != null) {
                String sub = call.getTargetPhoneAccount().getId();
                subscription = SubscriptionManager.getDefaultVoiceSubId();
                try {
                    subscription = Long.parseLong(sub);
                } catch (NumberFormatException e) {
                    Log.w(this, " NumberFormatException " + e);
                }
            } else if (call.isConference()) {
                for (Call childCall : call.getChildCalls()) {
                    subscription = Long.parseLong(childCall.getTargetPhoneAccount().getId());
                    if (childCall.getTargetPhoneAccount() != null) {
                        String sub = childCall.getTargetPhoneAccount().getId();
                        subscription = SubscriptionManager.getDefaultVoiceSubId();
                        try {
                            subscription = Long.parseLong(sub);
                        } catch (NumberFormatException e) {
                            Log.w(this, " NumberFormatException " + e);
                        }
                    } else {
                        Log.w(this, "PhoneAccountHandle is NULL for childCall: " + childCall);
                    }
                    if (subscription != INVALID_SUBID)
                        break;
                }
            } else {
                Log.w(this, "PhoneAccountHandle is NULL");
            }

            Log.d(TAG, "SUB on which call state to be updated " + subscription);
            if (subscription == INVALID_SUBID) {
                return;
@@ -1169,11 +1185,31 @@ public final class BluetoothPhoneService extends Service {
        long activeCallSub = 0;

        if (activeCall != null && activeCall.isConference()) {
            if (activeCall.getTargetPhoneAccount() != null) {
                String sub = activeCall.getTargetPhoneAccount().getId();
                activeCallSub = SubscriptionManager.getDefaultVoiceSubId();
                try {
                    activeCallSub = Long.parseLong(sub);
                } catch (NumberFormatException e) {
                    Log.w(this, " NumberFormatException " + e);
                }
            } else {
                for (Call childCall : activeCall.getChildCalls()) {
                activeCallSub = Long.parseLong(childCall.getTargetPhoneAccount().getId());
                    if (childCall.getTargetPhoneAccount() != null) {
                        String sub = childCall.getTargetPhoneAccount().getId();
                        activeCallSub = SubscriptionManager.getDefaultVoiceSubId();
                        try {
                            activeCallSub = Long.parseLong(sub);
                        } catch (NumberFormatException e) {
                            Log.w(this, " NumberFormatException " + e);
                        }
                    } else {
                        Log.w(this, "PhoneAccountHandle is NULL for childCall: " + childCall);
                    }
                    if (activeCallSub != INVALID_SUBID)
                        break;
                }
            }
            if (activeCallSub == subscription) {
                if (activeCall.can(PhoneCapabilities.SWAP_CONFERENCE)) {
                    // Indicate that BT device should show SWAP command by indicating that there