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

Commit c6ce0751 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8005451 from 8b988e72 to sc-v2-release

Change-Id: Id3c5f9dc1dc64a12aa4f59066a4a3dda0ed5d1de
parents aec993b9 8b988e72
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -54,6 +54,10 @@ public class FeatureFlagUtils {
    /** @hide */
    /** @hide */
    public static final String SETTINGS_SUPPORT_LARGE_SCREEN = "settings_support_large_screen";
    public static final String SETTINGS_SUPPORT_LARGE_SCREEN = "settings_support_large_screen";


    /** @hide */
    public static final String SETTINGS_ENABLE_MONITOR_PHANTOM_PROCS =
            "settings_enable_monitor_phantom_procs";

    private static final Map<String, String> DEFAULT_FLAGS;
    private static final Map<String, String> DEFAULT_FLAGS;


    static {
    static {
@@ -76,6 +80,7 @@ public class FeatureFlagUtils {
        DEFAULT_FLAGS.put(SETTINGS_USE_NEW_BACKUP_ELIGIBILITY_RULES, "true");
        DEFAULT_FLAGS.put(SETTINGS_USE_NEW_BACKUP_ELIGIBILITY_RULES, "true");
        DEFAULT_FLAGS.put(SETTINGS_ENABLE_SECURITY_HUB, "true");
        DEFAULT_FLAGS.put(SETTINGS_ENABLE_SECURITY_HUB, "true");
        DEFAULT_FLAGS.put(SETTINGS_SUPPORT_LARGE_SCREEN, "true");
        DEFAULT_FLAGS.put(SETTINGS_SUPPORT_LARGE_SCREEN, "true");
        DEFAULT_FLAGS.put(SETTINGS_ENABLE_MONITOR_PHANTOM_PROCS, "true");
    }
    }


    private static final Set<String> PERSISTENT_FLAGS;
    private static final Set<String> PERSISTENT_FLAGS;
@@ -83,6 +88,7 @@ public class FeatureFlagUtils {
        PERSISTENT_FLAGS = new HashSet<>();
        PERSISTENT_FLAGS = new HashSet<>();
        PERSISTENT_FLAGS.add(SETTINGS_PROVIDER_MODEL);
        PERSISTENT_FLAGS.add(SETTINGS_PROVIDER_MODEL);
        PERSISTENT_FLAGS.add(SETTINGS_SUPPORT_LARGE_SCREEN);
        PERSISTENT_FLAGS.add(SETTINGS_SUPPORT_LARGE_SCREEN);
        PERSISTENT_FLAGS.add(SETTINGS_ENABLE_MONITOR_PHANTOM_PROCS);
    }
    }


    /**
    /**
+26 −36
Original line number Original line Diff line number Diff line
@@ -3682,14 +3682,14 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                                    if (!mEdgeGlowBottom.isFinished()) {
                                    if (!mEdgeGlowBottom.isFinished()) {
                                        mEdgeGlowBottom.onRelease();
                                        mEdgeGlowBottom.onRelease();
                                    }
                                    }
                                    invalidateTopGlow();
                                    invalidateEdgeEffects();
                                } else if (incrementalDeltaY < 0) {
                                } else if (incrementalDeltaY < 0) {
                                    mEdgeGlowBottom.onPullDistance((float) overscroll / getHeight(),
                                    mEdgeGlowBottom.onPullDistance((float) overscroll / getHeight(),
                                            1.f - (float) x / getWidth());
                                            1.f - (float) x / getWidth());
                                    if (!mEdgeGlowTop.isFinished()) {
                                    if (!mEdgeGlowTop.isFinished()) {
                                        mEdgeGlowTop.onRelease();
                                        mEdgeGlowTop.onRelease();
                                    }
                                    }
                                    invalidateBottomGlow();
                                    invalidateEdgeEffects();
                                }
                                }
                            }
                            }
                        }
                        }
@@ -3729,7 +3729,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                            if (!mEdgeGlowBottom.isFinished()) {
                            if (!mEdgeGlowBottom.isFinished()) {
                                mEdgeGlowBottom.onRelease();
                                mEdgeGlowBottom.onRelease();
                            }
                            }
                            invalidateTopGlow();
                            invalidateEdgeEffects();
                        } else if (rawDeltaY < 0) {
                        } else if (rawDeltaY < 0) {
                            mEdgeGlowBottom.onPullDistance(
                            mEdgeGlowBottom.onPullDistance(
                                    (float) -overScrollDistance / getHeight(),
                                    (float) -overScrollDistance / getHeight(),
@@ -3737,7 +3737,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                            if (!mEdgeGlowTop.isFinished()) {
                            if (!mEdgeGlowTop.isFinished()) {
                                mEdgeGlowTop.onRelease();
                                mEdgeGlowTop.onRelease();
                            }
                            }
                            invalidateBottomGlow();
                            invalidateEdgeEffects();
                        }
                        }
                    }
                    }
                }
                }
@@ -3783,17 +3783,21 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
        // First allow releasing existing overscroll effect:
        // First allow releasing existing overscroll effect:
        float consumed = 0;
        float consumed = 0;
        if (mEdgeGlowTop.getDistance() != 0) {
        if (mEdgeGlowTop.getDistance() != 0) {
            if (canScrollUp()) {
                mEdgeGlowTop.onRelease();
            } else {
                consumed = mEdgeGlowTop.onPullDistance((float) deltaY / getHeight(),
                consumed = mEdgeGlowTop.onPullDistance((float) deltaY / getHeight(),
                        (float) x / getWidth());
                        (float) x / getWidth());
            if (consumed != 0f) {
                invalidateTopGlow();
            }
            }
            invalidateEdgeEffects();
        } else if (mEdgeGlowBottom.getDistance() != 0) {
        } else if (mEdgeGlowBottom.getDistance() != 0) {
            if (canScrollDown()) {
                mEdgeGlowBottom.onRelease();
            } else {
                consumed = -mEdgeGlowBottom.onPullDistance((float) -deltaY / getHeight(),
                consumed = -mEdgeGlowBottom.onPullDistance((float) -deltaY / getHeight(),
                        1f - (float) x / getWidth());
                        1f - (float) x / getWidth());
            if (consumed != 0f) {
                invalidateBottomGlow();
            }
            }
            invalidateEdgeEffects();
        }
        }
        int pixelsConsumed = Math.round(consumed * getHeight());
        int pixelsConsumed = Math.round(consumed * getHeight());
        return deltaY - pixelsConsumed;
        return deltaY - pixelsConsumed;
@@ -3803,30 +3807,16 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
     * @return <code>true</code> if either the top or bottom edge glow is currently active or
     * @return <code>true</code> if either the top or bottom edge glow is currently active or
     * <code>false</code> if it has no value to release.
     * <code>false</code> if it has no value to release.
     */
     */
    private boolean isGlowActive() {
    private boolean doesTouchStopStretch() {
        return mEdgeGlowBottom.getDistance() != 0 || mEdgeGlowTop.getDistance() != 0;
        return (mEdgeGlowBottom.getDistance() != 0 && !canScrollDown())
    }
                || (mEdgeGlowTop.getDistance() != 0 && !canScrollUp());

    private void invalidateTopGlow() {
        if (!shouldDisplayEdgeEffects()) {
            return;
        }
        final boolean clipToPadding = getClipToPadding();
        final int top = clipToPadding ? mPaddingTop : 0;
        final int left = clipToPadding ? mPaddingLeft : 0;
        final int right = clipToPadding ? getWidth() - mPaddingRight : getWidth();
        invalidate(left, top, right, top + mEdgeGlowTop.getMaxHeight());
    }
    }


    private void invalidateBottomGlow() {
    private void invalidateEdgeEffects() {
        if (!shouldDisplayEdgeEffects()) {
        if (!shouldDisplayEdgeEffects()) {
            return;
            return;
        }
        }
        final boolean clipToPadding = getClipToPadding();
        invalidate();
        final int bottom = clipToPadding ? getHeight() - mPaddingBottom : getHeight();
        final int left = clipToPadding ? mPaddingLeft : 0;
        final int right = clipToPadding ? getWidth() - mPaddingRight : getWidth();
        invalidate(left, bottom - mEdgeGlowBottom.getMaxHeight(), right, bottom);
    }
    }


    @Override
    @Override
@@ -4469,7 +4459,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                final int edgeY = Math.min(0, scrollY + mFirstPositionDistanceGuess) + translateY;
                final int edgeY = Math.min(0, scrollY + mFirstPositionDistanceGuess) + translateY;
                canvas.translate(translateX, edgeY);
                canvas.translate(translateX, edgeY);
                if (mEdgeGlowTop.draw(canvas)) {
                if (mEdgeGlowTop.draw(canvas)) {
                    invalidateTopGlow();
                    invalidateEdgeEffects();
                }
                }
                canvas.restoreToCount(restoreCount);
                canvas.restoreToCount(restoreCount);
            }
            }
@@ -4483,7 +4473,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                canvas.translate(edgeX, edgeY);
                canvas.translate(edgeX, edgeY);
                canvas.rotate(180, width, 0);
                canvas.rotate(180, width, 0);
                if (mEdgeGlowBottom.draw(canvas)) {
                if (mEdgeGlowBottom.draw(canvas)) {
                    invalidateBottomGlow();
                    invalidateEdgeEffects();
                }
                }
                canvas.restoreToCount(restoreCount);
                canvas.restoreToCount(restoreCount);
            }
            }
@@ -4573,7 +4563,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                mActivePointerId = ev.getPointerId(0);
                mActivePointerId = ev.getPointerId(0);


                int motionPosition = findMotionRow(y);
                int motionPosition = findMotionRow(y);
                if (isGlowActive()) {
                if (doesTouchStopStretch()) {
                    // Pressed during edge effect, so this is considered the same as a fling catch.
                    // Pressed during edge effect, so this is considered the same as a fling catch.
                    touchMode = mTouchMode = TOUCH_MODE_FLING;
                    touchMode = mTouchMode = TOUCH_MODE_FLING;
                } else if (touchMode != TOUCH_MODE_FLING && motionPosition >= 0) {
                } else if (touchMode != TOUCH_MODE_FLING && motionPosition >= 0) {
@@ -6579,7 +6569,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
     */
     */
    public void setBottomEdgeEffectColor(@ColorInt int color) {
    public void setBottomEdgeEffectColor(@ColorInt int color) {
        mEdgeGlowBottom.setColor(color);
        mEdgeGlowBottom.setColor(color);
        invalidateBottomGlow();
        invalidateEdgeEffects();
    }
    }


    /**
    /**
@@ -6593,7 +6583,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
     */
     */
    public void setTopEdgeEffectColor(@ColorInt int color) {
    public void setTopEdgeEffectColor(@ColorInt int color) {
        mEdgeGlowTop.setColor(color);
        mEdgeGlowTop.setColor(color);
        invalidateTopGlow();
        invalidateEdgeEffects();
    }
    }


    /**
    /**
+3 −0
Original line number Original line Diff line number Diff line
@@ -346,6 +346,9 @@ public class ExpandedAnimationController
     * bubble is dragged back into the row.
     * bubble is dragged back into the row.
     */
     */
    public void dragBubbleOut(View bubbleView, float x, float y) {
    public void dragBubbleOut(View bubbleView, float x, float y) {
        if (mMagnetizedBubbleDraggingOut == null) {
            return;
        }
        if (mSpringToTouchOnNextMotionEvent) {
        if (mSpringToTouchOnNextMotionEvent) {
            springBubbleTo(mMagnetizedBubbleDraggingOut.getUnderlyingObject(), x, y);
            springBubbleTo(mMagnetizedBubbleDraggingOut.getUnderlyingObject(), x, y);
            mSpringToTouchOnNextMotionEvent = false;
            mSpringToTouchOnNextMotionEvent = false;
+10 −4
Original line number Original line Diff line number Diff line
@@ -112,11 +112,17 @@ public interface Pip {
    default void showPictureInPictureMenu() {}
    default void showPictureInPictureMenu() {}


    /**
    /**
     * Called by NavigationBar in order to listen in for PiP bounds change. This is mostly used
     * Called by NavigationBar and TaskbarDelegate in order to listen in for PiP bounds change. This
     * for times where the PiP bounds could conflict with SystemUI elements, such as a stashed
     * is mostly used for times where the PiP bounds could conflict with SystemUI elements, such as
     * PiP and the Back-from-Edge gesture.
     * a stashed PiP and the Back-from-Edge gesture.
     */
     */
    default void setPipExclusionBoundsChangeListener(Consumer<Rect> listener) { }
    default void addPipExclusionBoundsChangeListener(Consumer<Rect> listener) { }

    /**
     * Remove a callback added previously. This is used when NavigationBar is removed from the
     * view hierarchy or destroyed.
     */
    default void removePipExclusionBoundsChangeListener(Consumer<Rect> listener) { }


    /**
    /**
     * Dump the current state and information if need.
     * Dump the current state and information if need.
+18 −8
Original line number Original line Diff line number Diff line
@@ -38,6 +38,8 @@ import com.android.wm.shell.common.DisplayLayout;
import java.io.PrintWriter;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Consumer;


@@ -89,7 +91,7 @@ public final class PipBoundsState {


    private @Nullable Runnable mOnMinimalSizeChangeCallback;
    private @Nullable Runnable mOnMinimalSizeChangeCallback;
    private @Nullable TriConsumer<Boolean, Integer, Boolean> mOnShelfVisibilityChangeCallback;
    private @Nullable TriConsumer<Boolean, Integer, Boolean> mOnShelfVisibilityChangeCallback;
    private @Nullable Consumer<Rect> mOnPipExclusionBoundsChangeCallback;
    private List<Consumer<Rect>> mOnPipExclusionBoundsChangeCallbacks = new ArrayList<>();


    public PipBoundsState(@NonNull Context context) {
    public PipBoundsState(@NonNull Context context) {
        mContext = context;
        mContext = context;
@@ -108,8 +110,8 @@ public final class PipBoundsState {
    /** Set the current PIP bounds. */
    /** Set the current PIP bounds. */
    public void setBounds(@NonNull Rect bounds) {
    public void setBounds(@NonNull Rect bounds) {
        mBounds.set(bounds);
        mBounds.set(bounds);
        if (mOnPipExclusionBoundsChangeCallback != null) {
        for (Consumer<Rect> callback : mOnPipExclusionBoundsChangeCallbacks) {
            mOnPipExclusionBoundsChangeCallback.accept(bounds);
            callback.accept(bounds);
        }
        }
    }
    }


@@ -407,17 +409,25 @@ public final class PipBoundsState {
    }
    }


    /**
    /**
     * Set a callback to watch out for PiP bounds. This is mostly used by SystemUI's
     * Add a callback to watch out for PiP bounds. This is mostly used by SystemUI's
     * Back-gesture handler, to avoid conflicting with PiP when it's stashed.
     * Back-gesture handler, to avoid conflicting with PiP when it's stashed.
     */
     */
    public void setPipExclusionBoundsChangeCallback(
    public void addPipExclusionBoundsChangeCallback(
            @Nullable Consumer<Rect> onPipExclusionBoundsChangeCallback) {
            @Nullable Consumer<Rect> onPipExclusionBoundsChangeCallback) {
        mOnPipExclusionBoundsChangeCallback = onPipExclusionBoundsChangeCallback;
        mOnPipExclusionBoundsChangeCallbacks.add(onPipExclusionBoundsChangeCallback);
        if (mOnPipExclusionBoundsChangeCallback != null) {
        for (Consumer<Rect> callback : mOnPipExclusionBoundsChangeCallbacks) {
            mOnPipExclusionBoundsChangeCallback.accept(getBounds());
            callback.accept(getBounds());
        }
        }
    }
    }


    /**
     * Remove a callback that was previously added.
     */
    public void removePipExclusionBoundsChangeCallback(
            @Nullable Consumer<Rect> onPipExclusionBoundsChangeCallback) {
        mOnPipExclusionBoundsChangeCallbacks.remove(onPipExclusionBoundsChangeCallback);
    }

    /** Source of truth for the current bounds of PIP that may be in motion. */
    /** Source of truth for the current bounds of PIP that may be in motion. */
    public static class MotionBoundsState {
    public static class MotionBoundsState {
        /** The bounds used when PIP is in motion (e.g. during a drag or animation) */
        /** The bounds used when PIP is in motion (e.g. during a drag or animation) */
Loading