This reverts commit c0e8ffea41
.
Reason for revert: The detected build breakage was unrelated to the aconfig change. Details in b/297881670#comment11.
Change-Id: Ia32bc2e796ed3de7fa049c2c2db340f4325a2853
47 lines
1.2 KiB
Plaintext
47 lines
1.2 KiB
Plaintext
package {package_name};
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
/** @hide */
|
|
public class FakeFeatureFlagsImpl implements FeatureFlags \{
|
|
public FakeFeatureFlagsImpl() \{
|
|
resetAll();
|
|
}
|
|
|
|
{{ for item in class_elements}}
|
|
@Override
|
|
public boolean {item.method_name}() \{
|
|
return getFlag(Flags.FLAG_{item.flag_name_constant_suffix});
|
|
}
|
|
{{ endfor}}
|
|
public void setFlag(String flagName, boolean value) \{
|
|
if (!this.mFlagMap.containsKey(flagName)) \{
|
|
throw new IllegalArgumentException("no such flag " + flagName);
|
|
}
|
|
this.mFlagMap.put(flagName, value);
|
|
}
|
|
|
|
public void resetAll() \{
|
|
for (Map.Entry entry : mFlagMap.entrySet()) \{
|
|
entry.setValue(null);
|
|
}
|
|
}
|
|
|
|
private boolean getFlag(String flagName) \{
|
|
Boolean value = this.mFlagMap.get(flagName);
|
|
if (value == null) \{
|
|
throw new IllegalArgumentException(flagName + " is not set");
|
|
}
|
|
return value;
|
|
}
|
|
|
|
private Map<String, Boolean> mFlagMap = new HashMap<>(
|
|
Map.of(
|
|
{{-for item in class_elements}}
|
|
Flags.FLAG_{item.flag_name_constant_suffix}, false{{ if not @last }},{{ endif }}
|
|
{{ -endfor }}
|
|
)
|
|
);
|
|
}
|