use of android.view.accessibility.AccessibilityManager in project android_packages_apps_Snap by LineageOS.
the class AccessibilityUtils method makeAnnouncement.
public static void makeAnnouncement(View view, CharSequence announcement) {
if (view == null)
return;
if (ApiHelper.HAS_ANNOUNCE_FOR_ACCESSIBILITY) {
view.announceForAccessibility(announcement);
} else {
// For API 15 and earlier, we need to construct an accessibility event
Context ctx = view.getContext();
AccessibilityManager am = (AccessibilityManager) ctx.getSystemService(Context.ACCESSIBILITY_SERVICE);
if (!am.isEnabled())
return;
AccessibilityEvent event = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED);
AccessibilityRecordCompat arc = new AccessibilityRecordCompat(event);
arc.setSource(view);
event.setClassName(view.getClass().getName());
event.setPackageName(view.getContext().getPackageName());
event.setEnabled(view.isEnabled());
event.getText().add(announcement);
am.sendAccessibilityEvent(event);
}
}
use of android.view.accessibility.AccessibilityManager in project Float-Bar by tianzhijiexian.
the class MainActivity method onResume.
@Override
protected void onResume() {
super.onResume();
AccessibilityManager manager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);
List<AccessibilityServiceInfo> list = AccessibilityManagerCompat.getEnabledAccessibilityServiceList(manager, AccessibilityServiceInfo.FEEDBACK_ALL_MASK);
System.out.println("list.size = " + list.size());
for (int i = 0; i < list.size(); i++) {
System.out.println("已经可用的服务列表 = " + list.get(i).getId());
if ("com.kale.floatbar/.service.FloatService".equals(list.get(i).getId())) {
System.out.println("已启用");
isEnabled = true;
break;
}
}
if (!isEnabled) {
showDialog(this, "激活悬浮窗", "您还没有激活悬浮窗。" + "在设置中:系统 → 辅助功能 → 服务 中激活" + getResources().getString(R.string.app_name) + "后,便可安全稳定的使用悬浮窗啦~", "去激活", "取消");
}
}
use of android.view.accessibility.AccessibilityManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AccessibilitySlicePreferenceController method getAccessibilityServiceInfo.
private AccessibilityServiceInfo getAccessibilityServiceInfo() {
final AccessibilityManager accessibilityManager = mContext.getSystemService(AccessibilityManager.class);
final List<AccessibilityServiceInfo> serviceList = accessibilityManager.getInstalledAccessibilityServiceList();
for (AccessibilityServiceInfo serviceInfo : serviceList) {
if (mComponentName.equals(serviceInfo.getComponentName())) {
return serviceInfo;
}
}
return null;
}
use of android.view.accessibility.AccessibilityManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ToggleAccessibilityServicePreferenceFragment method isServiceSupportAccessibilityButton.
private boolean isServiceSupportAccessibilityButton() {
final AccessibilityManager ams = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
final List<AccessibilityServiceInfo> services = ams.getInstalledAccessibilityServiceList();
for (AccessibilityServiceInfo info : services) {
if ((info.flags & AccessibilityServiceInfo.FLAG_REQUEST_ACCESSIBILITY_BUTTON) != 0) {
ServiceInfo serviceInfo = info.getResolveInfo().serviceInfo;
if (serviceInfo != null && TextUtils.equals(serviceInfo.name, getAccessibilityServiceInfo().getResolveInfo().serviceInfo.name)) {
return true;
}
}
}
return false;
}
use of android.view.accessibility.AccessibilityManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AccessibilitySettingsForSetupWizard method findService.
private AccessibilityServiceInfo findService(String packageName, String serviceName) {
final AccessibilityManager manager = getActivity().getSystemService(AccessibilityManager.class);
final List<AccessibilityServiceInfo> accessibilityServices = manager.getInstalledAccessibilityServiceList();
for (AccessibilityServiceInfo info : accessibilityServices) {
ServiceInfo serviceInfo = info.getResolveInfo().serviceInfo;
if (packageName.equals(serviceInfo.packageName) && serviceName.equals(serviceInfo.name)) {
return info;
}
}
return null;
}
Aggregations