Current DAC design assumes that AWC will behave as a proxy to LISA API and will be it's only consumer. Main reason for such decision was dictated by requirement of tracking and controlling LISA usage to prevent situation when application is currently started and external client (eg. DAC Manager) would call LISA's uninstall API. This would cause undefined behaviour, due to removal of application during active state. Covering LISA's API by AWC would prevent such situation by blocking uninstall request on AWC level.
Above approach unfortunately has cons:
This design resolve this issue by extending LISA API with locking mechanism, decoupling it from AWC and expose LISA API to external clients.
LISA API should be extended with three additional methods: lock, unlock, getLockInfo. Those methods are used by entity which manages application state (AWC) to block any operations (uninstall) on application during it's active state (started, suspended). Lock is performed with id, version of the application, lock owner and lock reason, we are only blocking specific version of application.
After sending asynchronous request (uninstall) to LISA, requesting client (eg. DAC Manager), if application is currently used (active - locked by AWC), will receive error result with information about lock reason(eg. ERROR_APP_ACTIVE). Additional API method getLockInfo will allow to check who is the lock owner.
If application is not currently in locked state (is in stopped state) asynchronous operation can be performed.
From other end if AWC will receive Start (or initiate itself) request from MainUI, it should send lock signal to the LISA to prevent its uninstallation/update by external LISA's API client (eg. DAC Manager) during application active state. If lock request initiated by AWC succeeds application can be started, otherwise return error will be sent to the caller (MainUI) that application is in currently being processed (uninstall) by LISA.
Both scenarios and API change are described below.
When LISA's client (DAC Manager, UI) will request to uninstall application which is currently used (locked) by AWC following error will be returned:
{
"code": 1009,
"message": "ERROR_APP_ACTIVE"
}
Lock/Unlock calls should be used exclusively by AWC (for now, maybe other use cases will show up which require locking by DAC Manager eg batching) just before transition to start and after transition to stop of the DAC application.
If AWC will try to activate (lock) application during ongoing uninstallation procedure, following error will be returned
{
"code": 1010,
"message": "ERROR_APP_UNINSTALLING"
}
By calling getLockInfo caller can receive more details about current lock owner and reason (for now there will be only 2 lisa and awc).
call getLockInfo from AWC → { "owner": "lisa", "reason": "uninstalling" }
call getLockInfo z DACM/UI -> { "owner": "awc", "reason": "active" }
<a name="head.Version"></a>
Version: 0.0.2
<a name="head.Description"></a>
Lisa JSON-RPC interface.
<a name="head.Methods"></a>
<a name="method.lock"></a>
Lock application.
Lock and take control over application state until unlock is called
| Name | Type | Description |
|---|---|---|
| params | object | |
| params.type | string | Application type (mime-type) |
| params.id | string | id of the application, assumed reverse domain name notation, the id should match the ASMS application id |
| params.version | string | version of the application |
| params?.owner | string | <sup>(optional)</sup> Owner of the lock |
| params?.reason | string | <sup>(optional)</sup> Reason for the lock (must be one of the following: active, installing, uninstalling) |
| Name | Type | Description |
|---|---|---|
| result | object | |
| result.handle | string |
| Code | Message | Description |
|---|---|---|
| 1001 | Request not accepted because of wrong parameters | WrongParams |
| 1004 | LISA is performing initialization, wait for operationStatus event | Initializing |
| 1009 | ERROR_APP_ACTIVE | |
| 1010 | ERROR_APP_UNINSTALLING |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Lisa.1.lock",
"params": {
"id": "com.libertyglobal.app.awesome",
"version": "1.0.0",
"owner": "awc",
"reason": "active"
}
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": {
"handle": "a76a9ad56769634dbbc9c54bac15ddb9"
}
}
<a name="method.unlock"></a>
Unlock application.
Unlock application and make it available to be used by other components
| Name | Type | Description |
|---|---|---|
| params | object | |
| params.handle | string |
| Name | Type | Description |
|---|---|---|
| result | object |
| Code | Message | Description |
|---|---|---|
| 1001 | Request not accepted because of wrong parameters | WrongParams |
| 1004 | LISA is performing initialization, wait for operationStatus event | Initializing |
| 1007 | The handle is not correct, e.g. the operation has finished. | WrongHandle |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Lisa.1.unlock",
"params": {
"handle": "a76a9ad56769634dbbc9c54bac15ddb9"
}
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": {}
}
<a name="method.getLockInfo"></a>
Get lock details.
Returns info about lock owner and lock reason
| Name | Type | Description |
|---|---|---|
| params | object | |
| params.type | string | Application type (mime-type) |
| params.id | string | id of the application, assumed reverse domain name notation, the id should match the ASMS application id |
| params.version | string | version of the application |
| Name | Type | Description |
|---|---|---|
| result | object | |
| result?.owner | string | <sup>(optional)</sup> Owner of the lock |
| result?.reason | string | <sup>(optional)</sup> Reason for the lock (must be one of the following: active, installing, uninstalling) |
| Code | Message | Description |
|---|---|---|
| 1001 | Request not accepted because of wrong parameters | WrongParams |
| 1004 | LISA is performing initialization, wait for operationStatus event | Initializing |
| 1007 | The handle is not correct, e.g. the operation has finished. | WrongHandle |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "Lisa.1.getLockInfo",
"params": {
"id": "com.libertyglobal.app.awesome",
"version": "1.0.0"
}
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": {
"owner": "awc",
"reason": "active"
}
}
<a name="head.Notifications"></a>
Notifications are autonomous events, triggered by the internals of the implementation, and broadcasted via JSON-RPC to all registered observers.
<a name="event.operationStatus"></a>
Completion of asynchronous operation.
Notification sent on the completion of asynchronous operation.
| Name | Type | Description |
|---|---|---|
| params | object | |
| params.handle | string | |
| params.operation | string | (Installing, Uninstalling) |
| params.type | string | Application type (mime-type) |
| params.id | string | id of the application, assumed reverse domain name notation, the id should match the ASMS application id |
| params.version | string | version of the application |
| params.status | string | (Success, Failed, Progress, Cancelled) |
| params?.details | string | <sup>(optional)</sup> |
{
"jsonrpc": "2.0",
"method": "client.events.1.operationStatus",
"params": {
"handle": "4c4712a4141d261ec0ca8f9037950685",
"operation": "Installing",
"type": "dac",
"id": "com.libertyglobal.app.awesome",
"version": "1.0.0",
"status": "Success",
"details": "Downloaded 2342 KB, unpacked 3233 KB"
}
}