Merge "Fix NPE in TvInputService and TvView"

This commit is contained in:
Youngsang Cho
2014-05-14 00:39:28 +00:00
committed by Android (Google) Code Review
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;