diff options
| author | Grant Menke <grantmenke@google.com> | 2025-01-09 14:32:14 -0800 |
|---|---|---|
| committer | aoleary <seanm187@gmail.com> | 2025-07-08 20:45:51 +0000 |
| commit | a4b0093c03c34c708969974ce53fbd093257006e (patch) | |
| tree | a011318291f854cba3765af2cfee2f82e89dbad7 /src | |
| parent | 5247990cb46c63c888f3af2317be9b517a6278cc (diff) | |
The scheduled executor in ConnectionServiceWrapper may be shutdown when calling createConference and createCall. This is infrequently causing a `RejectedExecutionException`. This CL adds a check that mScheduledExecutor is not shutdown before scheduling the cleanup.
Flag: EXEMPT Security High/Critical Severity CVE
Bug: 388588560
Test: manually using the provided apk + atest CallsManagerTest
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:dd63d318cf090ca2d458f772e2799614e6068006)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:ef6f10655531a06d2814c3fad25eb7cd1e117581)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5f4dfa3ead83c0b1eb9999b0389468d28347d167)
Merged-In: I0aaa0f7f57b8dd137403b6ceb7068e7c99652e1f
Change-Id: I0aaa0f7f57b8dd137403b6ceb7068e7c99652e1f
Diffstat (limited to 'src')
| -rwxr-xr-x | src/com/android/server/telecom/ConnectionServiceWrapper.java | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/src/com/android/server/telecom/ConnectionServiceWrapper.java b/src/com/android/server/telecom/ConnectionServiceWrapper.java index d30216ac8..e7b84f188 100755 --- a/src/com/android/server/telecom/ConnectionServiceWrapper.java +++ b/src/com/android/server/telecom/ConnectionServiceWrapper.java @@ -66,6 +66,7 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; @@ -1395,11 +1396,21 @@ 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); - mScheduledFutureMap.put(call, future); + if (mScheduledExecutor != null && !mScheduledExecutor.isShutdown()) { + try { + // 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); + } catch (RejectedExecutionException e) { + Log.e(this, e, "createConference: mScheduledExecutor was " + + "already shutdown"); + } + } else { + Log.w(this, "createConference: Scheduled executor is null or shutdown"); + } try { mServiceInterface.createConference( call.getConnectionManagerPhoneAccount(), @@ -1516,11 +1527,21 @@ 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); - mScheduledFutureMap.put(call, future); + if (mScheduledExecutor != null && !mScheduledExecutor.isShutdown()) { + try { + // 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); + } catch (RejectedExecutionException e) { + Log.e(this, e, "createConnection: mScheduledExecutor was " + + "already shutdown"); + } + } else { + Log.w(this, "createConnection: Scheduled executor is null or shutdown"); + } try { mServiceInterface.createConnection( call.getConnectionManagerPhoneAccount(), |
