关于安卓pm命令的问题

关于安卓pm命令的问题,以及解决方案(遇到了就记下,长时间更新)

这个android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died异常是我在 Lineage OS 14.1 – Android7.1.2里执行pm list packages -3出现的

android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died
        at android.os.BinderProxy.transactNative(Native Method)
        at android.os.BinderProxy.transact(Binder.java:615)
        at android.os.BinderProxy.shellCommand(Binder.java:662)
        at com.android.commands.pm.Pm.runShellCommand(Pm.java:295)
        at com.android.commands.pm.Pm.runList(Pm.java:666)
        at com.android.commands.pm.Pm.run(Pm.java:130)
        at com.android.commands.pm.Pm.main(Pm.java:99)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:264)

解决办法
1、电脑进行adb shell操作
2、(需要手机已经root)手机终端切换用户为shell(PS:终端有很多,比如Android Terminal Emulator、termux等)
su - shell或者su - 2000,因为shell用户的uid就是2000
3、系统降级到Android5.x

问题描述:
不管是普通用户还是root用户,只要执行了pm list就会出现这个问题,而在Android5.1里没有发现过这种问题,但有些人在Android8.x也不会出现这种问题,这个我不清楚怎么回事,当我在查看手机里的pm帮助时,发现跟Android5.x的帮助有一些不一样

我手机( Lineage OS 14.1 -- Android7.1.2)里发现的
NOTE: 'pm list' commands have moved! Run 'adb shell cmd package'
  to display the new commands.

pm path: print the path to the .apk of the given PACKAGE.

同位置,Android5.x里发现的
pm list packages: prints all packages, optionally only
  those whose package name contains the text in FILTER.  Options:
    -f: see their associated file.
    -d: filter to only show disbled packages.
    -e: filter to only show enabled packages.
    -s: filter to only show system packages.
    -3: filter to only show third party packages.
    -i: see the installer for the packages.
    -u: also include uninstalled packages.

pm list permission-groups: prints all known permission groups.

pm list permissions: prints all known permissions, optionally only
  those in GROUP.  Options:
    -g: organize by group.
    -f: print all information.
    -s: short summary.
    -d: only list dangerous permissions.
    -u: list only the permissions users will see.

pm list instrumentation: use to list all test packages; optionally
  supply <TARGET-PACKAGE> to list the test packages for a particular
  application.  Options:
    -f: list the .apk file for the test package.

pm list features: prints all features of the system.

pm list users: prints all users on the system.

pm path: print the path to the .apk of the given PACKAGE.

问题分析:

NOTE: 'pm list' commands have moved! Run 'adb shell cmd package' 
to display the new commands.

通过查看这段话以及我通过:切换用户、电脑adb操作、多个安卓版本对比,得出结论
只能通过shell用户操作的才能使用
比如你从普通用户直接提权到root用户,也还是不能用这条命令,但你如果是从shell用户提权到root用户的话,那就可以了

总结:
还是多看看每次更新的通知,不然出了问题都搞不清什么情况
Android的pm命令参数
时间:2019年5月11日

猜你喜欢

转载自blog.csdn.net/sorry_my_life/article/details/90106302