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

Commit f6c3e806 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/24802168',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/24802168', 'googleplex-android-review.googlesource.com/24834211'] into udc-qpr1-release.

Change-Id: I9a6284f0df464232a0dd99270ffbd7e0319841db
parents 88c8813d 47448721
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -26,6 +26,9 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.ArrayList;
import java.util.List;

@RunWith(AndroidJUnit4.class)
@SmallTest
public class BroadcastReceiverTests {
@@ -47,15 +50,22 @@ public class BroadcastReceiverTests {
    @Test
    public void testReceiverLimit() {
        final IntentFilter mockFilter = new IntentFilter("android.content.tests.TestAction");
        final List<EmptyReceiver> receivers = new ArrayList<>(RECEIVER_LIMIT_PER_APP);
        try {
            for (int i = 0; i < RECEIVER_LIMIT_PER_APP + 1; i++) {
                mContext.registerReceiver(new EmptyReceiver(), mockFilter,
                final EmptyReceiver receiver = new EmptyReceiver();
                mContext.registerReceiver(receiver, mockFilter,
                        Context.RECEIVER_EXPORTED_UNAUDITED);
                receivers.add(receiver);
            }
            fail("No exception thrown when registering "
                    + (RECEIVER_LIMIT_PER_APP + 1) + " receivers");
        } catch (IllegalStateException ise) {
            // Expected
        } finally {
            for (int i = receivers.size() - 1; i >= 0; i--) {
                mContext.unregisterReceiver(receivers.remove(i));
            }
        }
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ public class BatteryInputSuspendTest {
                    if (isCharging(intent) == mExpectedChargingState) {
                        mReady.open();
                    }
                    context.unregisterReceiver(this);
                }
            }, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
        }
+28 −6
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.graphics.Path
import android.graphics.Rect
import android.graphics.RectF
import android.os.Build
import android.os.Handler
import android.os.Looper
import android.os.RemoteException
import android.util.Log
@@ -58,7 +59,14 @@ class ActivityLaunchAnimator(
    /** The animator used when animating a Dialog into an app. */
    // TODO(b/218989950): Remove this animator and instead set the duration of the dim fade out to
    // TIMINGS.contentBeforeFadeOutDuration.
    private val dialogToAppAnimator: LaunchAnimator = DEFAULT_DIALOG_TO_APP_ANIMATOR
    private val dialogToAppAnimator: LaunchAnimator = DEFAULT_DIALOG_TO_APP_ANIMATOR,

    /**
     * Whether we should disable the WindowManager timeout. This should be set to true in tests
     * only.
     */
    // TODO(b/301385865): Remove this flag.
    private val disableWmTimeout: Boolean = false,
) {
    companion object {
        /** The timings when animating a View into an app. */
@@ -432,7 +440,8 @@ class ActivityLaunchAnimator(
        internal val delegate: AnimationDelegate

        init {
            delegate = AnimationDelegate(controller, callback, listener, launchAnimator)
            delegate =
                AnimationDelegate(controller, callback, listener, launchAnimator, disableWmTimeout)
        }

        @BinderThread
@@ -462,13 +471,26 @@ class ActivityLaunchAnimator(
        /** Listener for animation lifecycle events. */
        private val listener: Listener? = null,
        /** The animator to use to animate the window launch. */
        private val launchAnimator: LaunchAnimator = DEFAULT_LAUNCH_ANIMATOR
        private val launchAnimator: LaunchAnimator = DEFAULT_LAUNCH_ANIMATOR,

        /**
         * Whether we should disable the WindowManager timeout. This should be set to true in tests
         * only.
         */
        // TODO(b/301385865): Remove this flag.
        disableWmTimeout: Boolean = false,
    ) : RemoteAnimationDelegate<IRemoteAnimationFinishedCallback> {
        private val launchContainer = controller.launchContainer
        private val context = launchContainer.context
        private val transactionApplierView =
            controller.openingWindowSyncView ?: controller.launchContainer
        private val transactionApplier = SyncRtSurfaceTransactionApplier(transactionApplierView)
        private val timeoutHandler =
            if (!disableWmTimeout) {
                Handler(Looper.getMainLooper())
            } else {
                null
            }

        private val matrix = Matrix()
        private val invertMatrix = Matrix()
@@ -488,11 +510,11 @@ class ActivityLaunchAnimator(

        @UiThread
        internal fun postTimeout() {
            launchContainer.postDelayed(onTimeout, LAUNCH_TIMEOUT)
            timeoutHandler?.postDelayed(onTimeout, LAUNCH_TIMEOUT)
        }

        private fun removeTimeout() {
            launchContainer.removeCallbacks(onTimeout)
            timeoutHandler?.removeCallbacks(onTimeout)
        }

        @UiThread
+2 −1
Original line number Diff line number Diff line
@@ -57,7 +57,8 @@ class ActivityLaunchAnimatorTest : SysuiTestCase() {

    @Before
    fun setup() {
        activityLaunchAnimator = ActivityLaunchAnimator(testLaunchAnimator, testLaunchAnimator)
        activityLaunchAnimator =
            ActivityLaunchAnimator(testLaunchAnimator, testLaunchAnimator, disableWmTimeout = true)
        activityLaunchAnimator.callback = callback
        activityLaunchAnimator.addListener(listener)
    }