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

Commit 690c6914 authored by mincheli's avatar mincheli
Browse files

Assigns the default value of the cache magnification mode

The magnification switch button is not visible because the
image source is not set when calling showButton().
Because the default value of cache magnification mode is
the same as the current magnification mode.
And the check in showButton() blocks setting the image source
To fix this for fullscreen mode, the default value is replaced
ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN with
ACCESSIBILITY_MAGNIFICATION_MODE_NONE.

Bug: 188857483
Test: atest MagnificationModeSwitchTest
Change-Id: I36eb7b20f94adbab49f006627e60badeb0b0f02f
parent 27e37769
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.accessibility;

import static android.provider.Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_NONE;
import static android.provider.Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW;

import android.annotation.NonNull;
@@ -70,7 +71,7 @@ class MagnificationModeSwitch implements MagnificationGestureDetector.OnGestureL
    private final ImageView mImageView;
    private final Runnable mWindowInsetChangeRunnable;
    private final SfVsyncFrameCallbackProvider mSfVsyncFrameProvider;
    private int mMagnificationMode = Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN;
    private int mMagnificationMode = ACCESSIBILITY_MAGNIFICATION_MODE_NONE;
    private final LayoutParams mParams;
    @VisibleForTesting
    final Rect mDraggableWindowBounds = new Rect();
+4 −6
Original line number Diff line number Diff line
@@ -100,8 +100,6 @@ public class MagnificationModeSwitchTest extends SysuiTestCase {
    private AccessibilityManager mAccessibilityManager;
    @Mock
    private SfVsyncFrameCallbackProvider mSfVsyncFrameProvider;
    @Mock
    private Handler mHandler;
    private TestableWindowManager mWindowManager;
    private ViewPropertyAnimator mViewPropertyAnimator;
    private MagnificationModeSwitch mMagnificationModeSwitch;
@@ -152,12 +150,12 @@ public class MagnificationModeSwitchTest extends SysuiTestCase {
    }

    @Test
    public void showWindowModeButton_fullscreenMode_addViewAndSetImageResource() {
        mMagnificationModeSwitch.showButton(ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW);
    public void showFullscreenModeButton_addViewAndSetImageResource() {
        mMagnificationModeSwitch.showButton(ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN);

        verify(mSpyImageView).setImageResource(
                getIconResId(ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW));
        verify(mWindowManager).addView(eq(mSpyImageView), any(WindowManager.LayoutParams.class));
                getIconResId(ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN));
        assertEquals(mSpyImageView, mWindowManager.getAttachedView());
        assertShowFadingAnimation(FADE_IN_ALPHA);
        assertShowFadingAnimation(FADE_OUT_ALPHA);
    }