Search in sources :

Example 6 with IAccessibilityManager

use of android.view.accessibility.IAccessibilityManager in project platform_frameworks_base by android.

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);
}
Also used : IAccessibilityManager(android.view.accessibility.IAccessibilityManager) IBinder(android.os.IBinder) AccessibilityManager(android.view.accessibility.AccessibilityManager) IAccessibilityManager(android.view.accessibility.IAccessibilityManager)

Example 7 with IAccessibilityManager

use of android.view.accessibility.IAccessibilityManager in project android_frameworks_base by DirtyUnicorns.

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);
}
Also used : IAccessibilityManager(android.view.accessibility.IAccessibilityManager) IBinder(android.os.IBinder) AccessibilityManager(android.view.accessibility.AccessibilityManager) IAccessibilityManager(android.view.accessibility.IAccessibilityManager)

Example 8 with IAccessibilityManager

use of android.view.accessibility.IAccessibilityManager in project android_frameworks_base by DirtyUnicorns.

the class UiAutomationConnection method unregisterUiTestAutomationServiceLocked.

private void unregisterUiTestAutomationServiceLocked() {
    IAccessibilityManager manager = IAccessibilityManager.Stub.asInterface(ServiceManager.getService(Context.ACCESSIBILITY_SERVICE));
    try {
        // Calling out with a lock held is fine since if the system
        // process is gone the client calling in will be killed.
        manager.unregisterUiTestAutomationService(mClient);
        mClient = null;
    } catch (RemoteException re) {
        throw new IllegalStateException("Error while unregistering UiTestAutomationService", re);
    }
}
Also used : IAccessibilityManager(android.view.accessibility.IAccessibilityManager) RemoteException(android.os.RemoteException)

Example 9 with IAccessibilityManager

use of android.view.accessibility.IAccessibilityManager in project android_frameworks_base by DirtyUnicorns.

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;
}
Also used : WindowManagerInternal(android.view.WindowManagerInternal) IAccessibilityManager(android.view.accessibility.IAccessibilityManager) UserManager(android.os.UserManager) ComponentName(android.content.ComponentName) RemoteException(android.os.RemoteException)

Example 10 with IAccessibilityManager

use of android.view.accessibility.IAccessibilityManager in project android_frameworks_base by AOSPA.

the class UiAutomationConnection method unregisterUiTestAutomationServiceLocked.

private void unregisterUiTestAutomationServiceLocked() {
    IAccessibilityManager manager = IAccessibilityManager.Stub.asInterface(ServiceManager.getService(Context.ACCESSIBILITY_SERVICE));
    try {
        // Calling out with a lock held is fine since if the system
        // process is gone the client calling in will be killed.
        manager.unregisterUiTestAutomationService(mClient);
        mClient = null;
    } catch (RemoteException re) {
        throw new IllegalStateException("Error while unregistering UiTestAutomationService", re);
    }
}
Also used : IAccessibilityManager(android.view.accessibility.IAccessibilityManager) RemoteException(android.os.RemoteException)

Aggregations

IAccessibilityManager (android.view.accessibility.IAccessibilityManager)28 RemoteException (android.os.RemoteException)20 ComponentName (android.content.ComponentName)8 AccessibilityManager (android.view.accessibility.AccessibilityManager)8 AccessibilityServiceInfo (android.accessibilityservice.AccessibilityServiceInfo)7 UserManager (android.os.UserManager)4 MediumTest (android.test.suitebuilder.annotation.MediumTest)4 WindowManagerInternal (android.view.WindowManagerInternal)4 IBinder (android.os.IBinder)3 AccessibilityEvent (android.view.accessibility.AccessibilityEvent)2 LargeTest (android.test.suitebuilder.annotation.LargeTest)1 ArrayList (java.util.ArrayList)1