@Implements(value=android.hardware.display.DisplayManager.class, minSdk=17) public class ShadowDisplayManager extends 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 |
---|---|
protected void |
__constructor__(Context context) |
static int |
addDisplay(String qualifiersStr)
Adds a simulated display.
|
static void |
changeDisplay(int displayId,
String qualifiersStr)
Changes properties of a simulated display.
|
static void |
configureDefaultDisplay(Configuration configuration,
DisplayMetrics displayMetrics)
internal only
|
float |
getSaturationLevel()
Returns the current display saturation level set via
DisplayManager.setSaturationLevel(float) . |
static void |
removeDisplay(int displayId)
Removes a simulated display.
|
void |
setSaturationLevel(float level)
Sets the current display saturation level.
|
@Implementation protected void __constructor__(Context context)
public static int addDisplay(String qualifiersStr)
Adds a simulated display.
qualifiersStr
- the Qualifiers
string representing characteristics of the new display.public static void configureDefaultDisplay(Configuration configuration, DisplayMetrics displayMetrics)
internal only
public static void changeDisplay(int displayId, 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 float getSaturationLevel()
Returns the current display saturation level set via DisplayManager.setSaturationLevel(float)
.
public 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)
.