Merge "Set the shortcut size to large when user enabled Magnification" into main

This commit is contained in:
Jean Chen
2023-07-11 07:43:01 +00:00
committed by Android (Google) Code Review
3 changed files with 84 additions and 3 deletions

View File

@@ -52,11 +52,12 @@ public class FloatingMenuSizePreferenceController extends BasePreferenceControll
@Retention(RetentionPolicy.SOURCE)
@IntDef({
Size.UNKNOWN,
Size.SMALL,
Size.LARGE,
})
@VisibleForTesting
@interface Size {
public @interface Size {
int UNKNOWN = -1;
int SMALL = 0;
int LARGE = 1;
}

View File

@@ -643,6 +643,17 @@ public class ToggleScreenMagnificationPreferenceFragment extends
joiner.add(MAGNIFICATION_CONTROLLER_NAME);
Settings.Secure.putString(context.getContentResolver(), targetKey, joiner.toString());
// The size setting defaults to unknown. If the user has ever manually changed the size
// before, we do not automatically change it.
if (shortcutType == UserShortcutType.SOFTWARE
&& Settings.Secure.getInt(context.getContentResolver(),
Settings.Secure.ACCESSIBILITY_FLOATING_MENU_SIZE,
FloatingMenuSizePreferenceController.Size.UNKNOWN)
== FloatingMenuSizePreferenceController.Size.UNKNOWN) {
Settings.Secure.putInt(context.getContentResolver(),
Settings.Secure.ACCESSIBILITY_FLOATING_MENU_SIZE,
FloatingMenuSizePreferenceController.Size.LARGE);
}
}
@VisibleForTesting