Loading services/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ java_defaults { // "-Xep:AndroidFrameworkUid:ERROR", "-Xep:SelfEquals:ERROR", "-Xep:NullTernary:ERROR", "-Xep:TryFailThrowable:ERROR", // NOTE: only enable to generate local patchfiles // "-XepPatchChecks:refaster:frameworks/base/errorprone/refaster/EfficientXml.java.refaster", // "-XepPatchLocation:/tmp/refaster/", Loading services/tests/servicestests/src/com/android/server/am/ActivityManagerUtilsTest.java +12 −10 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ package com.android.server.am; import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.fail; import static org.junit.Assert.assertTrue; import androidx.test.filters.SmallTest; Loading Loading @@ -89,18 +89,20 @@ public class ActivityManagerUtilsTest { } @Test public void testSheckShouldSamplePackage() { public void testCheckShouldSamplePackage() { // Just make sure checkShouldSamplePackage is actually working... try { checkShouldSamplePackage(0.3f, 0.6f, false, true); fail(); } catch (AssertionError expected) { assertFailure(() -> checkShouldSamplePackage(0.3f, 0.6f, false, true)); assertFailure(() -> checkShouldSamplePackage(0.6f, 0.3f, true, false)); } private static void assertFailure(Runnable r) { boolean failed = false; try { checkShouldSamplePackage(0.6f, 0.3f, true, false); fail(); } catch (AssertionError expected) { r.run(); } catch (AssertionError e) { failed = true; } assertTrue(failed); } private void checkShouldSamplePackage(float inputSampleRate, float expectedRate, Loading Loading
services/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ java_defaults { // "-Xep:AndroidFrameworkUid:ERROR", "-Xep:SelfEquals:ERROR", "-Xep:NullTernary:ERROR", "-Xep:TryFailThrowable:ERROR", // NOTE: only enable to generate local patchfiles // "-XepPatchChecks:refaster:frameworks/base/errorprone/refaster/EfficientXml.java.refaster", // "-XepPatchLocation:/tmp/refaster/", Loading
services/tests/servicestests/src/com/android/server/am/ActivityManagerUtilsTest.java +12 −10 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ package com.android.server.am; import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.fail; import static org.junit.Assert.assertTrue; import androidx.test.filters.SmallTest; Loading Loading @@ -89,18 +89,20 @@ public class ActivityManagerUtilsTest { } @Test public void testSheckShouldSamplePackage() { public void testCheckShouldSamplePackage() { // Just make sure checkShouldSamplePackage is actually working... try { checkShouldSamplePackage(0.3f, 0.6f, false, true); fail(); } catch (AssertionError expected) { assertFailure(() -> checkShouldSamplePackage(0.3f, 0.6f, false, true)); assertFailure(() -> checkShouldSamplePackage(0.6f, 0.3f, true, false)); } private static void assertFailure(Runnable r) { boolean failed = false; try { checkShouldSamplePackage(0.6f, 0.3f, true, false); fail(); } catch (AssertionError expected) { r.run(); } catch (AssertionError e) { failed = true; } assertTrue(failed); } private void checkShouldSamplePackage(float inputSampleRate, float expectedRate, Loading