AconfigPackage
public
class
AconfigPackage
extends Object
java.lang.Object | |
↳ | android.os.flagging.AconfigPackage |
An aconfig
package containing the enabled state of its flags.
Note: this is intended only to be used by generated code. To determine if a given flag is enabled in app code, the generated android flags should be used.
This class is used to read the flag from Aconfig Package.Each instance of this class will
cache information related to one package. To read flags from a different package, a new instance
of this class should be loaded
.
Summary
Public methods | |
---|---|
boolean
|
getBooleanFlagValue(String flagName, boolean defaultValue)
Retrieves the value of a boolean flag. |
static
AconfigPackage
|
load(String packageName)
Loads an Aconfig Package from Aconfig Storage. |
Inherited methods | |
---|---|
Public methods
getBooleanFlagValue
public boolean getBooleanFlagValue (String flagName, boolean defaultValue)
Retrieves the value of a boolean flag.
This method retrieves the value of the specified flag. If the flag exists within the loaded Aconfig Package, its value is returned. Otherwise, the provided `defaultValue` is returned.
Parameters | |
---|---|
flagName |
String : The name of the flag (excluding any package name prefix).
This value cannot be null . |
defaultValue |
boolean : The value to return if the flag is not found. |
Returns | |
---|---|
boolean |
The boolean value of the flag, or `defaultValue` if the flag is not found. |
load
public static AconfigPackage load (String packageName)
Loads an Aconfig Package from Aconfig Storage.
This method attempts to load the specified Aconfig package.
Parameters | |
---|---|
packageName |
String : The name of the Aconfig package to load.
This value cannot be null . |
Returns | |
---|---|
AconfigPackage |
An instance of AconfigPackage , which may be empty if the package is not found
in the container.
This value cannot be null . |
Throws | |
---|---|
AconfigStorageReadException |
if there is an error reading from Aconfig Storage, such
as if the storage system is not found, the package is not found, or there is an error
reading the storage file. The specific error code can be obtained using AconfigStorageReadException.getErrorCode() . |