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

Commit 06db75a5 authored by Grant Menke's avatar Grant Menke
Browse files

Check ScheduledExecutor non-nullness before scheduling timeout cleanup

With change ag/30117743 the scheduled executor can be null when calling createConference and createCall. This is infrequently causing a NullPointerException. This CL adds checks that mScheduledExecutor is non-null before scheduling the cleanup.

Change-Id: I5401ff9891829f2dd3e3a1b322bbc55fa400091b
Flag: EXEMPT Security High/Critical Severity CVE
Bug: 379813294
Test: manually using the provided apk + atest CallsManagerTest
parent 35c9a70f
Loading
Loading
Loading
Loading
+14 −10
Original line number Diff line number Diff line
@@ -1655,11 +1655,13 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
                        }
                    }
                };
                // Post cleanup to the executor service and cache the future, so we can cancel it if
                // needed.
                ScheduledFuture<?> future = mScheduledExecutor.schedule(r.getRunnableToCancel(),
                        SERVICE_BINDING_TIMEOUT, TimeUnit.MILLISECONDS);
                if (mScheduledExecutor != null) {
                    // Post cleanup to the executor service and cache the future,
                    // so we can cancel it if needed.
                    ScheduledFuture<?> future = mScheduledExecutor.schedule(
                        r.getRunnableToCancel(),SERVICE_BINDING_TIMEOUT, TimeUnit.MILLISECONDS);
                    mScheduledFutureMap.put(call, future);
                }
                try {
                    mServiceInterface.createConference(
                            call.getConnectionManagerPhoneAccount(),
@@ -1784,11 +1786,13 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
                        }
                    }
                };
                // Post cleanup to the executor service and cache the future, so we can cancel it if
                // needed.
                ScheduledFuture<?> future = mScheduledExecutor.schedule(r.getRunnableToCancel(),
                        SERVICE_BINDING_TIMEOUT, TimeUnit.MILLISECONDS);
                if (mScheduledExecutor != null) {
                    // Post cleanup to the executor service and cache the future,
                    // so we can cancel it if needed.
                    ScheduledFuture<?> future = mScheduledExecutor.schedule(
                        r.getRunnableToCancel(),SERVICE_BINDING_TIMEOUT, TimeUnit.MILLISECONDS);
                    mScheduledFutureMap.put(call, future);
                }
                try {
                    if (mFlags.cswServiceInterfaceIsNull() && mServiceInterface == null) {
                        if (mFlags.dontTimeoutDestroyedCalls()) {