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

Commit 58b977cf authored by Roy Chou's avatar Roy Chou
Browse files

chore(#MagSettingsPanel): change persisting scale timing

Originally the Settings presisted scale is updated when the panel seekbar progress is changed or the window magnifier scale is changed by accessibility actions. In WindowMagnificationController we keep the same behavior. In WindowMagnificationSettings, per b/286176069 we change to only update the persisted scale with the seekbar final progress when the user interaction on seekbar is ended. We change the onPerformScaleAction parameters so when sysui call the service to change the magnifier scale, we can decide if the persisted scale should be updated.

Bug: 286176069
Test: manually
      atest WindowMagnificationTest
      atest MagnificationSettingsControllerTest
      atest WindowMagnificationSettingsTest
      atest WindowMagnificationControllerTest
      atest WindowMagnificationManagerTest
      atest MagnificationControllerTest
Change-Id: I995a059c6575298eeae095fb3daa9f037916014a
Merged-In: I995a059c6575298eeae095fb3daa9f037916014a
parent 96261a53
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -57,8 +57,9 @@ import android.graphics.Rect;
     *
     * @param displayId The logical display id.
     * @param scale the target scale, or {@link Float#NaN} to leave unchanged
     * @param updatePersistence whether the new scale should be persisted in Settings
     */
    void onPerformScaleAction(int displayId, float scale);
    void onPerformScaleAction(int displayId, float scale, boolean updatePersistence);

    /**
     * Called when the accessibility action is performed.
+4 −3
Original line number Diff line number Diff line
@@ -164,8 +164,9 @@ public class MagnificationSettingsController implements ComponentCallbacks {
         *
         * @param displayId The logical display id.
         * @param scale Magnification scale value.
         * @param updatePersistence whether the new scale should be persisted.
         */
        void onMagnifierScale(int displayId, float scale);
        void onMagnifierScale(int displayId, float scale, boolean updatePersistence);

        /**
         * Called when magnification mode changed.
@@ -215,9 +216,9 @@ public class MagnificationSettingsController implements ComponentCallbacks {
        }

        @Override
        public void onMagnifierScale(float scale) {
        public void onMagnifierScale(float scale, boolean updatePersistence) {
            mSettingsControllerCallback.onMagnifierScale(mDisplayId,
                    A11Y_ACTION_SCALE_RANGE.clamp(scale));
                    A11Y_ACTION_SCALE_RANGE.clamp(scale), updatePersistence);
        }
    };
}
+6 −4
Original line number Diff line number Diff line
@@ -333,9 +333,10 @@ public class WindowMagnification implements CoreStartable, CommandQueue.Callback
        }

        @Override
        public void onPerformScaleAction(int displayId, float scale) {
        public void onPerformScaleAction(int displayId, float scale, boolean updatePersistence) {
            if (mWindowMagnificationConnectionImpl != null) {
                mWindowMagnificationConnectionImpl.onPerformScaleAction(displayId, scale);
                mWindowMagnificationConnectionImpl.onPerformScaleAction(
                        displayId, scale, updatePersistence);
            }
        }

@@ -384,9 +385,10 @@ public class WindowMagnification implements CoreStartable, CommandQueue.Callback
        }

        @Override
        public void onMagnifierScale(int displayId, float scale) {
        public void onMagnifierScale(int displayId, float scale, boolean updatePersistence) {
            if (mWindowMagnificationConnectionImpl != null) {
                mWindowMagnificationConnectionImpl.onPerformScaleAction(displayId, scale);
                mWindowMagnificationConnectionImpl.onPerformScaleAction(
                        displayId, scale, updatePersistence);
            }
        }

+2 −2
Original line number Diff line number Diff line
@@ -129,10 +129,10 @@ class WindowMagnificationConnectionImpl extends IWindowMagnificationConnection.S
        }
    }

    void onPerformScaleAction(int displayId, float scale) {
    void onPerformScaleAction(int displayId, float scale, boolean updatePersistence) {
        if (mConnectionCallback != null) {
            try {
                mConnectionCallback.onPerformScaleAction(displayId, scale);
                mConnectionCallback.onPerformScaleAction(displayId, scale, updatePersistence);
            } catch (RemoteException e) {
                Log.e(TAG, "Failed to inform performing scale action", e);
            }
+2 −1
Original line number Diff line number Diff line
@@ -1511,7 +1511,8 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold

        private void performScale(float scale) {
            scale = A11Y_ACTION_SCALE_RANGE.clamp(scale);
            mWindowMagnifierCallback.onPerformScaleAction(mDisplayId, scale);
            mWindowMagnifierCallback.onPerformScaleAction(
                    mDisplayId, scale, /* updatePersistence= */ true);
        }
    }
}
 No newline at end of file
Loading