Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d90a2ae authored by Sergey Nikolaienkov's avatar Sergey Nikolaienkov
Browse files

Remove TV specific methods from Pip interface

Remove TV "legacy" methods from Pip interface:
  - addListener(...) that takes .tv.PipController.Listener objects
  - getMediaController()
  - getPlaybackState()
Leave both methods in .tv.PipController with package-private access
level.

Bug: 165795012
Bug: 169575409
Test: make WindowManager-Shell
Change-Id: I335d7d098b1a7af2c7958cd234553e7fde6557ac
parent c32a9421
Loading
Loading
Loading
Loading
+1 −33
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.app.PictureInPictureParams;
import android.content.ComponentName;
import android.content.pm.ActivityInfo;
import android.graphics.Rect;
import android.media.session.MediaController;

import com.android.wm.shell.pip.phone.PipTouchHandler;
import com.android.wm.shell.pip.tv.PipController;
@@ -34,13 +33,6 @@ import java.util.function.Consumer;
 * Interface to engage picture in picture feature.
 */
public interface Pip {
    /**
     * Registers {@link com.android.wm.shell.pip.tv.PipController.Listener} that gets called.
     * whenever receiving notification on changes in PIP.
     */
    default void addListener(PipController.Listener listener) {
    }

    /**
     * Registers a {@link PipController.MediaListener} to PipController.
     */
@@ -67,18 +59,9 @@ public interface Pip {
    default void expandPip() {
    }

    /**
     * Get current play back state. (e.g: Used in TV)
     *
     * @return The state of defined in PipController.
     */
    default int getPlaybackState() {
        return -1;
    }

    /**
     * Get the touch handler which manages all the touch handling for PIP on the Phone,
     * including moving, dismissing and expanding the PIP. (Do not used in TV)
     * including moving, dismissing and expanding the PIP. (Do not use in TV)
     *
     * @return
     */
@@ -86,15 +69,6 @@ public interface Pip {
        return null;
    }

    /**
     * Get MediaController.
     *
     * @return The MediaController instance.
     */
    default MediaController getMediaController() {
        return null;
    }

    /**
     * Hides the PIP menu.
     */
@@ -170,12 +144,6 @@ public interface Pip {
    default void onTaskStackChanged() {
    }

    /**
     * Removes a {@link PipController.Listener} from PipController.
     */
    default void removeListener(PipController.Listener listener) {
    }

    /**
     * Removes a {@link PipController.MediaListener} from PipController.
     */
+4 −4
Original line number Diff line number Diff line
@@ -545,14 +545,14 @@ public class PipController implements Pip, PipTaskOrganizer.PipTransitionCallbac
    /**
     * Adds a {@link Listener} to PipController.
     */
    public void addListener(Listener listener) {
    void addListener(Listener listener) {
        mListeners.add(listener);
    }

    /**
     * Removes a {@link Listener} from PipController.
     */
    public void removeListener(Listener listener) {
    void removeListener(Listener listener) {
        mListeners.remove(listener);
    }

@@ -641,7 +641,7 @@ public class PipController implements Pip, PipTaskOrganizer.PipTransitionCallbac
    /**
     * Gets the {@link android.media.session.MediaController} for the PIPed activity.
     */
    public MediaController getMediaController() {
    MediaController getMediaController() {
        return mPipMediaController;
    }

@@ -655,7 +655,7 @@ public class PipController implements Pip, PipTaskOrganizer.PipTransitionCallbac
     * This returns one of {@link #PLAYBACK_STATE_PLAYING}, {@link #PLAYBACK_STATE_PAUSED},
     * or {@link #PLAYBACK_STATE_UNAVAILABLE}.
     */
    public int getPlaybackState() {
    int getPlaybackState() {
        if (mPipMediaController == null || mPipMediaController.getPlaybackState() == null) {
            return PLAYBACK_STATE_UNAVAILABLE;
        }