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

Commit 4551f26d authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Use ShowErrorDialogsRule in AnrTest

This will help ensure that the setting is restored, without doing much
explicit work in the test itself.

Bug: 339924248
Flag: TEST_ONLY
Test: atest AnrTest
Change-Id: If06d496589a205881aaee2848b80ad91cae6c648
parent 9e143645
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -27,8 +27,6 @@ import android.hardware.display.DisplayManager
import android.os.Build
import android.os.IInputConstants.UNMULTIPLIED_DEFAULT_DISPATCHING_TIMEOUT_MILLIS
import android.os.SystemClock
import android.provider.Settings
import android.provider.Settings.Global.HIDE_ERROR_DIALOGS
import android.server.wm.CtsWindowInfoUtils.waitForStableWindowGeometry
import android.testing.PollingCheck

@@ -38,6 +36,7 @@ import androidx.test.uiautomator.UiObject2
import androidx.test.uiautomator.Until

import com.android.cts.input.DebugInputRule
import com.android.cts.input.ShowErrorDialogsRule
import com.android.cts.input.UinputTouchScreen

import java.time.Duration
@@ -79,18 +78,16 @@ class AnrTest {
    @get:Rule
    val debugInputRule = DebugInputRule()

    @get:Rule
    val showErrorDialogs = ShowErrorDialogsRule()

    @Before
    fun setUp() {
        val contentResolver = instrumentation.targetContext.contentResolver
        hideErrorDialogs = Settings.Global.getInt(contentResolver, HIDE_ERROR_DIALOGS, 0)
        Settings.Global.putInt(contentResolver, HIDE_ERROR_DIALOGS, 0)
        PACKAGE_NAME = UnresponsiveGestureMonitorActivity::class.java.getPackage()!!.getName()
    }

    @After
    fun tearDown() {
        val contentResolver = instrumentation.targetContext.contentResolver
        Settings.Global.putInt(contentResolver, HIDE_ERROR_DIALOGS, hideErrorDialogs)
    }

    @Test