Here are the examples of the java api android.app.Vr2dDisplayProperties taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
17
Source : Vr2dDisplay.java
with Apache License 2.0
from lulululbj
with Apache License 2.0
from lulululbj
/**
* Sets the resolution and DPI of the Vr2d virtual display used to display
* 2D applications in VR mode.
*
* <p>Requires {@link android.Manifest.permission#ACCESS_VR_MANAGER} permission.</p>
*
* @param displayProperties Properties of the virtual display for 2D applications
* in VR mode.
*/
public void setVirtualDisplayProperties(Vr2dDisplayProperties displayProperties) {
synchronized (mVdLock) {
if (DEBUG) {
Log.i(TAG, "VD setVirtualDisplayProperties: " + displayProperties.toString());
}
int width = displayProperties.getWidth();
int height = displayProperties.getHeight();
int dpi = displayProperties.getDpi();
boolean resized = false;
if (width < MIN_VR_DISPLAY_WIDTH || height < MIN_VR_DISPLAY_HEIGHT || dpi < MIN_VR_DISPLAY_DPI) {
Log.i(TAG, "Ignoring Width/Height/Dpi values of " + width + "," + height + "," + dpi);
} else {
Log.i(TAG, "Setting width/height/dpi to " + width + "," + height + "," + dpi);
mVirtualDisplayWidth = width;
mVirtualDisplayHeight = height;
mVirtualDisplayDpi = dpi;
resized = true;
}
if ((displayProperties.getFlags() & Vr2dDisplayProperties.FLAG_VIRTUAL_DISPLAY_ENABLED) == Vr2dDisplayProperties.FLAG_VIRTUAL_DISPLAY_ENABLED) {
mIsVirtualDisplayAllowed = true;
} else if ((displayProperties.getRemovedFlags() & Vr2dDisplayProperties.FLAG_VIRTUAL_DISPLAY_ENABLED) == Vr2dDisplayProperties.FLAG_VIRTUAL_DISPLAY_ENABLED) {
mIsVirtualDisplayAllowed = false;
}
if (mVirtualDisplay != null && resized && mIsVirtualDisplayAllowed) {
mVirtualDisplay.resize(mVirtualDisplayWidth, mVirtualDisplayHeight, mVirtualDisplayDpi);
ImageReader oldImageReader = mImageReader;
mImageReader = null;
startImageReader();
oldImageReader.close();
}
// Start/Stop the virtual display in case the updates indicated that we should.
updateVirtualDisplay();
}
}