Search in sources :

Example 6 with SurfaceSession

use of android.view.SurfaceSession in project android_frameworks_base by ParanoidAndroid.

the class Session method windowAddedLocked.

void windowAddedLocked() {
    if (mSurfaceSession == null) {
        if (WindowManagerService.localLOGV)
            Slog.v(WindowManagerService.TAG, "First window added to " + this + ", creating SurfaceSession");
        mSurfaceSession = new SurfaceSession();
        if (WindowManagerService.SHOW_TRANSACTIONS)
            Slog.i(WindowManagerService.TAG, "  NEW SURFACE SESSION " + mSurfaceSession);
        mService.mSessions.add(this);
    }
    mNumWindow++;
}
Also used : SurfaceSession(android.view.SurfaceSession)

Example 7 with SurfaceSession

use of android.view.SurfaceSession in project android_frameworks_base by ParanoidAndroid.

the class ElectronBeam method createSurface.

/* not used because it is too expensive to create / destroy contexts all of the time
    private void destroyEglContext() {
        if (mEglContext != null) {
            if (!EGL14.eglDestroyContext(mEglDisplay, mEglContext)) {
                logEglError("eglDestroyContext");
            }
            mEglContext = null;
        }
    }*/
private boolean createSurface() {
    if (mSurfaceSession == null) {
        mSurfaceSession = new SurfaceSession();
    }
    SurfaceControl.openTransaction();
    try {
        if (mSurfaceControl == null) {
            try {
                int flags;
                if (mMode == MODE_FADE) {
                    flags = SurfaceControl.FX_SURFACE_DIM | SurfaceControl.HIDDEN;
                } else {
                    flags = SurfaceControl.OPAQUE | SurfaceControl.HIDDEN;
                }
                mSurfaceControl = new SurfaceControl(mSurfaceSession, "ElectronBeam", mDisplayWidth, mDisplayHeight, PixelFormat.OPAQUE, flags);
            } catch (SurfaceControl.OutOfResourcesException ex) {
                Slog.e(TAG, "Unable to create surface.", ex);
                return false;
            }
        }
        mSurfaceControl.setLayerStack(mDisplayLayerStack);
        mSurfaceControl.setSize(mDisplayWidth, mDisplayHeight);
        mSurface = new Surface();
        mSurface.copyFrom(mSurfaceControl);
        mSurfaceLayout = new NaturalSurfaceLayout(mDisplayManager, mSurfaceControl);
        mSurfaceLayout.onDisplayTransaction();
    } finally {
        SurfaceControl.closeTransaction();
    }
    return true;
}
Also used : SurfaceSession(android.view.SurfaceSession) SurfaceControl(android.view.SurfaceControl) Surface(android.view.Surface) EGLSurface(android.opengl.EGLSurface)

Example 8 with SurfaceSession

use of android.view.SurfaceSession in project android_frameworks_base by AOSPA.

the class ColorFade method createSurface.

private boolean createSurface() {
    if (mSurfaceSession == null) {
        mSurfaceSession = new SurfaceSession();
    }
    SurfaceControl.openTransaction();
    try {
        if (mSurfaceControl == null) {
            try {
                int flags;
                if (mMode == MODE_FADE) {
                    flags = SurfaceControl.FX_SURFACE_DIM | SurfaceControl.HIDDEN;
                } else {
                    flags = SurfaceControl.OPAQUE | SurfaceControl.HIDDEN;
                }
                mSurfaceControl = new SurfaceControl(mSurfaceSession, "ColorFade", mDisplayWidth, mDisplayHeight, PixelFormat.OPAQUE, flags);
            } catch (OutOfResourcesException ex) {
                Slog.e(TAG, "Unable to create surface.", ex);
                return false;
            }
            mSurfaceControl.setLayerStack(mDisplayLayerStack);
            mSurfaceControl.setSize(mDisplayWidth, mDisplayHeight);
            mSurface = new Surface();
            mSurface.copyFrom(mSurfaceControl);
            mSurfaceLayout = new NaturalSurfaceLayout(mDisplayManagerInternal, mDisplayId, mSurfaceControl);
            mSurfaceLayout.onDisplayTransaction();
        }
    } finally {
        SurfaceControl.closeTransaction();
    }
    return true;
}
Also used : OutOfResourcesException(android.view.Surface.OutOfResourcesException) SurfaceSession(android.view.SurfaceSession) SurfaceControl(android.view.SurfaceControl) EGLSurface(android.opengl.EGLSurface) Surface(android.view.Surface)

Example 9 with SurfaceSession

use of android.view.SurfaceSession in project android_frameworks_base by DirtyUnicorns.

the class ColorFade method createSurface.

private boolean createSurface() {
    if (mSurfaceSession == null) {
        mSurfaceSession = new SurfaceSession();
    }
    SurfaceControl.openTransaction();
    try {
        if (mSurfaceControl == null) {
            try {
                int flags;
                if (mMode == MODE_FADE) {
                    flags = SurfaceControl.FX_SURFACE_DIM | SurfaceControl.HIDDEN;
                } else {
                    flags = SurfaceControl.OPAQUE | SurfaceControl.HIDDEN;
                }
                mSurfaceControl = new SurfaceControl(mSurfaceSession, "ColorFade", mDisplayWidth, mDisplayHeight, PixelFormat.OPAQUE, flags);
            } catch (OutOfResourcesException ex) {
                Slog.e(TAG, "Unable to create surface.", ex);
                return false;
            }
            mSurfaceControl.setLayerStack(mDisplayLayerStack);
            mSurfaceControl.setSize(mDisplayWidth, mDisplayHeight);
            mSurface = new Surface();
            mSurface.copyFrom(mSurfaceControl);
            mSurfaceLayout = new NaturalSurfaceLayout(mDisplayManagerInternal, mDisplayId, mSurfaceControl);
            mSurfaceLayout.onDisplayTransaction();
        }
    } finally {
        SurfaceControl.closeTransaction();
    }
    return true;
}
Also used : OutOfResourcesException(android.view.Surface.OutOfResourcesException) SurfaceSession(android.view.SurfaceSession) SurfaceControl(android.view.SurfaceControl) EGLSurface(android.opengl.EGLSurface) Surface(android.view.Surface)

Example 10 with SurfaceSession

use of android.view.SurfaceSession in project android_frameworks_base by ResurrectionRemix.

the class ColorFade method createSurface.

private boolean createSurface() {
    if (mSurfaceSession == null) {
        mSurfaceSession = new SurfaceSession();
    }
    SurfaceControl.openTransaction();
    try {
        if (mSurfaceControl == null) {
            try {
                int flags;
                if (mMode == MODE_FADE) {
                    flags = SurfaceControl.FX_SURFACE_DIM | SurfaceControl.HIDDEN;
                } else {
                    flags = SurfaceControl.OPAQUE | SurfaceControl.HIDDEN;
                }
                mSurfaceControl = new SurfaceControl(mSurfaceSession, "ColorFade", mDisplayWidth, mDisplayHeight, PixelFormat.OPAQUE, flags);
            } catch (OutOfResourcesException ex) {
                Slog.e(TAG, "Unable to create surface.", ex);
                return false;
            }
            mSurfaceControl.setLayerStack(mDisplayLayerStack);
            mSurfaceControl.setSize(mDisplayWidth, mDisplayHeight);
            mSurface = new Surface();
            mSurface.copyFrom(mSurfaceControl);
            mSurfaceLayout = new NaturalSurfaceLayout(mDisplayManagerInternal, mDisplayId, mSurfaceControl);
            mSurfaceLayout.onDisplayTransaction();
        }
    } finally {
        SurfaceControl.closeTransaction();
    }
    return true;
}
Also used : OutOfResourcesException(android.view.Surface.OutOfResourcesException) SurfaceSession(android.view.SurfaceSession) SurfaceControl(android.view.SurfaceControl) EGLSurface(android.opengl.EGLSurface) Surface(android.view.Surface)

Aggregations

SurfaceSession (android.view.SurfaceSession)12 EGLSurface (android.opengl.EGLSurface)6 Surface (android.view.Surface)6 SurfaceControl (android.view.SurfaceControl)6 OutOfResourcesException (android.view.Surface.OutOfResourcesException)5