After upgrading my Galaxy A51 from Android 10 to Android 11, it has started peri…odically (or randomly) killing my two XMPP client apps, yaxim and Bruno, despite both having a permanent (and visible) foreground service notification.
Ironically, the OS recognizes those kills as a crash and immediately restarts the app, causing a large amount of unneeded network traffic:
```
03-22 08:55:09.470 5028 10568 I ChimeraPolicyHandler: Killed on trigger2 : org.yaxim.bruno, freed: 34707, 10202[4548]:G2(0x20000) score=26,8(39 5 34707), pids: 4548 / stats: 4 / adjs: 200
[...]
03-22 08:55:09.585 5028 11722 I ActivityManager: Process org.yaxim.bruno (pid 4548) has died: prcp FGS (175,635)
03-22 08:55:09.586 5028 11722 W ActivityManager: Scheduling restart of crashed service org.yaxim.bruno/org.yaxim.androidclient.service.XMPPService in 1000ms for start-requested
```
Even more ironically, it also keeps resurrecting (auto-starting) apps that I have manually force-stopped before.
The ChimeraPolicyHandler seems to be a job running multiple times per hour in the `system_server` process. ps shows:
```
system 5028 4601 12953324 266152 0 0 S system_server
```
Full log of one ChimeraPolicyHandler run:
```
03-22 08:55:09.288 5028 10568 I ChimeraPolicyHandler: Start executePolicy: TRIGGER_SOURCE_HOME_IDLE
03-22 08:55:09.293 5028 10568 I ChimeraPolicyHandler: memAvailable: 750256, memFreeTarget: 890880, releaseTarget:140624, protectedLruCount: 6
03-22 08:55:09.403 5028 10568 I ChimeraPolicyHandler: Start doKill, protected policy: NORMAL
03-22 08:55:09.405 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.google.android.googlequicksearchbox, 10230[20349,14885]:G1(0x1) score=55,7(23 40 127100), pids: 20349 14885 / stats: 10 5 / adjs: 800 100
03-22 08:55:09.405 5028 10568 I ChimeraPolicyHandler: Skipped by interval: com.samsung.android.oneconnect, elapsed: 00:54:50, interval: 04:00:00, 10255[12960,13390]:G1(0x1) score=33,4(35 10 67797), pids: 12960 13390 / stats: 8 8 / adjs: 200 200
03-22 08:55:09.405 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.android.vending, 10226[25018]:G1(0x1) score=13,0(3 5 51575), pids: 25018 / stats: 12 / adjs: 100
03-22 08:55:09.405 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.android.systemui, 10054[10714]:G2(0x20000) score=76,0(65 10 240771), pids: 10714 / stats: 5 / adjs: -800
03-22 08:55:09.405 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.google.android.ext.services, 10080[24237,24270]:G2(0x20000) score=48,5(43 40 27866), pids: 24237 24270 / stats: 5 5 / adjs: 100 100
03-22 08:55:09.406 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.google.android.as, 10284[24194,24200]:G2(0x20000) score=42,9(34 40 19282), pids: 24194 24200 / stats: 5 5 / adjs: 100 100
03-22 08:55:09.406 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.samsung.android.dynamiclock, 10070[21726]:G2(0x20000) score=34,0(15 40 18505), pids: 21726 / stats: 5 / adjs: 0
03-22 08:55:09.406 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.samsung.android.app.telephonyui, 1001[27531]:G2(0x20002) score=31,1(48 5 36007), pids: 27531 / stats: 5 / adjs: 0
03-22 08:55:09.406 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.sec.location.nsflp2, 5013[11278]:G2(0x20002) score=31,1(57 5 10969), pids: 11278 / stats: 5 / adjs: 100
03-22 08:55:09.406 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.samsung.android.knox.containercore, 5250[11455]:G2(0x20002) score=28,6(53 5 6891), pids: 11455 / stats: 5 / adjs: 100
03-22 08:55:09.406 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.samsung.android.server.wifi.mobilewips, 1000[5432]:G2(0x20002) score=28,5(50 5 14599), pids: 5432 / stats: 6 / adjs: 100
03-22 08:55:09.410 5028 10568 I ChimeraPolicyHandler: Skipped by uid : com.samsung.android.beaconmanager, 5006[19846]:G2(0x20002) score=28,2(52 5 7092), pids: 19846 / stats: 8 / adjs: 200
03-22 08:55:09.410 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.sec.epdg, 1000[17442]:G2(0x20002) score=27,9(49 5 13754), pids: 17442 / stats: 6 / adjs: 100
03-22 08:55:09.411 5028 10568 I ChimeraPolicyHandler: Skipped by adj : org.kde.kdeconnect_tp, 10393[14802]:G2(0x8) score=27,8(26 20 22970), pids: 14802 / stats: 4 / adjs: 100
03-22 08:55:09.414 5028 10568 I ChimeraPolicyHandler: Skipped by uid : com.samsung.android.themecenter, 1000[10830]:G2(0x20002) score=27,6(51 5 6306), pids: 10830 / stats: 8 / adjs: 200
03-22 08:55:09.415 5028 10568 I ChimeraPolicyHandler: Skipped by interval: org.yaxim.bruno, elapsed: 00:52:29, interval: 04:00:00, 10202[4548]:G2(0x20000) score=26,8(39 5 34707), pids: 4548 / stats: 4 / adjs: 200
03-22 08:55:09.416 5028 10568 I ChimeraPolicyHandler: Skipped by interval: com.sec.android.easyonehand, elapsed: 00:51:40, interval: 04:00:00, 10201[5926]:G2(0x20000) score=23,6(38 5 18683), pids: 5926 / stats: 8 / adjs: 200
03-22 08:55:09.425 5028 10568 I ChimeraPolicyHandler: Skipped by Normal Service condition: com.samsung.android.providers.contacts, 15010062[7334,6035]:G2(0xa0000) score=23,5(29 5 42946), pids: 7334 6035 / stats: 19 19 / adjs: 915 850 reason: ACTIVITY_TIME
03-22 08:55:09.425 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.samsung.android.mcfserver, 1000[12405]:G2(0x20002) score=21,2(36 5 9534), pids: 12405 / stats: 6 / adjs: 100
03-22 08:55:09.426 5028 10568 I ChimeraPolicyHandler: Skipped by interval: com.samsung.android.bixby.agent, elapsed: 00:25:49, interval: 04:00:00, 5018[18287]:G2(0x20002) score=20,4(32 5 15738), pids: 18287 / stats: 10 / adjs: 800
03-22 08:55:09.426 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.samsung.android.smartsuggestions, 10475[20029,19131]:G2(0x20000) score=18,3(22 10 13072), pids: 20029 19131 / stats: 5 5 / adjs: 100 100
03-22 08:55:09.426 5028 10568 I ChimeraPolicyHandler: Skipped by interval: android, elapsed: 00:51:40, interval: 04:00:00, 1000[19042]:G2(0x20002) score=18,3(31 5 5917), pids: 19042 / stats: 10 / adjs: 800
03-22 08:55:09.426 5028 10568 I ChimeraPolicyHandler: Skipped by interval: com.samsung.android.svcagent, elapsed: 00:51:40, interval: 04:00:00, 1000[19085]:G2(0x20002) score=17,8(30 5 5645), pids: 19085 / stats: 10 / adjs: 500
03-22 08:55:09.427 5028 10568 I ChimeraPolicyHandler: Skipped by adj : org.yaxim.androidclient, 10409[13822]:G2(0x20000) score=15,5(4 5 64062), pids: 13822 / stats: 4 / adjs: 50
03-22 08:55:09.430 5028 10568 I ChimeraPolicyHandler: Skipped by Normal Service condition: com.samsung.android.stickercenter, 1000[16950]:G2(0x20002) score=13,8(20 5 9228), pids: 16950 / stats: 15 / adjs: 700 reason: ACTIVITY_TIME
03-22 08:55:09.434 5028 10568 I ChimeraPolicyHandler: Skipped by Normal Service condition: com.android.providers.calendar, 10102[18783]:G2(0x20000) score=13,1(19 5 8293), pids: 18783 / stats: 15 / adjs: 700 reason: ACTIVITY_TIME
03-22 08:55:09.435 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.samsung.android.biometrics.app.setting, 1000[21738]:G2(0x20002) score=11,1(13 5 12861), pids: 21738 / stats: 5 / adjs: 100
03-22 08:55:09.435 5028 10568 I ChimeraPolicyHandler: kill complete: killed 0 apps, freed 0 KB
03-22 08:55:09.435 5028 10568 I ChimeraPolicyHandler: Start doKill, protected policy: HEAVY
03-22 08:55:09.435 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.google.android.googlequicksearchbox, 10230[20349,14885]:G1(0x1) score=55,7(23 40 127100), pids: 20349 14885 / stats: 10 5 / adjs: 800 100
03-22 08:55:09.437 5028 10568 I ChimeraPolicyHandler: Killed on trigger2 : com.samsung.android.oneconnect, freed: 67797, 10255[12960,13390]:G1(0x1) score=33,4(35 10 67797), pids: 12960 13390 / stats: 8 8 / adjs: 200 200
03-22 08:55:09.443 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.android.vending, 10226[25018]:G1(0x1) score=13,0(3 5 51575), pids: 25018 / stats: 12 / adjs: 100
03-22 08:55:09.443 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.android.systemui, 10054[10714]:G2(0x20000) score=76,0(65 10 240771), pids: 10714 / stats: 5 / adjs: -800
03-22 08:55:09.450 5028 10568 I ChimeraPolicyHandler: Killed on trigger2 : com.google.android.ext.services, freed: 27866, 10080[24237,24270]:G2(0x20000) score=48,5(43 40 27866), pids: 24237 24270 / stats: 5 5 / adjs: 100 100
03-22 08:55:09.456 5028 10568 I ChimeraPolicyHandler: Killed on trigger2 : com.google.android.as, freed: 19282, 10284[24194,24200]:G2(0x20000) score=42,9(34 40 19282), pids: 24194 24200 / stats: 5 5 / adjs: 100 100
03-22 08:55:09.457 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.samsung.android.dynamiclock, 10070[21726]:G2(0x20000) score=34,0(15 40 18505), pids: 21726 / stats: 5 / adjs: 0
03-22 08:55:09.457 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.samsung.android.app.telephonyui, 1001[27531]:G2(0x20002) score=31,1(48 5 36007), pids: 27531 / stats: 5 / adjs: 0
03-22 08:55:09.457 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.sec.location.nsflp2, 5013[11278]:G2(0x20002) score=31,1(57 5 10969), pids: 11278 / stats: 5 / adjs: 100
03-22 08:55:09.458 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.samsung.android.knox.containercore, 5250[11455]:G2(0x20002) score=28,6(53 5 6891), pids: 11455 / stats: 5 / adjs: 100
03-22 08:55:09.458 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.samsung.android.server.wifi.mobilewips, 1000[5432]:G2(0x20002) score=28,5(50 5 14599), pids: 5432 / stats: 6 / adjs: 100
03-22 08:55:09.460 5028 10568 I ChimeraPolicyHandler: Skipped by uid : com.samsung.android.beaconmanager, 5006[19846]:G2(0x20002) score=28,2(52 5 7092), pids: 19846 / stats: 8 / adjs: 200
03-22 08:55:09.461 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.sec.epdg, 1000[17442]:G2(0x20002) score=27,9(49 5 13754), pids: 17442 / stats: 6 / adjs: 100
03-22 08:55:09.461 5028 10568 I ChimeraPolicyHandler: Skipped by adj : org.kde.kdeconnect_tp, 10393[14802]:G2(0x8) score=27,8(26 20 22970), pids: 14802 / stats: 4 / adjs: 100
03-22 08:55:09.465 5028 10568 I ChimeraPolicyHandler: Skipped by uid : com.samsung.android.themecenter, 1000[10830]:G2(0x20002) score=27,6(51 5 6306), pids: 10830 / stats: 8 / adjs: 200
03-22 08:55:09.470 5028 10568 I ChimeraPolicyHandler: Killed on trigger2 : org.yaxim.bruno, freed: 34707, 10202[4548]:G2(0x20000) score=26,8(39 5 34707), pids: 4548 / stats: 4 / adjs: 200
03-22 08:55:09.509 5028 10568 I ChimeraPolicyHandler: Killed on trigger2 : com.sec.android.easyonehand, freed: 18683, 10201[5926]:G2(0x20000) score=23,6(38 5 18683), pids: 5926 / stats: 8 / adjs: 200
03-22 08:55:09.599 5028 10568 I ChimeraPolicyHandler: Killed on trigger2 : com.samsung.android.providers.contacts, freed: 42946, 15010062[7334,6035]:G2(0xa0000) score=23,5(29 5 42946), pids: 7334 6035 / stats: 19 19 / adjs: 915 850
03-22 08:55:09.635 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.samsung.android.mcfserver, 1000[12405]:G2(0x20002) score=21,2(36 5 9534), pids: 12405 / stats: 6 / adjs: 100
03-22 08:55:09.675 5028 10568 I ChimeraPolicyHandler: Killed on trigger2 : com.samsung.android.bixby.agent, freed: 15738, 5018[18287]:G2(0x20002) score=20,4(32 5 15738), pids: 18287 / stats: 10 / adjs: 800
03-22 08:55:09.723 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.samsung.android.smartsuggestions, 10475[20029,19131]:G2(0x20000) score=18,3(22 10 13072), pids: 20029 19131 / stats: 5 5 / adjs: 100 100
03-22 08:55:09.724 5028 10568 I ChimeraPolicyHandler: Skipped by wakelock : android, 1000[19042]:G2(0x20002) score=18,3(31 5 5917), pids: 19042 / stats: 10 / adjs: 800
03-22 08:55:09.732 5028 10568 I ChimeraPolicyHandler: Skipped by uid : com.samsung.android.svcagent, 1000[19085]:G2(0x20002) score=17,8(30 5 5645), pids: 19085 / stats: 10 / adjs: 500
03-22 08:55:09.732 5028 10568 I ChimeraPolicyHandler: Skipped by adj : org.yaxim.androidclient, 10409[13822]:G2(0x20000) score=15,5(4 5 64062), pids: 13822 / stats: 4 / adjs: 50
03-22 08:55:09.743 5028 10568 I ChimeraPolicyHandler: Skipped by uid : com.samsung.android.stickercenter, 1000[16950]:G2(0x20002) score=13,8(20 5 9228), pids: 16950 / stats: 15 / adjs: 700
03-22 08:55:09.757 5028 10568 I ChimeraPolicyHandler: Killed on trigger2 : com.android.providers.calendar, freed: 8293, 10102[18783]:G2(0x20000) score=13,1(19 5 8293), pids: 18783 / stats: 15 / adjs: 700
03-22 08:55:09.768 5028 10568 I ChimeraPolicyHandler: Skipped by adj : com.samsung.android.biometrics.app.setting, 1000[21738]:G2(0x20002) score=11,1(13 5 12861), pids: 21738 / stats: 5 / adjs: 100
03-22 08:55:09.768 5028 10568 I ChimeraPolicyHandler: kill complete: killed 8 apps, freed 235312 KB
03-22 08:55:09.768 5028 10568 I ChimeraPolicyHandler: Processing time(ms) 480
```