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

Commit 41440ff2 authored by Daniel Norman's avatar Daniel Norman
Browse files

Removes overrides for shortcut-required service toggling.

These are unnecessary now that shortcut enabling is done via
A11yManager#enableShortcutsForTargets which handles enabling
a shortcut-required service if necessary, controlled by the
rolled out a11yQsShortcut flag.

These also cause a race condition conflict when attempting to toggle a
service that does not require a warning, causing it to disable the
service immediately after enabling.

Bug: 324653372
Flag: android.view.accessibility.a11y_qs_shortcut
Test: Toggle a shortcut-required service that does not require
      a warning; service is started correctly.
Test: Repeat for a service that does require a warning
Change-Id: Iff44d87faf8a5d2eb9b6643dd582c2b697ad0b5d
parent 7aabe039
Loading
Loading
Loading
Loading
+0 −27
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@ package com.android.settings.accessibility;

import android.accessibilityservice.AccessibilityServiceInfo;

import com.android.settingslib.accessibility.AccessibilityUtils;

/**
 * Fragment that does not have toggle bar to turn on service to use.
 *
@@ -37,29 +35,4 @@ public class InvisibleToggleAccessibilityServicePreferenceFragment extends
        super.onInstallSwitchPreferenceToggleSwitch();
        mToggleServiceSwitchPreference.setVisible(false);
    }

    /**
     * {@inheritDoc}
     *
     * Enables accessibility service only when user had allowed permission. Disables
     * accessibility service when shortcutPreference is unchecked.
     */
    @Override
    public void onToggleClicked(ShortcutPreference preference) {
        super.onToggleClicked(preference);
        boolean enabled = getArguments().getBoolean(AccessibilitySettings.EXTRA_CHECKED)
                && preference.isChecked();
        AccessibilityUtils.setAccessibilityServiceState(getContext(), mComponentName, enabled);
    }

    /**
     * {@inheritDoc}
     *
     * Enables accessibility service when user clicks permission allow button.
     */
    @Override
    void onAllowButtonFromShortcutToggleClicked() {
        super.onAllowButtonFromShortcutToggleClicked();
        AccessibilityUtils.setAccessibilityServiceState(getContext(), mComponentName, true);
    }
}