@Implements(value=android.hardware.display.DisplayManager.class, minSdk=17) public class ShadowDisplayManager extends java.lang.Object
For tests, display properties may be changed and devices may be added or removed programmatically.
Constructor and Description |
---|
ShadowDisplayManager() |
Modifier and Type | Method and Description |
---|---|
static int |
addDisplay(java.lang.String qualifiersStr)
Adds a simulated display.
|
static void |
changeDisplay(int displayId,
java.lang.String qualifiersStr)
Changes properties of a simulated display.
|
static void |
configureDefaultDisplay(android.content.res.Configuration configuration,
android.util.DisplayMetrics displayMetrics)
internal only
|
static float |
getSaturationLevel()
Returns the current display saturation level set via
DisplayManager.setSaturationLevel(float) . |
static void |
removeDisplay(int displayId)
Removes a simulated display.
|
static void |
setSaturationLevel(float level)
Sets the current display saturation level.
|
public static int addDisplay(java.lang.String qualifiersStr)
Adds a simulated display.
qualifiersStr
- the Qualifiers
string representing characteristics of the new display.public static void configureDefaultDisplay(android.content.res.Configuration configuration, android.util.DisplayMetrics displayMetrics)
internal only
public static void changeDisplay(int displayId, java.lang.String qualifiersStr)
Changes properties of a simulated display. If qualifiersStr
starts with a plus (+
) sign, the display’s previous configuration is modified with the given qualifiers; otherwise defaults are applied as described here.
displayId
- the display id to changequalifiersStr
- the Qualifiers
string representing characteristics of the new displaypublic static void removeDisplay(int displayId)
Removes a simulated display.
displayId
- the display id to removepublic static float getSaturationLevel()
Returns the current display saturation level set via DisplayManager.setSaturationLevel(float)
.
public static void setSaturationLevel(float level)
Sets the current display saturation level.
This is a workaround for tests which cannot use the relevant hidden SystemApi
, DisplayManager.setSaturationLevel(float)
.