Merge "Accessibility shortcut secondary action - legacy type fragment only have hardware shortcut"
This commit is contained in:
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings.accessibility;
|
package com.android.settings.accessibility;
|
||||||
|
|
||||||
|
import static com.android.settings.accessibility.AccessibilityUtil.UserShortcutType;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
@@ -23,9 +25,12 @@ import androidx.preference.PreferenceScreen;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
/** For accessibility services that target SDK <= Q. */
|
/** For accessibility services that target SDK <= Q. */
|
||||||
public class LegacyAccessibilityServicePreferenceFragment extends
|
public class LegacyAccessibilityServicePreferenceFragment extends
|
||||||
ToggleAccessibilityServicePreferenceFragment {
|
ToggleAccessibilityServicePreferenceFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
@@ -39,5 +44,15 @@ public class LegacyAccessibilityServicePreferenceFragment extends
|
|||||||
shortcutPreference.setSummary(hardwareTitle);
|
shortcutPreference.setSummary(hardwareTitle);
|
||||||
shortcutPreference.setSettingsVisibility(View.GONE);
|
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -623,7 +623,7 @@ public class ToggleAccessibilityServicePreferenceFragment extends
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ComponentName getComponentName() {
|
ComponentName getComponentName() {
|
||||||
return mComponentName;
|
return mComponentName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user