【Android】ProcessRecord、ServiceRecord和ConnectionRecord

ProcessRecordServiceRecordConnectionRecord

应用com.sunday.aidl里定义了一个aidl服务com.sunday.aidl/.MathService

在应用com.example.aidlclient里使用bindService去连接这个服务。

观察ProcessRecord和ConnectionRecord

 

ps查看

u0_a110     19726   627 4 16:09:08 ?     00:00:00 com.example.aidlclient

u0_a109     19743   627 1 16:09:09 ?     00:00:00 com.sunday.aidl

 

dumpsys activity p 查看进程记录信息

  *APP* UID10109 ProcessRecord{b8a5f8519743:com.sunday.aidl/u0a109}

    user #0uid=10109 gids={50109, 20109, 9997}

   requiredAbi=arm64-v8a instructionSet=null

   dir=/data/app/com.sunday.aidl-yCvf4ojSXJ_gW5UH-dhVOQ==/base.apkpublicDir=/data/app/com.sunday.aidl-yCvf4ojSXJ_gW5UH-dhVOQ==/base.apkdata=/data/user/0/com.sunday.aidl

    packageList={com.sunday.aidl}

   compat={320dpi}

   thread=android.app.IApplicationThread$Stub$Proxy@8e361da

    pid=19743starting=false

   lastActivityTime=-1m37s778ms lastPssTime=-1m27s96msnextPssTime=+32s698ms

   adjSeq=1307772 lruSeq=0 lastPss=8.9MB lastSwapPss=0.00lastCachedPss=0.00 lastCachedSwapPss=0.00

   cached=false empty=true

    oom:max=1001 curRaw=100 setRaw=100 cur=100 set=100

   curSchedGroup=1 setSchedGroup=1 systemNoUi=false trimMemoryLevel=0

   curProcState=5 repProcState=5 pssProcState=2 setProcState=5lastStateTime=-1m37s694ms

   reportedInteraction=false fgInteractionTime=-30s221ms

   hasClientActivities=true foregroundActivities=false (rep=false)

   lastRequestedGc=-1m37s806ms lastLowMemory=-1m37s806msreportLowMemory=false

    Services:

      - ServiceRecord{83ebd54 u0com.sunday.aidl/.MathService}

  *APP* UID10110 ProcessRecord{5e15eaf19726:com.example.aidlclient/u0a110}

    user #0uid=10110 gids={50110, 20110, 9997}

   requiredAbi=arm64-v8a instructionSet=null

    dir=/data/app/com.example.aidlclient-zZXqKJs2pslKIp5m1Zmwlg==/base.apkpublicDir=/data/app/com.example.aidlclient-zZXqKJs2pslKIp5m1Zmwlg==/base.apkdata=/data/user/0/com.example.aidlclient

   packageList={com.example.aidlclient}

   compat={320dpi}

    thread=android.app.IApplicationThread$Stub$Proxy@93d460b

    pid=19726starting=false

   lastActivityTime=-1m38s484ms lastPssTime=-1m27s143msnextPssTime=+32s698ms

   adjSeq=1307772 lruSeq=0 lastPss=26MB lastSwapPss=0.00 lastCachedPss=0.00lastCachedSwapPss=0.00

   cached=false empty=false

    oom:max=1001 curRaw=0 setRaw=0 cur=0 set=0

   curSchedGroup=2 setSchedGroup=2 systemNoUi=false trimMemoryLevel=0

   curProcState=5 repProcState=5 pssProcState=2 setProcState=5lastStateTime=-1m38s484ms

   hasShownUi=true pendingUiClean=true hasAboveClient=falsetreatLikeActivity=false

   reportedInteraction=false fgInteractionTime=-30s222ms

   hasClientActivities=false foregroundActivities=true (rep=true)

   lastRequestedGc=-1m38s488ms lastLowMemory=-1m38s488ms reportLowMemory=false

   Activities:

      -ActivityRecord{baf65c u0 com.example.aidlclient/.MainActivity t35428}

   Connections:

      - ConnectionRecord{8ff3245 u0CR com.sunday.aidl/.MathService:@628d2bc}

    ConnectedProviders:

      -43dbb12/com.android.providers.settings/.SettingsProvider->19726:com.example.aidlclient/u0a110s1/1 u0/0 +1m38s322ms

 

可以看到,如果进程中提供了服务,会有ServiceRecord记录,一个进程可以提供多个service,每个service都会有其ServiceRecord记录。

如果进程(com.example.aidlclient)中连接了服务,会有ConnectionRecord记录

 

 

你可能感兴趣的:(Android)