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

Commit 559ea4de authored by Ben Lin's avatar Ben Lin
Browse files

Pass resize information to PipMenuActivityController.

Although resize is passed to PipMenuActivity via Binder, it is lost when
using PipMenuActivityController, which is responsible for animating the
slight-expand animation. We should respect the value passed here in case
the caller does not want to expand PIP.

Bug: None
Test: Use something to trigger pip controls while passing resize=false,
see resize not happening

Change-Id: Ieb8abf060adc523a2ea4ea403285339fa9cac135
parent a7aeb79b
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ public class PipMenuActivity extends Activity {
    private static final float DISABLED_ACTION_ALPHA = 0.54f;

    private int mMenuState;
    private boolean mResize = true;
    private boolean mAllowMenuTimeout = true;
    private boolean mAllowTouches = true;

@@ -323,7 +324,7 @@ public class PipMenuActivity extends Activity {
            if (mMenuContainerAnimator != null) {
                mMenuContainerAnimator.cancel();
            }
            notifyMenuStateChange(menuState);
            notifyMenuStateChange(menuState, resizeMenuOnShow);
            mMenuContainerAnimator = new AnimatorSet();
            ObjectAnimator menuAnim = ObjectAnimator.ofFloat(mMenuContainer, View.ALPHA,
                    mMenuContainer.getAlpha(), 1f);
@@ -370,7 +371,7 @@ public class PipMenuActivity extends Activity {
        if (mMenuState != MENU_STATE_NONE) {
            cancelDelayedFinish();
            if (notifyMenuVisibility) {
                notifyMenuStateChange(MENU_STATE_NONE);
                notifyMenuStateChange(MENU_STATE_NONE, mResize);
            }
            mMenuContainerAnimator = new AnimatorSet();
            ObjectAnimator menuAnim = ObjectAnimator.ofFloat(mMenuContainer, View.ALPHA,
@@ -528,11 +529,13 @@ public class PipMenuActivity extends Activity {
        mBackgroundDrawable.setAlpha(alpha);
    }

    private void notifyMenuStateChange(int menuState) {
    private void notifyMenuStateChange(int menuState, boolean resize) {
        mMenuState = menuState;
        mResize = resize;
        Message m = Message.obtain();
        m.what = PipMenuActivityController.MESSAGE_MENU_STATE_CHANGED;
        m.arg1 = menuState;
        m.arg2 = resize ?  1 : 0;
        sendMessage(m, "Could not notify controller of PIP menu visibility");
    }

@@ -571,6 +574,7 @@ public class PipMenuActivity extends Activity {
        Message m = Message.obtain();
        m.what = PipMenuActivityController.MESSAGE_UPDATE_ACTIVITY_CALLBACK;
        m.replyTo = callback;
        m.arg1 = mResize ?  1 : 0;
        sendMessage(m, "Could not notify controller of activity finished");
    }

+4 −2
Original line number Diff line number Diff line
@@ -138,7 +138,8 @@ public class PipMenuActivityController {
            switch (msg.what) {
                case MESSAGE_MENU_STATE_CHANGED: {
                    int menuState = msg.arg1;
                    onMenuStateChanged(menuState, true /* resize */);
                    boolean resize = msg.arg2 != 0;
                    onMenuStateChanged(menuState, resize);
                    break;
                }
                case MESSAGE_EXPAND_PIP: {
@@ -166,7 +167,8 @@ public class PipMenuActivityController {
                    }
                    // Mark the menu as invisible once the activity finishes as well
                    if (mToActivityMessenger == null) {
                        onMenuStateChanged(MENU_STATE_NONE, true /* resize */);
                        final boolean resize = msg.arg1 != 0;
                        onMenuStateChanged(MENU_STATE_NONE, resize);
                    }
                    break;
                }