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

Commit b7035f3a authored by Matthew Ng's avatar Matthew Ng
Browse files

Added open, dismiss and split screen as custom accessibility actions

In overview with talkback, swiping would select the individual apps
instead of the open and dismiss views. The open and dismiss actions
are changed to accessibility custom actions with the additional action
to split the current app into multi-window mode.

Test: manual - used talkback with running all three actions in
landscape and portrait
Fixes: 29360763
Change-Id: Ie0bec99b849c5754d45577c66b17fa6b0c7e985c
parent e961992e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -297,4 +297,11 @@
         If < 0, uses the value from HardwarePropertiesManager#getDeviceTemperatures. -->
    <integer name="config_warningTemperature">-1</integer>

    <!-- Accessibility actions -->
    <item type="id" name="action_split_task_to_left" />
    <item type="id" name="action_split_task_to_right" />
    <item type="id" name="action_split_task_to_top" />
    <item type="id" name="action_open" />
    <item type="id" name="action_dimiss" />

</resources>
+10 −0
Original line number Diff line number Diff line
@@ -786,6 +786,16 @@
    <string name="recents_multistack_add_stack_dialog_split_vertical">Split Vertical</string>
    <!-- Recents: MultiStack add stack split custom radio button. [CHAR LIMIT=NONE] -->
    <string name="recents_multistack_add_stack_dialog_split_custom">Split Custom</string>
    <!-- Recents: Accessibility dismiss label -->
    <string name="recents_accessibility_dismissed">Dismiss</string>
    <!-- Recents: Accessibility open label -->
    <string name="recents_accessibility_open">Open</string>
    <!-- Recents: Accessibility split to the top -->
    <string name="recents_accessibility_split_screen_top">Split screen to the top</string>
    <!-- Recents: Accessibility split to the left -->
    <string name="recents_accessibility_split_screen_left">Split screen to the left</string>
    <!-- Recents: Accessibility split to the right -->
    <string name="recents_accessibility_split_screen_right">Split screen to the right</string>

    <!-- Fully qualified activity class names to be blacklisted in Recents, add package names into overlay as needed -->
    <string-array name="recents_blacklist_array">
+41 −2
Original line number Diff line number Diff line
@@ -17,12 +17,33 @@
package com.android.systemui.recents;

import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Rect;

import android.os.SystemProperties;
import com.android.systemui.R;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.model.TaskStack;

/**
 * Represents the dock regions for each orientation.
 */
class DockRegion {
    public static TaskStack.DockState[] PHONE_LANDSCAPE = {
            // We only allow docking to the left in landscape for now on small devices
            TaskStack.DockState.LEFT
    };
    public static TaskStack.DockState[] PHONE_PORTRAIT = {
            // We only allow docking to the top for now on small devices
            TaskStack.DockState.TOP
    };
    public static TaskStack.DockState[] TABLET_LANDSCAPE = {
            TaskStack.DockState.LEFT,
            TaskStack.DockState.RIGHT
    };
    public static TaskStack.DockState[] TABLET_PORTRAIT = PHONE_PORTRAIT;
}

/**
 * Application resources that can be retrieved from the application context and are not specifically
@@ -63,12 +84,14 @@ public class RecentsConfiguration {
    // Recents will layout task views in a grid mode when there's enough space in the screen.
    public boolean isGridEnabled;

    private final Context mAppContext;

    public RecentsConfiguration(Context context) {
        // Load only resources that can not change after the first load either through developer
        // settings or via multi window
        SystemServicesProxy ssp = Recents.getSystemServices();
        Context appContext = context.getApplicationContext();
        Resources res = appContext.getResources();
        mAppContext = context.getApplicationContext();
        Resources res = mAppContext.getResources();
        fakeShadows = res.getBoolean(R.bool.config_recents_fake_shadows);
        svelteLevel = res.getInteger(R.integer.recents_svelte_level);
        isGridEnabled = SystemProperties.getBoolean("ro.recents.grid", false);
@@ -86,4 +109,20 @@ public class RecentsConfiguration {
    public RecentsActivityLaunchState getLaunchState() {
        return mLaunchState;
    }

    /**
     * Returns the preferred dock states for the current orientation.
     * @return a list of dock states for device and its orientation
     */
    public TaskStack.DockState[] getDockStatesForCurrentOrientation() {
        boolean isLandscape = mAppContext.getResources().getConfiguration().orientation ==
                Configuration.ORIENTATION_LANDSCAPE;
        RecentsConfiguration config = Recents.getConfiguration();
        if (config.isLargeScreen) {
            return isLandscape ? DockRegion.TABLET_LANDSCAPE : DockRegion.TABLET_PORTRAIT;
        } else {
            return isLandscape ? DockRegion.PHONE_LANDSCAPE : DockRegion.PHONE_PORTRAIT;
        }
    }

}
+7 −0
Original line number Diff line number Diff line
@@ -30,10 +30,17 @@ public class DragStartEvent extends EventBus.Event {
    public final Task task;
    public final TaskView taskView;
    public final Point tlOffset;
    public final boolean isUserTouchInitiated;

    public DragStartEvent(Task task, TaskView taskView, Point tlOffset) {
        this(task, taskView, tlOffset, true);
    }

    public DragStartEvent(Task task, TaskView taskView, Point tlOffset,
            boolean isUserTouchInitiated) {
        this.task = task;
        this.taskView = taskView;
        this.tlOffset = tlOffset;
        this.isUserTouchInitiated = isUserTouchInitiated;
    }
}
+3 −2
Original line number Diff line number Diff line
@@ -454,7 +454,7 @@ public class RecentsView extends FrameLayout {
    }

    public final void onBusEvent(DragStartEvent event) {
        updateVisibleDockRegions(mTouchHandler.getDockStatesForCurrentOrientation(),
        updateVisibleDockRegions(Recents.getConfiguration().getDockStatesForCurrentOrientation(),
                true /* isDefaultDockState */, TaskStack.DockState.NONE.viewState.dockAreaAlpha,
                TaskStack.DockState.NONE.viewState.hintTextAlpha,
                true /* animateAlpha */, false /* animateBounds */);
@@ -471,7 +471,8 @@ public class RecentsView extends FrameLayout {

    public final void onBusEvent(DragDropTargetChangedEvent event) {
        if (event.dropTarget == null || !(event.dropTarget instanceof TaskStack.DockState)) {
            updateVisibleDockRegions(mTouchHandler.getDockStatesForCurrentOrientation(),
            updateVisibleDockRegions(
                    Recents.getConfiguration().getDockStatesForCurrentOrientation(),
                    true /* isDefaultDockState */, TaskStack.DockState.NONE.viewState.dockAreaAlpha,
                    TaskStack.DockState.NONE.viewState.hintTextAlpha,
                    true /* animateAlpha */, true /* animateBounds */);
Loading