Loading packages/SystemUI/src/com/android/systemui/accessibility/MagnificationModeSwitch.java +6 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.content.pm.ActivityInfo; import android.graphics.PixelFormat; import android.graphics.PointF; import android.os.Bundle; import android.os.UserHandle; import android.provider.Settings; import android.util.MathUtils; import android.view.Gravity; Loading Loading @@ -232,8 +233,11 @@ class MagnificationModeSwitch { mMagnificationMode ^ Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_ALL; mMagnificationMode = newMode; mImageView.setImageResource(getIconResId(newMode)); Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE, newMode); Settings.Secure.putIntForUser( mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE, newMode, UserHandle.USER_CURRENT); } private void handleSingleTap() { Loading packages/SystemUI/tests/src/com/android/systemui/accessibility/MagnificationModeSwitchTest.java +5 −4 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import static org.mockito.Mockito.when; import android.content.Context; import android.content.pm.ActivityInfo; import android.os.UserHandle; import android.provider.Settings; import android.testing.AndroidTestingRunner; import android.view.MotionEvent; Loading Loading @@ -186,8 +187,8 @@ public class MagnificationModeSwitchTest extends SysuiTestCase { // Perform dragging final View.OnTouchListener listener = mTouchListenerCaptor.getValue(); final int offset = ViewConfiguration.get(mContext).getScaledTouchSlop(); final int previousMode = Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE, 0); final int previousMode = Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE, 0, UserHandle.USER_CURRENT); listener.onTouch(mSpyImageView, MotionEvent.obtain( 0, 0, ACTION_DOWN, 100, 100, 0)); verify(mViewPropertyAnimator).cancel(); Loading Loading @@ -334,8 +335,8 @@ public class MagnificationModeSwitchTest extends SysuiTestCase { verify(mSpyImageView).setImageResource( getIconResId(expectedMode)); verify(mWindowManager).removeView(mSpyImageView); final int actualMode = Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE, 0); final int actualMode = Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE, 0, UserHandle.USER_CURRENT); assertEquals(expectedMode, actualMode); } } Loading
packages/SystemUI/src/com/android/systemui/accessibility/MagnificationModeSwitch.java +6 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.content.pm.ActivityInfo; import android.graphics.PixelFormat; import android.graphics.PointF; import android.os.Bundle; import android.os.UserHandle; import android.provider.Settings; import android.util.MathUtils; import android.view.Gravity; Loading Loading @@ -232,8 +233,11 @@ class MagnificationModeSwitch { mMagnificationMode ^ Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_ALL; mMagnificationMode = newMode; mImageView.setImageResource(getIconResId(newMode)); Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE, newMode); Settings.Secure.putIntForUser( mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE, newMode, UserHandle.USER_CURRENT); } private void handleSingleTap() { Loading
packages/SystemUI/tests/src/com/android/systemui/accessibility/MagnificationModeSwitchTest.java +5 −4 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import static org.mockito.Mockito.when; import android.content.Context; import android.content.pm.ActivityInfo; import android.os.UserHandle; import android.provider.Settings; import android.testing.AndroidTestingRunner; import android.view.MotionEvent; Loading Loading @@ -186,8 +187,8 @@ public class MagnificationModeSwitchTest extends SysuiTestCase { // Perform dragging final View.OnTouchListener listener = mTouchListenerCaptor.getValue(); final int offset = ViewConfiguration.get(mContext).getScaledTouchSlop(); final int previousMode = Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE, 0); final int previousMode = Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE, 0, UserHandle.USER_CURRENT); listener.onTouch(mSpyImageView, MotionEvent.obtain( 0, 0, ACTION_DOWN, 100, 100, 0)); verify(mViewPropertyAnimator).cancel(); Loading Loading @@ -334,8 +335,8 @@ public class MagnificationModeSwitchTest extends SysuiTestCase { verify(mSpyImageView).setImageResource( getIconResId(expectedMode)); verify(mWindowManager).removeView(mSpyImageView); final int actualMode = Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE, 0); final int actualMode = Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE, 0, UserHandle.USER_CURRENT); assertEquals(expectedMode, actualMode); } }