当前位置: 首页 > ds >正文

Android pm命令参考

通过ad执行pm命令,可以做很多事,拿下系统代码

/frameworks/base/services/core/java/com/android/server/pm/PackageManagerShellCommand.java,pm命令处理部分,具体参数去搜索:

    public int onCommand(String cmd) {if (cmd == null) {return handleDefaultCommands(cmd);}final PrintWriter pw = getOutPrintWriter();try {switch (cmd) {case "path":return runPath();case "dump":return runDump();case "list":return runList();case "gc":return runGc();case "resolve-activity":return runResolveActivity();case "query-activities":return runQueryIntentActivities();case "query-services":return runQueryIntentServices();case "query-receivers":return runQueryIntentReceivers();case "install":return runInstall();case "install-streaming":return runStreamingInstall();case "install-incremental":return runIncrementalInstall();case "install-abandon":case "install-destroy":return runInstallAbandon();case "install-commit":return runInstallCommit();case "install-create":return runInstallCreate();case "install-remove":return runInstallRemove();case "install-write":return runInstallWrite();case "install-existing":return runInstallExisting();case "set-install-location":return runSetInstallLocation();case "get-install-location":return runGetInstallLocation();case "install-add-session":return runInstallAddSession();case "move-package":return runMovePackage();case "move-primary-storage":return runMovePrimaryStorage();case "compile":return runCompile();case "reconcile-secondary-dex-files":return runreconcileSecondaryDexFiles();case "force-dex-opt":return runForceDexOpt();case "bg-dexopt-job":return runDexoptJob();case "cancel-bg-dexopt-job":return cancelBgDexOptJob();case "delete-dexopt":return runDeleteDexOpt();case "dump-profiles":return runDumpProfiles();case "snapshot-profile":return runSnapshotProfile();case "uninstall":return runUninstall();case "clear":return runClear();case "enable":return runSetEnabledSetting(PackageManager.COMPONENT_ENABLED_STATE_ENABLED);case "disable":return runSetEnabledSetting(PackageManager.COMPONENT_ENABLED_STATE_DISABLED);case "disable-user":return runSetEnabledSetting(PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER);case "disable-until-used":return runSetEnabledSetting(PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED);case "default-state":return runSetEnabledSetting(PackageManager.COMPONENT_ENABLED_STATE_DEFAULT);case "hide":return runSetHiddenSetting(true);case "unhide":return runSetHiddenSetting(false);case "suspend":return runSuspend(true);case "unsuspend":return runSuspend(false);case "set-distracting-restriction":return runSetDistractingRestriction();case "grant":return runGrantRevokePermission(true);case "revoke":return runGrantRevokePermission(false);case "reset-permissions":return runResetPermissions();case "set-permission-flags":return setOrClearPermissionFlags(true);case "clear-permission-flags":return setOrClearPermissionFlags(false);case "set-permission-enforced":return runSetPermissionEnforced();case "get-privapp-permissions":return runGetPrivappPermissions();case "get-privapp-deny-permissions":return runGetPrivappDenyPermissions();case "get-oem-permissions":return runGetOemPermissions();case "trim-caches":return runTrimCaches();case "create-user":return runCreateUser();case "remove-user":return runRemoveUser();case "set-user-restriction":return runSetUserRestriction();case "get-max-users":return runGetMaxUsers();case "get-max-running-users":return runGetMaxRunningUsers();case "set-home-activity":return runSetHomeActivity();case "set-installer":return runSetInstaller();case "get-instantapp-resolver":return runGetInstantAppResolver();case "has-feature":return runHasFeature();case "set-harmful-app-warning":return runSetHarmfulAppWarning();case "get-harmful-app-warning":return runGetHarmfulAppWarning();case "get-stagedsessions":return runListStagedSessions();case "uninstall-system-updates":String packageName = getNextArg();return uninstallSystemUpdates(packageName);case "rollback-app":return runRollbackApp();case "get-moduleinfo":return runGetModuleInfo();case "log-visibility":return runLogVisibility();case "bypass-staged-installer-check":return runBypassStagedInstallerCheck();case "bypass-allowed-apex-update-check":return runBypassAllowedApexUpdateCheck();case "set-silent-updates-policy":return runSetSilentUpdatesPolicy();default: {Boolean domainVerificationResult =mDomainVerificationShell.runCommand(this, cmd);if (domainVerificationResult != null) {return domainVerificationResult ? 0 : 1;}String nextArg = getNextArg();if (nextArg == null) {if (cmd.equalsIgnoreCase("-l")) {return runListPackages(false);} else if (cmd.equalsIgnoreCase("-lf")) {return runListPackages(true);}} else if (getNextArg() == null) {if (cmd.equalsIgnoreCase("-p")) {return displayPackageFilePath(nextArg, UserHandle.USER_SYSTEM);}}return handleDefaultCommands(cmd);}}} catch (RemoteException e) {pw.println("Remote exception: " + e);}return -1;}

http://www.xdnf.cn/news/3378.html

相关文章:

  • Windows系统下MinerU的CUDA加速配置指南
  • 6.1/Q1,浙江医院用NHANES:膳食中摄入黄酮类化合物有助于延缓生物衰老过程
  • 毫米波通信的技术挑战与解决方案
  • Nginx核心功能02
  • 对js的Date二次封装,继承了原Date的所有方法,增加了自己扩展的方法,可以实现任意时间往前往后推算多少小时、多少天、多少周、多少月;
  • django_rq
  • Unity编辑器扩展之导出项目中所有Script里面的文本内容
  • 《Python实战进阶》No45:性能分析工具 cProfile 与 line_profiler
  • 【SLAM】svo 的深度滤波和 msckf 的后端的点的优化的差异是什么?delayinit和depthfilter之间的差异是什么?
  • 多帧Dicom文件获取ImagePosition、Intercept、Slope、PixelSpacing
  • AndroidStudio生成AAR
  • 网页工具箱 --- 一个强大的浏览器脚本工具
  • 前端开发 Markdown 编辑器与富文本编辑器详解
  • 长尾关键词SEO优化策略精解
  • Vcpkg C++库管理工具安装
  • Azure AI Foundry实战:从零开始构建智能应用
  • 关于 live555延迟优化之缓存区优化“StreamParser::afterGettingBytes() warning: read”” 的解决方法
  • 晶振:从消费电子到航天领域的时间精度定义者
  • Git仓库目录的所有权问题
  • 2025 新生 DL-FWI 培训
  • Web开发-JavaEE应用SpringBoot栈模版注入ThymeleafFreemarkerVelocity
  • Antd Upload组件连续回车会多次触发文件夹弹窗的bug修复
  • MATLAB绘制饼图(二维/三维)
  • 如何解决服务器文件丢失或损坏的问题
  • linux中systemctl stop 和 kill -9的区别
  • 字节暑期实习-网络运维工程师面经
  • Java学习计划与资源推荐(入门到进阶、高阶、实战)
  • 从 PID 到 Agent:工业控制算法的五代进化史与智能协同革命
  • CentOS网络之network和NetworkManager深度解析
  • 小刚说C语言刷题—1462小明的游泳时间