org.robolectric.shadows.ShadowDisplayManagerGlobal Maven / Gradle / Ivy
package org.robolectric.shadows;
import android.hardware.display.DisplayManagerGlobal;
import android.hardware.display.IDisplayManager;
import android.hardware.display.RoboDisplayManager;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.internal.Shadow;
import org.robolectric.util.ReflectionHelpers;
import org.robolectric.util.ReflectionHelpers.ClassParameter;
import android.view.Display;
/**
* Shadow for {@link android.hardware.display.DisplayManagerGlobal}.
*/
@Implements(value = DisplayManagerGlobal.class, isInAndroidSdk = false)
public class ShadowDisplayManagerGlobal {
private static final RoboDisplayManager displayManager = new RoboDisplayManager();
@Implementation
public static Object getInstance() {
return ReflectionHelpers.callConstructor(DisplayManagerGlobal.class,
ClassParameter.from(IDisplayManager.class, displayManager));
}
@Implementation
public Object getDisplayInfo(int displayId) {
Object result = Shadow.newInstanceOf("android.view.DisplayInfo");
ReflectionHelpers.setField(result, "supportedModes", new Display.Mode[] { new Display.Mode(0, 0, 0, 0.0f) });
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy