Merge "Fix InvisibleToggle type service does not turn on or turn off correctly when edit shortcut dialog." into rvc-dev am: 981d10db0b am: 5d7fd4abc3 am: aa0c512ff5 am: 6267537581

Change-Id: I356ddb582b6fd154766c932e774ccbbe3d653f5e
This commit is contained in:
Menghan Li
2020-04-29 09:07:47 +00:00
committed by Automerger Merge Worker
3 changed files with 23 additions and 2 deletions

View File

@@ -17,6 +17,7 @@
package com.android.settings.accessibility;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.content.DialogInterface;
import android.view.View;
import com.android.settings.R;
@@ -68,4 +69,17 @@ public class InvisibleToggleAccessibilityServicePreferenceFragment extends
true);
}
}
/**
* {@inheritDoc}
*
* Enables accessibility service when shortcutPreference is checked.
*/
@Override
protected void callOnAlertDialogCheckboxClicked(DialogInterface dialog, int which) {
super.callOnAlertDialogCheckboxClicked(dialog, which);
final boolean enabled = mShortcutPreference.isChecked();
AccessibilityUtils.setAccessibilityServiceState(getContext(), mComponentName, enabled);
}
}

View File

@@ -597,7 +597,13 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
return shortcut.getType();
}
private void callOnAlertDialogCheckboxClicked(DialogInterface dialog, int which) {
/**
* This method will be invoked when a button in the edit shortcut dialog is clicked.
*
* @param dialog The dialog that received the click
* @param which The button that was clicked
*/
protected void callOnAlertDialogCheckboxClicked(DialogInterface dialog, int which) {
if (mComponentName == null) {
return;
}

View File

@@ -386,7 +386,8 @@ public class ToggleScreenMagnificationPreferenceFragment extends
return shortcut.getType();
}
private void callOnAlertDialogCheckboxClicked(DialogInterface dialog, int which) {
@Override
protected void callOnAlertDialogCheckboxClicked(DialogInterface dialog, int which) {
updateUserShortcutType(/* saveChanges= */ true);
optInAllMagnificationValuesToSettings(getPrefContext(), mUserShortcutType);
optOutAllMagnificationValuesFromSettings(getPrefContext(), ~mUserShortcutType);