欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 新闻 > 会展 > Android am命令参考

Android am命令参考

2025/5/9 8:10:13 来源:https://blog.csdn.net/oh_my_god/article/details/147731606  浏览:    关键词:Android am命令参考

am,activity manager的缩写,用户通过am命令管理activity、service、broadcast,输出调试信息等,代码文件:

/frameworks/base/services/core/java/com/android/server/am/ActivityManagerShellCommand.java

方法onCommand的case语句包含相应am 命令参数,具体参数作用去搜索

 @Overridepublic int onCommand(String cmd) {if (cmd == null) {return handleDefaultCommands(cmd);}final PrintWriter pw = getOutPrintWriter();try {switch (cmd) {case "start":case "start-activity":return runStartActivity(pw);case "startservice":case "start-service":return runStartService(pw, false);case "startforegroundservice":case "startfgservice":case "start-foreground-service":case "start-fg-service":return runStartService(pw, true);case "stopservice":case "stop-service":return runStopService(pw);case "broadcast":return runSendBroadcast(pw);case "compact":return runCompact(pw);case "instrument":getOutPrintWriter().println("Error: must be invoked through 'am instrument'.");return -1;case "trace-ipc":return runTraceIpc(pw);case "profile":return runProfile(pw);case "dumpheap":return runDumpHeap(pw);case "set-debug-app":return runSetDebugApp(pw);case "set-agent-app":return runSetAgentApp(pw);case "clear-debug-app":return runClearDebugApp(pw);case "set-watch-heap":return runSetWatchHeap(pw);case "clear-watch-heap":return runClearWatchHeap(pw);case "clear-exit-info":return runClearExitInfo(pw);case "bug-report":return runBugReport(pw);case "force-stop":return runForceStop(pw);case "stop-app":return runStopApp(pw);case "fgs-notification-rate-limit":return runFgsNotificationRateLimit(pw);case "crash":return runCrash(pw);case "kill":return runKill(pw);case "kill-all":return runKillAll(pw);case "make-uid-idle":return runMakeIdle(pw);case "monitor":return runMonitor(pw);case "watch-uids":return runWatchUids(pw);case "hang":return runHang(pw);case "restart":return runRestart(pw);case "idle-maintenance":return runIdleMaintenance(pw);case "screen-compat":return runScreenCompat(pw);case "package-importance":return runPackageImportance(pw);case "to-uri":return runToUri(pw, 0);case "to-intent-uri":return runToUri(pw, Intent.URI_INTENT_SCHEME);case "to-app-uri":return runToUri(pw, Intent.URI_ANDROID_APP_SCHEME);case "switch-user":return runSwitchUser(pw);case "get-current-user":return runGetCurrentUser(pw);case "start-user":return runStartUser(pw);case "unlock-user":return runUnlockUser(pw);case "stop-user":return runStopUser(pw);case "is-user-stopped":return runIsUserStopped(pw);case "get-started-user-state":return runGetStartedUserState(pw);case "track-associations":return runTrackAssociations(pw);case "untrack-associations":return runUntrackAssociations(pw);case "get-uid-state":return getUidState(pw);case "get-config":return runGetConfig(pw);case "suppress-resize-config-changes":return runSuppressResizeConfigChanges(pw);case "set-inactive":return runSetInactive(pw);case "get-inactive":return runGetInactive(pw);case "set-standby-bucket":return runSetStandbyBucket(pw);case "get-standby-bucket":return runGetStandbyBucket(pw);case "send-trim-memory":return runSendTrimMemory(pw);case "display":return runDisplay(pw);case "stack":return runStack(pw);case "task":return runTask(pw);case "write":return runWrite(pw);case "attach-agent":return runAttachAgent(pw);case "supports-multiwindow":return runSupportsMultiwindow(pw);case "supports-split-screen-multi-window":return runSupportsSplitScreenMultiwindow(pw);case "update-appinfo":return runUpdateApplicationInfo(pw);case "no-home-screen":return runNoHomeScreen(pw);case "wait-for-broadcast-idle":return runWaitForBroadcastIdle(pw);case "compat":return runCompat(pw);case "refresh-settings-cache":return runRefreshSettingsCache();case "memory-factor":return runMemoryFactor(pw);case "service-restart-backoff":return runServiceRestartBackoff(pw);case "get-isolated-pids":return runGetIsolatedProcesses(pw);case "set-stop-user-on-switch":return runSetStopUserOnSwitch(pw);case "set-bg-abusive-uids":return runSetBgAbusiveUids(pw);case "list-bg-exemptions-config":return runListBgExemptionsConfig(pw);default:return handleDefaultCommands(cmd);}} catch (RemoteException e) {pw.println("Remote exception: " + e);}return -1;}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词