use of android.view.accessibility.IAccessibilityManager in project android_frameworks_base by DirtyUnicorns.
the class UiAutomationConnection method registerUiTestAutomationServiceLocked.
private void registerUiTestAutomationServiceLocked(IAccessibilityServiceClient client, int flags) {
IAccessibilityManager manager = IAccessibilityManager.Stub.asInterface(ServiceManager.getService(Context.ACCESSIBILITY_SERVICE));
final AccessibilityServiceInfo info = new AccessibilityServiceInfo();
info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK;
info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;
info.flags |= AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS | AccessibilityServiceInfo.FLAG_REPORT_VIEW_IDS | AccessibilityServiceInfo.FLAG_FORCE_DIRECT_BOOT_AWARE;
info.setCapabilities(AccessibilityServiceInfo.CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT | AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION | AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY | AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_FILTER_KEY_EVENTS);
try {
// Calling out with a lock held is fine since if the system
// process is gone the client calling in will be killed.
manager.registerUiTestAutomationService(mToken, client, info, flags);
mClient = client;
} catch (RemoteException re) {
throw new IllegalStateException("Error while registering UiTestAutomationService.", re);
}
}
use of android.view.accessibility.IAccessibilityManager in project android_frameworks_base by DirtyUnicorns.
the class EnableAccessibilityController method disableAccessibility.
public static void disableAccessibility(Context context) {
final IAccessibilityManager accessibilityManager = IAccessibilityManager.Stub.asInterface(ServiceManager.getService("accessibility"));
ComponentName componentName = getInstalledSpeakingAccessibilityServiceComponent(context);
if (componentName == null) {
return;
}
final int userId = ActivityManager.getCurrentUser();
try {
accessibilityManager.disableAccessibilityService(componentName, userId);
} catch (RemoteException e) {
Log.e(TAG, "cannot disable accessibility " + e);
}
}
use of android.view.accessibility.IAccessibilityManager in project android_frameworks_base by ResurrectionRemix.
the class EnableAccessibilityController method disableAccessibility.
public static void disableAccessibility(Context context) {
final IAccessibilityManager accessibilityManager = IAccessibilityManager.Stub.asInterface(ServiceManager.getService("accessibility"));
ComponentName componentName = getInstalledSpeakingAccessibilityServiceComponent(context);
if (componentName == null) {
return;
}
final int userId = ActivityManager.getCurrentUser();
try {
accessibilityManager.disableAccessibilityService(componentName, userId);
} catch (RemoteException e) {
Log.e(TAG, "cannot disable accessibility " + e);
}
}
use of android.view.accessibility.IAccessibilityManager in project android_frameworks_base by ResurrectionRemix.
the class EnableAccessibilityController method enableAccessibility.
public static boolean enableAccessibility(Context context) {
final IAccessibilityManager accessibilityManager = IAccessibilityManager.Stub.asInterface(ServiceManager.getService("accessibility"));
final WindowManagerInternal windowManager = LocalServices.getService(WindowManagerInternal.class);
final UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
ComponentName componentName = getInstalledSpeakingAccessibilityServiceComponent(context);
if (componentName == null) {
return false;
}
boolean keyguardLocked = windowManager.isKeyguardLocked();
final boolean hasMoreThanOneUser = userManager.getUsers().size() > 1;
try {
if (!keyguardLocked || !hasMoreThanOneUser) {
final int userId = ActivityManager.getCurrentUser();
accessibilityManager.enableAccessibilityService(componentName, userId);
} else if (keyguardLocked) {
accessibilityManager.temporaryEnableAccessibilityStateUntilKeyguardRemoved(componentName, true);
}
} catch (RemoteException e) {
Log.e(TAG, "cannot enable accessibilty: " + e);
}
return true;
}
use of android.view.accessibility.IAccessibilityManager in project android_frameworks_base by ResurrectionRemix.
the class DevicePolicyManagerService method getAccessibilityManagerForUser.
private AccessibilityManager getAccessibilityManagerForUser(int userId) {
// Not using AccessibilityManager.getInstance because that guesses
// at the user you require based on callingUid and caches for a given
// process.
IBinder iBinder = ServiceManager.getService(Context.ACCESSIBILITY_SERVICE);
IAccessibilityManager service = iBinder == null ? null : IAccessibilityManager.Stub.asInterface(iBinder);
return new AccessibilityManager(mContext, service, userId);
}
Aggregations