私のアプリには 3 つのプロセスと 2 つのサービスがあり、それらの関係は次のとおりです: (UI 開始と BKService のバインド、UI 開始と LinkService のバインド、次に BKService バインド LinkService)
デーモンプロセス (BKService) / /(バインド A) | UI プロセス | (バインド C) \ (バインド B) | \ プッシュ処理 (LinkService)
プッシュ プロセスのメモリ使用量は、デーモン プロセスよりもはるかに少なくなります。
以下のように、dumpsys アクティビティ プロセスを使用して、adj タイプと値を確認します。
Proc # 7: svc B/ /S trm: 5 1998:cc.okcall:daemon/u0a155 (started-services)
Proc # 6: svc B/ /S trm: 5 2017:cc.okcall:push/u0a155 (started-services)
Proc # 5: cch+1 B/ /CA trm:80 2697:cc.okcall/u0a155 (cch-act)
詳細な dumpsys アクティビティ プロセス情報は次のとおりです。
*APP* UID 10155 ProcessRecord{4297b510 12359:cc.okcall/u0a155}
user #0 uid=10155
class=cc.okcall.MyApplication
dir=/data/app/cc.okcall-1.apk publicDir=/data/app/cc.okcall-1.apk data=/data/data/cc.okcall
packageList={cc.okcall}
compat={320dpi}
thread=android.app.ApplicationThreadProxy@42970828
pid=12359 starting=false
lastActivityTime=-6m44s889ms lastPssTime=-3m57s159ms nextPssTime=+26m2s662ms
adjSeq=449275 lruSeq=0 lastPss=20116 lastCachedPss=20116
keeping=false cached=true empty=true
oom: max=16 curRaw=10 setRaw=10 cur=10 set=10
curSchedGroup=0 setSchedGroup=0 systemNoUi=false trimMemoryLevel=0
curProcState=11 repProcState=11 pssProcState=10 setProcState=11 lastStateTime=-6m39s857ms
hasShownUi=true pendingUiClean=false hasAboveClient=false
lastWakeTime=0 timeUsed=0
lastCpuTime=0 timeUsed=0
lastRequestedGc=-9m44s117ms lastLowMemory=-9m44s117ms reportLowMemory=false
Activities:
- ActivityRecord{4285f6b8 u0 cc.okcall/.ui.home.ActivityHome t140}
Connections:
- ConnectionRecord{428a5048 u0 CR cc.okcall/.push.LinkService:@4236a318}
- ConnectionRecord{428f3300 u0 CR cc.okcall/.service.BKService:@42383ef8}
- ConnectionRecord{42baac98 u0 CR cc.okcall/.push.LinkService:@4236a318}
- ConnectionRecord{42bb4dc0 u0 CR cc.okcall/.service.BKService:@42383ef8}
Connected Providers:
- 4217c8b8/com.android.providers.settings/.SettingsProvider->12359:cc.okcall/u0a155 s1/1 u0/0 +9m43s423ms
- 4216e458/com.motorola.android.providers.settings/.MotorolaSettingsProvider->12359:cc.okcall/u0a155 s1/1 u0/0 +9m43s330ms
Receivers:
- ReceiverList{4293d538 12359 cc.okcall/10155/u0 remote:4294d840}
*APP* UID 10155 ProcessRecord{429e1778 12416:cc.okcall:push/u0a155}
user #0 uid=10155
class=cc.okcall.MyApplication
dir=/data/app/cc.okcall-1.apk publicDir=/data/app/cc.okcall-1.apk data=/data/data/cc.okcall
packageList={cc.okcall}
compat={320dpi}
thread=android.app.ApplicationThreadProxy@4225b430
pid=12416 starting=false
lastActivityTime=-9m40s498ms lastPssTime=-4m6s679ms nextPssTime=+15m53s244ms
adjSeq=449275 lruSeq=0 lastPss=9259 lastCachedPss=0
keeping=true cached=false empty=true
oom: max=16 curRaw=5 setRaw=5 cur=5 set=5
curSchedGroup=0 setSchedGroup=0 systemNoUi=false trimMemoryLevel=0
curProcState=7 repProcState=7 pssProcState=7 setProcState=7 lastStateTime=-6m39s867ms
hasClientActivities=true foregroundActivities=false
hasStartedServices=true
lastRequestedGc=-9m42s433ms lastLowMemory=-9m42s433ms reportLowMemory=false
Services:
- ServiceRecord{43147398 u0 cc.okcall/.push.LinkService}
Connected Providers:
- 4217c8b8/com.android.providers.settings/.SettingsProvider->12416:cc.okcall:push/u0a155 s1/1 u0/0 +9m41s11ms
Receivers:
- ReceiverList{42982798 12416 cc.okcall:push/10155/u0 remote:42555c68}
- ReceiverList{42d1b248 12416 cc.okcall:push/10155/u0 remote:42d1b028}
*APP* UID 10155 ProcessRecord{42d66170 12195:cc.okcall:daemon/u0a155}
user #0 uid=10155
class=cc.okcall.MyApplication
dir=/data/app/cc.okcall-1.apk publicDir=/data/app/cc.okcall-1.apk data=/data/data/cc.okcall
packageList={cc.okcall}
compat={320dpi}
thread=android.app.ApplicationThreadProxy@42abfc68
pid=12195 starting=false
lastActivityTime=-9m40s601ms lastPssTime=-4m6s757ms nextPssTime=+15m53s144ms
adjSeq=449275 lruSeq=0 lastPss=19601 lastCachedPss=0
keeping=true cached=false empty=true
oom: max=16 curRaw=5 setRaw=5 cur=5 set=5
curSchedGroup=0 setSchedGroup=0 systemNoUi=false trimMemoryLevel=0
curProcState=7 repProcState=7 pssProcState=7 setProcState=7 lastStateTime=-6m39s967ms
hasClientActivities=true foregroundActivities=false
hasStartedServices=true
lastRequestedGc=-9m48s171ms lastLowMemory=-9m48s171ms reportLowMemory=false
Services:
- ServiceRecord{431d5770 u0 cc.okcall/.service.BKService}
Connections:
- ConnectionRecord{42d455f0 u0 cc.okcall/.push.LinkService:@41f9aa40}
Published Providers:
- cc.okcall.provider.AccountProvider
-> ContentProviderRecord{42f4d1e0 u0 cc.okcall/.provider.AccountProvider}
- cc.okcall.provider.MessageProvider
-> ContentProviderRecord{42f4d278 u0 cc.okcall/.provider.MessageProvider}
- cc.okcall.provider.MeetupProvider
-> ContentProviderRecord{42f4d310 u0 cc.okcall/.provider.MeetupProvider}
- cc.okcall.provider.ContactProvider
-> ContentProviderRecord{42f4d3a8 u0 cc.okcall/.provider.ContactProvider}
Connected Providers:
- 4217c8b8/com.android.providers.settings/.SettingsProvider->12195:cc.okcall:daemon/u0a155 s1/1 u0/0 +9m41s118ms
Receivers:
- ReceiverList{42a3ed60 12195 cc.okcall:daemon/10155/u0 remote:421374c0}
私が理解しているように、メモリ不足の状態では、強制終了シーケンスは次のようにする必要があります: UI プロセス、デーモン プロセス、プッシュ プロセス。(BKService は LinkService のクライアントであるため、LinkService は unBind の前に停止せず、同じ oom_adj 値を使用すると、LinkService のメモリ使用量が少なくなります)。
しかし実際には、強制終了のシーケンスは常に、UI プロセス、プッシュ プロセス、デーモン プロセスです。誰かがこれを説明できますか?
バインド C (LinkService bind BKService) の方向を変更すると、デーモン プロセスがプッシュ プロセスよりも先に強制終了されます。
理由がわかりません。誰か助けてください。よろしくお願いします。