dont-kill-my-app icon indicating copy to clipboard operation
dont-kill-my-app copied to clipboard

Samsung Android 11: ChimeraPolicyHandler killing foreground services

Open ge0rg opened this issue 3 years ago • 59 comments

After upgrading my Galaxy A51 from Android 10 to Android 11, it has started periodically (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

ge0rg avatar Mar 22 '21 09:03 ge0rg

Hello, I think this supports the theory that in fact at least of the new issues on Samsung after Android 11 could be accounted to memory management issues. So IMHO Samsung did memory leaks in their Android 11 so the memory on your phone periodically runs out and this is a standard Android feature to kill processes to regain memory. We have seen such issues especially on Moto G phones in the past which were notorious for memory leaks. This issue basically does that all services get restarted from time to time on your devcie which causes performance issues and of course apps may not work properly.. this issue is on Samsung to fix IMHO..

petrnalevka avatar Mar 22 '21 09:03 petrnalevka

I've seen the OOM killer in the past, but I'm pretty sure it wasn't advertising itself as "ChimeraPolicyHandler", and I can't find any reference to "ChimeraPolicyHandler" in the AOSP, so I tend to think this is some Samsung magic at work. It also seems to have some whitelist of processes / UIDs ("Skipped by uid"), but maybe that only really whitelists the system process.

ge0rg avatar Mar 22 '21 09:03 ge0rg

In the app I work it is happening the same. I have a Samsung 20 with the latest Android 11 (security patch 01-03-2021).

I have a foreground service and I've already put the app (org.myapp.msg.dev) in Battery optimization ignored list. I don't know what to do anymore.

I would like to know how "ChimeraPolicyHandler" selects the app to be killed. Samsung should be more transparent in this aspect.

04-06 13:31:10.486 12542 12601 I CameraPerformance: Device - StartPreviewRequest : End[1617726670486]
04-06 13:31:10.486 12542 12542 I Camera11: onStartPreviewCompleted
04-06 13:31:10.486 12542 12542 I VerificationLog: Executed
04-06 13:31:10.486 12542 12542 I CameraPerformance: Launch - LazyLoading : Start[1617726670486]
04-06 13:31:10.486   722 12691 I [email protected]: [CAMKPI] camera3->process_capture_result : X
04-06 13:31:10.486 12542 12542 I CameraPerformance: ShootingMode - onActivate(Photo) : Start[1617726670486]
04-06 13:31:10.486  1142  3027 D FreecessController: Receive signal-module info(callerPid:0,uid:10302) from freecessmonitor
04-06 13:31:10.487 12542 12542 I ZoomPresenter: refreshProperty zoomCategory: NOT_SUPPORT, supportUiSet: [], zoomPositionType:NORMAL, buttonList: [], defaultButtonValue: -1
04-06 13:31:10.487 12542 12542 I KeyScreenLayerPresenter: onShowViewRequested mBitMarker ffffffff mBitMarkerForViewVisibility ffffffff
04-06 13:31:10.488 12542 12542 I RequestQueue: addRequest : APPLY_SETTINGS, com.sec.android.app.camera.engine.-$$Lambda$CommonEngine$BFOhyHc3pFR3i5NQnW-Mb3hrQv4@7c3a324
04-06 13:31:10.488 12542 12542 I RequestQueue: addRequest : SET_PRIVATE_SETTING, enable_intelligent_guide : true
04-06 13:31:10.488 12542 12602 I RequestQueue: beforeExecute : APPLY_SETTINGS(5601)
04-06 13:31:10.488 12542 12602 I RequestQueue: [5601] [5600 ]
04-06 13:31:10.488 12542 12602 I Request : ApplySettingsRequest - Start
04-06 13:31:10.488 12542 12602 W Request : ApplySettingsRequest : Returned, no need to set maker public settings
04-06 13:31:10.488 12542 12602 I Request : ApplySettingsRequest - End
04-06 13:31:10.488 12542 12602 I RequestQueue: afterExecute : APPLY_SETTINGS(5601)
04-06 13:31:10.488 12542 12602 I RequestQueue: [  ] [5600 ]
04-06 13:31:10.488 12542 12602 I RequestQueue: beforeExecute : SET_PRIVATE_SETTING(5600)
04-06 13:31:10.488 12542 12542 I RequestQueue: addRequest : APPLY_SETTINGS, com.sec.android.app.camera.engine.-$$Lambda$CommonEngine$BKOYlYOg5vRBvBdEi-lMokuUNwg@329cd90
04-06 13:31:10.488 12542 12602 I RequestQueue: [5600] []
04-06 13:31:10.488 12542 12542 I RequestQueue: addRequest : SET_PRIVATE_SETTING, enable_sw_face_detection : true
04-06 13:31:10.488 12542 12602 I Request : SetPrivateSettingRequest - Start
04-06 13:31:10.488 12542 12542 I BroadcastUtil: notifyCameraInfo : Start
04-06 13:31:10.488 12542 12602 I Request : execute key = MakerPrivateKey(enable_intelligent_guide) value = true
04-06 13:31:10.488 12542 12602 I V1/IntelligentGuideNode: initialize - activate true, asyncInit false
04-06 13:31:10.489 12542 12542 I BroadcastUtil: notifyCameraInfo : End
04-06 13:31:10.489 12542 12542 W Camera11: There is no registered HRM Shutter listener. return.
04-06 13:31:10.489 12542 12542 I LayerManagerView: setKeyScreenLayerVisibility: true
04-06 13:31:10.489  2115 12794 D SystemUIService: summary.java-heap : 25760
04-06 13:31:10.489  2115 12794 D SystemUIService: summary.native-heap : 42764
04-06 13:31:10.489  2115 12794 D SystemUIService: summary.code : 24444
04-06 13:31:10.489  2115 12794 D SystemUIService: summary.stack : 916
04-06 13:31:10.489  2115 12794 D SystemUIService: summary.graphics : 0
04-06 13:31:10.489  2115 12794 D SystemUIService: summary.private-other : 16616
04-06 13:31:10.489  2115 12794 D SystemUIService: summary.system : 98918
04-06 13:31:10.489  2115 12794 D SystemUIService: summary.total-pss : 209418
04-06 13:31:10.489  1142  3027 D FreecessController: UFZ : org.mozilla.focus(8333)
04-06 13:31:10.489  2115 12794 D SystemUIService: summary.total-swap : 109656
04-06 13:31:10.489  2115 12794 D SystemUIService:  - View count -
04-06 13:31:10.489   698   698 D gralloc : [mali_gralloc_allocate] begin
04-06 13:31:10.489   698   698 D gralloc : buffer_descriptor: wh(2400 1080) usage_pc(0x20006 0x20006) hal_format(0x23) layer_count(1) sizes(0 0 0) strde(0) byte_stride(0) alloc_wh(0 0) internal_format(0x0) alloc_format(0x0) fd_count(1) plane_count(0)
04-06 13:31:10.489 12542 12542 I ZoomPresenter: refreshProperty zoomCategory: FOV, supportUiSet: [BUTTON], zoomPositionType:NORMAL, buttonList: [Pair{FRONT_CAMERA_ANGLE_FULL 0}, Pair{FRONT_CAMERA_ANGLE_CROP 1}], defaultButtonValue: 1
04-06 13:31:10.489  1142  3027 D FreecessController: UFZ : org.mozilla.focus(0), reason: Signal
04-06 13:31:10.490  7154  7186 W BtGatt.GattService: unfreezeScan() - No AppScanStats found with uid: 10302
04-06 13:31:10.490   678   791 E TrafficController: FREECESS
04-06 13:31:10.491   698   698 D gralloc : [mali_gralloc_allocate] allocation successful
04-06 13:31:10.492  3813  3813 I F0      : limitGPUFreq:: freq = -1
04-06 13:31:10.492  3813  3813 I F0      : limitCPUFreq:: freq = -1
04-06 13:31:10.492  1142  2818 D FreecessController: apply [LRs:false] to uid[10302]
04-06 13:31:10.492  1142  2818 W LocationManagerService: onFreezeStateChanged, uid[10302]=false
04-06 13:31:10.493  1142  2818 V AlarmManager: unblockMARsRestrictedAlarmsForUidPackage: uid = 10302, packageName = null
04-06 13:31:10.493  1142  2818 D FreecessController: send pending alarm to packageName:null, uid:10302
04-06 13:31:10.493  1142  2818 I PowerManagerService: [PWL] SetWakeLockEnableDisable uid = 10302 , disable= false
04-06 13:31:10.493  1142  2818 I PowerManagerService: [PWL] can not change uid =  10302
04-06 13:31:10.493 12542 12607 I BeautyPhotoMaker: sendDynamicShotInfoCallback - TimeStamp(59740050055731) dynamicShotInfo(processingMode = 0x200000, dsCondition = 0xCE, dsMode = SINGLE, dsExtraInfo = 0x200000, dsDeviceInfo = 0x7A10303) camDevice: CamDeviceImpl(acecf83) - id(3)
04-06 13:31:10.493 12542 12607 I BeautyPhotoMaker: sendDynamicShotCaptureDurationCallback - TimeStamp(59740050055731) dynamicShotCaptureDuration(0) camDevice: CamDeviceImpl(acecf83) - id(3)
04-06 13:31:10.494 12542 12607 I BeautyPhotoMaker: sendLightConditionCallback - TimeStamp(59740050055731) LightCondition(0x21) camDevice: CamDeviceImpl(acecf83) - id(3)
04-06 13:31:10.494 12542 12601 I CallbackManager: onLightConditionChanged : lightCondition=LLS_FLASH(33)
04-06 13:31:10.494 12542 12601 I BurstCaptureController: onBurstShotFpsChanged : burstShotFps=20
04-06 13:31:10.494 12542 12607 I BeautyPhotoMaker: sendBurstShotFpsCallback - TimeStamp(59740050055731) BurstShotFps(20) camDevice: CamDeviceImpl(acecf83) - id(3)
04-06 13:31:10.496   710  1689 I Sensors : Light_IR_Sensor irdata=7 r=245, g=132, b=63, c=12, ir_atime/ir_brightness=120, ir_again=0, time=59740302660349
04-06 13:31:10.501 12542 12542 I RequestQueue: addRequest : SET_PRIVATE_SETTING, enable_motion_photo_ppp : false
04-06 13:31:10.501 12542 12542 I RequestQueue: addRequest : SET_PRIVATE_SETTING, enable_face_shape_correction : false
04-06 13:31:10.503 12542 12542 I CameraPerformance: ShootingMode - onActivate(Photo) : End[1617726670503] [17]
04-06 13:31:10.504  2115 12794 D SystemUIService: View=2046
04-06 13:31:10.504 12542 12542 I CameraOrientationEvtMgr: orientation listener enabled 0
04-06 13:31:10.504  1142  4184 D SemContextService: lock : registerCallback
04-06 13:31:10.505  1142  4184 D SemContextService: EventInfo.sendEvent() : service = Auto Rotation, listener = com.samsung.android.hardware.context.SemContextService$Listener@cea3c76
04-06 13:31:10.505  1142  4184 W Binder  : Outgoing transactions from this process must be FLAG_ONEWAY
04-06 13:31:10.505  1142  4184 W Binder  : java.lang.Throwable
04-06 13:31:10.505  1142  4184 W Binder  : 	at android.os.BinderProxy.transact(BinderProxy.java:514)
04-06 13:31:10.505  1142  4184 W Binder  : 	at com.samsung.android.hardware.context.ISemContextCallback$Stub$Proxy.getListenerInfo(ISemContextCallback.java:162)
04-06 13:31:10.505  1142  4184 W Binder  : 	at com.samsung.android.hardware.context.SemContextService$ListenerManager.notifyListeners(SemContextService.java:1332)
04-06 13:31:10.505  1142  4184 W Binder  : 	at com.samsung.android.hardware.context.SemContextService.registerCallback(SemContextService.java:259)
04-06 13:31:10.505  1142  4184 W Binder  : 	at com.samsung.android.hardware.context.ISemContextService$Stub.onTransact(ISemContextService.java:156)
04-06 13:31:10.505  1142  4184 W Binder  : 	at android.os.Binder.execTransactInternal(Binder.java:1190)
04-06 13:31:10.505  1142  4184 W Binder  : 	at android.os.Binder.execTransact(Binder.java:1159)
04-06 13:31:10.505  1142  4184 D SemContextService: 	.registerCallback : 7, client=com.sec.android.app.camera.provider.CameraOrientationEventManager@e5f75d
04-06 13:31:10.505  1142  4184 D SemContextConnectionList: client packageName : com.sec.android.app.camera.provider.CameraOrientationEventManager@e5f75d
04-06 13:31:10.505  1142  4184 D SemContextService: unlock : registerCallback
04-06 13:31:10.505 12542 12542 I CameraExecutorManager: initialize
04-06 13:31:10.506 12542 12681 I FaceLandmarkSolution: FL Engine version : ArcSoft_FaceLandmark_2.0.125231001.371_#21049-5-B18695
04-06 13:31:10.506 12542 12681 I FaceLandmarkSolution: FL Wrapper version : 2.0.30
04-06 13:31:10.507 12542 12542 I Camera11: loadHeavyResources : Start[1617726670507]
04-06 13:31:10.507 12542 12797 I CameraExecutorManager: onShootingModeChanged : 0, 0, false
04-06 13:31:10.508 12542 12542 I Camera11: loadHeavyResources : End[1617726670508] [1]
04-06 13:31:10.508 12542 12542 I CameraPerformance: Launch - LazyLoading : End[1617726670508] [22]
04-06 13:31:10.508 12542 12542 I RequestQueue: addRequest : APPLY_SETTINGS, com.sec.android.app.camera.engine.-$$Lambda$CommonEngine$BFOhyHc3pFR3i5NQnW-Mb3hrQv4@3c950ff
04-06 13:31:10.508 12542 12542 I RequestQueue: addRequest : SET_PRIVATE_SETTING, enable_intelligent_guide : true
04-06 13:31:10.511   698   698 D gralloc : [mali_gralloc_allocate] begin
04-06 13:31:10.511   698   698 D gralloc : buffer_descriptor: wh(2400 1080) usage_pc(0x20006 0x20006) hal_format(0x23) layer_count(1) sizes(0 0 0) strde(0) byte_stride(0) alloc_wh(0 0) internal_format(0x0) alloc_format(0x0) fd_count(1) plane_count(0)
04-06 13:31:10.512   722 12790 I ExynosCameraMetadataConverterVendor: [CAM(1)][]-(translateVendorControlMetaData[4046]):[R3 F4] dynamicShotExtraInfo (0 -> 2)
04-06 13:31:10.514   698   698 D gralloc : [mali_gralloc_allocate] allocation successful
04-06 13:31:10.515   722 12755 I EDEN    : [Exynos][EDEN][v1.6.7-2][RT::EdenRuntime] ExecuteReq:345: (+) modelId=72200009, mode=0
04-06 13:31:10.519  1142 12800 D TspStateManager: update cmd=set_grip_data,1,60,10,52,162
04-06 13:31:10.522   722 12788 I EDEN    : [Exynos][EDEN][v1.6.7-2][EDEN_RT_STUB] ExecuteReq:691: (+)
04-06 13:31:10.523   766 11788 I EDEN    : [Exynos][EDEN][v1.6.7-2][RT::EdenRuntime] ExecuteReq:345: (+) modelId=76600005, mode=2
04-06 13:31:10.524   679   679 I Zygote  : Process 12013 exited due to signal 9 (Killed)
04-06 13:31:10.526  1142  2170 D StorageManagerService: getExternalStorageMountMode: uid=1000 packageName=com.samsung.android.provider.filterprovider
04-06 13:31:10.526  1142  2170 D CompatibilityChangeReporter: Compat change id reported: 135634846; UID 1000; state: DISABLED
04-06 13:31:10.527  1142  4177 I ActivityManager: Process com.samsung.android.app.routines (pid 12013) has died: cch+35 CEM (140,1876)
04-06 13:31:10.528  1142  2170 W ActivityManager: wait for provider publish: waiters=1 callerApp=ProcessRecord{6c14494 12542:com.sec.android.app.camera/u0a111} cpr=ContentProviderRecord{95a775a u0 com.samsung.android.provider.filterprovider/.FilterProvider}
04-06 13:31:10.531  1142  4184 D SensorService: Calling batch handle==2 flags=0 rate=20000000 timeout== 0
04-06 13:31:10.534  2907  2907 E HostManager: onTrimMemory [15]
04-06 13:31:10.535  3201  3201 I SAFrameworkService: onTrimMemory(15): clearing caches...
04-06 13:31:10.535 20501 20501 I [-3]oneconnect[1.7.64.21_01][CORE]: [SCMain][QCApp].onTrimMemory - ************** lvl=15 elapsed=0ms
04-06 13:31:10.535  3201  3201 W SaBufferPool: ClearCache : Current cache size is lesser than the threshold of 0
04-06 13:31:10.536  3690  3690 W DMASA[U]: [AppLogData]onTrimMemory(15):1617726670536
04-06 13:31:10.537  3690  3690 W DMASA[C]: [DiagMonAgentApplication]onTrimMemory (15)
04-06 13:31:10.537  2115  2115 D SystemUIService: onTrimMemory = 15
04-06 13:31:10.537  2115  2115 D StatusBar: onTrimMemory = 15
04-06 13:31:10.537  2115  2115 D SystemUIService: onTrimMemory : 15
04-06 13:31:10.537  2115  2115 D SystemUIService: Starting getMemoryInfo in MemoryInfoReporter thread.
04-06 13:31:10.540 20490 20490 I [-3]oneconnect[1.7.64.21_01][RECEIVER]: [SCMain][QCApp].onTrimMemory - ************** lvl=15 elapsed=0ms
04-06 13:31:10.540 12542 12542 E SeslRecyclerView: No adapter attached; skipping layout
04-06 13:31:10.540  2802  2802 W DeviceManager_FLP: onTrimMemory : 15
04-06 13:31:10.540  2802  2802 I GpsSessionManager_FLP: arrangeInvalidSessions
04-06 13:31:10.541   466   466 I lmkd    : 5(delay),0(swap), 0(freelimit) memory pressure events were skipped after a kill!
04-06 13:31:10.541 12542 12542 W Camera11: onTrimMemory : 15
04-06 13:31:10.542  2115 12805 D SystemUIService:  - Memory Information -
04-06 13:31:10.547  7610  7610 I AppBase : AppBase.onTrimMemory():781 onTrimMemory(): 15
04-06 13:31:10.549 20936 20936 I [-3]oneconnect[1.7.64.21_01][MDE]: [SCMain][QCApp].onTrimMemory - ************** lvl=15 elapsed=0ms
04-06 13:31:10.550 12542 12597 I SemDvfsHyPerManager: acquire hyper - com.sec.android.app.camera/12542@0, type = 18
04-06 13:31:10.551   718   718 I HYPER-HAL: [ResourceManager.cpp]getResourceManager(): Resouce not supported on this device - resourceID : 0x12
04-06 13:31:10.551   718   718 E HYPER-HAL: [HyPerManager.cpp]getSupportedFrequency(): mRscManager is NULL
04-06 13:31:10.552   718   718 E HYPER-HAL: [HyPer.cpp]getSupportedFrequency(): AIDL getTable is NULL
04-06 13:31:10.552   466   466 I lmkd    : cached 2, sandbox(not0) 0
04-06 13:31:10.554 12542 12597 I CallStateManager: onCallStateChanged : 0
04-06 13:31:10.558   710   710 I Sensors : batch(2) - gyro_sensor try to batching with 20000000
04-06 13:31:10.560   466   466 I lmkd    : Reclaim 'com.samsung.android.biometrics.app.setting' (11292), uid 1000, oom_adj 925, state 19 to free 175588kB; reason: low watermark is breached and swap is low (407196kB < 262140kB)
04-06 13:31:10.564 12229 12328 I ReactNativeJNI: Memory warning (pressure level: TRIM_MEMORY_RUNNING_CRITICAL) received by JS VM, running a GC
04-06 13:31:10.567   679   679 D Zygote  : Forked child process 12808
04-06 13:31:10.569  1142  1986 I ChimeraPolicyHandler: Skipped by uid     : com.samsung.android.themecenter, 1000[2247]:G2(0x20002) score=37,0(91 10 7008), pids: 2247 / stats: 8 / adjs: 200 
04-06 13:31:10.569  1142  1986 I ChimeraPolicyHandler: Skipped by adj     : com.sec.location.nsflp2, 5013[2802]:G2(0x20002) score=35,5(83 10 14594), pids: 2802 / stats: 5 / adjs: 100 
04-06 13:31:10.569  1142  1986 I ChimeraPolicyHandler: Skipped by adj     : com.android.keychain, 15001000[8704]:G2(0x20002) score=34,3(79 10 15172), pids: 8704 / stats: 6 / adjs: 100 
04-06 13:31:10.569  1142  1986 I ChimeraPolicyHandler: Skipped by adj     : com.samsung.android.honeyboard, 10165[5825]:G2(0x20000) score=34,1(55 10 66817), pids: 5825 / stats: 7 / adjs: 100 
04-06 13:31:10.574   718 12596 I HYPER-HAL: [RequestManager.cpp]releaseLocked(): Released ID : 1609321
04-06 13:31:10.586  1142  1238 W ActivityManager: Slow operation: 61ms so far, now at startProcess: returned from zygote!
04-06 13:31:10.587  1142  1238 W ActivityManager: Slow operation: 62ms so far, now at startProcess: done updating battery stats
04-06 13:31:10.587  1142  1238 W ActivityManager: Slow operation: 62ms so far, now at startProcess: building log message
04-06 13:31:10.587  1142  1238 I ActivityManager: Start proc 12808:com.samsung.android.provider.filterprovider/1000 for content provider {com.samsung.android.provider.filterprovider/com.samsung.android.provider.filterprovider.FilterProvider}
04-06 13:31:10.587  1142  1238 W ActivityManager: Slow operation: 62ms so far, now at startProcess: starting to update pids map
04-06 13:31:10.588  1142  1238 W ActivityManager: Slow operation: 62ms so far, now at startProcess: done updating pids map
04-06 13:31:10.588  1142  1986 I ChimeraPolicyHandler: Killed on trigger0 : org.myapp.msg.dev, freed: 154998, 10208[10593]:G2(0x20000) score=34,0(15 10 154998), pids: 10593 / stats: 4 / adjs: 200 
04-06 13:31:10.589  1142  1986 I ChimeraPolicyHandler: kill complete: killed 4 apps, freed 255323 KB
04-06 13:31:10.589  1142  1986 I ChimeraPolicyHandler: Processing time(ms) 200

aberenguel avatar Apr 06 '21 20:04 aberenguel

Hello, big thanks for the growing evidence on this issue.. Did you see https://issuetracker.google.com/issues/179644471 ? Does maybe disabling battery optimization on the device prevent the ChimeraPolicyHandler from killing the foreground service? Big thanks for all your feedback!

petrnalevka avatar Apr 08 '21 14:04 petrnalevka

I am not an expert, but from my experience, disabling battery optimization does't stop apps from being killed. Radomly, I get crash report. And would you mind modifying the content of samsung on DKMA website? Because it does't do the trick at all. In fact, maybe there is no way to maintain apps running in the background.

JhonHuGit avatar Apr 14 '21 03:04 JhonHuGit

@JhonHuGit Many thanks... unfortunately we are not yet sure if this is a bug on some Samsung devices (API level 30) or if this is really intended behavior by Samsung... At least on our support requests from Samsung users in wast majority of cases on API 30 the DKMA link resolves the issues. But we are updating the https://dontkillmyapp.com/samsung page with more details on this and with a link to this thread..Many thanks..

petrnalevka avatar Apr 30 '21 08:04 petrnalevka

Two days ago, Samsung rolled out a new update, patch level "April 1st" , One UI 3.1. Since then, my apps weren't killed a single time. To me, this looks like it was a genuine bug and that it's fixed now. Thanks to Samsung for listening to users and developers!

ge0rg avatar May 12 '21 15:05 ge0rg

@ge0rg big thanks for the update, that would be a great news.. can others also confirm? Big thanks..

petrnalevka avatar May 16 '21 23:05 petrnalevka

In my Galaxy S21, since february second update, this problem was solved, but in latest may update is this problem returned. Foreground services are killed. My own application and also another applications. This not kill application, but restarts foreground service (parameter intent in service onStartCommand() method is null). Notification for foreground service is removed and application must again generate it. Similar problem is in application GSam Battery monitor.

henrichg avatar May 18 '21 14:05 henrichg

@henrichg big thanks for the valuable update. In some of my own apps when the service is critical to keep it I use an AlarmManager-based restarting of the foreground service. Nevertheless this can happen on stock Android even without ChimeraPolicyHandler.. actually when running critically low on memory Android will kill the foreground service and restart later on if STICKY with a null intent. Did you check in the logcat if this is still caused by Chimera? As I guess a memory leak is not an uncommon thing on Samsung devices unfortunately and it would cause similar observations.. Big thanks..

petrnalevka avatar May 19 '21 08:05 petrnalevka

Hm, I do not know, if it is caused by Chimera. Maybe yes. I must log it. I'm using applications in mobile since buy it. Facebook, Twitter, Reddit, Chrome, GitHub, XDA Developers, Instagram, Google Play, Galaxy Store, F-Droid, GSam Battery monitor, Autentificator, Google Pay, .... Not any new application is added to mobile. Also in my PhoneProfilesPlus application was not any news. Memory usage in mobile is (by me) good: 5GB from 7.5GB. Average usage 66%. For PhoneProfilesPlus it is 90-130MB. And yes, I know. If system restarts service, intent parameter is null. It is in API documentation. But by me, it is not due to low memery. Service is STICKY, is started with startForegroundService() followed by startForeground().

henrichg avatar May 19 '21 10:05 henrichg

Hm interesting. Problem was going away. After change of Samsung battery optimizations settings:

  • enabled: Device care / Battery / 3-dot menu / Auto optimize daily
  • enabled: Device care / Battery/ Background usage limits / Put unused apps to sleep -- Device care / Battery/ Background usage limits / Sleeping apps: Mi Home -- Device care / Battery/ Background usage limits / Deep sleeping apps: 0 -- Device care / Battery/ Background usage limits / Never sleeping apps: 0
  • enabled: Device care / Battery/ More battery settings / Adaptive battery

But "Optimize battery usage" for PPP is set to "Not optimized".

Interesting. :-)

henrichg avatar May 21 '21 10:05 henrichg

Hello @henrichg .. big thanks for the update.. which of the settings do you think has effect on the foreground services? Do I understand correctly that you enabled some of the background usage limits?

petrnalevka avatar May 21 '21 12:05 petrnalevka

I was all settings disabled (look my previous post). And foreground service was restarted. After enabled all (except "Optimize battery usage", it stays set to "Not optimize") yesterday, not any restart of service occurs.

henrichg avatar May 21 '21 12:05 henrichg

Very strange :).. big thanks for the update..

petrnalevka avatar May 21 '21 12:05 petrnalevka

I can confirm it does the same on the note 10 and the galaxy a01

LuisGuzmanTech avatar Jun 19 '21 21:06 LuisGuzmanTech

The same for me, the foreground service for my looping music player is killed after some time when the phone goes off.

XomaDev avatar Jul 26 '21 15:07 XomaDev

@XomaDev incredible.. many thanks for the update.. we still hope this is bug rather than a feature..

petrnalevka avatar Aug 01 '21 12:08 petrnalevka

Greetings,

I have the same issue on my good old Galaxy S5 running Lineage 18.1 (Android 11). The problems of Sleep as Android being killed while running in foreground started after the upgrade from Lineage 17.1.

I've noticed two things:

  1. The problem goes away in airplane mode (or turning off wifi and mobile data)
  2. The Goole Play Store now is radically killing all kinds of apps while searching for updates (not only the ones actually being updated).

So, just a guess that those two could be related. Prevent the Play Store from doing its thing by killing all data connections.

Regards, Zy.

Zytrel avatar Aug 20 '21 08:08 Zytrel

Hello folks, I have been contacted by Android Team recently and they are asking for developers willing to contribute tests as part of their CTS (Compatibility Test Suite)...

I have reimplemented the DontKillMyApp Benchmark as part of Android's CTS Verifier tool which is now in review as a pull request under https://android-review.googlesource.com/c/platform/cts/+/1799749

I would like to ask you, are there any devs who would be willing to help and contribute their tests to the CTS Verifier so that we can help Google put further pressure on misbehaving OEMs?

Big thanks. Regards, Petr

petrnalevka avatar Aug 20 '21 11:08 petrnalevka

Hi. I can confirm that the issue with Android 10/11 killing foreground processes is still happening and not exclusive to Samsung devices. I noticed the issue with an autoclicker app I've used for months. Then, maybe since july, it started closing misteriously after about 1 hour of un-attended use (screen on and device active). It happens on both my android devices: a Samsung S20+ (SM-986B) with Android 11 and a Huawei Media Pad M6 (SCM-W09) with Android 10.

I did assume that it was related to some new Android battery conserving intrusive policy but until yesterday I didn't get serious about trying to fix it.

I decided to unlock my S20+ in order to try some custom ROMs and see if the problem persisted. It does.

Then I found @petrnalevka about Android killing apps on samsung devices (https://dontkillmyapp.com/samsung, very informative, thank you). I did follow all advise there on both devices, but the issue still occurs.

I have focused on just the one device for now, so I can do proper tests.

The thing I'm inclined to think now is that the issue is related to excesive App power consumption since I've noticed that if I load a script with, let's say, 1 click every 10ms, the app is closed so much sooner (maybe after 5 minutes) that if I test with 1 click every 100ms (maybe it gets closed after 1 hour).

I would like to investigate the android logs now to check who is doing the killing. I have to research that since I've never done it before, but I will update results here when I do.

Thanks all for the information and I hope we can get to the bottom of it and force Google or whomever to fix it.

jurrabi avatar Sep 09 '21 08:09 jurrabi

@jurrabi many thanks for your investigation. I'm little skeptical that there would be a common mechanism across Android 11 and 10 and Samsung and Huawei. IMHO I do not think this is something in AOSP and I'm not seeing this behavior on my Pixel phones. IMHO it is more likely that those are two independent mechanisms as both vendors are problematic / or it may also be a memory management issue - memory leak as Android standard policy is to kill even foreground services if critically low on memory. But if you can investigate the logcat it would be great if you would share some hints on what is happening.. many thanks..

petrnalevka avatar Sep 09 '21 08:09 petrnalevka

Thanks foryour response. I'll share the logs. But first I'm gonna check if a can find a stable AOSP for my S20+ and try to reproduce the issue. I'm guessing if it does it would probably mean as you said an issue with memory management on the app itself...

jurrabi avatar Sep 09 '21 15:09 jurrabi

I am seeing this exact issue on all the Samsung A11 devices at my organization. They're on Android 11 with Aug 1,2021 Android security patch installed.

They have 2GB RAM and it happens quicker if I open other apps after starting the foreground service as compared to not doing anything after starting the foreground service so this makes me think it's a memory related issue which others have already pointed out.

Should we re-open this issue since it's marked as Closed?

Let me know if anyone has got any updates from Samsung?

guptapurv avatar Oct 25 '21 16:10 guptapurv

Many thanks for sharing this, I'm reopening the issue

petrnalevka avatar Oct 26 '21 08:10 petrnalevka

Hello @petrnalevka, first of all thanks for your input in the https://dontkillmyapp.com/samsung, really good website that shows the configurations that are needed to not have android kill my app.

But my client has Samsung A20 devices and ever since he got Android 11 update, 1 may patch, he keeps telling me the app restarts or crashes.

I've implementented a service that registers the logcat of the android, but without any luck, there's no crashes being registered, simply put the log ends, and the app restarts without any crash, at least from the app, idk if there's any system crash, but even if there was, it should show a popup saying the app is crashing, but it's not showing anything.

The app closes and when he launches the app again, it has been restarted...

My problem right now, is that I cannot reproduce this, I have a A20 device, same app version, same 1 may security patch.

PedroMC4B avatar Nov 26 '21 15:11 PedroMC4B

Does anyone have input on Android 12 on Samsung S21? The users of my app (read aloud with TTS, often with screen off) report similar issues, while it somehow worked well on Android 11, after applying the settings from dontkillmyapp.com site... Please share, thank you!

gregko avatar Nov 30 '21 13:11 gregko

Hello @petrnalevka, first of all thanks for your input in the https://dontkillmyapp.com/samsung, really good website that shows the configurations that are needed to not have android kill my app.

But my client has Samsung A20 devices and ever since he got Android 11 update, 1 may patch, he keeps telling me the app restarts or crashes.

I've implementented a service that registers the logcat of the android, but without any luck, there's no crashes being registered, simply put the log ends, and the app restarts without any crash, at least from the app, idk if there's any system crash, but even if there was, it should show a popup saying the app is crashing, but it's not showing anything.

The app closes and when he launches the app again, it has been restarted...

My problem right now, is that I cannot reproduce this, I have a A20 device, same app version, same 1 may security patch.

Do you know how much is the total RAM is on the client's device and how much is the RAM available for the apps to run? This is a memory issue so you need to hit that limit in order to reproduce the issue.

guptapurv avatar Dec 01 '21 04:12 guptapurv

Do you know how much is the total RAM is on the client's device and how much is the RAM available for the apps to run? This is a memory issue so you need to hit that limit in order to reproduce the issue.

Well, it has 3gb total ram, and well I can supply a bit of log that I have on these devices and this issue occurs

11-19 06:42:16.774 I/shuttle.releas(15023): Background young concurrent copying GC freed 156003(7607KB) AllocSpace objects, 14(472KB) LOS objects, 57% free, 6358KB/14MB, paused 379us total 120.578ms
...
11-19 06:44:14.067 I/System.out(15023): Thread-50 calls detatch()
11-19 06:44:14.067 V/beware.WSSendCoordinates(15023): RESPONSE: Done!
11-19 06:44:14.067 V/beware.WSSendCoordinates(15023): 1 coordinates sent to server.
11-19 06:44:14.070 I/beware.WSSendCoordinates(15023): send Coordinates
--------- beginning of main
11-19 06:52:17.616 E/Terminal(25096): 2021-11-19 06:52:17 # Battery Level = 98%
11-19 06:52:17.616 E/Logger  (25096): Last GC: 1637300374659
11-19 06:52:17.616 E/Logger  (25096): Time between last GC: 762957
11-19 06:52:17.616 E/Logger  (25096): Time between GC: 120000
11-19 06:52:17.616 E/Memory  (25096): Max JVM memory = 524288 KB # Current JVM memory = 3697 KB # Free JVM memory = 1533 KB # JVM memory being used = 2164 KB # Available JVM memory = 522124 KB
11-19 06:52:17.647 I/shuttle.releas(25096): Explicit concurrent copying GC freed 2544(184KB) AllocSpace objects, 2(40KB) LOS objects, 24% free, 1939KB/2586KB, paused 145us total 30.530ms

Basically I have a logger that prints into a file the logcat of the device, and when the app is in background, it sends coordinates of the device to the server if the user has moved alot from his last position, etc...

But this happens alot when the client devices do this I/System.out(15023): Thread-50 calls detatch() what's this ? This log is not supplied from my App...

And well, last week he told me that the app suddenly closed without having any crash log, or any crash event. It simply just closed while in foreground.

PedroMC4B avatar Dec 02 '21 08:12 PedroMC4B

I think most of us are well past placing the wake locks and the apps still get stopped or killed on many phones. The phone makers don't respect wake locks, they just want to brag in their ads about the "great battery life" their devices have. On Samsung Android 11 and UI 3.1, the settings described at dontkillmyapp.com work. Android 12 on Samsung devices is still not documented, for many devices its still not available either.

gregko avatar Dec 21 '21 22:12 gregko