Merge "Fix the testDumpOutput presubmit test" into main
diff --git a/services/core/java/com/android/server/utils/AnrTimer.java b/services/core/java/com/android/server/utils/AnrTimer.java
index 743005a..b7d8cfc 100644
--- a/services/core/java/com/android/server/utils/AnrTimer.java
+++ b/services/core/java/com/android/server/utils/AnrTimer.java
@@ -767,7 +767,7 @@
* Return true if the native timers are supported. Native timers are supported if the method
* nativeAnrTimerSupported() can be executed and it returns true.
*/
- private static boolean nativeTimersSupported() {
+ public static boolean nativeTimersSupported() {
try {
return nativeAnrTimerSupported();
} catch (java.lang.UnsatisfiedLinkError e) {
diff --git a/services/tests/servicestests/src/com/android/server/utils/AnrTimerTest.java b/services/tests/servicestests/src/com/android/server/utils/AnrTimerTest.java
index c8bef45..076d5ca 100644
--- a/services/tests/servicestests/src/com/android/server/utils/AnrTimerTest.java
+++ b/services/tests/servicestests/src/com/android/server/utils/AnrTimerTest.java
@@ -312,10 +312,12 @@
}
/**
- * Verify the dump output.
+ * Verify the dump output. This only applies when native timers are supported.
*/
@Test
public void testDumpOutput() throws Exception {
+ if (!AnrTimer.nativeTimersSupported()) return;
+
String r1 = getDumpOutput();
assertThat(r1).doesNotContain("timer:");