com.webos.surfacemanager
API Summary
Handles the UX, animations of windows. It manages all system and application input handling.
Overview of the API
Provides information about applications surfaces and a limited set of controls for them.
Methods
closeByAppId
Description
Close an application's surface with given appId.
In most cases, closing the surface leads the application to quit. But with this method, the compositor doesn't discard its surface item (a container of the surface). It is useful when the compositor wants to keep the application's context from the compositor side even when the application is not running anymore. A typical use case of this method is to reclaim the memory by Memory Manager.
NOTE: This method is deprecated in the Goldilocks release.
Parameters
Name | Required | Type | Description |
---|---|---|---|
id | Required | String | Application ID |
Call Returns
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean |
|
errorCode | Optional | Number | errorCode contains the error code if the method fails. The method will return errorCode only if it fails. See the Error Codes Reference of this method for more details |
errorText | Optional | String | errorText contains the error text if the method fails. The method will return errorText only if it fails. See the Error Codes Reference of this method for more details. |
Error Codes Reference
Error Code | Error Text | Error Description |
---|---|---|
1 | "APP_ID" is not running | There is no surface item associated with the given appId. |
Example
Example code
# luna-send -n 1 luna://com.webos.surfacemanager/closeByAppId '{"id":"com.webos.app.test"}'
Response:
{
"returnValue": true
}
getForegroundAppInfo
Description
Provides the list of applications that are currently visible in the foreground.
Note:
- This is a private method that can be used by SAM only.
- For public use, refer to the com.webos.applicationManager/getForegroundAppInfo method.
Parameters
Name | Required | Type | Description |
---|---|---|---|
subscribe | Optional | Boolean | Indicates if subscribed to get notifications. Possible values are:
Default: false |
Call Returns
Name | Required | Type | Description |
---|---|---|---|
foregroundAppInfo | Required | Object array: foregroundAppInfo | Information about a surface that is shown in the foreground. |
returnValue | Required | Boolean | Indicates the status of the operation. Possible values are:
Note: returnValue will always contain true. |
subscribed | Optional | Boolean | Indicates if subscribed to get notifications. Possible values are:
Default: false |
Subscription Returns
Name | Required | Type | Description |
---|---|---|---|
foregroundAppInfo | Required | Object array: foregroundAppInfo | Information about a surface that is shown in the foreground. |
returnValue | Required | Boolean | Indicates the status of the operation. Possible values are:
Note: returnValue will always contain true. |
subscribed | Optional | Boolean | Indicates if subscribed to get notifications. Possible values are:
Default: false |
Example
Example: Without subscription
# luna-send -n 1 luna://com.webos.surfacemanager/getForegroundAppInfo '{}'
Response:
{
"foregroundAppInfo":[
{
"appId":"com.webos.app.test",
"processId":"6983",
"windowGroup":true,
"windowGroupOwner":true,
"windowGroupOwnerId":"",
"windowId":"",
"windowType":"_WEBOS_WINDOW_TYPE_CARD"
}
],
"returnValue":true
}
Example: With subscription
# luna-send -f -i luna://com.webos.surfacemanager/getForegroundAppInfo '{"subscribe":true}'
Response:
{
"subscribed":true,
"foregroundAppInfo":[
{
"appId":"com.webos.app.test",
"processId":"6983",
"windowGroup":true,
"windowGroupOwner":true,
"windowGroupOwnerId":"",
"windowId":"",
"windowType":"_WEBOS_WINDOW_TYPE_CARD"
}
],
"returnValue":true
}
Example: Window-group response
# luna-send -n 1 -f luna://com.webos.applicationManager/launch '{"id":"com.webos.app.test-windowgroupowner"} '
# luna-send -n 1 -f luna://com.webos.applicationManager/launch '{"id":"com.webos.app.test-windowgroupclient"} '
# luna-send -n 1 -f luna://com.webos.surfacemanager/getForegroundAppInfo '{}'
Response:
{
"foregroundAppInfo":[
{
"windowGroupOwner":true,
"windowId":"",
"appId":"com.webos.app.test-windowgroupowner",
"windowGroupOwnerId":"",
"windowType":"_WEBOS_WINDOW_TYPE_CARD",
"processId":"4668",
"windowGroup":true
},
{
"windowGroupOwner":false,
"windowId":"",
"appId":"com.webos.app.test-windowgroupclient",
"windowGroupOwnerId":"com.webos.app.test-windowgroupowner",
"windowType":"_WEBOS_WINDOW_TYPE_CARD",
"processId":"4750",
"windowGroup":true
}
],
"returnValue":true
}
captureCompositorOutput
Description
Takes a screenshot of the content that the compositor generates. The content can be either a frame that contains the graphics composition result or an application surface that is being composited.
Note:
- This method can be used when a privileged webOS component wants to take a screenshot for its own purpose. It should not be allowed for public use since the screenshot may contain security-sensitive information.
- As this method is provided by LSM (Luna Surface Manager), the content is limited to what LSM is able to composite. It may not be possible to take video area with this method due to this technical limitation.
- Scaling is not supported.
Parameters
Name | Required | Type | Description |
---|---|---|---|
output | Required | String | Indicates the absolute path of the output image file. |
appId | Optional | String | Indicates the id of the application. Note: If not specified, then the entire composited frame will be captured. |
format | Optional | String | Indicates the output image format. Possible values are:
|
displayId | Optional | Number | Indicates the id of display to be captured. |
Call Returns
Name | Required | Type | Description |
---|---|---|---|
output | Optional | String | Indicates the absolute path of output image file. |
resolution | Optional | String | Indicates the resolution of the output image in the form of <width>x<height>. Example: 1920x1080 |
format | Optional | String | Indicates the output image format. Possible values are:
|
returnValue | Required | Boolean | Indicates the status of the operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes" section of this method for details. |
Error Codes Reference
Error Code | Error Text | Error Description |
---|---|---|
101 | ERR_MISSING_OUTPUT | The input parameter named "output" is required but it is not passed. |
102 | ERR_INVALID_PATH | Unable to write a file with a given path due to filesystem related errors. (Non-existent base directory or access denied.) |
103 | ERR_NO_SURFACE | No surface exists associated with a given appId. |
104 | ERR_INVALID_FORMAT | No matching format found. Format must be "BMP", "JPG", or "PNG" (Case sensitive). |
105 | ERR_UNABLE_TO_SAVE | Fail to save a file. |
106 | ERR_INVALID_DISPLAY | Invalid display id. |
107 | ERR_HAS_SECURED_CONTENT | Surface to be captured has secure content. |
Example
Example : Without displayId
# luna-send -n 1 luna://com.webos.surfacemanager/captureCompositorOutput '{
"output":"/tmp/test.bmp",
"appId":"com.webos.app.test",
"format":"BMP"
}'
Response:
{
"format":"BMP",
"output":"/tmp/test.bmp",
"resolution":"1920x1080",
"returnValue":true
}
# luna-send -n 1 luna://com.webos.surfacemanager/captureCompositorOutput '{
"output":"/tmp/test.jpg",
"appId":"com.webos.app.test",
"format":"JPG"
}'
Response:
{
"format":"JPG",
"output":"/tmp/test.jpg",
"resolution":"1920x1080",
"returnValue":true
}
# luna-send -n 1 luna://com.webos.surfacemanager/captureCompositorOutput '{
"output":"/tmp/test.png",
"appId":"com.webos.app.test",
"format":"PNG"
}'
Response:
{
"format":"PNG",
"output":"/tmp/test.png",
"resolution":"1920x1080",
"returnValue":true
}
# luna-send -n 1 luna://com.webos.surfacemanager/captureCompositorOutput '{
"output":"/tmp/test.jpg",
"appId":"",
"format":"JPG"
}'
Response:
{
"format":"JPG",
"output":"/tmp/test.jpg",
"resolution":"1920x1080",
"returnValue":true
}
# luna-send -n 1 luna://com.webos.surfacemanager/captureCompositorOutput '{
"output":"/tmp/test.jpg",
"format":"JPG"
}'
Response:
{
"format":"JPG",
"output":"/tmp/test.jpg",
"resolution":"1920x1080",
"returnValue":true
}
# luna-send -n 1 luna://com.webos.surfacemanager/captureCompositorOutput '{
"output":"/tmp/test.bmp",
"appId":"com.webos.app.test"
}'
Response:
{
"format":"BMP",
"output":"/tmp/test.bmp",
"resolution":"1920x1080",
"returnValue":true
}
# luna-send -n 1 luna://com.webos.surfacemanager/captureCompositorOutput '{
"output":"/tmp/test.bmp"
}'
Response:
{
"format":"BMP",
"output":"/tmp/test.bmp",
"resolution":"1920x1080",
"returnValue":true
}
Example : With displayId specified
# luna-send -n 1 luna://com.webos.surfacemanager/captureCompositorOutput '{
"output":"/tmp/test.bmp",
"appId":"com.webos.app.test",
"format":"BMP",
"displayId":0
}'
Response:
{
"format":"BMP",
"output":"/tmp/test.bmp",
"resolution":"1920x1080",
"returnValue":true
}
# luna-send -n 1 luna://com.webos.surfacemanager/captureCompositorOutput '{
"output":"/tmp/test.jpg",
"format":"JPG",
"displayId":1
}'
Response:
{
"format":"JPG",
"output":"/tmp/test.jpg",
"resolution":"1920x1080",
"returnValue":true
}
setAppMirroring
Description
Starts or stops app mirroring for a given display pair.
Parameters
Name | Required | Type | Description |
---|---|---|---|
mirror | Required | Boolean | Indicates whether to mirror the app. Possible values are:
|
from | Required | Number | Indicates id of the display from which the app is mirrored. |
to | Required | Number | Indicates id of the display mirrored by the app. |
Call Returns
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes" section of this method for details. |
Error Codes Reference
Error Code | Error Text | Error Description |
---|---|---|
1 | ERR_INVALID_COMMAND | Missing or invalid parameters |
2 | ERR_NO_APP | No app to mirror |
3 | ERR_INVALID_DISPLAY | Invalid display ID |
4 | ERR_NO_MIRRORING | No mirroring matched to given display IDs |
5 | ERR_ALREADY_MIRRORING | Mirroring is already set for given display ID pair |
6 | ERR_SAME_DISPLAY | Same display IDs are used for pairing |
7 | ERR_MIRRORING_DISABLED | Mirroring disabled for given display ID |
10 | INTERNAL_ERROR | Internal error |
Example
Example code
# luna-send -n 1 -f luna://com.webos.surfacemanager/setAppMirroring '{
"mirror":true,
"from":0,
"to":1
}'
Response:
{
"returnValue":true
}
Example code
# luna-send -n 1 -f luna://com.webos.surfacemanager/setAppMirroring '{
"mirror":false,
"from":0,
"to":1
}'
Response:
{
"returnValue":true
}
getAppMirroring
Description
Gets the status of the app mirroring.
Parameters
Name | Required | Type | Description |
---|---|---|---|
subscribe | Optional | Boolean | Indicates if subscribed to get notifications. Possible values are:
Default: false |
Call Returns
Name | Required | Type | Description |
---|---|---|---|
mirroringInfo | Required | Object array: mirroringInfo | Indicates the mirroring status of each display. |
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
Note: returnValue is always true. |
Subscription Returns
Name | Required | Type | Description |
---|---|---|---|
mirroringInfo | Required | Object array: mirroringInfo | Indicates mirroring status of each display. |
returnValue | Required | Boolean | Indicates the status of the operation. Possible values are:
Note: returnValue is always true. |
subscribed | Optional | Boolean | Indicates if subscribed to get notifications. Possible values are:
|
Example
Example: Without subscription
# luna-send -n 1 -f luna://com.webos.surfacemanager/getAppMirroring '{}'
Response:
{
"mirroringInfo":[
{
"mirroringStatus":"inactive",
"displayId":0
},
{
"mirroringStatus":"inactive",
"displayId":1
}
],
"returnValue":true
}
Example: With subscription
# luna-send -i -f luna://com.webos.surfacemanager/getAppMirroring '{"subscribe":true}'
Response:
{
"mirroringInfo":[
{
"mirroringStatus":"sender",
"displayId":0
},
{
"mirroringStatus":"receiver",
"displayId":1
}
],
"returnValue":true,
"subscribed":true
}
Objects
foregroundAppInfo
Provides information about a surface that is shown in the foreground.
Name | Required | Type | Description |
---|---|---|---|
appId | Required | String | Indicates id of the application associated with the surface. |
windowType | Required | String | Indicates window type associated with the surface. Example: _WEBOS_WINDOW_TYPE_CARD |
processId | Required | String | Indicates process id (PID) of the surface. |
windowId | Required | String | Indicates windowId associated with the surface. Note: windowId will always contain " " (empty string). |
windowGroup | Optional | Boolean | Indicates windowGroup associated with the surface. Note:
|
windowGroupOwner | Optional | Boolean | Indicates if the application is owner/client of a window-group (surface-group). Possible values are:
Note:
|
windowGroupOwnerId | Optional | String | Indicates id of the window-group ( surface-group ) for surface-group-client applications. Note: If the application is surface-group-owner, it will return " " (empty string). |
mirroringInfo
Indicates mirroring status of each display.
Name | Required | Type | Description |
---|---|---|---|
mirroringStatus | Required | String | Indicates status of mirroring. Possible values are:
|
displayId | Required | Number | Indicates the id of the display from which the app is mirrored to/from. |