Skip to main content

Interface IPolySystemService

com.poly.polyos.system

Interface IPolySystemService


public interface IPolySystemService

System service exposed for PolyClients

Since:
3.0.11

Method Summary

Modifier and TypeMethod and Description
java.lang.StringcollateLogPackage()
Collects logs from the system and all connected secondary devices
byte[]decryptData(byte[] data)
Decrypts the specified data using the Poly manufacturer installed private key on the DeviceType DeviceType.PRIMARY
booleanendDeviceMode()
Ends any current device mode session
java.lang.StringendDigitalSignage()
Ends digital signage. If Digital Signage is currently running, this will stop it and return to the active application.
ActivityPathgetCurrentActivity()
Get the current activity running on the targeted endpoint.
java.lang.StringgetDeviceCertificates(boolean includeCAChain)
Retrieves the Poly manufacturer-installed device certificate on the DeviceType DeviceType.PRIMARY
java.lang.StringgetDeviceId()
Returns a unique ID of the device of DeviceType.PRIMARY
DevicePluginStategetDevicePluginState()
Returns the current state of the HDMI/USB connections
java.lang.StringgetFirmwareVersion()
Returns the firmware version of DeviceType.PRIMARY
PackageInfogetPackageInfo(java.lang.String packageName)
Gets the package details for the specified package name. If the specified package is invalid the returned PackageInfo will be empty.
intgetSleepTimeOut()
Returns the sleep timeout
SystemStategetSystemState()
Returns the current SystemState
booleanisDeviceModeEnabled()
Returns whether device mode capability is enabled
booleanisDigitalSignageEnabled()
Returns true if the Digital Signage feature is enabled, otherwise the method returns false.
booleanisInDeviceMode()
Returns whether the system is currently in device mode session
booleanisInDigitalSignage()
Returns true if Digital Signage is currently running, otherwise the method returns false.
voidlaunchSystemSettings()
Launches settings on the DeviceType DeviceType.PRIMARY
booleanprepareSystemLogs(java.lang.String destPath, long maxSize, boolean includeAppLogs)
Collects logs from the system and all connected secondary devices (if called from primary) Optionally includes ecosystem application logs from apps running on the system/secondaries. Optionally limits the size of the collected logs, collates them into a single gzipped tarball file, and writes them to a caller-supplied path.
voidregisterSystemListener(IPolySystemListener listener)
Registers a IPolySystemListener
booleanresetSystem(ResetOptions resetOptions)
Performs factory reset on the system
booleanrestartSystem()
Restarts the system
voidsetDeviceModeEnabled(boolean enabled)
Enables or disables device mode capability
booleansetSleepTimeOut(int timeout)
Sets the timeout for sleep
booleanshutdownSystem()
Shuts down the system
byte[]signData(byte[] data)
Generates a digital signature for the specified data using the Poly manufacturer-installed device private key, on the DeviceType DeviceType.PRIMARY
booleansleep()
Puts the system to sleep
booleanstartActivity(java.lang.String packageName, java.lang.String activityName)
Starts an activity on the targeted endpoint. If the activity was started true is returned, otherwise the method will return false.
booleanstartDeviceMode()
Starts a device mode session
booleanstartDigitalSignage()
Starts Digital Signage if the feature is enabled. Digital signage only runs on the codec. Method returns true if digital signage was started, false if it was not.
IPolySystemServicetargetLocal()
Returns a IPolySystemService targeting the calls to the local DeviceType
voidunRegisterSystemListener(IPolySystemListener listener)
Unregisters a IPolySystemListener
booleanupdateApp(java.lang.String url)
Deprecated
Use updateApplication(String).
Calling this directly from a controller app is not supported. Instead, to update the Controller app, call this on an instance returned from targetLocal().
The Primary app can be updated by directly calling this from the primary app.
ResponseStatusupdateApplication(java.lang.String url)
Updates the client application from the given url
booleanupdateFirmware(java.lang.String url)
Updates firmware using the provided URL.
booleanwakeup()
Wakes up the system

Method Detail

getDeviceId

java.lang.String getDeviceId()
Returns a unique id of the device of DeviceType.PRIMARY
This can be targeted to DeviceType.CONTROLLER, if called on an instance returned by targetLocal().

restartSystem

boolean restartSystem()
Restarts the system
This can be targeted to DeviceType.CONTROLLER, if called on an instance returned by targetLocal().

shutdownSystem

boolean shutdownSystem()
Shuts down the system

sleep

boolean sleep()
Puts the system to sleep

wakeup

boolean wakeup()
Wakes up the system

getSystemState

SystemState getSystemState()
Returns current SystemState

setSleepTimeOut

boolean setSleepTimeOut(int timeout)
Sets the time out for sleep. Set to 0 to disable sleep.

getSleepTimeOut

int getSleepTimeOut()
Returns the sleep timeout

getFirmwareVersion

java.lang.String getFirmwareVersion()
Returns firmware version of DeviceType.PRIMARY. This can be targeted to DeviceType.CONTROLLER, if called on an instance returned by targetLocal()

launchSystemSettings

void launchSystemSettings()
Launches settings on the DeviceTypeDeviceType.PRIMARY.
This can be targeted to DeviceType.CONTROLLER, if called on an instance returned by targetLocal().

updateApp

boolean updateApp(java.lang.String url)

Deprecated. Use updateApplication(String).
Calling this directly from a controller app is not supported. Instead, to update the Controller app, call this on an instance returned from targetLocal().
The Primary app can be updated by directly calling this from the primary app.

Parameters:
url - URL from which to download the APK. The package name of this should match the package name of the app calling this.

Returns: True if update successfully started

collateLogPackage

java.lang.String collateLogPackage()
Collects logs from the system and all connected secondary devices (e.g. controllers), including ecosystem application logs from apps running on the system/secondaries, and collate them into a single gzipped tarball file written to a system-determined path.
The log package file will be automatically removed from the file system ~10 minutes after it is created, or upon system reboot.
This API is only available from the DeviceType.PRIMARY device and will throw an exception if called from DeviceType.CONTROLLER. Use IPolyRoomService.getDeviceType() to know the type device.
See #prepareSystemLogs(String, long, boolean) for similar functionality with more options, including the ability to call on a DeviceType.CONTROLLER.

Returns:
The full path and filename of the log file package; null if the log file package could not be successfully created.

Since:
3.0.21

See Also:
prepareSystemLogs(String, long, boolean)

registerSystemListener

void registerSystemListener(IPolySystemListener listener)
Registers an IPolySystemListener

unRegisterSystemListener

void unRegisterSystemListener(IPolySystemListener listener)
Unregisters a IPolySystemListener

targetLocal

IPolySystemService targetLocal()
Returns a IPolySystemService targeting the calls to the local DeviceType
Returns the same instance if called from DeviceType.PRIMARY.
If called from DeviceType.CONTROLLER, the returned instance targets calls to DeviceType.CONTROLLER.
Only the following methods are available to be targeted to DeviceType.CONTROLLER. Other methods if called on this returned instance will throw PolyOsException

By Default all calls are targeted to DeviceType.PRIMARY.

Since:
3.0.38

getDeviceCertificates

java.lang.String getDeviceCertificates(boolean includeCAChain)
Retrieves the Poly manufacturer installed device certificate on the DeviceTypeDeviceType.PRIMARY.
This can be targeted to DeviceType.CONTROLLER if called on an instance returned by targetLocal().

Parameters:
includeCAChain - specifies whether or not to include the issuing certificate authority certificates in the return

Returns:
PEM-encoded certificate, or bundle of certificates if includeCAChain is true.

Since:
3.0.45

signData

byte[] signData(byte[] data)
Generates a digital signature, for the specified data, using the Poly manufacturer installed device private key, on the DeviceType DeviceType.PRIMARY.
The digital signature is generated using the "SHA256withRSA" algorithm.
This can be targeted to DeviceType.CONTROLLER, if called on an instance returned by targetLocal().

Parameters:
data - The data to sign; must be less than 1,000,000 bytes in size.

Returns:
The digital signature; null if the digital signature could not be created i.e. data size was beyond permitted maximum.

Since:
3.0.45

decryptData

byte[] decryptData(byte[] data)
Decrypts the specified data using the Poly manufacturer installed private key on the DeviceTypeDeviceType.PRIMARY. That is, the specified data must be encrypted with the public key from the Poly manufacturer installed device certificate.
The "RSA/ECB/PKCS1Padding" cipher algorithm is used for decryption.
This can be targeted to DeviceType.CONTROLLER, if called on an instance returned by targetLocal().

Parameters:
data - The encrypted data to decrypt; must be less than 1,000,000 bytes in size.

Returns:
The decrypted data; null if decryption was not possible (i.e., data size was beyond permitted maximum, or data was not encrypted with the device certificate's public key)

Since:
3.0.45

isDeviceModeEnabled

boolean isDeviceModeEnabled()
Returns whether device mode capability is enabled

Since:
3.0.54

setDeviceModeEnabled

void setDeviceModeEnabled(boolean enabled)
Enables or disables device mode capability

Since:
3.0.54 Experimental

isInDeviceMode

boolean isInDeviceMode()
Returns whether system is currently in device mode session

Since:
3.0.54

startDeviceMode

boolean startDeviceMode()
Starts a device mode session. Will fail if device mode capability as returned by isDeviceModeEnabled() is false.

Returns:
true if successful

Since:
3.0.54

endDeviceMode

boolean endDeviceMode()
Ends any current device mode session

Returns:
true if successful

Since:
3.0.54

prepareSystemLogs

boolean prepareSystemLogs(java.lang.String destPath,
long maxSize,
boolean includeAppLogs)

Collects logs from the system and all connected secondary devices (if called from primary) Optionally includes ecosystem application logs from apps running on the system/secondaries. Optionally limits the size of the collected logs, collates them into a single gzipped tarball file, and writes them to a caller-supplied path.

If called from secondary, it will only include logs for that secondary.
The caller must "clean up" the file. This method may be called from a DeviceType.CONTROLLER device, see IPolyRoomService.getDeviceType().
To call this from a DeviceType.CONTROLLER device, call on an instance returned from targetLocal().
The log files will be written on the secondary device and will only include the log files of the secondary device itself (not the primary system or any other connected secondary devices).

Parameters:
destPath - Path where to create the logs
maxSize - Max size of logs in bytes
includeAppLogs - Whether to include app logs

Returns:
true if successfully created log package

Since:
3.2.4

updateFirmware

boolean updateFirmware(java.lang.String url)
Updates firmware using the provided URL. On empty URL (on primary), updates to the default system URL.
To update just the Controller firmware, call from controller on an instance returned from targetLocal().

Returns:
true if update successfully started

Since:
3.2.16

updateApplication

ResponseStatus updateApplication(java.lang.String url)
Updates the client application from the given URL.
Calling this directly from a controller app is not supported. Instead, to update the Controller app, call this on an instance returned from targetLocal().
The primary app can be updated by directly calling this from the primary app.

Parameters:
url - URL from which to download the APK. The package name of this should match with the package name of the app calling this

Returns:
ResponseStatus related to the success of the operation.

Since:
3.2.2.0-3

resetSystem

boolean resetSystem(ResetOptions resetOptions)
Performs a factory reset on the system

Parameters:
resetOptions - Options used to determine what is reset.

Returns:
true if factory reset successfully started

Since:
3.3.0.0-6 This can be targeted to DeviceType.CONTROLLER, if called on an instance returned by targetLocal().

getDevicePluginState

DevicePluginState getDevicePluginState()
Returns the current state of the HDMI/USB connections

Returns:
DevicePluginState

Since:
3.3.0.0-8

startActivity

boolean startActivity(java.lang.String packageName,
java.lang.String activityName)

Start an activity on the targeted endpoint.

Parameters:
packageName - package name of the app to launch
activityName - full path name of the activity to launch

Returns:
True if the activity was started

Since:
3.6.0-2

getCurrentActivity

ActivityPath getCurrentActivity()
Gets the current activity running on the targeted endpoint.

Returns:
ActivityPath of the activity running.

Since:
3.6.0-2

getPackageInfo

PackageInfo getPackageInfo(java.lang.String packageName)
Gets the package details for the specified package name. If the specified package is invalid the returned PackageInfo will be empty.

Parameters:
packageName - name of the package

Returns:
PackageInfo with name, version, etc.

Since:
3.6.0.0-4

isDigitalSignageEnabled

boolean isDigitalSignageEnabled()
Returns whether digital signage capability is enabled

Since:
3.7.0.0-2

isInDigitalSignage

boolean isInDigitalSignage()
Returns whether system is currently in digital signage

Since:
3.7.0.0-2

startDigitalSignage

boolean startDigitalSignage()
Starts digital signage if the feature is enabled. Digital signage only runs on the codec. It will fail if the digital signage capability as returned by isDigitalSignageEnabled() is false.

Returns:
Returns true if successful

Since:
3.7.0.0-2

endDigitalSignage

boolean endDigitalSignage()
If Digital Signage is currently running, this will stop it and return to the active application.

Returns:
Returns true if successful

Since:
3.7.0.0-2