Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5bcbbd65 authored by Minche Li's avatar Minche Li Committed by Android (Google) Code Review
Browse files

Merge changes from topic "config_magnification_area"

* changes:
  Adjusts the default magnification settings for config_magnification_area
  Adds a new config flag, config_magnification_area
parents 7e47fa7a f9d7150a
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -3202,6 +3202,10 @@
         panning to scaling the magnification viewport. -->
         panning to scaling the magnification viewport. -->
    <item name="config_screen_magnification_scaling_threshold" format="float" type="dimen">0.3</item>
    <item name="config_screen_magnification_scaling_threshold" format="float" type="dimen">0.3</item>


    <!-- Whether to support magnification area. If not enabled, it would hide the entry in
         magnification settings and adjust the default magnification capability.  -->
    <bool name="config_magnification_area">true</bool>

    <!-- If true, the display will be shifted around in ambient mode. -->
    <!-- If true, the display will be shifted around in ambient mode. -->
    <bool name="config_enableBurnInProtection">false</bool>
    <bool name="config_enableBurnInProtection">false</bool>


+2 −0
Original line number Original line Diff line number Diff line
@@ -4143,6 +4143,8 @@
  <java-symbol type="string" name="turn_on_magnification_settings_action" />
  <java-symbol type="string" name="turn_on_magnification_settings_action" />
  <java-symbol type="string" name="dismiss_action" />
  <java-symbol type="string" name="dismiss_action" />


  <java-symbol type="bool" name="config_magnification_area" />

  <java-symbol type="bool" name="config_trackerAppNeedsPermissions"/>
  <java-symbol type="bool" name="config_trackerAppNeedsPermissions"/>


  <!-- Package with global data query permissions for AppSearch -->
  <!-- Package with global data query permissions for AppSearch -->
+13 −6
Original line number Original line Diff line number Diff line
@@ -4726,17 +4726,23 @@ public class SettingsProvider extends ContentProvider {
                }
                }


                if (currentVersion == 192) {
                if (currentVersion == 192) {
                    // Version 192: set the default value for magnification capabilities. If
                    // Version 192: set the default value for magnification capabilities.
                    // magnification is enabled by the user, set it to full-screen, and set a value
                    // If the device supports magnification area and magnification is enabled
                    // to show a prompt when using the magnification first time after upgrading.
                    // by the user, set it to full-screen, and set a value to show a prompt
                    // when using the magnification first time after upgrading.
                    final SettingsState secureSettings = getSecureSettingsLocked(userId);
                    final SettingsState secureSettings = getSecureSettingsLocked(userId);
                    final Setting magnificationCapabilities = secureSettings.getSettingLocked(
                    final Setting magnificationCapabilities = secureSettings.getSettingLocked(
                            Secure.ACCESSIBILITY_MAGNIFICATION_CAPABILITY);
                            Secure.ACCESSIBILITY_MAGNIFICATION_CAPABILITY);
                    final boolean supportMagnificationArea = getContext().getResources().getBoolean(
                            com.android.internal.R.bool.config_magnification_area);
                    final int capability = supportMagnificationArea
                            ? R.integer.def_accessibility_magnification_capabilities
                            : Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN;
                    final String supportShowPrompt = supportMagnificationArea ? "1" : "0";
                    if (magnificationCapabilities.isNull()) {
                    if (magnificationCapabilities.isNull()) {
                        secureSettings.insertSettingLocked(
                        secureSettings.insertSettingLocked(
                                Secure.ACCESSIBILITY_MAGNIFICATION_CAPABILITY,
                                Secure.ACCESSIBILITY_MAGNIFICATION_CAPABILITY,
                                String.valueOf(getContext().getResources().getInteger(
                                String.valueOf(getContext().getResources().getInteger(capability)),
                                        R.integer.def_accessibility_magnification_capabilities)),
                                null, true, SettingsState.SYSTEM_PACKAGE_NAME);
                                null, true, SettingsState.SYSTEM_PACKAGE_NAME);


                        if (isMagnificationSettingsOn(secureSettings)) {
                        if (isMagnificationSettingsOn(secureSettings)) {
@@ -4746,7 +4752,8 @@ public class SettingsProvider extends ContentProvider {
                                    null, false  /* makeDefault */,
                                    null, false  /* makeDefault */,
                                    SettingsState.SYSTEM_PACKAGE_NAME);
                                    SettingsState.SYSTEM_PACKAGE_NAME);
                            secureSettings.insertSettingLocked(
                            secureSettings.insertSettingLocked(
                                    Secure.ACCESSIBILITY_SHOW_WINDOW_MAGNIFICATION_PROMPT, "1",
                                    Secure.ACCESSIBILITY_SHOW_WINDOW_MAGNIFICATION_PROMPT,
                                    supportShowPrompt,
                                    null, false /* makeDefault */,
                                    null, false /* makeDefault */,
                                    SettingsState.SYSTEM_PACKAGE_NAME);
                                    SettingsState.SYSTEM_PACKAGE_NAME);
                        }
                        }
+9 −0
Original line number Original line Diff line number Diff line
@@ -118,6 +118,9 @@ class AccessibilityUserState {
    private int mNonInteractiveUiTimeout = 0;
    private int mNonInteractiveUiTimeout = 0;
    private int mInteractiveUiTimeout = 0;
    private int mInteractiveUiTimeout = 0;
    private int mLastSentClientState = -1;
    private int mLastSentClientState = -1;

    /** {@code true} if the device config supports magnification area. */
    private final boolean mSupportMagnificationArea;
    // The magnification mode of default display.
    // The magnification mode of default display.
    private int mMagnificationMode = ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN;
    private int mMagnificationMode = ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN;
    // The magnification capabilities used to know magnification mode could be switched.
    // The magnification capabilities used to know magnification mode could be switched.
@@ -138,6 +141,10 @@ class AccessibilityUserState {
    private int mSoftKeyboardShowMode = SHOW_MODE_AUTO;
    private int mSoftKeyboardShowMode = SHOW_MODE_AUTO;


    boolean isValidMagnificationModeLocked() {
    boolean isValidMagnificationModeLocked() {
        if (!mSupportMagnificationArea
                && mMagnificationMode == Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW) {
            return false;
        }
        return (mMagnificationCapabilities & mMagnificationMode) != 0;
        return (mMagnificationCapabilities & mMagnificationMode) != 0;
    }
    }


@@ -156,6 +163,8 @@ class AccessibilityUserState {
                R.color.accessibility_focus_highlight_color);
                R.color.accessibility_focus_highlight_color);
        mFocusStrokeWidth = mFocusStrokeWidthDefaultValue;
        mFocusStrokeWidth = mFocusStrokeWidthDefaultValue;
        mFocusColor = mFocusColorDefaultValue;
        mFocusColor = mFocusColorDefaultValue;
        mSupportMagnificationArea = mContext.getResources().getBoolean(
                R.bool.config_magnification_area);
    }
    }


    boolean isHandlingAccessibilityEventsLocked() {
    boolean isHandlingAccessibilityEventsLocked() {