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

Unverified Commit 88fda357 authored by Kevin F. Haggerty's avatar Kevin F. Haggerty
Browse files

Merge tag 'android-security-14.0.0_r19' into staging/lineage-21.0_android-security-14.0.0_r19

Android security 14.0.0 release 19

* tag 'android-security-14.0.0_r19':
  Revert "Resolve cross account user ringtone validation."
  Resolve cross account user ringtone validation.
  Ensure ScheduledExecutor is not shutdown before scheduling timeout cleanup.
  Ensure connection is unbound on call redirection timeout.

Change-Id: I3214b16e4b7a868ccc20ad121b037d638300d843
parents 4707f344 6cd89543
Loading
Loading
Loading
Loading
+31 −10
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ import java.util.concurrent.CompletableFuture;
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;
@@ -1657,11 +1658,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);
                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(),
@@ -1780,11 +1791,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);
                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(),
+8 −0
Original line number Diff line number Diff line
@@ -133,6 +133,14 @@ public class CallRedirectionProcessor implements CallRedirectionCallback {
                            + mServiceType + " call redirection service");
                }
            }
            Log.i(this, "notifyTimeout: call redirection has timed out so "
                    + "unbinding the connection");
            if (mConnection != null) {
                // We still need to call unbind even if the service disconnected.
                mContext.unbindService(mConnection);
                mConnection = null;
            }
            mService = null;
        }

        private class CallRedirectionServiceConnection implements ServiceConnection {
+12 −0
Original line number Diff line number Diff line
@@ -221,6 +221,9 @@ public class CallRedirectionProcessorTest extends TelecomTestCase {
        verify(mCallsManager, times(1)).onCallRedirectionComplete(eq(mCall), any(),
                eq(mPhoneAccountHandle), eq(null), eq(SPEAKER_PHONE_ON), eq(VIDEO_STATE),
                eq(false), eq(CallRedirectionProcessor.UI_TYPE_NO_ACTION));
        // Verify service was unbound
        verify(mContext, times(1)).
                unbindService(any(ServiceConnection.class));
    }

    @Test
@@ -249,6 +252,9 @@ public class CallRedirectionProcessorTest extends TelecomTestCase {
        verify(mCallsManager, times(1)).onCallRedirectionComplete(eq(mCall), any(),
                eq(mPhoneAccountHandle), eq(null), eq(SPEAKER_PHONE_ON), eq(VIDEO_STATE),
                eq(true), eq(CallRedirectionProcessor.UI_TYPE_USER_DEFINED_TIMEOUT));
        // Verify service was unbound
        verify(mContext, times(1)).
                unbindService(any(ServiceConnection.class));
    }

    @Test
@@ -280,6 +286,9 @@ public class CallRedirectionProcessorTest extends TelecomTestCase {
        verify(mCallsManager, times(1)).onCallRedirectionComplete(eq(mCall), any(),
                eq(mPhoneAccountHandle), eq(null), eq(SPEAKER_PHONE_ON), eq(VIDEO_STATE),
                eq(true), eq(CallRedirectionProcessor.UI_TYPE_USER_DEFINED_TIMEOUT));
        // Verify service was unbound
        verify(mContext, times(1)).
                unbindService(any(ServiceConnection.class));

        // Wait for another carrier timeout time, but should not expect any carrier service request
        // is triggered.
@@ -289,6 +298,9 @@ public class CallRedirectionProcessorTest extends TelecomTestCase {
        verify(mCallsManager, times(1)).onCallRedirectionComplete(eq(mCall), any(),
                eq(mPhoneAccountHandle), eq(null), eq(SPEAKER_PHONE_ON), eq(VIDEO_STATE),
                eq(true), eq(CallRedirectionProcessor.UI_TYPE_USER_DEFINED_TIMEOUT));
        // Verify service was unbound
        verify(mContext, times(1)).
                unbindService(any(ServiceConnection.class));
    }

    @Test