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

Commit 29ec3f25 authored by Lee Shombert's avatar Lee Shombert
Browse files

Remove obsolete AnrTimer Java code

This removes obsolete AnrTimer java code.  The aconfig flag is unused
but it is retained for use in the next CL.  The unit test is updated.

Test: atest
 * FrameworksServicesTests:com.android.server.am
 * FrameworksServicesTests:com.android.server.utils
 * FrameworksMockingServicesTests:com.android.server.am

Bug: 282428924

Change-Id: I131f329f2651a4a316bc4de8fa2e905c267b10f3
parent 3d182295
Loading
Loading
Loading
Loading
+67 −650

File changed.

Preview size limit exceeded, changes collapsed.

+27 −0
Original line number Diff line number Diff line
@@ -30,13 +30,19 @@ import androidx.test.filters.SmallTest;
import com.android.internal.annotations.GuardedBy;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

@SmallTest
@Presubmit
@RunWith(Parameterized.class)
public class AnrTimerTest {

    // The commonly used message timeout key.
@@ -105,6 +111,16 @@ public class AnrTimerTest {
        }
    }

    /**
     * Force AnrTimer to use the test parameter for the feature flag.
     */
    class TestInjector extends AnrTimer.Injector {
        @Override
        boolean anrTimerServiceEnabled() {
            return mEnabled;
        }
    }

    /**
     * An instrumented AnrTimer.
     */
@@ -137,6 +153,17 @@ public class AnrTimerTest {
        assertEquals(actual.what, MSG_TIMEOUT);
    }

    @Parameters(name = "featureEnabled={0}")
    public static Collection<Object[]> data() {
        return Arrays.asList(new Object[][] { {false}, {true} });
    }

    /** True if the feature is enabled. */
    private boolean mEnabled;

    public AnrTimerTest(boolean featureEnabled) {
        mEnabled = featureEnabled;
    }

    /**
     * Verify that a simple expiration succeeds.  The timer is started for 10ms.  The test