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

Commit 3df4588d authored by Kazuki Takise's avatar Kazuki Takise Committed by Android (Google) Code Review
Browse files

Merge "Add config flag to disable Pinch resize PiP" into main

parents 9534c6e5 50e71b59
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -413,11 +413,6 @@ public final class SystemUiDeviceConfigFlags {
    public static final String DARK_LAUNCH_REMOTE_PREDICTION_SERVICE_ENABLED =
            "dark_launch_remote_prediction_service_enabled";

    /**
     * (boolean) Whether to enable pinch resizing for PIP.
     */
    public static final String PIP_PINCH_RESIZE = "pip_pinch_resize";

    /**
     * (boolean) Whether to enable stashing for PIP.
     */
+3 −0
Original line number Diff line number Diff line
@@ -58,6 +58,9 @@
         if a custom action is present before closing it. -->
    <integer name="config_pipForceCloseDelay">1000</integer>

    <!-- Allow PIP to resize via pinch gesture. -->
    <bool name="config_pipEnablePinchResize">true</bool>

    <!-- Animation duration when using long press on recents to dock -->
    <integer name="long_press_dock_anim_duration">250</integer>

+2 −17
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
 */
package com.android.wm.shell.pip.phone;

import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.PIP_PINCH_RESIZE;
import static com.android.internal.policy.TaskResizingAlgorithm.CTRL_BOTTOM;
import static com.android.internal.policy.TaskResizingAlgorithm.CTRL_LEFT;
import static com.android.internal.policy.TaskResizingAlgorithm.CTRL_NONE;
@@ -31,7 +30,6 @@ import android.graphics.Rect;
import android.graphics.Region;
import android.hardware.input.InputManager;
import android.os.Looper;
import android.provider.DeviceConfig;
import android.view.BatchedInputEventReceiver;
import android.view.Choreographer;
import android.view.InputChannel;
@@ -155,21 +153,8 @@ public class PipResizeGestureHandler {
        mContext.getDisplay().getRealSize(mMaxSize);
        reloadResources();

        mEnablePinchResize = DeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_SYSTEMUI,
                PIP_PINCH_RESIZE,
                /* defaultValue = */ true);
        DeviceConfig.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_SYSTEMUI,
                mMainExecutor,
                new DeviceConfig.OnPropertiesChangedListener() {
                    @Override
                    public void onPropertiesChanged(DeviceConfig.Properties properties) {
                        if (properties.getKeyset().contains(PIP_PINCH_RESIZE)) {
                            mEnablePinchResize = properties.getBoolean(
                                    PIP_PINCH_RESIZE, /* defaultValue = */ true);
                        }
                    }
                });
        final Resources res = mContext.getResources();
        mEnablePinchResize = res.getBoolean(R.bool.config_pipEnablePinchResize);
    }

    public void onConfigurationChanged() {
+5 −0
Original line number Diff line number Diff line
@@ -28,11 +28,13 @@ import static org.mockito.Mockito.verify;
import android.graphics.Rect;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
import android.testing.TestableResources;
import android.view.MotionEvent;
import android.view.ViewConfiguration;

import androidx.test.filters.SmallTest;

import com.android.wm.shell.R;
import com.android.wm.shell.ShellTestCase;
import com.android.wm.shell.common.FloatingContentCoordinator;
import com.android.wm.shell.common.ShellExecutor;
@@ -98,6 +100,9 @@ public class PipResizeGestureHandlerTest extends ShellTestCase {
    @Before
    public void setUp() throws Exception {
        MockitoAnnotations.initMocks(this);
        final TestableResources res = mContext.getOrCreateTestableResources();
        res.addOverride(R.bool.config_pipEnablePinchResize, true);

        mPipDisplayLayoutState = new PipDisplayLayoutState(mContext);
        mSizeSpecSource = new PhoneSizeSpecSource(mContext, mPipDisplayLayoutState);
        mPipBoundsState = new PipBoundsState(mContext, mSizeSpecSource, mPipDisplayLayoutState);