Modify flow in ToggleFeaturePreferenceFragment

* Show edit shortcut dialog should belong to the basic feature, so move
them back to ToggleFeaturePreferenceFragment
* Add test cases for UserShortcutType to prepare to further refactor

Bug: 158540780
Test: atest ToggleFeaturePreferenceFragmentTest
Change-Id: Ia84bea5581f85d199f395b2065652ce69738abbf
This commit is contained in:
jasonwshsu
2020-07-13 03:59:36 +08:00
committed by Jason Hsu
parent 1044467d33
commit 1a1ae82460
8 changed files with 339 additions and 72 deletions

View File

@@ -311,7 +311,11 @@ public class ToggleAccessibilityServicePreferenceFragment extends
@Override
public void onSettingsClicked(ShortcutPreference preference) {
super.onSettingsClicked(preference);
// Do not restore shortcut in shortcut chooser dialog when shortcutPreference is turned off.
mUserShortcutTypesCache = mShortcutPreference.isChecked()
? getUserShortcutTypes(getPrefContext(), UserShortcutType.SOFTWARE)
: UserShortcutType.EMPTY;
final boolean isServiceOnOrShortcutAdded = mShortcutPreference.isChecked()
|| mToggleServiceDividerSwitchPreference.isChecked();
showPopupDialog(isServiceOnOrShortcutAdded ? DialogEnums.EDIT_SHORTCUT