public class AceInternalAbility extends Object
Internal abilities are applicable to services that are closely related to ability service logics and require low response latency.
Internal abilities can be called only by the local ability. For details about how to process requests to a remote
ability, see (int, MessageParcel, MessageParcel, MessageOption).
The bundleName and abilityName are used to map internal abilities on the JavaScript side and the
Java side. When you register an internal ability handler with the local ability, ensure that the bundle and ability
names are the same as those on the JavaScript side, and note that the names are case sensitive.
If abilityType is set to an internal ability on the JavaScript side,
AceInternalAbilityHandler#onRemoteRequest(int, MessageParcel, MessageParcel) will be called when a call
request from JavaScript is received. You can use the onRemoteRequest method to implement functions provided
by the internal ability. The functions are differentiated by service codes and requested with different data
structures.
Before publishing your JavaScript APIs, ensure that the service codes and request data structures are forward-compatible.
| 限定符和类型 | 类 | 说明 |
|---|---|---|
static interface |
AceInternalAbility.AceInternalAbilityHandler |
Handles the requests from the local ability to call an internal ability.
|
| 构造器 | 说明 |
|---|---|
AceInternalAbility(String abilityName) |
A constructor used to create an
AceInternalAbility object based on the input bundle and internal ability
names. |
AceInternalAbility(String bundleName,
String abilityName) |
A constructor used to create an
AceInternalAbility object based on the input bundle and internal
ability names. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
setInternalAbilityHandler(AceInternalAbility.AceInternalAbilityHandler handler) |
Registers this internal ability and its processing method (handler) with the JS UI framework.
|
void |
setInternalAbilityHandler(AceInternalAbility.AceInternalAbilityHandler handler,
AceAbility ability) |
Registers this internal ability and its processing method (handler) with the JS UI framework and binds the
handler to a specified
AceAbility object. |
public AceInternalAbility(String bundleName, String abilityName)
AceInternalAbility object based on the input bundle and internal
ability names.
The names are case sensitive and must be the same as those on the JavaScript side.
bundleName - Indicates the bundle name. This parameter cannot be null.abilityName - Indicates the internal ability name. This parameter cannot be null.IllegalArgumentException - Throws this exception if any parameter is invalid. Check whether an input name
is null.public AceInternalAbility(String abilityName)
AceInternalAbility object based on the input bundle and internal ability
names. The names are case sensitive and must be the same as those on the JavaScript side.abilityName - Indicates the internal ability name. This parameter cannot be null.IllegalArgumentException - Throws this exception if any parameter is invalid. Check whether an input name is
null.public void setInternalAbilityHandler(AceInternalAbility.AceInternalAbilityHandler handler)
handler - Indicates the internal ability handler. For details, see AceInternalAbilityHandler.
If this parameter is null, this internal ability will be deregistered from the framework.public void setInternalAbilityHandler(AceInternalAbility.AceInternalAbilityHandler handler, AceAbility ability)
AceAbility object.handler - Indicates the internal ability handler. For details, see AceInternalAbilityHandler.
If this parameter is null, this internal ability will be deregistered from the framework.ability - Indicates the AceAbility object to which the handler is to be bound.