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

Commit 214c80ff authored by Roy Chou's avatar Roy Chou Committed by Android (Google) Code Review
Browse files

Merge changes Ia1402c90,Ibb579a54 into udc-qpr-dev

* changes:
  chore(#MagSettingsPanel): make service notify sysui the controlling magnifier scale changed
  chore(#MagSettingsPanel): adjust SeekBarWithIconButtonsView callbacks
parents ea0f7d80 adb4b95f
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -115,4 +115,13 @@ oneway interface IWindowMagnificationConnection {
     * @param callback the interface to be called.
     */
    void setConnectionCallback(in IWindowMagnificationConnectionCallback callback);

    /**
     * Notify System UI the magnification scale on the specified display for userId is changed.
     *
     * @param userId the user id.
     * @param displayId the logical display id.
     * @param scale magnification scale.
     */
    void onUserMagnificationScaleChanged(int userId, int displayId, float scale);
}
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
package com.android.internal.accessibility.common;

/**
 * Collection of common constants for accessibility shortcut.
 * Collection of common constants for accessibility magnification.
 */
public final class MagnificationConstants {
    private MagnificationConstants() {}
+17 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.content.Context;
import android.graphics.Rect;
import android.hardware.display.DisplayManager;
import android.os.Handler;
import android.util.SparseArray;
import android.view.Display;
import android.view.SurfaceControl;
import android.view.WindowManagerGlobal;
@@ -72,6 +73,9 @@ public class WindowMagnification implements CoreStartable, CommandQueue.Callback
    private WindowMagnificationConnectionImpl mWindowMagnificationConnectionImpl;
    private SysUiState mSysUiState;

    @VisibleForTesting
    SparseArray<SparseArray<Float>> mUsersScales = new SparseArray();

    private static class ControllerSupplier extends
            DisplayIdIndexSupplier<WindowMagnificationController> {

@@ -295,6 +299,19 @@ public class WindowMagnification implements CoreStartable, CommandQueue.Callback
        mModeSwitchesController.removeButton(displayId);
    }

    @MainThread
    void setUserMagnificationScale(int userId, int displayId, float scale) {
        SparseArray<Float> scales = mUsersScales.get(userId);
        if (scales == null) {
            scales = new SparseArray<>();
            mUsersScales.put(userId, scales);
        }
        if (scales.contains(displayId) && scales.get(displayId) == scale) {
            return;
        }
        scales.put(displayId, scale);
    }

    @VisibleForTesting
    final WindowMagnifierCallback mWindowMagnifierCallback = new WindowMagnifierCallback() {
        @Override
+6 −0
Original line number Diff line number Diff line
@@ -98,6 +98,12 @@ class WindowMagnificationConnectionImpl extends IWindowMagnificationConnection.S
        mHandler.post(() -> mWindowMagnification.hideMagnificationSettingsPanel(display));
    }

    @Override
    public void onUserMagnificationScaleChanged(int userId, int displayId, float scale) {
        mHandler.post(() -> mWindowMagnification.setUserMagnificationScale(
                userId, displayId, scale));
    }

    @Override
    public void setConnectionCallback(IWindowMagnificationConnectionCallback callback) {
        mConnectionCallback = callback;
+8 −2
Original line number Diff line number Diff line
@@ -172,7 +172,8 @@ class WindowMagnificationSettings implements MagnificationGestureDetector.OnGest
        };
    }

    private class ZoomSeekbarChangeListener implements SeekBar.OnSeekBarChangeListener {
    private class ZoomSeekbarChangeListener implements
            SeekBarWithIconButtonsView.OnSeekBarWithIconButtonsChangeListener {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            float scale = (progress / (float) mSeekBarMagnitude) + SCALE_MIN_VALUE;
@@ -197,6 +198,11 @@ class WindowMagnificationSettings implements MagnificationGestureDetector.OnGest
        public void onStopTrackingTouch(SeekBar seekBar) {
            // Do nothing
        }

        @Override
        public void onUserInteractionFinalized(SeekBar seekBar, @ControlUnitType int control) {
            // Do nothing
        }
    }

    private final AccessibilityDelegate mPanelDelegate = new AccessibilityDelegate() {
@@ -521,7 +527,7 @@ class WindowMagnificationSettings implements MagnificationGestureDetector.OnGest
                Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE, 0,
                UserHandle.USER_CURRENT);
        setScaleSeekbar(scale);
        mZoomSeekbar.setOnSeekBarChangeListener(new ZoomSeekbarChangeListener());
        mZoomSeekbar.setOnSeekBarWithIconButtonsChangeListener(new ZoomSeekbarChangeListener());

        mAllowDiagonalScrollingView =
                (LinearLayout) mSettingView.findViewById(R.id.magnifier_horizontal_lock_view);
Loading