aconfig: generate full fakefeatureflagsimpl in prod mode

This change will generate full fakefeatureflagsimpl in prod mode.
FakeFeatureFlagsImp will be the same in test mode and the prod mode.
FeatureFlagsImpl will be all unimplemented in test mode. setFlag,
resetAll are added into the interface FeatureFlags.

The reason to make this change is for project using injection pattern,
the project doesn't have to use test mode to test the flag guarded code.
The project can directly use the FakeFeatureFlagsImpl for testing.

Bug: 294838180
Test: atest AconfigJavaHostTest --host AND atest aconfig.test.java
Change-Id: Ib6d40fd3a9ef872e01594fd4f8d6c4cb10bb173a
This commit is contained in:
Zhi Dou
2023-08-15 19:33:27 +00:00
parent 5d7f9cb2a1
commit 06a448fac7
6 changed files with 81 additions and 148 deletions

View File

@@ -17,7 +17,7 @@ public final class FeatureFlagsImpl implements FeatureFlags \{
return {item.default_value};
{{ endif- }}
}
{{ endfor- }}
{{ endfor }}
}
{{ else }}
{#- Generate only stub if in test mode #}
@@ -28,17 +28,6 @@ public final class FeatureFlagsImpl implements FeatureFlags \{
throw new UnsupportedOperationException(
"Method is not implemented.");
}
{{ endfor- }}
@Override
public void setFlag(String flagName, boolean value) \{
throw new UnsupportedOperationException(
"Method is not implemented.");
}
@Override
public void resetAll() \{
throw new UnsupportedOperationException(
"Method is not implemented.");
}
{{ endfor }}
}
{{ endif }}