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

Commit 36c492cf authored by Youngsang Cho's avatar Youngsang Cho Committed by Android (Google) Code Review
Browse files

Merge "Explictly release the surface in TV input framework"

parents f6b635e4 f8362068
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);
            }
        }