Sequenceablepublic class AbilityInfo extends Object implements Sequenceable
| 限定符和类型 | 类 | 说明 |
|---|---|---|
static class |
AbilityInfo.AbilitySubType |
Enumerates subtypes of templates that can be used by an ability.
|
static class |
AbilityInfo.AbilityType |
Enumerates types of templates that can be used by an ability.
|
static class |
AbilityInfo.DisplayOrientation |
Enumerates ability display orientations.
|
static class |
AbilityInfo.LaunchMode |
Enumerates ability launch modes.
|
Sequenceable.Producer<T>| 限定符和类型 | 字段 | 说明 |
|---|---|---|
String |
bundleName |
Indicates the name of the bundle containing the ability.
|
String |
className |
Indicates the class name of the ability.
|
boolean |
enabled |
Indicates whether or not this ability may be instantiated.
|
String |
label |
Indicates the label of the ability
|
static Sequenceable.Producer<AbilityInfo> |
PRODUCER |
Creates a
AbilityInfo instance from a Parcel. |
| 构造器 | 说明 |
|---|---|
AbilityInfo() |
Default constructor used to create an
AbilityInfo instance. |
AbilityInfo(AbilityInfo source) |
A constructor used to create an
AbilityInfo instance by copying parameters from an
existing one. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
dump(String prefix,
PrintWriter writer) |
Prints the ability information into a specified target.
|
ApplicationInfo |
getApplicationInfo() |
Obtains information about the current application.
|
int |
getBackgroundModes() |
Obtains the
backgroundModes tag of an ability. |
String |
getBundleName() |
Obtains the name of the bundle containing the ability.
|
String |
getClassName() |
Obtains the class name of an ability.
|
int |
getDefaultFormHeight() |
Obtains the default height of an
AbilityForm. |
int |
getDefaultFormWidth() |
Obtains the default width of an
AbilityForm. |
String |
getDescription() |
Obtains the description of an ability.
|
List<String> |
getDeviceCapabilities() |
Obtains the device capabilities required for running an ability.
|
List<String> |
getDeviceTypes() |
Obtains the types of devices where an ability can run.
|
boolean |
getFormEnabled() |
Obtains the
formEnabled tag of an ability. |
int |
getFormEntity() |
Obtains the area where an
AbilityForm can be displayed. |
String |
getIconPath() |
Obtains the path where the icon resource file of an ability is saved.
|
String |
getLabel() |
Obtains the name of an ability that is visible to users or the resource index of the ability name.
|
AbilityInfo.LaunchMode |
getLaunchMode() |
Obtains the launch mode of an ability, either
singleton or standard. |
int |
getMinFormHeight() |
Obtains the minimum height of an
AbilityForm. |
int |
getMinFormWidth() |
Obtains the minimum width of an
AbilityForm. |
String |
getModuleName() |
Obtains the
module-name tag of an ability. |
AbilityInfo.DisplayOrientation |
getOrientation() |
Obtains the display orientation of an ability.
|
String |
getOriginalClassName() |
Obtains the original class name of an ability.
|
List<String> |
getPermissions() |
Obtains the permissions required for other abilities to call the current ability.
|
String |
getProcess() |
Obtains the name of the process where this ability should run.
|
String |
getReadPermission() |
Obtains the permission required for reading a data ability.
|
String |
getTargetAbility() |
Obtains the target ability that this ability points to.
|
AbilityInfo.AbilityType |
getType() |
Obtains the type of templates used by an ability.
|
String |
getURI() |
Obtains the Uniform Resource Identifier (URI) of an ability.
|
String |
getWritePermission() |
Obtains the permission required for writing a data ability.
|
boolean |
isDifferentName() |
Judge whether the ability is in harmony transition stage.
|
boolean |
isVisible() |
Checks whether an ability can be called by other abilities.
|
boolean |
marshalling(Parcel out) |
Marshals this
Sequenceable object into a Parcel. |
String |
toString() |
Provide name and hashCode of abilityInfo.
|
boolean |
unmarshalling(Parcel in) |
Unmarshals this
Sequenceable object from a Parcel. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waithasFileDescriptorpublic static final Sequenceable.Producer<AbilityInfo> PRODUCER
AbilityInfo instance from a Parcel.public String bundleName
public String className
The class name is formed by combining the bundle name and the value of the name tag of the
ability.
public boolean enabled
public String label
public AbilityInfo()
AbilityInfo instance.public AbilityInfo(AbilityInfo source)
AbilityInfo instance by copying parameters from an
existing one.source - Indicates the AbilityInfo object.public String getLabel()
You can configure the label tag in the configuration file. The default value is the value
of the name tag, and you can retain the default value.
public String getDescription()
The description of an ability can be a character string, or a resource index of the description. You can configure the description in the configuration file. The default value is an empty string, and you can retain the default value.
public String getIconPath()
You can configure the icon tag in the configuration file. The default value is an empty string,
and you can retain the default value.
public boolean isVisible()
You can configure the visible tag in the configuration file. The default value is false,
and you can retain the default value.
true if the ability can be called by other abilities; returns false otherwise.public AbilityInfo.AbilityType getType()
Ability has three types of templates:
AbilityType#PAGE with a UI,
AbilityType#SERVICE without a UI,
and AbilityType#DATA that provides data access services.
The type tag must be specified. You must have configured it in the configuration file.
public AbilityInfo.DisplayOrientation getOrientation()
orientation is valid only for abilities using the Page template. It can be any of the following
values:
DisplayOrientation#UNSPECIFIED: The system automatically determines the display orientation of
an ability.DisplayOrientation#LANDSCAPE: An ability is displayed in landscape orientation.DisplayOrientation#PORTRAIT: An ability is displayed in portrait orientation.DisplayOrientation#FOLLOWRECENT: An ability is displayed orientation same as the recent ability
in stack.You can configure this tag in the configuration file. The default value is unspecified,
and you can retain the default value.
public AbilityInfo.LaunchMode getLaunchMode()
singleton or standard.
In LaunchMode#STANDARD pattern, an ability can have multiple instances,
while in LaunchMode#SINGLETON pattern, an ability has only a single instance.
You can configure the launch-mode tag in the configuration file. The default value is singleton,
and you can retain the default value.
public String getBundleName()
public String getClassName()
The class name is formed by combining the bundle name and the value of the name tag of the
ability.
public String getOriginalClassName()
The shell class name is formed by combining the shell bundle name and the value of the name tag of the
shell ability.
public List<String> getPermissions()
Each permission must be a character string, which is usually a reverse domain name.
You can specify either predefined permissions or permissions customized by the application.
The name of a customized permission specified in this tag must be the same as the value of name of a
permission defined in the def-permissions tag.
You can configure the permissions tag in the configuration file. The default value is an empty list,
and you can retain the default value.
public List<String> getDeviceTypes()
device-type specifies the types of devices running an ability. The predefined types are
tv, pc, car, and watch.
You can configure this tag in the configuration file.
public List<String> getDeviceCapabilities()
device-capability indicates the capabilities that a device should have for running an ability. The
capabilities must be consistent with those described in the profile file of the device.
You can configure this tag in the configuration file. The default value is an empty list, indicating that
no device capabilities are required for running the ability, and you can retain the default value.
public String getURI()
public boolean isDifferentName()
true if the ability is in harmony transition stage; returns false otherwise.public String getModuleName()
module-name tag of an ability.
module-name indicates the name of the HAP file which the ability belongs to. This tag is automatically
generated by the IDE.
public String getProcess()
The process name is set in the process attribute of this ability in the config.json
file. If it is not set, the process attribute set for the application is used by default.
public String getTargetAbility()
If you have set the targetAbility attribute for this ability in config.json, this
ability is only an ability alias, and the ability specified by targetAbility is the real ability it
points to. If the specified target ability cannot be found in the current bundle, config.json
will fail to be parsed.
public boolean getFormEnabled()
formEnabled tag of an ability.
formEnabled specifies whether AbilityForm is enabled for an ability using the Page template.
Do not set this tag to true for abilities using any other template.
The default value is false, and you can retain the default value.
true if AbilityForm is enabled for the ability; returns false otherwise.public int getBackgroundModes()
backgroundModes tag of an ability.
backgroundModes is dedicated to abilities using the Service template. You can use this tag to assign
one or more background service modes to an ability.
The available background modes and their respective tag values are as follows:
0b00000001.0b00000010.0b00000010.0b00000010.0b00000100.0b00001000.0b00010000.0b00010000.0b00100000.The final tag value can be the sum of multiple preceding values. You need to use a single value, for
example, 0b00000010 or 0b00010000, only once in this tag for your application to have all
background modes corresponding to that value.
public ApplicationInfo getApplicationInfo()
ApplicationInfo object for the current application.public int getFormEntity()
AbilityForm can be displayed.1 if the AbilityForm can be displayed on the home
screen; returns 2 if it can be displayed on the search interface; returns 3 if
it can be displayed on both areas.public int getMinFormHeight()
AbilityForm.
The initial value is 0. If formEnabled is set to false, this method is invalid.
AbilityForm.public int getDefaultFormHeight()
AbilityForm.
The initial value is 0. If formEnabled is set to false, this method is invalid.
AbilityForm.public int getMinFormWidth()
AbilityForm.
The initial value is 0. If formEnabled is set to false, this method is invalid.
AbilityForm.public int getDefaultFormWidth()
AbilityForm.
The initial value is 0. If formEnabled is set to false, this method is invalid.
AbilityForm.public String getReadPermission()
public String getWritePermission()
public boolean marshalling(Parcel out)
SequenceableSequenceable object into a Parcel.marshalling 在接口中 Sequenceableout - Indicates the Parcel object to which the Sequenceable
object will be marshaled..true if the marshalling is successful; returns false otherwise.Sequenceable.marshalling(Parcel)public boolean unmarshalling(Parcel in)
SequenceableSequenceable object from a Parcel.unmarshalling 在接口中 Sequenceablein - Indicates the Parcel object into which the Sequenceable
object has been marshaled.true if the unmarshalling is successful; returns false otherwise.Sequenceable.unmarshalling(Parcel)public void dump(String prefix, PrintWriter writer) throws IllegalArgumentException
prefix - Indicates the prefix of the attribute names contained in the printed information.writer - Indicates the target into which the information will be printed.IllegalArgumentException - Throws this exception if an input parameter is illegal.