Merge "TIF: Handle possible memory leaks" into nyc-dev

This commit is contained in:
TreeHugger Robot
2016-05-10 01:23:35 +00:00
committed by Android (Google) Code Review

View File

@@ -78,6 +78,8 @@ public abstract class TvInputService extends Service {
private static final boolean DEBUG = false; private static final boolean DEBUG = false;
private static final String TAG = "TvInputService"; private static final String TAG = "TvInputService";
private static final int DETACH_OVERLAY_VIEW_TIMEOUT_MS = 5000;
/** /**
* This is the interface name that a service implementing a TV input should say that it support * This is the interface name that a service implementing a TV input should say that it support
* -- that is, this is the action it uses for its intent filter. To be supported, the service * -- that is, this is the action it uses for its intent filter. To be supported, the service
@@ -268,7 +270,6 @@ public abstract class TvInputService extends Service {
* Base class for derived classes to implement to provide a TV input session. * Base class for derived classes to implement to provide a TV input session.
*/ */
public abstract static class Session implements KeyEvent.Callback { public abstract static class Session implements KeyEvent.Callback {
private static final int DETACH_OVERLAY_VIEW_TIMEOUT_MS = 5000;
private static final int POSITION_UPDATE_INTERVAL_MS = 1000; private static final int POSITION_UPDATE_INTERVAL_MS = 1000;
private final KeyEvent.DispatcherState mDispatcherState = new KeyEvent.DispatcherState(); private final KeyEvent.DispatcherState mDispatcherState = new KeyEvent.DispatcherState();
@@ -1256,7 +1257,7 @@ public abstract class TvInputService extends Service {
// Creates a container view to check hanging on the overlay view detaching. // Creates a container view to check hanging on the overlay view detaching.
// Adding/removing the overlay view to/from the container make the view attach/detach // Adding/removing the overlay view to/from the container make the view attach/detach
// logic run on the main thread. // logic run on the main thread.
mOverlayViewContainer = new FrameLayout(mContext); mOverlayViewContainer = new FrameLayout(mContext.getApplicationContext());
mOverlayViewContainer.addView(mOverlayView); mOverlayViewContainer.addView(mOverlayView);
// TvView's window type is TYPE_APPLICATION_MEDIA and we want to create // TvView's window type is TYPE_APPLICATION_MEDIA and we want to create
// an overlay window above the media window but below the application window. // an overlay window above the media window but below the application window.
@@ -1496,8 +1497,9 @@ public abstract class TvInputService extends Service {
POSITION_UPDATE_INTERVAL_MS); POSITION_UPDATE_INTERVAL_MS);
} }
} }
}
private final class OverlayViewCleanUpTask extends AsyncTask<View, Void, Void> { private static final class OverlayViewCleanUpTask extends AsyncTask<View, Void, Void> {
@Override @Override
protected Void doInBackground(View... views) { protected Void doInBackground(View... views) {
View overlayViewParent = views[0]; View overlayViewParent = views[0];
@@ -1517,7 +1519,6 @@ public abstract class TvInputService extends Service {
return null; return null;
} }
} }
}
/** /**
* Base class for derived classes to implement to provide a TV input recording session. * Base class for derived classes to implement to provide a TV input recording session.