android查看service状态,android dumpsys实时查看各service状态

我们先来看下有哪些service可以看dump

先进入adb shell , dumpsys | grep "DUMP OF SERVICE"就可以看哪些service可以dump

dumpsys | grep "DUMP OF SERVICE"

DUMP OF SERVICE DockObserver:

DUMP OF SERVICE SurfaceFlinger:

DUMP OF SERVICE accessibility:

DUMP OF SERVICE account:

DUMP OF SERVICE activity:

DUMP OF SERVICE alarm:

Can't find service: android.service.gatekeeper.IGateKeeperService

DUMP OF SERVICE android.security.keystore:

DUMP OF SERVICE appops:

DUMP OF SERVICE appwidget:

DUMP OF SERVICE assetatlas:

DUMP OF SERVICE audio:

DUMP OF SERVICE backup:

DUMP OF SERVICE battery:// 电池

DUMP OF SERVICE batteryproperties:

DUMP OF SERVICE batterystats:

DUMP OF SERVICE bluetooth_manager:

DUMP OF SERVICE carrier_config:

DUMP OF SERVICE clipboard:

DUMP OF SERVICE commontime_management:

DUMP OF SERVICE connectivity:

DUMP OF SERVICE consumer_ir:

DUMP OF SERVICE content:

DUMP OF SERVICE country_detector:

DUMP OF SERVICE cpuinfo:

DUMP OF SERVICE dbinfo:

DUMP OF SERVICE device_policy:

DUMP OF SERVICE deviceidle:

DUMP OF SERVICE devicestoragemonitor:

DUMP OF SERVICE diskstats:

DUMP OF SERVICE display:

DUMP OF SERVICE dreams:

DUMP OF SERVICE drm.drmManager:

DUMP OF SERVICE dropbox:

DUMP OF SERVICE ethernet:

DUMP OF SERVICE fingerprint:

DUMP OF SERVICE gfxinfo:

DUMP OF SERVICE graphicsstats:

DUMP OF SERVICE imms:

DUMP OF SERVICE ims:

DUMP OF SERVICE input:

DUMP OF SERVICE input_method:

DUMP OF SERVICE iphonesubinfo:

DUMP OF SERVICE isms:

DUMP OF SERVICE isub:

DUMP OF SERVICE jobscheduler:

DUMP OF SERVICE launcherapps:

DUMP OF SERVICE lcframeworkwrapper:

DUMP OF SERVICE location:

DUMP OF SERVICE lock_settings:

DUMP OF SERVICE media.audio_flinger:

DUMP OF SERVICE media.audio_policy:

DUMP OF SERVICE media.camera:

DUMP OF SERVICE media.camera.proxy:

DUMP OF SERVICE media.player:

DUMP OF SERVICE media.radio:

DUMP OF SERVICE media.resource_manager:

DUMP OF SERVICE media.sound_trigger_hw:

DUMP OF SERVICE media_projection:

DUMP OF SERVICE media_router:

DUMP OF SERVICE media_session:

DUMP OF SERVICE meminfo:

DUMP OF SERVICE mount://挂载

DUMP OF SERVICE netpolicy:

DUMP OF SERVICE netstats:

DUMP OF SERVICE network_management:

DUMP OF SERVICE network_score:

DUMP OF SERVICE notification:

DUMP OF SERVICE package:

DUMP OF SERVICE permission:

DUMP OF SERVICE phone:

DUMP OF SERVICE power://电源

DUMP OF SERVICE print:

DUMP OF SERVICE processinfo:

DUMP OF SERVICE procstats:

DUMP OF SERVICE restrictions:

DUMP OF SERVICE rttmanager:

DUMP OF SERVICE samplingprofiler:

DUMP OF SERVICE scheduling_policy:

DUMP OF SERVICE search:

DUMP OF SERVICE sensorservice:

DUMP OF SERVICE serial:

DUMP OF SERVICE servicediscovery:

DUMP OF SERVICE simphonebook:

DUMP OF SERVICE statusbar:

DUMP OF SERVICE telecom:

DUMP OF SERVICE telephony.registry:

DUMP OF SERVICE textservices:

DUMP OF SERVICE trust:

DUMP OF SERVICE uimode:

DUMP OF SERVICE updatelock:

DUMP OF SERVICE usagestats:

DUMP OF SERVICE usb:

DUMP OF SERVICE user:

DUMP OF SERVICE vibrator:

DUMP OF SERVICE voiceinteraction:

DUMP OF SERVICE wallpaper:

DUMP OF SERVICE webviewupdate:

DUMP OF SERVICE wifi:

DUMP OF SERVICE wifip2p:

DUMP OF SERVICE wifiscanner:

DUMP OF SERVICE window:

比如查看battery电池的实时信息,可以打dumpsys battery

shell@lte26007:/ $ dumpsys battery

dumpsys battery

Current Battery Service state:

AC powered: false

USB powered: true

Wireless powered: false

Max charging current: 0

status: 2

health: 2

present: true

level: 97

scale: 100

voltage: 4203

temperature: 280

technology: Li-poly



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Android Framework 中查看启动服务耗时,可以通过 adb shell dumpsys activity services 命令来获取。这个命令会输出所有正在运行的服务的信息,包括它们的启动时间和耗时。 例如,假设我们要查看系统中当前正在运行的所有服务的启动耗时,可以在终端中输入以下命令: ``` adb shell dumpsys activity services ``` 输出结果中,每个服务的信息都会以如下形式显示: ``` SERVICE com.example.MyService * ServiceRecord{123456 u0 com.example/.MyService} intent={act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example/.MyService} packageName=com.example processName=com.example baseDir=/data/app/com.example-1/base.apk dataDir=/data/data/com.example app=ProcessRecord{7890 u0 com.example:myprocess/xyz} createTime=-2m28s824ms startingBgTimeout=-- lastActivity=-2m28s824ms restartTime=-2m28s824ms createdFromFg=true startRequested=true stopIfKilled=true callStart=true lastStartId=0 bindings.size=0 executingStart=-1 startId=-1 delayedStop=false stopWithTask=false lastStartForeground=false noisy=false fgg=false explicitIdle=false comp=null connection=null delayed=true delayedStop=false stopWithTask=false lastStartId=-1 destroyTime=-1 crashCount=0 restartDelay=0 restartCount=0 nextRestartTime=-1 proc=start executeNesting=1 callingIdentity=System whitelistManager=null mBoundApplication=AppBindData{...} mServiceInfo=ServiceInfo{...} mPackageName=com.example grantedUriPermissions=0 pendingStarts.size=0 lastPrincipalResuming=null retainInstance=false mStartCompatibility=0 mDispatchedStarts=[StartInfo{...}] mDelayedStop=-- mDestroyed=false mStopIfKilled=false mStopWithTask=false mStartRequested=true mDelayed=true mLastStartId=-1 mExecuteNesting=1 mAllowCancel=true mResultTo=null mService=null mHasAutoCreateConnections=false mCreateBytes=-1 mRestored=false mDestroyedByApp=false mIsForeground=false mForegroundId=0 mForegroundNoti=null mCrashCount=0 mRestartCount=0 ``` 其中,createTime 表示服务创建时间,lastActivity 表示最后一次活动时间,restartTime 表示服务重新启动时间,executeNesting 表示执行嵌套深度(如果超过 1,则表示服务正在执行其他操作,如绑定等),mCreateBytes 表示创建服务时使用的内存大小,mCrashCount 表示服务崩溃次数,mRestartCount 表示服务重启次数等。 注意,dumpsys activity services 命令会输出大量信息,如果要查找特定服务的启动时间,可以使用 grep 命令进行过滤。例如,要查看 com.example.MyService 的启动时间,可以使用以下命令: ``` adb shell dumpsys activity services | grep com.example.MyService ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值