Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8e8c095 authored by Qasid Ahmad Sadiq's avatar Qasid Ahmad Sadiq
Browse files

Give AccessibilityServices System Capabilities.

For now, this CL is for a conversation on how to give AccesibilityService particular capabilities.

Fixes: 154954447
Test: atest CTSAccessibility*.
Change-Id: I2e47d9a94fda04e60a5eb15a1ec54479c9322b1e
parent cd63ddf9
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -94,8 +94,10 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect
        if (userState == null) return;
        final long identity = Binder.clearCallingIdentity();
        try {
            int flags = Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE
                    | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS;
            int flags = Context.BIND_AUTO_CREATE
                    | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE
                    | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS
                    | Context.BIND_INCLUDE_CAPABILITIES;
            if (userState.getBindInstantServiceAllowedLocked()) {
                flags |= Context.BIND_ALLOW_INSTANT;
            }
+5 −2
Original line number Diff line number Diff line
@@ -129,8 +129,11 @@ public class AccessibilityServiceConnectionTest {
    public void bind_requestsContextToBindService() {
        mConnection.bindLocked();
        verify(mMockContext).bindServiceAsUser(any(Intent.class), eq(mConnection),
                eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE
                | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), any(UserHandle.class));
                eq(Context.BIND_AUTO_CREATE
                        | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE
                        | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS
                        | Context.BIND_INCLUDE_CAPABILITIES),
                any(UserHandle.class));
    }

    @Test