I'm trying to get a simple accessibility service, like Google's Voice Access or Button Mapper to work on an LG Exalt LTE, running a stripped down version of Marshmellow.
The stock is missing many UI components, including system Accessibility Settings, which are normally used for turning accessibility services on or off.
I would like to know if it is possible to compensate for lack of UI with ADB.
I've tried the following:
Install the app (Take Button Mapper for example),
Its manifest declares a few permissions, that i've granted, say:
<uses-permission name="android.permission.WRITE_SECURE_SETTINGS" />
was granted
adb shell pm grant package.name.here android.permission.WRITE_SECURE_SETTINGS
I even gave it
android.permission.WRITE_SECURE_SETTINGS
even though its not declared in the permissions list in the top of the manifest.
I get this error:
Operation not allowed: java.lang.SecurityException: Package package.name.here has not requested permission android.permission.BIND_ACCESSIBILITY_SERVICE
However, It is declared in the manifest here though:
<service name="a.i" permission="android.permission.BIND_ACCESSIBILITY_SERVICE" stopWithTask="true">
<meta-data name="android.accessibilityservice" resource="res/xml/accessibility.xml" />
<intent-filter>
<action name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
</service>
and thats where the problem is.
this is the service itself, and it requires a non-package-wide permission, BIND_ACCESSIBILITY_SERVICE
.
if I start it with ADB like this
adb shell am startservice -n package.name.here/a.i
I get and error
Error: Requires permission android.permission.BIND_ACCESSIBILITY_SERVICE
even though I already granted the permission to the package.
I've even tried adb shell settings put secure enabled_accessibility_services package.name.here/.a.i
, but still get the same error.
Bottom line:
How do I start a service and grant permissions to that service with ADB? To be clear. I already know that I can use adb shell pm grant
to grant a permission to the whole package, but in this case it is a permission not required by the whole package it is declared in a specific component and I am at loss as to how to launch the component with the permissions it requires through ADB.