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

Commit 12376ebc authored by Jaewan Kim's avatar Jaewan Kim Committed by android-build-merger
Browse files

Merge "PIP: Send KEYCODE_WINDOW to app first if PIP isn\'t exist" into nyc-dev

am: bdc47001

* commit 'bdc47001':
  PIP: Send KEYCODE_WINDOW to app first if PIP isn't exist

Change-Id: I72405b64139580d0a95872eb5d47f3a2f5f3d28d
parents 09bd1c1a bdc47001
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -3068,6 +3068,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     */
    public static final int RECENT_APPS_VISIBLE = 0x00004000;
    /**
     * @hide
     *
     * Whether the TV's picture-in-picture is visible or not.
     */
    public static final int TV_PICTURE_IN_PICTURE_VISIBLE = 0x00010000;
    /**
     * @hide
     *
+13 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.StyleRes;
import android.annotation.SystemApi;
import android.app.ActivityManagerNative;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
@@ -1255,6 +1256,18 @@ public abstract class Window {
        return getDecorView().findViewById(id);
    }

    /**
     * Puts the activity in picture-in-picture mode.
     * @see android.R.attr#supportsPictureInPicture
     * @hide
     */
    protected void enterPictureInPictureMode() {
        try {
            ActivityManagerNative.getDefault().enterPictureInPictureMode(mAppToken);
        } catch (IllegalArgumentException|RemoteException e) {
        }
    }

    /**
     * Convenience for
     * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)}
+7 −0
Original line number Diff line number Diff line
@@ -2002,6 +2002,13 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                }
                return true;
            }

            case KeyEvent.KEYCODE_WINDOW: {
                if (!event.isCanceled()) {
                    enterPictureInPictureMode();
                }
                return true;
            }
        }

        return false;
+2 −7
Original line number Diff line number Diff line
@@ -105,14 +105,9 @@ oneway interface IStatusBar
    void onCameraLaunchGestureDetected(int source);

    /**
     * Request picture-in-picture.
     *
     * <p>
     * This is called when an user presses picture-in-picture key or equivalent.
     * TV device may start picture-in-picture from foreground activity if there's none.
     * Picture-in-picture overlay menu will be shown instead otherwise.
     * Shows the TV's picture-in-picture menu if an activity is in picture-in-picture mode.
     */
    void requestTvPictureInPicture();
    void showTvPictureInPictureMenu();

    void addQsTile(in ComponentName tile);
    void remQsTile(in ComponentName tile);
+7 −7
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ public class CommandQueue extends IStatusBar.Stub {
    private static final int MSG_START_ASSIST                  = 23 << MSG_SHIFT;
    private static final int MSG_CAMERA_LAUNCH_GESTURE         = 24 << MSG_SHIFT;
    private static final int MSG_TOGGLE_KEYBOARD_SHORTCUTS     = 25 << MSG_SHIFT;
    private static final int MSG_REQUEST_TV_PICTURE_IN_PICTURE = 26 << MSG_SHIFT;
    private static final int MSG_SHOW_TV_PICTURE_IN_PICTURE_MENU = 26 << MSG_SHIFT;
    private static final int MSG_ADD_QS_TILE                   = 27 << MSG_SHIFT;
    private static final int MSG_REMOVE_QS_TILE                = 28 << MSG_SHIFT;
    private static final int MSG_CLICK_QS_TILE                 = 29 << MSG_SHIFT;
@@ -124,7 +124,7 @@ public class CommandQueue extends IStatusBar.Stub {
        void showAssistDisclosure();
        void startAssist(Bundle args);
        void onCameraLaunchGestureDetected(int source);
        void requestTvPictureInPicture();
        void showTvPictureInPictureMenu();

        void addQsTile(ComponentName tile);
        void remQsTile(ComponentName tile);
@@ -274,10 +274,10 @@ public class CommandQueue extends IStatusBar.Stub {
    }

    @Override
    public void requestTvPictureInPicture() {
    public void showTvPictureInPictureMenu() {
        synchronized (mLock) {
            mHandler.removeMessages(MSG_REQUEST_TV_PICTURE_IN_PICTURE);
            mHandler.obtainMessage(MSG_REQUEST_TV_PICTURE_IN_PICTURE).sendToTarget();
            mHandler.removeMessages(MSG_SHOW_TV_PICTURE_IN_PICTURE_MENU);
            mHandler.obtainMessage(MSG_SHOW_TV_PICTURE_IN_PICTURE_MENU).sendToTarget();
        }
    }

@@ -488,8 +488,8 @@ public class CommandQueue extends IStatusBar.Stub {
                case MSG_CAMERA_LAUNCH_GESTURE:
                    mCallbacks.onCameraLaunchGestureDetected(msg.arg1);
                    break;
                case MSG_REQUEST_TV_PICTURE_IN_PICTURE:
                    mCallbacks.requestTvPictureInPicture();
                case MSG_SHOW_TV_PICTURE_IN_PICTURE_MENU:
                    mCallbacks.showTvPictureInPictureMenu();
                    break;
                case MSG_ADD_QS_TILE:
                    mCallbacks.addQsTile((ComponentName) msg.obj);
Loading