Loading core/tests/systemproperties/src/android/os/SystemPropertiesTest.java +4 −3 Original line number Diff line number Diff line Loading @@ -23,10 +23,11 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import android.platform.test.ravenwood.RavenwoodConfig; import android.platform.test.ravenwood.RavenwoodRule; import androidx.test.filters.SmallTest; import org.junit.Rule; import org.junit.Test; import java.util.Objects; Loading @@ -39,8 +40,8 @@ public class SystemPropertiesTest { private static final String PERSIST_KEY = "persist.sys.testkey"; private static final String NONEXIST_KEY = "doesnotexist_2341431"; @RavenwoodConfig.Config public static final RavenwoodConfig mRavenwood = new RavenwoodConfig.Builder() @Rule public final RavenwoodRule mRavenwood = new RavenwoodRule.Builder() .setSystemPropertyMutable(KEY, null) .setSystemPropertyMutable(UNSET_KEY, null) .setSystemPropertyMutable(PERSIST_KEY, null) Loading ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodConfig.java +16 −18 Original line number Diff line number Diff line Loading @@ -142,34 +142,32 @@ public final class RavenwoodConfig { } /** * Configure the given system property as immutable for the duration of the test. * Read access to the key is allowed, and write access will fail. When {@code value} is * {@code null}, the value is left as undefined. * * All properties in the {@code debug.*} namespace are automatically mutable, with no * developer action required. * * Has no effect on non-Ravenwood environments. * @deprecated Use {@link RavenwoodRule.Builder#setSystemPropertyImmutable(String, Object)} */ @Deprecated public Builder setSystemPropertyImmutable(@NonNull String key, @Nullable Object value) { mConfig.mSystemProperties.setValue(key, value); mConfig.mSystemProperties.setAccessReadOnly(key); return this; } /** * Configure the given system property as mutable for the duration of the test. * Both read and write access to the key is allowed, and its value will be reset between * each test. When {@code value} is {@code null}, the value is left as undefined. * * All properties in the {@code debug.*} namespace are automatically mutable, with no * developer action required. * * Has no effect on non-Ravenwood environments. * @deprecated Use {@link RavenwoodRule.Builder#setSystemPropertyMutable(String, Object)} */ @Deprecated public Builder setSystemPropertyMutable(@NonNull String key, @Nullable Object value) { return this; } Builder setSystemPropertyImmutableReal(@NonNull String key, @Nullable Object value) { mConfig.mSystemProperties.setValue(key, value); mConfig.mSystemProperties.setAccessReadOnly(key); return this; } Builder setSystemPropertyMutableReal(@NonNull String key, @Nullable Object value) { mConfig.mSystemProperties.setValue(key, value); mConfig.mSystemProperties.setAccessReadWrite(key); return this; Loading ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java +2 −2 Original line number Diff line number Diff line Loading @@ -152,7 +152,7 @@ public final class RavenwoodRule implements TestRule { * Has no effect on non-Ravenwood environments. */ public Builder setSystemPropertyImmutable(@NonNull String key, @Nullable Object value) { mBuilder.setSystemPropertyImmutable(key, value); mBuilder.setSystemPropertyImmutableReal(key, value); return this; } Loading @@ -167,7 +167,7 @@ public final class RavenwoodRule implements TestRule { * Has no effect on non-Ravenwood environments. */ public Builder setSystemPropertyMutable(@NonNull String key, @Nullable Object value) { mBuilder.setSystemPropertyMutable(key, value); mBuilder.setSystemPropertyMutableReal(key, value); return this; } Loading services/tests/powerstatstests/src/com/android/server/power/stats/WakelockPowerStatsCollectorTest.java +4 −6 Original line number Diff line number Diff line Loading @@ -26,8 +26,7 @@ import android.content.Context; import android.os.Process; import android.platform.test.annotations.DisableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.platform.test.ravenwood.RavenwoodConfig; import android.platform.test.ravenwood.RavenwoodConfig.Config; import android.platform.test.ravenwood.RavenwoodRule; import com.android.internal.os.PowerStats; import com.android.server.power.feature.flags.Flags; Loading @@ -39,10 +38,9 @@ import org.junit.Test; public class WakelockPowerStatsCollectorTest { @Config public static final RavenwoodConfig sConfig = new RavenwoodConfig.Builder() .setProvideMainThread(true) @Rule public final RavenwoodRule mRule = new RavenwoodRule.Builder() .setSystemPropertyImmutable( "persist.sys.com.android.server.power.feature.flags." + "framework_wakelock_info-override", Loading Loading
core/tests/systemproperties/src/android/os/SystemPropertiesTest.java +4 −3 Original line number Diff line number Diff line Loading @@ -23,10 +23,11 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import android.platform.test.ravenwood.RavenwoodConfig; import android.platform.test.ravenwood.RavenwoodRule; import androidx.test.filters.SmallTest; import org.junit.Rule; import org.junit.Test; import java.util.Objects; Loading @@ -39,8 +40,8 @@ public class SystemPropertiesTest { private static final String PERSIST_KEY = "persist.sys.testkey"; private static final String NONEXIST_KEY = "doesnotexist_2341431"; @RavenwoodConfig.Config public static final RavenwoodConfig mRavenwood = new RavenwoodConfig.Builder() @Rule public final RavenwoodRule mRavenwood = new RavenwoodRule.Builder() .setSystemPropertyMutable(KEY, null) .setSystemPropertyMutable(UNSET_KEY, null) .setSystemPropertyMutable(PERSIST_KEY, null) Loading
ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodConfig.java +16 −18 Original line number Diff line number Diff line Loading @@ -142,34 +142,32 @@ public final class RavenwoodConfig { } /** * Configure the given system property as immutable for the duration of the test. * Read access to the key is allowed, and write access will fail. When {@code value} is * {@code null}, the value is left as undefined. * * All properties in the {@code debug.*} namespace are automatically mutable, with no * developer action required. * * Has no effect on non-Ravenwood environments. * @deprecated Use {@link RavenwoodRule.Builder#setSystemPropertyImmutable(String, Object)} */ @Deprecated public Builder setSystemPropertyImmutable(@NonNull String key, @Nullable Object value) { mConfig.mSystemProperties.setValue(key, value); mConfig.mSystemProperties.setAccessReadOnly(key); return this; } /** * Configure the given system property as mutable for the duration of the test. * Both read and write access to the key is allowed, and its value will be reset between * each test. When {@code value} is {@code null}, the value is left as undefined. * * All properties in the {@code debug.*} namespace are automatically mutable, with no * developer action required. * * Has no effect on non-Ravenwood environments. * @deprecated Use {@link RavenwoodRule.Builder#setSystemPropertyMutable(String, Object)} */ @Deprecated public Builder setSystemPropertyMutable(@NonNull String key, @Nullable Object value) { return this; } Builder setSystemPropertyImmutableReal(@NonNull String key, @Nullable Object value) { mConfig.mSystemProperties.setValue(key, value); mConfig.mSystemProperties.setAccessReadOnly(key); return this; } Builder setSystemPropertyMutableReal(@NonNull String key, @Nullable Object value) { mConfig.mSystemProperties.setValue(key, value); mConfig.mSystemProperties.setAccessReadWrite(key); return this; Loading
ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java +2 −2 Original line number Diff line number Diff line Loading @@ -152,7 +152,7 @@ public final class RavenwoodRule implements TestRule { * Has no effect on non-Ravenwood environments. */ public Builder setSystemPropertyImmutable(@NonNull String key, @Nullable Object value) { mBuilder.setSystemPropertyImmutable(key, value); mBuilder.setSystemPropertyImmutableReal(key, value); return this; } Loading @@ -167,7 +167,7 @@ public final class RavenwoodRule implements TestRule { * Has no effect on non-Ravenwood environments. */ public Builder setSystemPropertyMutable(@NonNull String key, @Nullable Object value) { mBuilder.setSystemPropertyMutable(key, value); mBuilder.setSystemPropertyMutableReal(key, value); return this; } Loading
services/tests/powerstatstests/src/com/android/server/power/stats/WakelockPowerStatsCollectorTest.java +4 −6 Original line number Diff line number Diff line Loading @@ -26,8 +26,7 @@ import android.content.Context; import android.os.Process; import android.platform.test.annotations.DisableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.platform.test.ravenwood.RavenwoodConfig; import android.platform.test.ravenwood.RavenwoodConfig.Config; import android.platform.test.ravenwood.RavenwoodRule; import com.android.internal.os.PowerStats; import com.android.server.power.feature.flags.Flags; Loading @@ -39,10 +38,9 @@ import org.junit.Test; public class WakelockPowerStatsCollectorTest { @Config public static final RavenwoodConfig sConfig = new RavenwoodConfig.Builder() .setProvideMainThread(true) @Rule public final RavenwoodRule mRule = new RavenwoodRule.Builder() .setSystemPropertyImmutable( "persist.sys.com.android.server.power.feature.flags." + "framework_wakelock_info-override", Loading