(七十八) 查看Android状态的命令积累

2023-12-19 07:48

本文主要是介绍(七十八) 查看Android状态的命令积累,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1.基础知识准备:

1.1 PSS

Item全称含义等价
USSUnique Set Size物理内存进程独占的内存
PSSProportional Set Size物理内存PSS= USS+ 按比例包含共享库
RSSResident Set Size物理内存RSS= USS+ 包含共享库
VSSVirtual Set Size虚拟内存VSS= RSS+ 未分配实际物理内存

故内存的大小关系:VSS >= RSS >= PSS >= USS

 

1.2 OOM

首先要明白android基于linux系统,系统的内存使用规则是不一样的。
windows下的内存管理规则为:退出即销毁,程序的内存会被回收。
linux的内存认为不用白不用,在程序退出后,如果没有新的内存申请,则内存不会被释放,这样下一次运行的时候会提高响应速度。
如此,android设计了low_memory和OUT_OF_MEMORY机制。
low_memory是在程序申请内存的时候报警,然后可以对这个报警进行一些响应,比如释放不用的资源来防止崩溃之类的。在低内存机器中,观察launcher在机器刚开机和运行一段时间后所占内存的大小就能发现,开机的时候内存占用很大,但是随着应用越开越多,占用内存在一步步被释放。
而OOM机制是机器底层的一种强制保鲜,在OOM发生的时候内核会排序强制杀掉进程来保证系统的继续运行,同样这种OOM异常容易发生在低内存机器上,比如512M。
首先系统会根据程序是否是空进程(已经由用户关闭的不带有任何服务和provider的进程),是否有服务,是否有provider,是否为前台进程,来排序,可以输入 adb shell dumpsys meminfo来查看,列出信息中的Total PSS by OOM adjustment:就是系统为程序的OOM排序结果,OOM异常的时候会根据这个表单从下网上杀掉进程释放内存。
OOM的阈值:是机器判定发生OOM的规则,在/kernel/drivers/staging/android/lowmemorykiller.c中可以看到
lowmem_adj[6] 为OOM等级,lowmem_minfree[6]为对应的在系统内存低于多少的时候,adj中高于该等级的活动都要被强制释放。对应的可以修改阈值,完成后编译lk就可以了。
以上就是关于low_memory和OOM的机制和修改

 

2.命令

2.1 dumpsys meminfo

adb shell dumpsys meminfo > /home/jiatai/shell_test/adbshell/dumpsys_meminfo.txt

Applications Memory Usage (in Kilobytes):
Uptime: 88147036 Realtime: 281774647Total PSS by process:384,092K: com.tencent.mm (pid 4145 / activities)201,704K: com.tencent.mm:tools (pid 22565)196,064K: com.android.systemui (pid 1962 / activities)181,041K: system (pid 1515)153,757K: com.zhihu.android (pid 11002 / activities)...Total PSS by OOM adjustment:328,105K: Native28,264K: android.hardware.camera.provider@2.4-service (pid 736)25,669K: logd (pid 568)21,586K: android.hardware.graphics.composer@2.1-service (pid 742)...560,837K: Persistent196,064K: com.android.systemui (pid 1962 / activities)181,041K: system (pid 1515)39,864K: com.android.phone (pid 2249)29,365K: com.android.nfc (pid 3078)23,107K: com.miui.daemon (pid 3066)20,614K: com.miui.whetstone (pid 3131)17,774K: com.xiaomi.xmsf (pid 3090)12,414K: com.xiaomi.finddevice (pid 3104)9,671K: com.miui.contentcatcher (pid 3039)8,156K: .dataservices (pid 2195)5,503K: com.qualcomm.qti.telephonyservice (pid 2205)4,838K: com.qualcomm.qcrilmsgtunnel (pid 2232)4,314K: org.simalliance.openmobileapi.service (pid 3052)4,140K: com.goodix.fingerprint (pid 3027)3,972K: com.qualcomm.qti.services.secureui:sui_service (pid 3116)13,162K: Persistent Service13,162K: com.android.bluetooth (pid 1924)277,044K: Foreground153,757K: com.zhihu.android (pid 11002 / activities)51,420K: com.google.android.webview:sandboxed_process0 (pid 11169)32,895K: com.miui.securitycenter.remote (pid 3706)20,325K: android.process.media (pid 6268)18,647K: com.miui.powerkeeper (pid 3649)235,251K: Visible82,287K: com.sohu.inputmethod.sogou.xiaomi (pid 4256)42,269K: com.miui.guardprovider (pid 20178)39,993K: com.xiaomi.hm.health (pid 11687)17,436K: com.xiaomi.metoknlp (pid 3379)14,516K: com.miui.systemAdSolution (pid 11865)11,884K: com.miui.analytics (pid 11697)10,754K: com.xiaomi.account (pid 16448)7,871K: com.xiaomi.bluetooth (pid 2737)4,508K: com.miui.wmsvc (pid 4988)3,733K: com.android.smspush (pid 12098)226,370K: Perceptible136,693K: tv.danmaku.bili (pid 6935 / activities)29,606K: tv.danmaku.bili:download (pid 7148)27,739K: tv.danmaku.bili:ijkservice (pid 7449)18,397K: tv.danmaku.bili:push (pid 6978)9,104K: com.lbe.security.miui (pid 3871)4,831K: com.google.android.webview:sandboxed_process0 (pid 7027)524,837K: Backup384,092K: com.tencent.mm (pid 4145 / activities)140,745K: com.netease.cloudmusic (pid 8758 / activities)42,365K: A Services32,637K: com.netease.cloudmusic:play (pid 8828)9,728K: com.android.camera (pid 13584)96,112K: Home96,112K: com.miui.home (pid 3234 / activities)26,240K: Previous26,240K: com.tencent.mm:exdevice (pid 4276)339,369K: B Services201,704K: com.tencent.mm:tools (pid 22565)31,761K: com.tencent.mm:push (pid 4423)28,118K: tv.danmaku.bili:web (pid 7249)18,376K: com.android.thememanager (pid 13077)14,637K: com.zhihu.android:pushservice (pid 11284)11,669K: com.android.settings:remote (pid 12286)10,808K: org.simalliance.openmobileapi.service:remote (pid 5203)8,930K: com.xiaomi.market:guard (pid 20117)5,174K: com.miui.core (pid 15435)4,265K: com.qualcomm.qti.callenhancement (pid 12121)3,927K: com.xiaomi.android.dm.service (pid 12158)343,692K: Cached86,893K: com.tencent.mm:appbrand0 (pid 10030)23,111K: com.google.android.webview:sandboxed_process1 (pid 7831)23,039K: com.miui.personalassistant (pid 11957)20,151K: com.miui.personalassistant:alipayinside (pid 21144)19,516K: com.google.android.webview:sandboxed_process0 (pid 22792)18,828K: com.miui.gallery (pid 9255)18,711K: tv.danmaku.bili:stats (pid 7109)17,824K: com.android.browser (pid 12782)17,801K: com.miui.systemAdSolution:ui (pid 9630)15,023K: android.process.acore (pid 9167)11,349K: com.miui.cloudservice (pid 9094)11,090K: com.xiaomi.market (pid 10966)10,588K: com.miui.hybrid (pid 11718)8,993K: com.miui.personalassistant:trans (pid 11924)8,190K: com.miui.micloudsync:sync (pid 12486)7,788K: com.xiaomi.simactivate.service (pid 9115)7,224K: com.android.settings (pid 20783)6,160K: com.miui.micloudsync (pid 12505)4,485K: com.android.printspooler (pid 11362)3,541K: com.android.musicfx (pid 9407)3,387K: com.xiaomi.micloud.sdk (pid 11434)Total PSS by category:1,127,920K: Native310,168K: Gfx dev301,477K: Unknown281,096K: Dalvik260,949K: .dex mmap248,877K: .so mmap210,819K: .art mmap75,116K: Dalvik Other72,937K: .oat mmap71,951K: .apk mmap18,961K: Other mmap17,368K: Ashmem6,667K: Stack5,182K: .ttf mmap2,325K: .jar mmap1,559K: Other dev12K: Cursor0K: EGL mtrack0K: GL mtrack0K: Other mtrackTotal RAM: 5,862,112K (status normal)Free RAM: 2,930,144K (  343,692K cached pss + 2,199,148K cached kernel +   130,568K cached ion +   256,736K free)Used RAM: 3,178,932K (2,669,692K used pss +   509,240K kernel)Lost RAM:   789,856KTuning: 256 (large 512), oom   322,560K, restore limit   107,520K (high-end-gfx)

如上dumpsys meminfo结果可以看出分如下几类统计ram使用情况:

 

1) Total PSS by process

2) Total PSS by OOM adjustment

  • Native
  • Persistent
  • Persistent Service
  • Foreground
  • Visible
  • Perceptible
  • Backup
  • A Services
  • Home
  • Previous
  • B Services
  • Cached

3) Total PSS by category:按类别统计的ram使用情况

 

最后这显示了手机整体ram使用情况:

Total RAM: 5,862,112K (status normal)
 Free RAM: 2,930,144K (  343,692K cached pss + 2,199,148K cached kernel +   130,568K cached ion +   256,736K free)
 Used RAM: 3,178,932K (2,669,692K used pss +   509,240K kernel)
 Lost RAM:   789,856K
   Tuning: 256 (large 512), oom   322,560K, restore limit   107,520K (high-end-gfx)

 

2.2 cat /proc/meminfo

MemTotal:        5862112 kB
MemFree:          290600 kB
MemAvailable:    2250212 kB
Buffers:          735864 kB
Cached:          1371512 kB
SwapCached:            0 kB
Active:          3215144 kB
Inactive:         891736 kB
Active(anon):    2092852 kB
Inactive(anon):    34536 kB
Active(file):    1122292 kB
Inactive(file):   857200 kB
Unevictable:       82496 kB
Mlocked:           82496 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:       2082104 kB
Mapped:           891920 kB
Shmem:             45676 kB
Slab:             260080 kB
SReclaimable:      96904 kB
SUnreclaim:       163176 kB
KernelStack:       63904 kB
PageTables:        76856 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     2931056 kB
Committed_AS:   139282048 kB
VmallocTotal:   258867136 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
CmaTotal:         163840 kB
CmaFree:               0 kB

 

2.3  cat  /proc/cpuinfo

Processor	: AArch64 Processor rev 4 (aarch64)
processor	: 0
BogoMIPS	: 38.40
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer	: 0x51
CPU architecture: 8
CPU variant	: 0xa
CPU part	: 0x801
CPU revision	: 4processor	: 1
BogoMIPS	: 38.40
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer	: 0x51
CPU architecture: 8
CPU variant	: 0xa
CPU part	: 0x801
CPU revision	: 4processor	: 2
BogoMIPS	: 38.40
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer	: 0x51
CPU architecture: 8
CPU variant	: 0xa
CPU part	: 0x801
CPU revision	: 4processor	: 3
BogoMIPS	: 38.40
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer	: 0x51
CPU architecture: 8
CPU variant	: 0xa
CPU part	: 0x801
CPU revision	: 4processor	: 4
BogoMIPS	: 38.40
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer	: 0x51
CPU architecture: 8
CPU variant	: 0xa
CPU part	: 0x800
CPU revision	: 1processor	: 5
BogoMIPS	: 38.40
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer	: 0x51
CPU architecture: 8
CPU variant	: 0xa
CPU part	: 0x800
CPU revision	: 1processor	: 6
BogoMIPS	: 38.40
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer	: 0x51
CPU architecture: 8
CPU variant	: 0xa
CPU part	: 0x800
CPU revision	: 1processor	: 7
BogoMIPS	: 38.40
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer	: 0x51
CPU architecture: 8
CPU variant	: 0xa
CPU part	: 0x800
CPU revision	: 1Hardware	: Qualcomm Technologies, Inc MSM8998

MSM8998就是高通骁龙835,8核处理器

 

 

2.4 dumpsys cpuinfo

chiron:/proc $ dumpsys cpuinfo
Load: 4.07 / 4.05 / 3.99
CPU usage from 215568ms to 195558ms ago (2018-08-10 22:53:04.131 to 2018-08-10 22:53:24.141):12% 6935/tv.danmaku.bili: 10% user + 1.2% kernel / faults: 52 minor4.7% 11002/com.zhihu.android: 1.1% user + 3.5% kernel / faults: 51 minor3.9% 780/surfaceflinger: 1.7% user + 2.1% kernel1% 1515/system_server: 0.2% user + 0.7% kernel / faults: 46 minor0.9% 11284/com.zhihu.android:pushservice: 0.3% user + 0.6% kernel0.9% 14337/kworker/u16:11: 0% user + 0.9% kernel0.7% 22/ksoftirqd/2: 0% user + 0.7% kernel0.5% 7449/tv.danmaku.bili:ijkservice: 0.2% user + 0.2% kernel0.5% 13718/kworker/u16:5: 0% user + 0.5% kernel0.4% 4145/com.tencent.mm: 0.4% user + 0% kernel / faults: 146 minor0.4% 14058/kworker/u16:0: 0% user + 0.4% kernel0% 4423/com.tencent.mm:push: 0% user + 0% kernel / faults: 56 minor0.2% 22565/com.tencent.mm:tools: 0.2% user + 0% kernel0.2% 81/smem_native_rpm: 0% user + 0.2% kernel0.2% 999/msm_irqbalance: 0% user + 0.1% kernel0.1% 15/ksoftirqd/1: 0% user + 0.1% kernel0.1% 438/cfinteractive: 0% user + 0.1% kernel0% 10/rcuop/0: 0% user + 0% kernel0% 902/thermal-engine: 0% user + 0% kernel0% 3649/com.miui.powerkeeper: 0% user + 0% kernel / faults: 8 minor0% 6978/tv.danmaku.bili:push: 0% user + 0% kernel / faults: 3 minor0% 14395/kworker/0:0: 0% user + 0% kernel0% 20178/com.miui.guardprovider: 0% user + 0% kernel / faults: 236 minor0% 3/ksoftirqd/0: 0% user + 0% kernel0% 7/rcu_preempt: 0% user + 0% kernel0% 568/logd: 0% user + 0% kernel0% 777/lmkd: 0% user + 0% kernel0% 883/sensors.qcom: 0% user + 0% kernel / faults: 30 minor0% 1032/ipacm: 0% user + 0% kernel0% 1962/com.android.systemui: 0% user + 0% kernel / faults: 3 minor0% 3090/com.xiaomi.xmsf: 0% user + 0% kernel / faults: 11 minor0% 3131/com.miui.whetstone: 0% user + 0% kernel / faults: 1 minor0% 5654/tcpdump: 0% user + 0% kernel0% 9293/adbd: 0% user + 0% kernel / faults: 45 minor
4.1% TOTAL: 2.2% user + 1.4% kernel + 0% iowait + 0.2% irq + 0% softirq

可以查看cpu利用率,iowait过高有可能引起anr。

 

2.5 dumpsys -l

chiron:/proc $ dumpsys -l
Currently running services:DockObserverMiuiBackupMiuiInitProcessManagerSurfaceFlingeraccessibilityaccountactivityalarmandroid.security.keystoreappopsappwidgetaudioautofillbackupbatterybatterypropertiesbatterystatsbluetooth_managercarrier_configclipboardcneservicecom.goodix.FingerprintServicecom.qualcomm.location.izat.IzatService

 

2.6 dumpsys meminfo packageName

chiron:/proc $ dumpsys meminfo com.android.settings
Applications Memory Usage (in Kilobytes):
Uptime: 90592678 Realtime: 284220288** MEMINFO in pid 14341 [com.android.settings] **Pss  Private  Private  SwapPss     Heap     Heap     HeapTotal    Dirty    Clean    Dirty     Size    Alloc     Free------   ------   ------   ------   ------   ------   ------Native Heap    16448    16212        0        0    38912    33802     5109Dalvik Heap     6418     6400        0        0     5291     2646     2645Dalvik Other     1137     1136        0        0                           Stack       48       48        0        0                           Ashmem       10        8        0        0                           Gfx dev     4212     4212        0        0                           Other dev        8        0        8        0                           .so mmap     1208      216       20        0                           .jar mmap        0        0        0        0                           .apk mmap     1138        0      700        0                           .ttf mmap      163        0       64        0                           .dex mmap     5545       32     3748        0                           .oat mmap     1262        0       12        0                           .art mmap     2878     2528       36        0                           Other mmap       15        4        0        0                           Unknown     1762     1760        0        0                           TOTAL    42252    32556     4588        0    44203    36448     7754App SummaryPss(KB)------Java Heap:     8964Native Heap:    16212Code:     4792Stack:       48Graphics:     4212Private Other:     2916System:     5108TOTAL:    42252       TOTAL SWAP PSS:        0ObjectsViews:      461         ViewRootImpl:        3AppContexts:        5           Activities:        3Assets:        5        AssetManagers:        3Local Binders:       43        Proxy Binders:       45Parcel memory:        9         Parcel count:       66Death Recipients:        7      OpenSSL Sockets:        1WebViews:        0SQLMEMORY_USED:        0PAGECACHE_OVERFLOW:        0          MALLOC_SIZE:      117

 

2.7 dumpsys activity

chiron:/ $ dumpsys activity -h                                                 
Activity manager dump options:[-a] [-c] [-p PACKAGE] [-h] [WHAT] ...WHAT may be one of:a[ctivities]: activity stack stater[recents]: recent activities stateb[roadcasts] [PACKAGE_NAME] [history [-s]]: broadcast statebroadcast-stats [PACKAGE_NAME]: aggregated broadcast statisticsi[ntents] [PACKAGE_NAME]: pending intent statep[rocesses] [PACKAGE_NAME]: process stateo[om]: out of memory managementperm[issions]: URI permission grant stateprov[iders] [COMP_SPEC ...]: content provider stateprovider [COMP_SPEC]: provider client-side states[ervices] [COMP_SPEC ...]: service stateas[sociations]: tracked app associationssettings: currently applied config settingsservice [COMP_SPEC]: service client-side statepackage [PACKAGE_NAME]: all state related to given packageall: dump all activitiestop: dump the top activityWHAT may also be a COMP_SPEC to dump activities.COMP_SPEC may be a component name (com.foo/.myApp),a partial substring in a component name, ahex object identifier.-a: include all available server state.-c: include client state.-p: limit output to given package.--checkin: output checkin format, resetting data.--C: output checkin format, not resetting data.

2.7.1  dumpsys activity packageName

chiron:/ $ dumpsys activity com.android.settings                               
TASK com.android.settings id=17600 userId=0ACTIVITY com.android.settings/.SubSettings ef1f9cb pid=14341Local Activity d0705dd State:mResumed=false mStopped=true mFinished=falsemChangingConfigurations=falsemCurrentConfig={1.0 460mcc65535mnc [zh_CN] ldltr sw392dp w392dp h714dp 440dpi nrml long port finger -keyb/v/h -nav/h appBounds=Rect(0, 0 - 1080, 2030) s.111 themeChanged=0 themeChangedFlags=0}mLoadersStarted=trueActive Fragments in 38f2fae:#0: MiuiMyDeviceSettings{312814f #0 id=0x7f0a0290}mFragmentId=#7f0a0290 mContainerId=#7f0a0290 mTag=nullmState=3 mIndex=0 mWho=android:fragment:0 mBackStackNesting=0mAdded=true mRemoving=false mFromLayout=false mInLayout=falsemHidden=false mDetached=false mMenuVisible=true mHasMenu=truemRetainInstance=false mRetaining=false mUserVisibleHint=truemFragmentManager=FragmentManager{38f2fae in HostCallbacks{46150dc}}mHost=android.app.Activity$HostCallbacks@46150dcmArguments=Bundle[{:android:show_fragment_title=2131888927}]mSavedViewState={16908290=android.view.AbsSavedState$1@a3aa5e5, 16908298=AbsListView.SavedState{da298ba selectedId=-9223372036854775808 firstId=-1 viewTop=0 position=0 height=1045 filter=null checkState=null}, 269156388=android.view.AbsSavedState$1@a3aa5e5, 269156392=android.view.AbsSavedState$1@a3aa5e5, 269156393=android.view.AbsSavedState$1@a3aa5e5, 269156430=android.view.AbsSavedState$1@a3aa5e5, 269156431=android.view.AbsSavedState$1@a3aa5e5, 269156432=com.miui.internal.widget.ActionBarView$SavedState@29fe36b, 269156433=com.miui.internal.widget.ActionBarContextView$SavedState@5209ec8, 269156434=android.view.AbsSavedState$1@a3aa5e5, 269156435=android.view.AbsSavedState$1@a3aa5e5, 2131361917=android.view.AbsSavedState$1@a3aa5e5, 2131362105=AbsListView.SavedState{5f4bb61 selectedId=-9223372036854775808 firstId=-1 viewTop=0 position=0 height=618 filter=null checkState=null}, 2131362121=android.view.AbsSavedState$1@a3aa5e5, 2131362623=android.view.AbsSavedState$1@a3aa5e5, 2131362759=android.view.AbsSavedState$1@a3aa5e5, 2131362762=ScrollView.SavedState{8518686 scrollPosition=0}, 2131363038=android.view.AbsSavedState$1@a3aa5e5, 2131363041=android.view.AbsSavedState$1@a3aa5e5, 2131363042=android.view.AbsSavedState$1@a3aa5e5, 2131363043=android.view.AbsSavedState$1@a3aa5e5}mContainer=android.widget.FrameLayout{e1a87b V.E...... .......D 0,0-1080,2160 #7f0a0290 app:id/main_content}mView=com.miui.internal.widget.ActionBarOverlayLayout{173d099 V.E...... ......ID 0,0-1080,2160 #100b004e miui:id/action_bar_overlay_layout}Child FragmentManager{3574b47 in MiuiMyDeviceSettings{312814f}}:FragmentManager misc state:mHost=android.app.Activity$HostCallbacks@46150dcmContainer=android.app.Fragment$1@504df74mParent=MiuiMyDeviceSettings{312814f #0 id=0x7f0a0290}mCurState=3 mStateSaved=true mDestroyed=falseAdded Fragments:#0: MiuiMyDeviceSettings{312814f #0 id=0x7f0a0290}Fragments Created Menus:#0: MiuiMyDeviceSettings{312814f #0 id=0x7f0a0290}FragmentManager misc state:mHost=android.app.Activity$HostCallbacks@46150dcmContainer=android.app.Activity$HostCallbacks@46150dcmCurState=3 mStateSaved=true mDestroyed=falseViewRoot:mAdded=true mRemoved=falsemConsumeBatchedInputScheduled=falsemConsumeBatchedInputImmediatelyScheduled=falsemPendingInputEventCount=0mProcessInputEventsScheduled=falsemTraversalScheduled=false      mIsAmbientMode=falseandroid.view.ViewRootImpl$NativePreImeInputStage: mQueueLength=0android.view.ViewRootImpl$ImeInputStage: mQueueLength=0android.view.ViewRootImpl$NativePostImeInputStage: mQueueLength=0Choreographer:mFrameScheduled=falsemLastFrameTime=90880598 (253177 ms ago)View Hierarchy:DecorView@5b50552[SubSettings]com.miui.internal.widget.ActionBarOverlayLayout{fa249e V.E...... .......D 0,0-1080,2160 #100b004e miui:id/action_bar_overlay_layout}android.widget.FrameLayout{1ddeb7f V.E...... .......D 0,0-1080,2160 #1020002 android:id/content}android.support.v4.widget.DrawerLayout{bea1395 VFE...... .......D 0,0-1080,2160 #7f0a015e app:id/drawer_layout}android.widget.LinearLayout{edfecaa V.E...... .......D 0,0-1080,2160 #7f0a0107 app:id/content_parent}android.widget.Toolbar{4efc09b G.E...... ......I. 0,0-0,0 #7f0a001a app:id/action_bar}android.widget.FrameLayout{37213e4 G.E...... ......I. 0,0-0,0 #7f0a0105 app:id/content_header_container}android.widget.FrameLayout{ffa204d V.E...... .......D 0,0-1080,2160 #7f0a0104 app:id/content_frame}android.widget.LinearLayout{82e8a50 V.E...... .......D 0,0-1080,2160}Looper (main, tid 2) {6e0ac9d}(Total messages: 0, polling=false, quitting=false)

可以看到activity/fragment/viewroot/choreographer/view hierarchy/looper等信息。

 

2.8 dumpsys package

chiron:/ $ dumpsys package -h                                                  
Package manager dump options:[-h] [-f] [--checkin] [cmd] ...--checkin: dump for a checkin-f: print details of intent filters-h: print this helpcmd may be one of:l[ibraries]: list known shared librariesf[eatures]: list device featuresk[eysets]: print known keysetsr[esolvers] [activity|service|receiver|content]: dump intent resolversperm[issions]: dump permissionspermission [name ...]: dump declaration and use of given permissionpref[erred]: print preferred package settingspreferred-xml [--full]: print preferred package settings as xmlprov[iders]: dump content providersp[ackages]: dump installed packagess[hared-users]: dump shared user IDsm[essages]: print collected runtime messagesv[erifiers]: print package verifier infod[omain-preferred-apps]: print domains preferred appsi[ntent-filter-verifiers]|ifv: print intent filter verifier infoversion: print database version infowrite: write current settings nowinstalls: details about install sessionscheck-permission <permission> <package> [<user>]: does pkg hold perm?dexopt: dump dexopt statecompiler-stats: dump compiler statisticsenabled-overlays: dump list of enabled overlay packages<package.name>: info about given package

dumpsys package packageName可以查看应用对应的权限相关信息

 

这篇关于(七十八) 查看Android状态的命令积累的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/511426

相关文章

Linux使用dd命令来复制和转换数据的操作方法

《Linux使用dd命令来复制和转换数据的操作方法》Linux中的dd命令是一个功能强大的数据复制和转换实用程序,它以较低级别运行,通常用于创建可启动的USB驱动器、克隆磁盘和生成随机数据等任务,本文... 目录简介功能和能力语法常用选项示例用法基础用法创建可启动www.chinasem.cn的 USB 驱动

关于Maven生命周期相关命令演示

《关于Maven生命周期相关命令演示》Maven的生命周期分为Clean、Default和Site三个主要阶段,每个阶段包含多个关键步骤,如清理、编译、测试、打包等,通过执行相应的Maven命令,可以... 目录1. Maven 生命周期概述1.1 Clean Lifecycle1.2 Default Li

Python如何使用seleniumwire接管Chrome查看控制台中参数

《Python如何使用seleniumwire接管Chrome查看控制台中参数》文章介绍了如何使用Python的seleniumwire库来接管Chrome浏览器,并通过控制台查看接口参数,本文给大家... 1、cmd打开控制台,启动谷歌并制定端口号,找不到文件的加环境变量chrome.exe --rem

windows系统下shutdown重启关机命令超详细教程

《windows系统下shutdown重启关机命令超详细教程》shutdown命令是一个强大的工具,允许你通过命令行快速完成关机、重启或注销操作,本文将为你详细解析shutdown命令的使用方法,并提... 目录一、shutdown 命令简介二、shutdown 命令的基本用法三、远程关机与重启四、实际应用

Debian如何查看系统版本? 7种轻松查看Debian版本信息的实用方法

《Debian如何查看系统版本?7种轻松查看Debian版本信息的实用方法》Debian是一个广泛使用的Linux发行版,用户有时需要查看其版本信息以进行系统管理、故障排除或兼容性检查,在Debia... 作为最受欢迎的 linux 发行版之一,Debian 的版本信息在日常使用和系统维护中起着至关重要的作

Java汇编源码如何查看环境搭建

《Java汇编源码如何查看环境搭建》:本文主要介绍如何在IntelliJIDEA开发环境中搭建字节码和汇编环境,以便更好地进行代码调优和JVM学习,首先,介绍了如何配置IntelliJIDEA以方... 目录一、简介二、在IDEA开发环境中搭建汇编环境2.1 在IDEA中搭建字节码查看环境2.1.1 搭建步

Linux使用nohup命令在后台运行脚本

《Linux使用nohup命令在后台运行脚本》在Linux或类Unix系统中,后台运行脚本是一项非常实用的技能,尤其适用于需要长时间运行的任务或服务,本文我们来看看如何使用nohup命令在后台... 目录nohup 命令简介基本用法输出重定向& 符号的作用后台进程的特点注意事项实际应用场景长时间运行的任务服

Redis的Hash类型及相关命令小结

《Redis的Hash类型及相关命令小结》edisHash是一种数据结构,用于存储字段和值的映射关系,本文就来介绍一下Redis的Hash类型及相关命令小结,具有一定的参考价值,感兴趣的可以了解一下... 目录HSETHGETHEXISTSHDELHKEYSHVALSHGETALLHMGETHLENHSET

Android数据库Room的实际使用过程总结

《Android数据库Room的实际使用过程总结》这篇文章主要给大家介绍了关于Android数据库Room的实际使用过程,详细介绍了如何创建实体类、数据访问对象(DAO)和数据库抽象类,需要的朋友可以... 目录前言一、Room的基本使用1.项目配置2.创建实体类(Entity)3.创建数据访问对象(DAO

如何使用 Bash 脚本中的time命令来统计命令执行时间(中英双语)

《如何使用Bash脚本中的time命令来统计命令执行时间(中英双语)》本文介绍了如何在Bash脚本中使用`time`命令来测量命令执行时间,包括`real`、`user`和`sys`三个时间指标,... 使用 Bash 脚本中的 time 命令来统计命令执行时间在日常的开发和运维过程中,性能监控和优化是不