use of android.accessibilityservice.AccessibilityServiceInfo in project platform_frameworks_base by android.
the class AccessibilityManager method getAccessibilityServiceList.
/**
* Returns the {@link ServiceInfo}s of the installed accessibility services.
*
* @return An unmodifiable list with {@link ServiceInfo}s.
*
* @deprecated Use {@link #getInstalledAccessibilityServiceList()}
*/
@Deprecated
public List<ServiceInfo> getAccessibilityServiceList() {
List<AccessibilityServiceInfo> infos = getInstalledAccessibilityServiceList();
List<ServiceInfo> services = new ArrayList<>();
final int infoCount = infos.size();
for (int i = 0; i < infoCount; i++) {
AccessibilityServiceInfo info = infos.get(i);
services.add(info.getResolveInfo().serviceInfo);
}
return Collections.unmodifiableList(services);
}
use of android.accessibilityservice.AccessibilityServiceInfo in project AndroidChromium by JackyAndroid.
the class AccessibilityUtil method showWarningIfOldTalkbackRunning.
/**
* Checks to see if an old version of TalkBack is running that Chrome doesn't support,
* and if so, shows an alert dialog prompting the user to update the app.
* @param context A {@link Context} instance.
* @return True if the dialog was shown.
*/
public static boolean showWarningIfOldTalkbackRunning(Context context) {
AccessibilityManager manager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
if (manager == null)
return false;
boolean isTalkbackRunning = false;
try {
List<AccessibilityServiceInfo> services = manager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_SPOKEN);
for (AccessibilityServiceInfo service : services) {
if (service.getId().contains(TALKBACK_PACKAGE_NAME))
isTalkbackRunning = true;
}
} catch (NullPointerException e) {
// getEnabledAccessibilityServiceList() can throw an NPE due to a bad
// AccessibilityService.
}
if (!isTalkbackRunning)
return false;
if (PackageUtils.getPackageVersion(context, TALKBACK_PACKAGE_NAME) < MIN_TALKBACK_VERSION && !sOldTalkBackVersionAlertShown) {
showOldTalkbackVersionAlertOnce(context);
return true;
}
return false;
}
use of android.accessibilityservice.AccessibilityServiceInfo in project android_frameworks_base by ParanoidAndroid.
the class EnableAccessibilityController method getInstalledSpeakingAccessibilityServices.
private static List<AccessibilityServiceInfo> getInstalledSpeakingAccessibilityServices(Context context) {
List<AccessibilityServiceInfo> services = new ArrayList<AccessibilityServiceInfo>();
services.addAll(AccessibilityManager.getInstance(context).getInstalledAccessibilityServiceList());
Iterator<AccessibilityServiceInfo> iterator = services.iterator();
while (iterator.hasNext()) {
AccessibilityServiceInfo service = iterator.next();
if ((service.feedbackType & AccessibilityServiceInfo.FEEDBACK_SPOKEN) == 0) {
iterator.remove();
}
}
return services;
}
use of android.accessibilityservice.AccessibilityServiceInfo in project android_frameworks_base by ParanoidAndroid.
the class AccessibilityManagerService method getInstalledAccessibilityServiceList.
public List<AccessibilityServiceInfo> getInstalledAccessibilityServiceList(int userId) {
synchronized (mLock) {
final int resolvedUserId = mSecurityPolicy.resolveCallingUserIdEnforcingPermissionsLocked(userId);
// The automation service is a fake one and should not be reported
// to clients as being installed - it really is not.
UserState userState = getUserStateLocked(resolvedUserId);
if (userState.mUiAutomationService != null) {
List<AccessibilityServiceInfo> installedServices = new ArrayList<AccessibilityServiceInfo>();
installedServices.addAll(userState.mInstalledServices);
installedServices.remove(userState.mUiAutomationService);
return installedServices;
}
return userState.mInstalledServices;
}
}
use of android.accessibilityservice.AccessibilityServiceInfo in project android_frameworks_base by ParanoidAndroid.
the class AccessibilityManagerService method readInstalledAccessibilityServiceLocked.
private boolean readInstalledAccessibilityServiceLocked(UserState userState) {
mTempAccessibilityServiceInfoList.clear();
List<ResolveInfo> installedServices = mPackageManager.queryIntentServicesAsUser(new Intent(AccessibilityService.SERVICE_INTERFACE), PackageManager.GET_SERVICES | PackageManager.GET_META_DATA, mCurrentUserId);
for (int i = 0, count = installedServices.size(); i < count; i++) {
ResolveInfo resolveInfo = installedServices.get(i);
ServiceInfo serviceInfo = resolveInfo.serviceInfo;
if (!android.Manifest.permission.BIND_ACCESSIBILITY_SERVICE.equals(serviceInfo.permission)) {
Slog.w(LOG_TAG, "Skipping accessibilty service " + new ComponentName(serviceInfo.packageName, serviceInfo.name).flattenToShortString() + ": it does not require the permission " + android.Manifest.permission.BIND_ACCESSIBILITY_SERVICE);
continue;
}
AccessibilityServiceInfo accessibilityServiceInfo;
try {
accessibilityServiceInfo = new AccessibilityServiceInfo(resolveInfo, mContext);
mTempAccessibilityServiceInfoList.add(accessibilityServiceInfo);
} catch (XmlPullParserException xppe) {
Slog.e(LOG_TAG, "Error while initializing AccessibilityServiceInfo", xppe);
} catch (IOException ioe) {
Slog.e(LOG_TAG, "Error while initializing AccessibilityServiceInfo", ioe);
}
}
if (!mTempAccessibilityServiceInfoList.equals(userState.mInstalledServices)) {
userState.mInstalledServices.clear();
userState.mInstalledServices.addAll(mTempAccessibilityServiceInfoList);
mTempAccessibilityServiceInfoList.clear();
return true;
}
mTempAccessibilityServiceInfoList.clear();
return false;
}
Aggregations