Context
While trying to launch a tor service in Orbot, on a rooted phone, I am encountering some difficulties.
When I try to launch the tor connection with:
adb shell am startservice -n org.torproject.android/.service.OrbotService
I get error:
Starting service: Intent { cmp=org.torproject.android/.service.OrbotService }
Error: Requires permission android.permission.BIND_VPN_SERVICE
Yet when I try to set that permission with:
adb shell pm grant org.torproject.android android.permission.BIND_VPN_SERVICE
It throws error:
Security exception: Package org.torproject.android has not requested permission android.permission.BIND_VPN_SERVICE
java.lang.SecurityException: Package org.torproject.android has not requested permission android.permission.BIND_VPN_SERVICE
at com.android.server.pm.permission.BasePermission.enforceDeclaredUsedAndRuntimeOrDevelopment(BasePermission.java:444)
at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermission(PermissionManagerService.java:2238)
at com.android.server.pm.permission.PermissionManagerService.access$1100(PermissionManagerService.java:122)
at com.android.server.pm.permission.PermissionManagerService$PermissionManagerServiceInternalImpl.grantRuntimePermission(PermissionManagerService.java:3239)
at com.android.server.pm.PackageManagerService.grantRuntimePermission(PackageManagerService.java:5788)
at com.android.server.pm.PackageManagerShellCommand.runGrantRevokePermission(PackageManagerShellCommand.java:1955)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:230)
at android.os.ShellCommand.exec(ShellCommand.java:104)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21952)
at android.os.Binder.shellCommand(Binder.java:881)
at android.os.Binder.onTransact(Binder.java:765)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4876)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4049)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)
Based on this answer I should create the request in the AndroidManifest.xml
of the Orbot .apk
file, however, I am not compiling the apk, the apk is already pre-installed from a store, and I would expect the request for the permission to be stored when I try to launch the service. (Such that it recongises the previous request for permmission when I try to set it).
Question
How can I start the service and set the required permission successfully using adb
?