Search in sources :

Example 31 with OutOfResourcesException

use of android.view.Surface.OutOfResourcesException in project android_frameworks_base by crdroidandroid.

the class EmulatorDisplayOverlay method drawIfNeeded.

private void drawIfNeeded() {
    if (!mDrawNeeded || !mVisible) {
        return;
    }
    mDrawNeeded = false;
    Rect dirty = new Rect(0, 0, mScreenSize.x, mScreenSize.y);
    Canvas c = null;
    try {
        c = mSurface.lockCanvas(dirty);
    } catch (IllegalArgumentException e) {
    } catch (OutOfResourcesException e) {
    }
    if (c == null) {
        return;
    }
    c.drawColor(Color.TRANSPARENT, PorterDuff.Mode.SRC);
    mSurfaceControl.setPosition(0, 0);
    // Always draw the overlay with square dimensions
    int size = Math.max(mScreenSize.x, mScreenSize.y);
    mOverlay.setBounds(0, 0, size, size);
    mOverlay.draw(c);
    mSurface.unlockCanvasAndPost(c);
}
Also used : Rect(android.graphics.Rect) OutOfResourcesException(android.view.Surface.OutOfResourcesException) Canvas(android.graphics.Canvas) Point(android.graphics.Point)

Aggregations

OutOfResourcesException (android.view.Surface.OutOfResourcesException)31 Point (android.graphics.Point)21 Rect (android.graphics.Rect)19 RootViewSurfaceTaker (com.android.internal.view.RootViewSurfaceTaker)10 RemoteException (android.os.RemoteException)9 SurfaceControl (android.view.SurfaceControl)8 CompatibilityInfo (android.content.res.CompatibilityInfo)5 Configuration (android.content.res.Configuration)5 Resources (android.content.res.Resources)5 Canvas (android.graphics.Canvas)5 Region (android.graphics.Region)5 AnimatedVectorDrawable (android.graphics.drawable.AnimatedVectorDrawable)5 Drawable (android.graphics.drawable.Drawable)5 EGLSurface (android.opengl.EGLSurface)5 Surface (android.view.Surface)5 SurfaceSession (android.view.SurfaceSession)5 IAccessibilityInteractionConnectionCallback (android.view.accessibility.IAccessibilityInteractionConnectionCallback)5 InputMethodManager (android.view.inputmethod.InputMethodManager)5 BaseSurfaceHolder (com.android.internal.view.BaseSurfaceHolder)5 WindowManager (android.view.WindowManager)4