Revert "SupportLeanbackDemos: Use Fragment#onPictureInPictureChanged()"

This reverts commit 9ca8c945ae9fd81c0931c7a4bfe93258d6600473.

Backgroud: this change breaks generatev4.py conversion process due to b/27495998

Bug: 27495998
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/PlaybackOverlayActivity.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/PlaybackOverlayActivity.java
index eed78f1..a0ea5fd 100644
--- a/samples/SupportLeanbackDemos/src/com/example/android/leanback/PlaybackOverlayActivity.java
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/PlaybackOverlayActivity.java
@@ -16,7 +16,11 @@
 import android.app.Activity;
 import android.os.Bundle;
 
+import java.util.ArrayList;
+import java.util.List;
+
 public class PlaybackOverlayActivity extends Activity {
+    private List<PictureInPictureListener> mListeners = new ArrayList<>();
 
     /** Called when the activity is first created. */
     @Override
@@ -25,4 +29,23 @@
         super.onCreate(savedInstanceState);
         setContentView(R.layout.playback_controls);
     }
+
+    @Override
+    public void onPictureInPictureChanged(boolean inPictureInPicture) {
+        for (PictureInPictureListener listener : mListeners) {
+            listener.onPictureInPictureChanged(inPictureInPicture);
+        }
+    }
+
+    public void registerPictureInPictureListener(PictureInPictureListener listener) {
+        mListeners.add(listener);
+    }
+
+    public void unregisterPictureInPictureListener(PictureInPictureListener listener) {
+        mListeners.remove(listener);
+    }
+
+    public interface PictureInPictureListener {
+        void onPictureInPictureChanged(boolean inPictureInPicture);
+    }
 }
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/PlaybackOverlayFragment.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/PlaybackOverlayFragment.java
index 313088f..849189e 100644
--- a/samples/SupportLeanbackDemos/src/com/example/android/leanback/PlaybackOverlayFragment.java
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/PlaybackOverlayFragment.java
@@ -43,7 +43,8 @@
 import android.widget.Toast;
 
 public class PlaybackOverlayFragment
-        extends android.support.v17.leanback.app.PlaybackOverlayFragment {
+        extends android.support.v17.leanback.app.PlaybackOverlayFragment
+        implements PlaybackOverlayActivity.PictureInPictureListener {
     private static final String TAG = "leanback.PlaybackControlsFragment";
 
     /**
@@ -170,11 +171,13 @@
         super.onStart();
         mGlue.setFadingEnabled(true);
         mGlue.enableProgressUpdating(mGlue.hasValidMedia() && mGlue.isMediaPlaying());
+        ((PlaybackOverlayActivity) getActivity()).registerPictureInPictureListener(this);
     }
 
     @Override
     public void onStop() {
         mGlue.enableProgressUpdating(false);
+        ((PlaybackOverlayActivity) getActivity()).unregisterPictureInPictureListener(this);
         super.onStop();
     }