Fix NPE in TvInputService and TvView

Bug: 14781233, Bug: 14629185
Change-Id: I8511674f4f3864b3deaa58f4c95b9c91e68f49f4
This commit is contained in:
Youngsang Cho
2014-05-13 21:13:47 +09:00
parent 59618a1890
commit c31c450f5d
2 changed files with 4 additions and 2 deletions

View File

@@ -489,7 +489,7 @@ public abstract class TvInputService extends Service {
}
}
}
if (mOverlayView == null) {
if (mOverlayView == null || !mOverlayView.isAttachedToWindow()) {
return Session.DISPATCH_NOT_HANDLED;
}
if (!mOverlayView.hasWindowFocus()) {

View File

@@ -347,7 +347,9 @@ public class TvView extends SurfaceView {
public void onSessionCreated(Session session) {
if (this != mSessionCallback) {
// This callback is obsolete.
session.release();
if (session != null) {
session.release();
}
return;
}
mSession = session;