summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Candice Lo <chihtinglo@google.com> 2023-06-12 08:44:16 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-06-12 08:44:16 +0000
commit1358e7e04f92d358808d9ff1f36bbfd0fe825a9b (patch)
tree2128c5df6ca7c0dce91973653d7fd2d95a2bf217
parentffd4223c114c39f08824ebc0c082e23429009695 (diff)
parent7e0bed1b382b0cef4ba8891cf3c7c7b3801ba0f5 (diff)
Merge "Update default values for capability and mode" into udc-qpr-dev am: 7e0bed1b38
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23628540 Change-Id: If9168c29cbe877c1c3c9cba6200c808637c070a2 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationSettings.java12
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/accessibility/WindowMagnificationSettingsTest.java14
2 files changed, 16 insertions, 10 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationSettings.java b/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationSettings.java
index b086912bd904..31b0f056df8d 100644
--- a/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationSettings.java
+++ b/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationSettings.java
@@ -18,7 +18,6 @@ package com.android.systemui.accessibility;
import static android.provider.Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_ALL;
import static android.provider.Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN;
-import static android.provider.Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_NONE;
import static android.provider.Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
@@ -405,16 +404,23 @@ class WindowMagnificationSettings implements MagnificationGestureDetector.OnGest
}
private int getMagnificationMode() {
+ // If current capability is window mode, we would like the default value of the mode to
+ // be WINDOW, otherwise, the default value would be FULLSCREEN.
+ int defaultValue =
+ (getMagnificationCapability() == ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW)
+ ? ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW
+ : ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN;
+
return mSecureSettings.getIntForUser(
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE,
- ACCESSIBILITY_MAGNIFICATION_MODE_NONE,
+ defaultValue,
UserHandle.USER_CURRENT);
}
private int getMagnificationCapability() {
return mSecureSettings.getIntForUser(
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_CAPABILITY,
- ACCESSIBILITY_MAGNIFICATION_MODE_NONE,
+ ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN,
UserHandle.USER_CURRENT);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/accessibility/WindowMagnificationSettingsTest.java b/packages/SystemUI/tests/src/com/android/systemui/accessibility/WindowMagnificationSettingsTest.java
index b3f9958764dc..275723be3859 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/accessibility/WindowMagnificationSettingsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/accessibility/WindowMagnificationSettingsTest.java
@@ -20,7 +20,6 @@ import static android.provider.Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATI
import static android.provider.Settings.Secure.ACCESSIBILITY_MAGNIFICATION_CAPABILITY;
import static android.provider.Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_ALL;
import static android.provider.Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN;
-import static android.provider.Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_NONE;
import static android.provider.Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW;
import static com.google.common.truth.Truth.assertThat;
@@ -29,6 +28,7 @@ import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
@@ -525,13 +525,13 @@ public class WindowMagnificationSettingsTest extends SysuiTestCase {
private void setupMagnificationCapabilityAndMode(int capability, int mode) {
when(mSecureSettings.getIntForUser(
- Settings.Secure.ACCESSIBILITY_MAGNIFICATION_CAPABILITY,
- ACCESSIBILITY_MAGNIFICATION_MODE_NONE,
- UserHandle.USER_CURRENT)).thenReturn(capability);
+ eq(Settings.Secure.ACCESSIBILITY_MAGNIFICATION_CAPABILITY),
+ anyInt(),
+ eq(UserHandle.USER_CURRENT))).thenReturn(capability);
when(mSecureSettings.getIntForUser(
- Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE,
- ACCESSIBILITY_MAGNIFICATION_MODE_NONE,
- UserHandle.USER_CURRENT)).thenReturn(mode);
+ eq(Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE),
+ anyInt(),
+ eq(UserHandle.USER_CURRENT))).thenReturn(mode);
}
private void setupScaleInSecureSettings(float scale) {