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

Commit c8a349c8 authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Update a11y strings for flexible split

* Temporary solution, long term and hopefully more scalable is
to try to re-land ag/33667759

Test: Manual
Bug: 415827083
Flag: com.android.wm.shell.enable_flexible_two_app_split
Change-Id: I7beaeee40a81efcfcb2b0ebb3c91c9bf43129fde
parent 1348bc31
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -21,9 +21,11 @@

    <!-- Accessibility actions for the docked stack divider -->
    <item type="id" name="action_move_tl_full" />
    <item type="id" name="action_move_tl_90" />
    <item type="id" name="action_move_tl_70" />
    <item type="id" name="action_move_tl_50" />
    <item type="id" name="action_move_tl_30" />
    <item type="id" name="action_move_tl_10" />
    <item type="id" name="action_move_rb_full" />
    <item type="id" name="action_swap_apps" />

+16 −12
Original line number Diff line number Diff line
@@ -83,29 +83,33 @@
    <string name="divider_title">Split screen divider</string>

    <!-- Accessibility action for moving docked stack divider to make the left screen full screen [CHAR LIMIT=NONE] -->
    <string name="accessibility_action_divider_left_full">Left full screen</string>
    <string name="accessibility_action_divider_left_full">Make left app full screen</string>
    <!-- Accessibility action for moving docked stack divider to make the left screen 70% [CHAR LIMIT=NONE] -->
    <string name="accessibility_action_divider_left_70">Left 70%</string>
    <string formatted="false" name="accessibility_action_divider_left_10">10% left, 90% right</string>
    <string formatted="false" name="accessibility_action_divider_left_30">30% left, 70% right</string>
    <!-- Accessibility action for moving docked stack divider to make the left screen 50% [CHAR LIMIT=NONE] -->
    <string name="accessibility_action_divider_left_50">Left 50%</string>
    <string formatted="false" name="accessibility_action_divider_left_50">50% left, 50% right</string>
    <!-- Accessibility action for moving docked stack divider to make the left screen 30% [CHAR LIMIT=NONE] -->
    <string name="accessibility_action_divider_left_30">Left 30%</string>
    <string formatted="false" name="accessibility_action_divider_left_70">70% left, 30% right</string>
    <string formatted="false" name="accessibility_action_divider_left_90">90% left, 10% right</string>
    <!-- Accessibility action for moving docked stack divider to make the right screen full screen [CHAR LIMIT=NONE] -->
    <string name="accessibility_action_divider_right_full">Right full screen</string>
    <string name="accessibility_action_divider_right_full">Make right app full screen</string>
    <!-- Accessibility action for swapping the apps around the divider (double tap action) [CHAR LIMIT=NONE] -->
    <string name="accessibility_action_divider_swap_vertical">Swap top app with bottom</string>
    <string name="accessibility_action_divider_swap_horizontal">Swap left app with right</string>
    <string name="accessibility_action_divider_swap_vertical">Swap top app with bottom app, keep current split</string>
    <string name="accessibility_action_divider_swap_horizontal">Swap left app with right app, keep current split</string>

    <!-- Accessibility action for moving docked stack divider to make the top screen full screen [CHAR LIMIT=NONE] -->
    <string name="accessibility_action_divider_top_full">Top full screen</string>
    <string name="accessibility_action_divider_top_full">Make top app full screen</string>
    <!-- Accessibility action for moving docked stack divider to make the top screen 70% [CHAR LIMIT=NONE] -->
    <string name="accessibility_action_divider_top_70">Top 70%</string>
    <string formatted="false" name="accessibility_action_divider_top_10">10% top, 90% bottom</string>
    <string formatted="false" name="accessibility_action_divider_top_30">30% top, 70% bottom</string>
    <!-- Accessibility action for moving docked stack divider to make the top screen 50% [CHAR LIMIT=NONE] -->
    <string name="accessibility_action_divider_top_50">Top 50%</string>
    <string formatted="false" name="accessibility_action_divider_top_50">50% top, 50% bottom</string>
    <!-- Accessibility action for moving docked stack divider to make the top screen 30% [CHAR LIMIT=NONE] -->
    <string name="accessibility_action_divider_top_30">Top 30%</string>
    <string formatted="false" name="accessibility_action_divider_top_70">70% top, 30% bottom</string>
    <string formatted="false" name="accessibility_action_divider_top_90">90% top, 10% bottom</string>
    <!-- Accessibility action for moving docked stack divider to make the bottom screen full screen [CHAR LIMIT=NONE] -->
    <string name="accessibility_action_divider_bottom_full">Bottom full screen</string>
    <string name="accessibility_action_divider_bottom_full">Make bottom app full screen</string>

    <!-- Accessibility label for splitting to the left drop zone [CHAR LIMIT=NONE] -->
    <string name="accessibility_split_left">Split left</string>
+8 −0
Original line number Diff line number Diff line
@@ -541,6 +541,14 @@ public class DividerSnapAlgorithm {
        return mLastSplitTarget != mMiddleTarget;
    }

    public boolean isSecondSplitTargetAvailable() {
        return mSecondSplitTarget != mMiddleTarget;
    }

    public boolean isSecondLastSplitTargetAvailable() {
        return mSecondLastSplitTarget != mMiddleTarget;
    }

    /**
     * Finds the {@link SnapPosition} nearest to the given position.
     */
+60 −3
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.view.PointerIcon.TYPE_HORIZONTAL_DOUBLE_ARROW;
import static android.view.PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW;

import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.CURSOR_HOVER_STATES_ENABLED;
import static com.android.wm.shell.common.split.DividerSnapAlgorithm.SNAP_FLEXIBLE_HYBRID;
import static com.android.wm.shell.shared.split.SplitScreenConstants.snapPositionToUIString;

import android.animation.Animator;
@@ -151,10 +152,23 @@ public class DividerView extends FrameLayout implements View.OnTouchListener {
        public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
            super.onInitializeAccessibilityNodeInfo(host, info);
            final DividerSnapAlgorithm snapAlgorithm = mSplitLayout.mDividerSnapAlgorithm;
            // TODO(b/415827083) remove all this and try to re-land ag/33667759
            boolean showFlexSnapPoints = snapAlgorithm.areOffscreenRatiosSupported() &&
                    snapAlgorithm.getSnapMode() == SNAP_FLEXIBLE_HYBRID;
            if (mSplitLayout.isLeftRightSplit()) {
                info.addAction(new AccessibilityAction(R.id.action_move_tl_full,
                        mContext.getString(R.string.accessibility_action_divider_left_full)));
                if (snapAlgorithm.isFirstSplitTargetAvailable()) {
                    info.addAction(new AccessibilityAction(
                            showFlexSnapPoints ? R.id.action_move_tl_90 : R.id.action_move_tl_70,
                            showFlexSnapPoints ?
                                    mContext.getString(
                                            R.string.accessibility_action_divider_left_90)
                                    : mContext.getString(
                                            R.string.accessibility_action_divider_left_70)
                            ));
                }
                if (showFlexSnapPoints && snapAlgorithm.isSecondSplitTargetAvailable()) {
                    info.addAction(new AccessibilityAction(R.id.action_move_tl_70,
                            mContext.getString(R.string.accessibility_action_divider_left_70)));
                }
@@ -163,10 +177,20 @@ public class DividerView extends FrameLayout implements View.OnTouchListener {
                    info.addAction(new AccessibilityAction(R.id.action_move_tl_50,
                            mContext.getString(R.string.accessibility_action_divider_left_50)));
                }
                if (snapAlgorithm.isLastSplitTargetAvailable()) {
                if (showFlexSnapPoints && snapAlgorithm.isSecondLastSplitTargetAvailable()) {
                    info.addAction(new AccessibilityAction(R.id.action_move_tl_30,
                            mContext.getString(R.string.accessibility_action_divider_left_30)));
                }
                if (snapAlgorithm.isLastSplitTargetAvailable()) {
                    info.addAction(new AccessibilityAction(
                            showFlexSnapPoints ? R.id.action_move_tl_10 : R.id.action_move_tl_30,
                            showFlexSnapPoints ?
                                    mContext.getString(
                                            R.string.accessibility_action_divider_left_10)
                                    : mContext.getString(
                                            R.string.accessibility_action_divider_left_30)
                    ));
                }
                info.addAction(new AccessibilityAction(R.id.action_move_rb_full,
                        mContext.getString(R.string.accessibility_action_divider_right_full)));
                info.addAction(new AccessibilityAction(R.id.action_swap_apps,
@@ -175,6 +199,18 @@ public class DividerView extends FrameLayout implements View.OnTouchListener {
                info.addAction(new AccessibilityAction(R.id.action_move_tl_full,
                        mContext.getString(R.string.accessibility_action_divider_top_full)));
                if (snapAlgorithm.isFirstSplitTargetAvailable()) {
                    info.addAction(new AccessibilityAction(
                            showFlexSnapPoints ? R.id.action_move_tl_90 : R.id.action_move_tl_70,
                            showFlexSnapPoints ?
                                    mContext.getString(
                                            R.string.accessibility_action_divider_top_90)
                                    : mContext.getString(
                                            R.string.accessibility_action_divider_top_70)
                    ));
                    info.addAction(new AccessibilityAction(R.id.action_move_tl_70,
                            mContext.getString(R.string.accessibility_action_divider_top_70)));
                }
                if (showFlexSnapPoints && snapAlgorithm.isSecondSplitTargetAvailable()) {
                    info.addAction(new AccessibilityAction(R.id.action_move_tl_70,
                            mContext.getString(R.string.accessibility_action_divider_top_70)));
                }
@@ -183,10 +219,20 @@ public class DividerView extends FrameLayout implements View.OnTouchListener {
                    info.addAction(new AccessibilityAction(R.id.action_move_tl_50,
                            mContext.getString(R.string.accessibility_action_divider_top_50)));
                }
                if (snapAlgorithm.isLastSplitTargetAvailable()) {
                if (showFlexSnapPoints && snapAlgorithm.isSecondLastSplitTargetAvailable()) {
                    info.addAction(new AccessibilityAction(R.id.action_move_tl_30,
                            mContext.getString(R.string.accessibility_action_divider_top_30)));
                }
                if (snapAlgorithm.isLastSplitTargetAvailable()) {
                    info.addAction(new AccessibilityAction(
                            showFlexSnapPoints ? R.id.action_move_tl_10 : R.id.action_move_tl_30,
                            showFlexSnapPoints ?
                                    mContext.getString(
                                            R.string.accessibility_action_divider_top_10)
                                    : mContext.getString(
                                            R.string.accessibility_action_divider_top_30)
                    ));
                }
                info.addAction(new AccessibilityAction(R.id.action_move_rb_full,
                        mContext.getString(R.string.accessibility_action_divider_bottom_full)));
                info.addAction(new AccessibilityAction(R.id.action_swap_apps,
@@ -204,13 +250,24 @@ public class DividerView extends FrameLayout implements View.OnTouchListener {

            SnapTarget nextTarget = null;
            DividerSnapAlgorithm snapAlgorithm = mSplitLayout.mDividerSnapAlgorithm;
            // TODO(b/415827083) remove all this and try to re-land ag/33667759
            boolean showFlexSnapPoints = snapAlgorithm.areOffscreenRatiosSupported() &&
                    snapAlgorithm.getSnapMode() == SNAP_FLEXIBLE_HYBRID;
            if (action == R.id.action_move_tl_full) {
                nextTarget = snapAlgorithm.getDismissEndTarget();
            } else if (action == R.id.action_move_tl_70) {
            } else if (action == R.id.action_move_tl_90) {
                nextTarget = snapAlgorithm.getLastSplitTarget();
            } else if (action == R.id.action_move_tl_70) {
                nextTarget = showFlexSnapPoints ?
                        snapAlgorithm.getSecondLastSplitTarget() :
                        snapAlgorithm.getLastSplitTarget();
            } else if (action == R.id.action_move_tl_50) {
                nextTarget = snapAlgorithm.getMiddleTarget();
            } else if (action == R.id.action_move_tl_30) {
                nextTarget = showFlexSnapPoints ?
                        snapAlgorithm.getSecondSplitTarget() :
                        snapAlgorithm.getFirstSplitTarget();
            } else if (action == R.id.action_move_tl_10) {
                nextTarget = snapAlgorithm.getFirstSplitTarget();
            } else if (action == R.id.action_move_rb_full) {
                nextTarget = snapAlgorithm.getDismissStartTarget();