summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Candice <chihtinglo@google.com> 2024-05-15 05:14:50 +0000
committer Candice <chihtinglo@google.com> 2024-05-15 06:32:14 +0000
commit6bf8c427dfd76ff55f697bb2c2e8ba8eb659656c (patch)
tree3690902f84e1e22cf0652cd22879ce6a76d0ad06
parent4847581bebbc20d67021fe8e97de9a5bb3c09b73 (diff)
refactor(size preference): rename the class to WindowMagnificationFrameSizePrefs
Rename the class name so it will be more clear to show that we are keeping the magnification window frame size instead of the window itself. Bug: 325567876 Test: atest WindowMagnificationFrameSizePrefsTest Flag: N/A Change-Id: Idc5641c73551ed0e2a82361c83b1574f5d24cd88
-rw-r--r--packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java12
-rw-r--r--packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationFrameSizePrefs.java (renamed from packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationSizePrefs.java)4
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/accessibility/WindowMagnificationFrameSizePrefsTest.java (renamed from packages/SystemUI/tests/src/com/android/systemui/accessibility/WindowMagnificationSizePrefsTest.java)14
3 files changed, 15 insertions, 15 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java b/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java
index e66261c459c7..5458ab1196d7 100644
--- a/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java
+++ b/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java
@@ -240,7 +240,7 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold
private boolean mEditSizeEnable = false;
private boolean mSettingsPanelVisibility = false;
@VisibleForTesting
- WindowMagnificationSizePrefs mWindowMagnificationSizePrefs;
+ WindowMagnificationFrameSizePrefs mWindowMagnificationFrameSizePrefs;
@Nullable
private final MirrorWindowControl mMirrorWindowControl;
@@ -270,7 +270,7 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold
mSysUiState = sysUiState;
mScvhSupplier = scvhSupplier;
mConfiguration = new Configuration(context.getResources().getConfiguration());
- mWindowMagnificationSizePrefs = new WindowMagnificationSizePrefs(mContext);
+ mWindowMagnificationFrameSizePrefs = new WindowMagnificationFrameSizePrefs(mContext);
final Display display = mContext.getDisplay();
mDisplayId = mContext.getDisplayId();
@@ -457,7 +457,7 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold
if (!enable) {
// Keep the magnifier size when exiting edit mode
- mWindowMagnificationSizePrefs.saveSizeForCurrentDensity(
+ mWindowMagnificationFrameSizePrefs.saveSizeForCurrentDensity(
new Size(mMagnificationFrame.width(), mMagnificationFrame.height()));
}
}
@@ -944,7 +944,7 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold
}
private void setMagnificationFrame(int width, int height, int centerX, int centerY) {
- mWindowMagnificationSizePrefs.saveSizeForCurrentDensity(new Size(width, height));
+ mWindowMagnificationFrameSizePrefs.saveSizeForCurrentDensity(new Size(width, height));
// Sets the initial frame area for the mirror and place it to the given center on the
// display.
@@ -954,11 +954,11 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold
}
private Size restoreMagnificationWindowFrameSizeIfPossible() {
- if (!mWindowMagnificationSizePrefs.isPreferenceSavedForCurrentDensity()) {
+ if (!mWindowMagnificationFrameSizePrefs.isPreferenceSavedForCurrentDensity()) {
return getDefaultMagnificationWindowFrameSize();
}
- return mWindowMagnificationSizePrefs.getSizeForCurrentDensity();
+ return mWindowMagnificationFrameSizePrefs.getSizeForCurrentDensity();
}
private Size getDefaultMagnificationWindowFrameSize() {
diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationSizePrefs.java b/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationFrameSizePrefs.java
index a401f2a980c1..e83e85e1af1a 100644
--- a/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationSizePrefs.java
+++ b/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationFrameSizePrefs.java
@@ -23,14 +23,14 @@ import android.util.Size;
/**
* Class to handle SharedPreference for window magnification size.
*/
-final class WindowMagnificationSizePrefs {
+final class WindowMagnificationFrameSizePrefs {
private static final String WINDOW_MAGNIFICATION_PREFERENCES =
"window_magnification_preferences";
Context mContext;
SharedPreferences mWindowMagnificationSizePreferences;
- public WindowMagnificationSizePrefs(Context context) {
+ WindowMagnificationFrameSizePrefs(Context context) {
mContext = context;
mWindowMagnificationSizePreferences = mContext
.getSharedPreferences(WINDOW_MAGNIFICATION_PREFERENCES, Context.MODE_PRIVATE);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/accessibility/WindowMagnificationSizePrefsTest.java b/packages/SystemUI/tests/src/com/android/systemui/accessibility/WindowMagnificationFrameSizePrefsTest.java
index 516b6658d24a..93c0eeaac488 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/accessibility/WindowMagnificationSizePrefsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/accessibility/WindowMagnificationFrameSizePrefsTest.java
@@ -39,9 +39,9 @@ import org.junit.runner.RunWith;
@SmallTest
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
-public class WindowMagnificationSizePrefsTest extends SysuiTestCase {
+public class WindowMagnificationFrameSizePrefsTest extends SysuiTestCase {
- WindowMagnificationSizePrefs mWindowMagnificationSizePrefs;
+ WindowMagnificationFrameSizePrefs mWindowMagnificationFrameSizePrefs;
FakeSharedPreferences mSharedPreferences;
@Before
@@ -51,24 +51,24 @@ public class WindowMagnificationSizePrefsTest extends SysuiTestCase {
when(mContext.getSharedPreferences(
eq("window_magnification_preferences"), anyInt()))
.thenReturn(mSharedPreferences);
- mWindowMagnificationSizePrefs = new WindowMagnificationSizePrefs(mContext);
+ mWindowMagnificationFrameSizePrefs = new WindowMagnificationFrameSizePrefs(mContext);
}
@Test
public void saveSizeForCurrentDensity_getExpectedSize() {
Size testSize = new Size(500, 500);
- mWindowMagnificationSizePrefs.saveSizeForCurrentDensity(testSize);
+ mWindowMagnificationFrameSizePrefs.saveSizeForCurrentDensity(testSize);
- assertThat(mWindowMagnificationSizePrefs.getSizeForCurrentDensity())
+ assertThat(mWindowMagnificationFrameSizePrefs.getSizeForCurrentDensity())
.isEqualTo(testSize);
}
@Test
public void saveSizeForCurrentDensity_containsPreferenceForCurrentDensity() {
Size testSize = new Size(500, 500);
- mWindowMagnificationSizePrefs.saveSizeForCurrentDensity(testSize);
+ mWindowMagnificationFrameSizePrefs.saveSizeForCurrentDensity(testSize);
- assertThat(mWindowMagnificationSizePrefs.isPreferenceSavedForCurrentDensity())
+ assertThat(mWindowMagnificationFrameSizePrefs.isPreferenceSavedForCurrentDensity())
.isTrue();
}
}