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

Commit cea6e83a authored by Tyler Gunn's avatar Tyler Gunn Committed by Android (Google) Code Review
Browse files

Merge "telecom: Add null checks for service interface" into main

parents 701a2c63 2fda0778
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -2462,7 +2462,16 @@ public class CallsManager extends Call.ListenerBase
            // CallScreeningService in order for it to potentially provide caller ID.
            dialerSelectPhoneAccountFuture.thenAcceptBothAsync(contactLookupFuture,
                    (callPhoneAccountHandlePair, uriCallerInfoPair) -> {
                        if (callPhoneAccountHandlePair == null) {
                            return;
                        }
                        Call theCall = callPhoneAccountHandlePair.first;
                        // Other branches building on dialerSelectPhoneAccountFuture do this, so
                        // we should early return here; if there is no call, then don't bother
                        // continuing.
                        if (theCall == null) {
                            return;
                        }
                        UserHandle userHandleForCallScreening = theCall.
                                getAssociatedUser();
                        boolean isInContacts = uriCallerInfoPair.second != null
+49 −36
Original line number Diff line number Diff line
@@ -1037,7 +1037,8 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
            long token = Binder.clearCallingIdentity();
            try {
                synchronized (mLock) {
                    logIncoming("setAddress %s %s %d", callId, address, presentation);
                    logIncoming("setAddress %s %s %d", callId, Log.piiHandle(address),
                            presentation);
                    Call call = mCallIdMapper.getCall(callId);
                    if (call != null) {
                        call.setHandle(address, presentation);
@@ -1059,7 +1060,7 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
            long token = Binder.clearCallingIdentity();
            try {
                synchronized (mLock) {
                    logIncoming("setCallerDisplayName %s %s %d", callId, callerDisplayName,
                    logIncoming("setCallerDisplayName %s %s %d", callId, Log.pii(callerDisplayName),
                            presentation);
                    Call call = mCallIdMapper.getCall(callId);
                    if (call != null) {
@@ -2014,6 +2015,7 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
                            Log.piiHandle(call.getHandle()));
                    try {
                        logOutgoing("createConnectionFailed %s", callId);
                        if (mServiceInterface != null) {
                            mServiceInterface.createConnectionFailed(
                                    call.getConnectionManagerPhoneAccount(),
                                    callId,
@@ -2028,6 +2030,7 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
                                    Log.getExternalSession(TELECOM_ABBREVIATION));
                            call.setDisconnectCause(new DisconnectCause(DisconnectCause.CANCELED));
                            call.disconnect();
                        }
                    } catch (RemoteException e) {
                    }
                }
@@ -2101,6 +2104,7 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
                    Log.addEvent(call, LogUtils.Events.HANDOVER_FAILED,
                            Log.piiHandle(call.getHandle()));
                    try {
                        if (mServiceInterface != null) {
                            mServiceInterface.handoverFailed(
                                    callId,
                                    new ConnectionRequest(
@@ -2112,6 +2116,7 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
                                            false),
                                    reason,
                                    Log.getExternalSession(TELECOM_ABBREVIATION));
                        }
                    } catch (RemoteException e) {
                    }
                }
@@ -2137,9 +2142,11 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
                // If still bound, tell the connection service create connection has failed.
                if (callId != null && isServiceValid("handoverComplete")) {
                    try {
                        if (mServiceInterface != null) {
                            mServiceInterface.handoverComplete(
                                    callId,
                                    Log.getExternalSession(TELECOM_ABBREVIATION));
                        }
                    } catch (RemoteException e) {
                    }
                }
@@ -2216,8 +2223,10 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
        if (callId != null && isServiceValid("onCallAudioStateChanged")) {
            try {
                logOutgoing("onCallAudioStateChanged %s %s", callId, audioState);
                if (mServiceInterface != null) {
                    mServiceInterface.onCallAudioStateChanged(callId, audioState,
                            Log.getExternalSession(TELECOM_ABBREVIATION));
                }
            } catch (RemoteException e) {
            }
        }
@@ -2693,8 +2702,10 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
            public void onSuccess() {
                if (!isServiceValid("connectionServiceFocusLost")) return;
                try {
                    if (mServiceInterface != null) {
                        mServiceInterface.connectionServiceFocusLost(
                                Log.getExternalSession(TELECOM_ABBREVIATION));
                    }
                } catch (RemoteException ignored) {
                    Log.d(this, "failed to inform the focus lost event");
                }
@@ -2713,8 +2724,10 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
            public void onSuccess() {
                if (!isServiceValid("connectionServiceFocusGained")) return;
                try {
                    if (mServiceInterface != null) {
                        mServiceInterface.connectionServiceFocusGained(
                                Log.getExternalSession(TELECOM_ABBREVIATION));
                    }
                } catch (RemoteException ignored) {
                    Log.d(this, "failed to inform the focus gained event");
                }