Fix NPE while dispatching input event.
- occasionally, TvView can be detached while the input event is being processed. BUG: 14791903 Change-Id: Id1def32ace1bf9765ae30a00ea4579670d1d40aa
This commit is contained in:
@@ -31,6 +31,7 @@ import android.view.MotionEvent;
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.ViewRootImpl;
|
||||
|
||||
/**
|
||||
* View playing TV
|
||||
@@ -89,7 +90,10 @@ public class TvView extends SurfaceView {
|
||||
if (dispatchUnhandledInputEvent(event)) {
|
||||
return;
|
||||
}
|
||||
getViewRootImpl().dispatchUnhandledInputEvent(event);
|
||||
ViewRootImpl viewRootImpl = getViewRootImpl();
|
||||
if (viewRootImpl != null) {
|
||||
viewRootImpl.dispatchUnhandledInputEvent(event);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user