"Run Shell" non-root action error while in terminal it works (Tasker v5.0b9)

1,130 views
Skip to first unread message

GPS

unread,
Jul 17, 2017, 7:49:31 AM7/17/17
to Tasker
Hi,
On tasker v5.0b9, when I run action "Run shell", while NOT selecting "run as root", *SOME* commands returns weird error for no reason:
  • am force-stop --user 0 PACKAGE_NAME
  • pm uninstall --user 0 -k PACKAGE_NAME
The errors are ( as output of the commands above, accordingly ):
  • java.lang.SecurityException: Permission Denial:
    forceStopPackage() from pid=15910, uid=10162 requires android.permission.FORCE_STOP_PACKAGES
    at android.os.Parcel.readException(Parcel.java:1684)
    at android.os.Parcel.readException(Parcel.java:1637)
    at android.app.ActivityManagerProxy.forceStopPackage(ActivityManagerNative.java:5255)
    at com.android.commands.am.Am.runForceStop(Am.java:752)
    at com.android.commands.am.Am.onRun(Am.java:400)
    at com.android.internal.os.BaseCommand.run(BaseCommand.java:51)
    at com.android.commands.am.Am.main(Am.java:124)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:264)
  • Exception occurred while dumping:
    java.lang.NullPointerException
    at com.android.internal.util.Preconditions.checkNotNull(Preconditions.java:94)
    at com.android.server.AppOpsService.checkPackage(AppOpsService.java:1073)
    at android.app.AppOpsManager.checkPackage(AppOpsManager.java:1937)
    at com.android.server.pm.PackageInstallerService.uninstall(PackageInstallerService.java:874)
    at com.android.server.pm.PackageManagerShellCommand.runUninstall(PackageManagerShellCommand.java:792)
    at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:118)
    at android.os.ShellCommand.exec(ShellCommand.java:94)
    at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:18565)
    at android.os.Binder.shellCommand(Binder.java:468)
    at android.os.Binder.onTransact(Binder.jav
When I run the these command in terminal emulator on the same phone or by using adb (WITHOUT su !), they exec and work, with NO error whatsoever.
Please note that I MUST use the "--user 0" since I wish to run these command on phones W/O root, those the need to run them as "current/local user", i.e user number "0".

I also tried to put these command in some "sh" script file on /sdcard then ran "Shell command" action of
"sh /sdcard/script.sh" -> but I get the SAME errors.
again, using terminal emulator or ADB ( W/O root/su ) - it exec and work without any issue or error.

I hope you can solve this bug.
Thanks,
GPS.
Message has been deleted

GPS

unread,
Jul 17, 2017, 7:52:53 AM7/17/17
to Tasker
P.S - I'm on a "Resurrection Remix" custom rom which is based on LineageOS which is based on Android 7.1.2

Pent

unread,
Jul 17, 2017, 8:01:45 AM7/17/17
to Tasker
adb has special permissions I believe.

I don't know what a terminal emulator app does different from a shell execution
that would give it those extra permissions. But are you sure there's no root involved anywhere down the
line ? e.g. the terminal emulator acquires the permissions as root even before your shell starts.

Because being able to e.g. uninstall packages using a normal app like Tasker would be a serious
security flaw.

Pent

GPS

unread,
Jul 17, 2017, 9:10:01 AM7/17/17
to Tasker
bah...
you're probably right..
I did gave once root perm to the terminal emulator - that's enough i guess to let these command word although I don't "su" beforehand.

any chance tasker can mimic adb's permissions in any way ?

Pent

unread,
Jul 17, 2017, 12:11:11 PM7/17/17
to Tasker

any chance tasker can mimic adb's permissions in any way ?

Again, it would be a security hole. Maybe it exists, but it would be closed
quickly I think.

Pent
 

Niaogu Bugu

unread,
Jul 19, 2017, 5:30:23 AM7/19/17
to Tasker

在 2017年7月17日星期一 UTC+8下午9:10:01,GPS写道:
Reply all
Reply to author
Forward
0 new messages