Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8362068 authored by Youngsang Cho's avatar Youngsang Cho
Browse files

Explictly release the surface in TV input framework

Change-Id: Id178e8959f9c25d1d5f1ab85d5e8455577570d11
parent aa2112f6
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -150,6 +150,7 @@ public abstract class TvInputService extends Service {
        private final KeyEvent.DispatcherState mDispatcherState = new KeyEvent.DispatcherState();
        private final WindowManager mWindowManager;
        private WindowManager.LayoutParams mWindowParams;
        private Surface mSurface;
        private View mOverlayView;
        private boolean mOverlayViewEnabled;
        private IBinder mWindowToken;
@@ -346,6 +347,10 @@ public abstract class TvInputService extends Service {
         */
        void release() {
            onRelease();
            if (mSurface != null) {
                mSurface.release();
                mSurface = null;
            }
            removeOverlayView(true);
        }

@@ -354,6 +359,10 @@ public abstract class TvInputService extends Service {
         */
        void setSurface(Surface surface) {
            onSetSurface(surface);
            if (mSurface != null) {
                mSurface.release();
            }
            mSurface = surface;
            // TODO: Handle failure.
        }

+4 −0
Original line number Diff line number Diff line
@@ -554,6 +554,10 @@ public final class TvInputManagerService extends SystemService {
                    }
                }
            } finally {
                if (surface != null) {
                    // surface is not used in TvInputManagerService.
                    surface.release();
                }
                Binder.restoreCallingIdentity(identity);
            }
        }