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

Commit d5095abc authored by Jason Hsu's avatar Jason Hsu Committed by Android (Google) Code Review
Browse files

Merge "Accessibility shortcut secondary action - legacy type fragment only have hardware shortcut"

parents 424b44c6 802fad99
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.settings.accessibility;

import static com.android.settings.accessibility.AccessibilityUtil.UserShortcutType;

import android.os.Bundle;
import android.view.View;

@@ -23,9 +25,12 @@ import androidx.preference.PreferenceScreen;

import com.android.settings.R;

import com.google.common.collect.ImmutableSet;

/** For accessibility services that target SDK <= Q. */
public class LegacyAccessibilityServicePreferenceFragment extends
        ToggleAccessibilityServicePreferenceFragment {

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
@@ -39,5 +44,15 @@ public class LegacyAccessibilityServicePreferenceFragment extends
            shortcutPreference.setSummary(hardwareTitle);
            shortcutPreference.setSettingsVisibility(View.GONE);
        }
        // Only allowed hardware PreferredShortcutType in this fragment.
        setAllowedPreferredShortcutType(UserShortcutType.HARDWARE);
    }

    private void setAllowedPreferredShortcutType(int type) {
        final AccessibilityUserShortcutType shortcut = new AccessibilityUserShortcutType(
                getComponentName().flattenToString(), type);

        SharedPreferenceUtils.setUserShortcutType(getPrefContext(),
                ImmutableSet.of(shortcut.flattenToString()));
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -623,7 +623,7 @@ public class ToggleAccessibilityServicePreferenceFragment extends
        }
    }

    private ComponentName getComponentName() {
    ComponentName getComponentName() {
        return mComponentName;
    }
}