The namespace and flag names will be used as identifiers in the auto-generated code. Place restrictions on what constitutes a valid name. Valid identifiers are those that match /[a-z][a-z0-9_]/. aconfig explicitly does not implement any automatic translation to make names valid identifiers: this sidesteps potential conflicts such as "foo.bar" and "foo_bar" mapping to the same name if dots were translated to underscores. Bug: b/284252015 Test: atest aconfig.test Change-Id: I38d005a74311e5829e540063404d1565071e6e96
20 lines
513 B
Plaintext
20 lines
513 B
Plaintext
package aconfig.{namespace};
|
|
{{ if readwrite }}
|
|
import android.provider.DeviceConfig;
|
|
{{ endif }}
|
|
public final class Flags \{
|
|
{{ for item in class_elements}}
|
|
public static boolean {item.method_name}() \{
|
|
{{ if item.readwrite- }}
|
|
return DeviceConfig.getBoolean(
|
|
"{namespace}",
|
|
"{item.feature_name}__{item.flag_name}",
|
|
{item.default_value}
|
|
);
|
|
{{ -else- }}
|
|
return {item.default_value};
|
|
{{ -endif }}
|
|
}
|
|
{{ endfor }}
|
|
}
|