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

Commit 76dddad0 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "Remove PIP tuner items" into oc-dev am: 86339dc8 am: 2d11f63d"

parents 8b5d1a5e d7637ece
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -1892,21 +1892,6 @@
    <!-- PiP BTW notification description. [CHAR LIMIT=NONE] -->
    <string name="pip_notification_message">If you don’t want <xliff:g id="name" example="Google Maps">%s</xliff:g> to use this feature, tap to open settings and turn it off.</string>

    <!-- PiP section of the tuner. [CHAR LIMIT=NONE] -->
    <string name="picture_in_picture" translatable="false">Picture-in-Picture</string>

    <!-- PiP minimize title. [CHAR LIMIT=NONE]-->
    <string name="pip_minimize_title" translatable="false">Minimize</string>

    <!-- PiP minimize description. [CHAR LIMIT=NONE] -->
    <string name="pip_minimize_description" translatable="false">Drag or fling the PIP to the edges of the screen to minimize it.</string>

    <!-- PiP fling to dismiss title. [CHAR LIMIT=NONE]-->
    <string name="pip_fling_dismiss_title" translatable="false">Fling to dismiss</string>

    <!-- PiP fling to dismiss description. [CHAR LIMIT=NONE] -->
    <string name="pip_fling_dismiss_description" translatable="false">Fling from anywhere on the screen to the bottom of the screen to dismiss the PIP.</string>

    <!-- Button to play the current media on picture-in-picture (PIP) [CHAR LIMIT=30] -->
    <string name="pip_play">Play</string>

+0 −18
Original line number Diff line number Diff line
@@ -121,24 +121,6 @@

    </PreferenceScreen>

    <PreferenceScreen
      android:key="picture_in_picture"
      android:title="@string/picture_in_picture">

      <com.android.systemui.tuner.TunerSwitch
        android:key="pip_minimize"
        android:title="@string/pip_minimize_title"
        android:summary="@string/pip_minimize_description"
        sysui:defValue="false" />

      <com.android.systemui.tuner.TunerSwitch
        android:key="pip_fling_dismiss"
        android:title="@string/pip_fling_dismiss_title"
        android:summary="@string/pip_fling_dismiss_description"
        sysui:defValue="false" />

    </PreferenceScreen>

    <PreferenceScreen
      android:key="doze"
      android:title="@string/tuner_doze">
+11 −30
Original line number Diff line number Diff line
@@ -54,11 +54,13 @@ import java.io.PrintWriter;
 * Manages all the touch handling for PIP on the Phone, including moving, dismissing and expanding
 * the PIP.
 */
public class PipTouchHandler implements TunerService.Tunable {
public class PipTouchHandler {
    private static final String TAG = "PipTouchHandler";

    private static final String TUNER_KEY_MINIMIZE = "pip_minimize";
    private static final String TUNER_KEY_FLING_DISMISS = "pip_fling_dismiss";
    // Allow the PIP to be dragged to the edge of the screen to be minimized.
    private static final boolean ENABLE_MINIMIZE = false;
    // Allow the PIP to be flung from anywhere on the screen to the bottom to be dismissed.
    private static final boolean ENABLE_FLING_DISMISS = false;

    // These values are used for metrics and should never change
    private static final int METRIC_VALUE_DISMISSED_BY_TAP = 0;
@@ -113,11 +115,6 @@ public class PipTouchHandler implements TunerService.Tunable {
                }
            };

    // Allow the PIP to be dragged to the edge of the screen to be minimized.
    private boolean mEnableMinimize = false;
    // Allow the PIP to be flung from anywhere on the screen to the bottom to be dismissed.
    private boolean mEnableFlingToDismiss = false;

    // Behaviour states
    private int mMenuState;
    private boolean mIsMinimized;
@@ -196,10 +193,6 @@ public class PipTouchHandler implements TunerService.Tunable {
        mExpandedShortestEdgeSize = context.getResources().getDimensionPixelSize(
                R.dimen.pip_expanded_shortest_edge_size);

        // Register any tuner settings changes
        Dependency.get(TunerService.class).addTunable(this, TUNER_KEY_MINIMIZE);
        Dependency.get(TunerService.class).addTunable(this, TUNER_KEY_FLING_DISMISS);

        // Register the listener for input consumer touch events
        inputConsumerController.setTouchListener(this::handleTouchEvent);
        inputConsumerController.setRegistrationListener(this::onRegistrationChanged);
@@ -240,18 +233,6 @@ public class PipTouchHandler implements TunerService.Tunable {
        }
    }

    @Override
    public void onTuningChanged(String key, String newValue) {
        switch (key) {
            case TUNER_KEY_MINIMIZE:
                mEnableMinimize = newValue == null ? false : Integer.parseInt(newValue) != 0;
                break;
            case TUNER_KEY_FLING_DISMISS:
                mEnableFlingToDismiss = newValue == null ? false : Integer.parseInt(newValue) != 0;
                break;
        }
    }

    public void onConfigurationChanged() {
        mMotionHelper.onConfigurationChanged();
        mMotionHelper.synchronizePinnedStackBounds();
@@ -451,7 +432,7 @@ public class PipTouchHandler implements TunerService.Tunable {
     * Sets the minimized state.
     */
    void setMinimizedStateInternal(boolean isMinimized) {
        if (!mEnableMinimize) {
        if (!ENABLE_MINIMIZE) {
            return;
        }
        setMinimizedState(isMinimized, false /* fromController */);
@@ -461,7 +442,7 @@ public class PipTouchHandler implements TunerService.Tunable {
     * Sets the minimized state.
     */
    void setMinimizedState(boolean isMinimized, boolean fromController) {
        if (!mEnableMinimize) {
        if (!ENABLE_MINIMIZE) {
            return;
        }
        if (mIsMinimized != isMinimized) {
@@ -597,7 +578,7 @@ public class PipTouchHandler implements TunerService.Tunable {
                final PointF lastDelta = touchState.getLastTouchDelta();
                float left = mTmpBounds.left + lastDelta.x;
                float top = mTmpBounds.top + lastDelta.y;
                if (!touchState.allowDraggingOffscreen() || !mEnableMinimize) {
                if (!touchState.allowDraggingOffscreen() || !ENABLE_MINIMIZE) {
                    left = Math.max(mMovementBounds.left, Math.min(mMovementBounds.right, left));
                }
                if (ENABLE_DISMISS_DRAG_TO_EDGE) {
@@ -645,7 +626,7 @@ public class PipTouchHandler implements TunerService.Tunable {
            final boolean isHorizontal = Math.abs(vel.x) > Math.abs(vel.y);
            final float velocity = PointF.length(vel.x, vel.y);
            final boolean isFling = velocity > mFlingAnimationUtils.getMinVelocityPxPerSecond();
            final boolean isUpWithinDimiss = mEnableFlingToDismiss
            final boolean isUpWithinDimiss = ENABLE_FLING_DISMISS
                    && touchState.getLastTouchPosition().y >= mMovementBounds.bottom
                    && mMotionHelper.isGestureToDismissArea(mMotionHelper.getBounds(), vel.x,
                            vel.y, isFling);
@@ -666,7 +647,7 @@ public class PipTouchHandler implements TunerService.Tunable {
            if (touchState.isDragging()) {
                final boolean isFlingToEdge = isFling && isHorizontal && mMovementWithinMinimize
                        && (mStartedOnLeft ? vel.x < 0 : vel.x > 0);
                if (mEnableMinimize &&
                if (ENABLE_MINIMIZE &&
                        !mIsMinimized && (mMotionHelper.shouldMinimizePip() || isFlingToEdge)) {
                    // Pip should be minimized
                    setMinimizedStateInternal(true);
@@ -758,7 +739,7 @@ public class PipTouchHandler implements TunerService.Tunable {
        pw.println(innerPrefix + "mImeHeight=" + mImeHeight);
        pw.println(innerPrefix + "mSavedSnapFraction=" + mSavedSnapFraction);
        pw.println(innerPrefix + "mEnableDragToEdgeDismiss=" + ENABLE_DISMISS_DRAG_TO_EDGE);
        pw.println(innerPrefix + "mEnableMinimize=" + mEnableMinimize);
        pw.println(innerPrefix + "mEnableMinimize=" + ENABLE_MINIMIZE);
        mSnapAlgorithm.dump(pw, innerPrefix);
        mTouchState.dump(pw, innerPrefix);
        mMotionHelper.dump(pw, innerPrefix);