First accessibility device disabled if enableing a second one is canceled.
The value whether accessibility should stay enabled was incorrectly computed and as a result accessibility was disaabled when the second accessibility service enabling is canceled. bug:7716830 Change-Id: Ic23c24b1ffa90811e21210aeeca158568ad37904
This commit is contained in:
@@ -726,25 +726,22 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
||||
|
||||
// Determine enabled services and accessibility state.
|
||||
ComponentName toggledService = ComponentName.unflattenFromString(preferenceKey);
|
||||
final boolean accessibilityEnabled;
|
||||
boolean accessibilityEnabled = false;
|
||||
if (enabled) {
|
||||
enabledServices.add(toggledService);
|
||||
// Enabling at least one service enables accessibility.
|
||||
accessibilityEnabled = true;
|
||||
enabledServices.add(toggledService);
|
||||
} else {
|
||||
enabledServices.remove(toggledService);
|
||||
// Check how many enabled and installed services are present.
|
||||
int enabledAndInstalledServiceCount = 0;
|
||||
Set<ComponentName> installedServices = sInstalledServices;
|
||||
for (ComponentName enabledService : enabledServices) {
|
||||
if (installedServices.contains(enabledService)) {
|
||||
enabledAndInstalledServiceCount++;
|
||||
}
|
||||
}
|
||||
// Disabling the last service disables accessibility.
|
||||
accessibilityEnabled = enabledAndInstalledServiceCount > 1
|
||||
|| (enabledAndInstalledServiceCount == 1
|
||||
&& !installedServices.contains(toggledService));
|
||||
enabledServices.remove(toggledService);
|
||||
accessibilityEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update the enabled services setting.
|
||||
|
Reference in New Issue
Block a user