Fix InvisibleToggle type service does not turn on or turn off correctly when edit shortcut dialog.
Root cause: service status is not updated after the shortcut status changed. Next: Add callback to update the service status Bug: 155157599 Test: Manual test Change-Id: I286a04d43066c787304c54eb7b0dfdac5728b6ac
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
package com.android.settings.accessibility;
|
package com.android.settings.accessibility;
|
||||||
|
|
||||||
import android.accessibilityservice.AccessibilityServiceInfo;
|
import android.accessibilityservice.AccessibilityServiceInfo;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
@@ -68,4 +69,17 @@ public class InvisibleToggleAccessibilityServicePreferenceFragment extends
|
|||||||
true);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -597,7 +597,13 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
return shortcut.getType();
|
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) {
|
if (mComponentName == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -381,7 +381,8 @@ public class ToggleScreenMagnificationPreferenceFragment extends
|
|||||||
return shortcut.getType();
|
return shortcut.getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void callOnAlertDialogCheckboxClicked(DialogInterface dialog, int which) {
|
@Override
|
||||||
|
protected void callOnAlertDialogCheckboxClicked(DialogInterface dialog, int which) {
|
||||||
updateUserShortcutType(/* saveChanges= */ true);
|
updateUserShortcutType(/* saveChanges= */ true);
|
||||||
optInAllMagnificationValuesToSettings(getPrefContext(), mUserShortcutType);
|
optInAllMagnificationValuesToSettings(getPrefContext(), mUserShortcutType);
|
||||||
optOutAllMagnificationValuesFromSettings(getPrefContext(), ~mUserShortcutType);
|
optOutAllMagnificationValuesFromSettings(getPrefContext(), ~mUserShortcutType);
|
||||||
|
Reference in New Issue
Block a user