Create settings for window magnification (3/n)

This change is for internal test.
Add a switch preference for magnification enable mode.

Bug: 146019459
Bug: 146473544
Test: make RunSettingsRoboTests ROBOTEST_FILTER=MagnificationEnablePreferenceControllerTest -j64
Change-Id: I85fdbb5b0efc106d5301d95802b8d6b7dbe8145d
This commit is contained in:
mincheli
2020-01-08 20:26:04 +08:00
parent 5fae0c617c
commit 5b59e62ecb
6 changed files with 106 additions and 97 deletions

View File

@@ -256,6 +256,11 @@ public class ToggleScreenMagnificationPreferenceFragment extends
updateAlertDialogCheckState();
updateAlertDialogEnableState();
// Window magnification mode doesn't support advancedView.
if (isWindowMagnification(getPrefContext())) {
advancedView.setVisibility(View.GONE);
return;
}
// Shows the triple tap checkbox directly if clicked.
if (mTripleTapTypeCheckBox.isChecked()) {
advancedView.setVisibility(View.GONE);
@@ -610,4 +615,13 @@ public class ToggleScreenMagnificationPreferenceFragment extends
}
return false;
}
private boolean isWindowMagnification(Context context) {
final int mode = Settings.Secure.getIntForUser(
context.getContentResolver(),
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE,
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN,
context.getContentResolver().getUserId());
return mode == Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW;
}
}