Added notes on AbstractAdServicesFlagsSetterRule about using setFlags()
Bug: 300146214
Test: unfortunately not
Change-Id: I88a2c188f609d8e82eab4376f64cdfb99c0c1242
diff --git a/adservices/tests/test-util/side-less/com/android/adservices/common/AbstractAdServicesFlagsSetterRule.java b/adservices/tests/test-util/side-less/com/android/adservices/common/AbstractAdServicesFlagsSetterRule.java
index a8aa3ea..cb0d7ee 100644
--- a/adservices/tests/test-util/side-less/com/android/adservices/common/AbstractAdServicesFlagsSetterRule.java
+++ b/adservices/tests/test-util/side-less/com/android/adservices/common/AbstractAdServicesFlagsSetterRule.java
@@ -46,6 +46,11 @@
* <p>Most methods set {@link android.provider.DeviceConfig} flags, although some sets {@link
* android.os.SystemProperties} instead - those are typically suffixed with {@code forTests}
*/
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// NOTE: DO NOT add new setXyz() methods, unless they need non-trivial logic. Instead, let your //
+// test call setFlags(flagName) (statically import FlagsConstant.flagName), which will make it //
+// easier to transition the test to an annotated-base approach. //
+////////////////////////////////////////////////////////////////////////////////////////////////////
abstract class AbstractAdServicesFlagsSetterRule<T extends AbstractAdServicesFlagsSetterRule<T>>
implements TestRule {
@@ -362,7 +367,7 @@
/**
* Overrides flag used by {@link com.android.adservices.service.PhFlags#getPpapiAppAllowList()}.
*/
- // <p> TODO (b/303901926) - apploy consistent naming to allow list methods
+ // <p> TODO (b/303901926) - apply consistent naming to allow list methods
public T setPpapiAppAllowList(String value) {
return setOrCacheFlag(FlagsConstants.KEY_PPAPI_APP_ALLOW_LIST, value, ALLOWLIST_SEPARATOR);
}
@@ -429,6 +434,12 @@
return setFlag(FlagsConstants.KEY_MDD_BACKGROUND_TASK_KILL_SWITCH, value);
}
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ // NOTE: DO NOT add new setXyz() methods, unless they need non-trivial logic. Instead, let //
+ // your test call setFlags(flagName) (statically import FlagsConstant.flagName), which will //
+ // make it easier to transition the test to an annotated-base approach. //
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+
/**
* Sets all flags needed to enable compatibility mode, according to the Android version of the
* device running the test.
@@ -481,6 +492,12 @@
});
}
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ // NOTE: DO NOT add new setXyz() methods, unless they need non-trivial logic. Instead, let //
+ // your test call setFlags(flagName) (statically import FlagsConstant.flagName), which will //
+ // make it easier to transition the test to an annotated-base approach. //
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+
/**
* @deprecated only used by {@code CompatAdServicesTestUtils.resetFlagsToDefault()} - flags are
* automatically reset when used as a JUnit Rule.