| options | Object | No| The options are as follows:<br>- **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.|
| options | Object | No| The options are as follows:<br>- **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.|
...
@@ -83,6 +84,7 @@ Obtains information about the second-level album or files in asynchronous mode.
...
@@ -83,6 +84,7 @@ Obtains information about the second-level album or files in asynchronous mode.
Provides methods for reading and writing basic data types and arrays, inter-process communication (IPC) objects, interface tokens, and sequenceable objects.
Provides APIs for reading and writing data in specific format. During RPC, the sender can use the **write()** method provided **MessageParcel** to write data to a **MessageParcel** object in specific format. The receiver can use the **read()** method provided by **MessageParcel** to read data in specific format from a **MessageParcel** object. The data formats include basic data types and arrays, IPC objects, interface tokens, and custom sequenceable objects.
### create
### create
...
@@ -28,6 +28,7 @@ Creates a **MessageParcel** object. This method is a static method.
...
@@ -28,6 +28,7 @@ Creates a **MessageParcel** object. This method is a static method.
| token | string | Yes| Interface token to write.|
| token | string | Yes| Interface token to write.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...
@@ -175,11 +181,12 @@ Writes an interface token to this **MessageParcel** object.
...
@@ -175,11 +181,12 @@ Writes an interface token to this **MessageParcel** object.
readInterfaceToken(): string
readInterfaceToken(): string
Reads the interface token from this **MessageParcel** object. The interface tokens are read in the order in which they are written into the **MessageParcel** object.
Reads the interface token from this **MessageParcel** object. The interface token is read in the sequence in which it is written to the **MessageParcel** object. The local object can use it to verify the communication.
| floatArray | number[] | Yes| FloatArray to write. The system processes Float data as that of the Double type. Therefore, the total number of bytes occupied by a FloatArray must be calculated as the Double type.|
| floatArray | number[] | Yes| FloatArray to write. The system processes Float data as that of the Double type. Therefore, the total number of bytes occupied by a FloatArray must be calculated as the Double type.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...
@@ -1347,6 +1417,7 @@ Reads a FloatArray from this **MessageParcel** object.
...
@@ -1347,6 +1417,7 @@ Reads a FloatArray from this **MessageParcel** object.
| dataIn | number[] | Yes| FloatArray to read. The system processes Float data as that of the Double type. Therefore, the total number of bytes occupied by a FloatArray must be calculated as the Double type.|
| dataIn | number[] | Yes| FloatArray to read. The system processes Float data as that of the Double type. Therefore, the total number of bytes occupied by a FloatArray must be calculated as the Double type.|
...
@@ -1372,6 +1443,7 @@ Reads the FloatArray from this **MessageParcel** object.
...
@@ -1372,6 +1443,7 @@ Reads the FloatArray from this **MessageParcel** object.
| [IRemoteObject](#iremoteobject) | Returns the [RemoteObject](#ashmem8) if it is the caller; returns the [IRemoteObject](#iremoteobject), the holder of this **RemoteProxy** object, if the caller is a [RemoteProxy](#remoteproxy) object.|
| [IRemoteObject](#iremoteobject) | Returns the [RemoteObject](#ashmem8) if it is the caller; returns the [IRemoteObject](#iremoteobject), the holder of this **RemoteProxy** object, if the caller is a [RemoteProxy](#remoteproxy) object.|
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
...
@@ -2521,6 +2639,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -2521,6 +2639,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...
@@ -2528,16 +2647,17 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -2528,16 +2647,17 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
### sendRequest<sup>8+(deprecated)</sup>
### sendRequest<sup>8+(deprecated)</sup>
> **NOTE**<br/>
> This API is deprecated since API Version 9. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9).
> This API is deprecated since API version 9. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9).
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
...
@@ -2546,6 +2666,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -2546,6 +2666,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.|
| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.|
...
@@ -2559,6 +2680,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -2559,6 +2680,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
...
@@ -2567,6 +2689,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -2567,6 +2689,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.|
| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.|
...
@@ -2580,6 +2703,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -2580,6 +2703,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
...
@@ -2598,12 +2722,14 @@ Adds a callback for receiving death notifications of the remote object. This met
...
@@ -2598,12 +2722,14 @@ Adds a callback for receiving death notifications of the remote object. This met
> This API is deprecated since API version 8. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9-1).
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
...
@@ -2694,6 +2825,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -2694,6 +2825,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...
@@ -2741,16 +2873,17 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -2741,16 +2873,17 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
### sendRequest<sup>8+(deprecated)</sup>
### sendRequest<sup>8+(deprecated)</sup>
> **NOTE**<br/>
> This API is deprecated since API Version 9. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9-1).
> This API is deprecated since API version 9. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9-1).
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
...
@@ -2759,6 +2892,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -2759,6 +2892,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.|
| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.|
...
@@ -2818,6 +2952,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -2818,6 +2952,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
...
@@ -2826,6 +2961,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -2826,6 +2961,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.|
| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.|
...
@@ -2885,6 +3021,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -2885,6 +3021,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
...
@@ -2946,11 +3083,13 @@ Obtains the **LocalInterface** object of an interface descriptor.
...
@@ -2946,11 +3083,13 @@ Obtains the **LocalInterface** object of an interface descriptor.
| number | Returns **0** if the operation is successful; returns an error code if the input object is null or a **RemoteObject**, or if the operation fails.|
| number | Returns **0** if the operation is successful; returns an error code if the input object is null or a **RemoteObject**, or if the operation fails.|
...
@@ -3488,6 +3646,7 @@ Changes the UID and PID of the remote user to the UID and PID of the local user.
...
@@ -3488,6 +3646,7 @@ Changes the UID and PID of the remote user to the UID and PID of the local user.
> This API is deprecated since API version 8. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9-2).
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
...
@@ -3581,6 +3744,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -3581,6 +3744,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...
@@ -3630,16 +3794,17 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -3630,16 +3794,17 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
### sendRequest<sup>8+(deprecated)</sup>
### sendRequest<sup>8+(deprecated)</sup>
> **NOTE**<br/>
> This API is deprecated since API Version 9. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9-2).
> This API is deprecated since API version 9. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9-2).
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
...
@@ -3648,6 +3813,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -3648,6 +3813,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.|
| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.|
...
@@ -3709,6 +3875,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -3709,6 +3875,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
...
@@ -3717,6 +3884,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -3717,6 +3884,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.|
| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.|
...
@@ -3777,6 +3945,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -3777,6 +3945,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
| code | number | Yes| Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
...
@@ -3831,15 +4000,20 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
...
@@ -3831,15 +4000,20 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| option | [MessageOption](#messageoption) | Yes| Whether the operation is synchronous or asynchronous.|
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Returns a Boolean value if the request is processed synchronously in **onRemoteRequestEx**. If the operation is successful, **true** is returned. Otherwise, **false** is returned.|
| Promise <boolean> | Returns a promise object if the request is processed asynchronously in **onRemoteRequestEx**.|
**Example**: Overload **onRemoteRequestEx** to process a request synchronously.