public final class DLSecondDisplayManager
extends java.lang.Object
DLSecondDisplayManager allows
to configure and manage the 2nd Display, in order to enable/disable the whole feature or to restrict
only to allowed Apps to show notifications on 2nd Display.
In order to show a notification on the 2nd Display, an App shall be allowed with addPackage(java.lang.String),
that adds the given installed App in the list of allowed Apps. After that, when that App sends an Android notification,
it will be shown on 2nd Display. The removePackage(java.lang.String), on the contrary,
allows to remove an installed App from the list of allowed Apps.
By default, all installed Apps are allowed to show notifications on 2nd Display.
So, the setNewAppEnabled(boolean) API allows to change the default behavior
for the Apps installed at a later stage, while the current configuration for the installed Apps is preserved.
Android documentation Create a Notification and Create and Manage Notification Channels provide helpful information to create and manage notifications.
Moreover, to have a better understanding of 2nd Display and notification management, the 2nd Display Sample is highly recommended.
| Modifier and Type | Method and Description |
|---|---|
boolean |
addPackage(java.lang.String packageName)
Allows a package to show its own content on the 2nd Display.
|
java.util.List<java.lang.String> |
getAllowedPackages()
Returns the list of allowed packages to show own Android notifications on the 2nd Display.
|
int |
getBrightness()
Return an integer value that represents the brightness percentage level on 2nd display
|
static DLSecondDisplayManager |
getInstance()
Returns an instance of the
DLSecondDisplayManager. |
boolean |
getNewAppEnabled()
Return a boolean value that represents if new Apps will show notifications on 2nd display
|
boolean |
getRotateEnabled()
Return a boolean value that represents if rotation is enabled on 2nd display
|
RotationSpeed |
getRotationSpeed()
Return an enum that represents 2nd display rotation speed
|
TimeoutSleep |
getSwitchOffTimeout()
Return an enum that represents 2nd display switch-off timeout
|
boolean |
isPackageAllowed(java.lang.String packageName)
Returns the allowed/disallowed configuration for the given package to show its own content ont the 2nd Display.
|
boolean |
isSecondDisplayAvailable()
Returns the availability of the 2nd Display feature.
|
boolean |
isSecondDisplayEnabled()
Returns the enabled/disabled status of the 2nd Display.
|
boolean |
removePackage(java.lang.String packageName)
Disable the given package to show its own content on the 2nd Display.
|
boolean |
setBrightness(int brightness)
Set brightness level on 2nd display
|
boolean |
setNewAppEnabled(boolean isEnabled)
Enable or disable notifications on 2nd display for all the new Apps
|
boolean |
setRotateEnabled(boolean enable)
Set rotation on 2nd display
|
boolean |
setRotationSpeed(RotationSpeed speed)
Set 2nd display rotation speed
|
boolean |
setSecondDisplayEnabled(boolean enable)
Enables or disables the 2nd Display.
|
boolean |
setSwitchOffTimeout(TimeoutSleep timeout)
Set switch-off timeout on 2nd display
|
public static DLSecondDisplayManager getInstance()
DLSecondDisplayManager.
This method provides the reference to the unique instance of
2nd Display Manager.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public boolean isSecondDisplayAvailable()
boolean
True if the device supports the 2nd Display, False otherwise,
or throws anException in case of failure.public boolean isSecondDisplayEnabled()
boolean
True if the 2nd Display is enabled, False otherwise.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public boolean setSecondDisplayEnabled(boolean enable)
enable - True to enable the 2nd Display, False to disable it.boolean
True if the operation complete successfully, False otherwise.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public boolean addPackage(java.lang.String packageName)
packageName - Name of the package to be added to the list of packages allowed to show notifications on the 2nd display.boolean
True if the operation complete successfully, False otherwise (eg. package not found).DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public boolean isPackageAllowed(java.lang.String packageName)
packageName - Name of the package to be checked.boolean
True if the package is allowed, False otherwise (eg. package not found).DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public boolean removePackage(java.lang.String packageName)
packageName - Name of the package to be removed to the list of packages allowed to show notifications on the 2nd display.boolean
True if the operation complete successfully, False otherwise (eg. package not found).DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public java.util.List<java.lang.String> getAllowedPackages()
DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public boolean setNewAppEnabled(boolean isEnabled)
isEnabled - Boolean parameter that represents if new Apps should show notifications on 2nd displayboolean
True if Apps can show notification, false otherwise.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public boolean getNewAppEnabled()
boolean
True if Apps can show notification, false otherwise.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public boolean setBrightness(int brightness)
brightness - Brightness percentage level for 2nd display: Values lower than 0 or higher than 100 will be cropped respectevely to 0 and 100.boolean
True if Apps can show notification, false otherwise.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public int getBrightness()
DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public boolean setRotateEnabled(boolean enable)
enable - Boolean parameter that represents if rotation is enabled on 2nd displayboolean
True if Apps can set rotation, false otherwise.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public boolean getRotateEnabled()
boolean
Boolean value that represents if rotation is enabled on 2nd display.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public boolean setSwitchOffTimeout(TimeoutSleep timeout)
timeout - Enum that represents 2nd display rotation speed.boolean
True if Apps can set the switch-off timeout, false otherwise.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public TimeoutSleep getSwitchOffTimeout()
DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public boolean setRotationSpeed(RotationSpeed speed)
speed - Enum that represents the desired 2nd display rotation speed.boolean
True if Apps can set the rotation speed, false otherwise.DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.public RotationSpeed getRotationSpeed()
DeviceException - in case of error, when exceptions are enabled through the ErrorManager singleton.