use of android.view.Display in project android_frameworks_base by AOSPA.
the class VirtualDisplayTest method testPrivateVirtualDisplay.
/**
* Ensures that an application can create a private virtual display and show
* its own windows on it.
*/
public void testPrivateVirtualDisplay() throws Exception {
VirtualDisplay virtualDisplay = mDisplayManager.createVirtualDisplay(NAME, WIDTH, HEIGHT, DENSITY, mSurface, 0);
assertNotNull("virtual display must not be null", virtualDisplay);
Display display = virtualDisplay.getDisplay();
try {
assertDisplayRegistered(display, Display.FLAG_PRIVATE);
// Show a private presentation on the display.
assertDisplayCanShowPresentation("private presentation window", display, BLUEISH, WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION, 0);
} finally {
virtualDisplay.release();
}
assertDisplayUnregistered(display);
}
use of android.view.Display in project android_frameworks_base by AOSPA.
the class VirtualDisplayTest method testSecurePublicPresentationVirtualDisplay.
/**
* Ensures that an application can create a secure public virtual display and show
* its own windows on it. This test requires the CAPTURE_SECURE_VIDEO_OUTPUT permission.
*
* Because this test does not have an activity token, we use the TOAST window
* type to create the window. Another choice might be SYSTEM_ALERT_WINDOW but
* that requires a permission.
*/
public void testSecurePublicPresentationVirtualDisplay() throws Exception {
VirtualDisplay virtualDisplay = mDisplayManager.createVirtualDisplay(NAME, WIDTH, HEIGHT, DENSITY, mSurface, DisplayManager.VIRTUAL_DISPLAY_FLAG_SECURE | DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION);
assertNotNull("virtual display must not be null", virtualDisplay);
Display display = virtualDisplay.getDisplay();
try {
assertDisplayRegistered(display, Display.FLAG_PRESENTATION | Display.FLAG_SECURE);
// Mirroring case with secure window (and display is secure).
// Show a window on the default display. It should be mirrored to the
// virtual display automatically.
Display defaultDisplay = mDisplayManager.getDisplay(Display.DEFAULT_DISPLAY);
assertDisplayCanShowPresentation("mirrored secure window on secure display", defaultDisplay, GREENISH, WindowManager.LayoutParams.TYPE_TOAST, WindowManager.LayoutParams.FLAG_SECURE);
// Presentation case with secure window (and display is secure).
// Show a normal presentation on the display.
assertDisplayCanShowPresentation("secure presentation window on secure display", display, BLUEISH, WindowManager.LayoutParams.TYPE_TOAST, WindowManager.LayoutParams.FLAG_SECURE);
} finally {
virtualDisplay.release();
}
assertDisplayUnregistered(display);
}
use of android.view.Display in project generic-oauth2-login-for-android by wareninja.
the class FacebookOAuthDialog method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSpinner = new ProgressDialog(getContext());
mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
mSpinner.setMessage("Loading...");
mContent = new LinearLayout(getContext());
mContent.setOrientation(LinearLayout.VERTICAL);
setUpTitle();
setUpWebView();
Display display = getWindow().getWindowManager().getDefaultDisplay();
final float scale = getContext().getResources().getDisplayMetrics().density;
float[] dimensions = display.getWidth() < display.getHeight() ? DIMENSIONS_PORTRAIT : DIMENSIONS_LANDSCAPE;
addContentView(mContent, new FrameLayout.LayoutParams((int) (dimensions[0] * scale + 0.5f), (int) (dimensions[1] * scale + 0.5f)));
}
use of android.view.Display in project generic-oauth2-login-for-android by wareninja.
the class FsqOAuthDialog method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSpinner = new ProgressDialog(getContext());
mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
mSpinner.setMessage("Loading...");
mContent = new LinearLayout(getContext());
mContent.setOrientation(LinearLayout.VERTICAL);
setUpTitle();
setUpWebView();
Display display = getWindow().getWindowManager().getDefaultDisplay();
final float scale = getContext().getResources().getDisplayMetrics().density;
float[] dimensions = display.getWidth() < display.getHeight() ? DIMENSIONS_PORTRAIT : DIMENSIONS_LANDSCAPE;
addContentView(mContent, new FrameLayout.LayoutParams((int) (dimensions[0] * scale + 0.5f), (int) (dimensions[1] * scale + 0.5f)));
}
use of android.view.Display in project generic-oauth2-login-for-android by wareninja.
the class GowallaOAuthDialog method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSpinner = new ProgressDialog(getContext());
mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
mSpinner.setMessage("Loading...");
mContent = new LinearLayout(getContext());
mContent.setOrientation(LinearLayout.VERTICAL);
setUpTitle();
setUpWebView();
Display display = getWindow().getWindowManager().getDefaultDisplay();
final float scale = getContext().getResources().getDisplayMetrics().density;
float[] dimensions = display.getWidth() < display.getHeight() ? DIMENSIONS_PORTRAIT : DIMENSIONS_LANDSCAPE;
addContentView(mContent, new FrameLayout.LayoutParams((int) (dimensions[0] * scale + 0.5f), (int) (dimensions[1] * scale + 0.5f)));
}
Aggregations