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

Commit 7d8ae59f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Updates magnification button after an accessibility action is performed" into sc-dev

parents 086a0be6 80a35549
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -60,4 +60,11 @@ import android.graphics.Rect;
     */
    void onPerformScaleAction(int displayId, float scale);

    /**
     * Called when the accessibility action is performed.
     *
     * @param displayId The logical display id.
     */
    void onAccessibilityActionPerformed(int displayId);

}
+7 −0
Original line number Diff line number Diff line
@@ -194,6 +194,13 @@ public class WindowMagnification extends SystemUI implements WindowMagnifierCall
        }
    }

    @Override
    public void onAccessibilityActionPerformed(int displayId) {
        if (mWindowMagnificationConnectionImpl != null) {
            mWindowMagnificationConnectionImpl.onAccessibilityActionPerformed(displayId);
        }
    }

    @Override
    public void requestWindowMagnificationConnection(boolean connect) {
        if (connect) {
+10 −0
Original line number Diff line number Diff line
@@ -120,4 +120,14 @@ class WindowMagnificationConnectionImpl extends IWindowMagnificationConnection.S
            }
        }
    }

    void onAccessibilityActionPerformed(int displayId) {
        if (mConnectionCallback != null) {
            try {
                mConnectionCallback.onAccessibilityActionPerformed(displayId);
            } catch (RemoteException e) {
                Log.e(TAG, "Failed to inform an accessibility action is already performed", e);
            }
        }
    }
}
+9 −17
Original line number Diff line number Diff line
@@ -756,31 +756,23 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold
                final float scale = mScale + A11Y_CHANGE_SCALE_DIFFERENCE;
                mWindowMagnifierCallback.onPerformScaleAction(mDisplayId,
                        A11Y_ACTION_SCALE_RANGE.clamp(scale));
                return true;
            }
            if (action == R.id.accessibility_action_zoom_out) {
            } else if (action == R.id.accessibility_action_zoom_out) {
                final float scale = mScale - A11Y_CHANGE_SCALE_DIFFERENCE;
                mWindowMagnifierCallback.onPerformScaleAction(mDisplayId,
                        A11Y_ACTION_SCALE_RANGE.clamp(scale));
                return true;
            }
            if (action == R.id.accessibility_action_move_up) {
            } else if (action == R.id.accessibility_action_move_up) {
                move(0, -mSourceBounds.height());
                return true;
            }
            if (action == R.id.accessibility_action_move_down) {
            } else if (action == R.id.accessibility_action_move_down) {
                move(0, mSourceBounds.height());
                return true;
            }
            if (action == R.id.accessibility_action_move_left) {
            } else if (action == R.id.accessibility_action_move_left) {
                move(-mSourceBounds.width(), 0);
                return true;
            }
            if (action == R.id.accessibility_action_move_right) {
            } else if (action == R.id.accessibility_action_move_right) {
                move(mSourceBounds.width(), 0);
                return true;
            }
            } else {
                return false;
            }
            mWindowMagnifierCallback.onAccessibilityActionPerformed(mDisplayId);
            return true;
        }
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -46,4 +46,11 @@ interface WindowMagnifierCallback {
     * @param scale the target scale, or {@link Float#NaN} to leave unchanged
     */
    void onPerformScaleAction(int displayId, float scale);

    /**
     * Called when the accessibility action is performed.
     *
     * @param displayId The logical display id.
     */
    void onAccessibilityActionPerformed(int displayId);
}
Loading