Merge "Disable accessibility if all accessibility serivces are disbaled."

This commit is contained in:
Svetoslav Ganov
2011-09-14 11:07:36 -07:00
committed by Android (Google) Code Review

View File

@ -225,7 +225,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
return false;
}
}
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction() == Intent.ACTION_BOOT_COMPLETED) {
@ -697,6 +697,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
private void manageServicesLocked() {
populateEnabledServicesLocked(mEnabledServices);
updateServicesStateLocked(mInstalledServices, mEnabledServices);
disableAccessibilityIfNoEnabledServices(mEnabledServices);
}
/**
@ -780,6 +781,19 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
}
}
/**
* Disables accessibility if there are no enabled accessibility services which
* to consume the generated accessibility events.
*
* @param enabledServices The set of enabled services.
*/
private void disableAccessibilityIfNoEnabledServices(Set<ComponentName> enabledServices) {
if (enabledServices.isEmpty()) {
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.ACCESSIBILITY_ENABLED, 0);
}
}
/**
* Sends the state to the clients.
*/