[Q] Framework doesn't gracefully handle foreground application that uses too much CPU - Android Q&A, Help & Troubleshooting

Hello,
There is a known behaviour about when device is low on memory (OOM is activated and last used activities are killed and resources are freed)
But I didn't find any info about how Android will handle foregrounded applications, which overloading the system. I mean starting a stress app overloads the system so much (CPU: 130%, loadavg 30, 25, 20) and there is no CPU time slot for system activities (system_server threads and so on). After a couple of minutes it starts to timeouts in FinalizerWatchdogDaemon and many other places.
Any ideas and info about this situation is appreciated.
Thanks,
B.

Related

[ASK] How to reduce Application Memory Footprint?

Hi all,
I am a newbie @ Android application development, and still trying to learn. I have one question. If we take for example, the Greenify app, if i look into its memory consumption, the value is quite low (3.4MB +-) whereas, with my app, it always hover around 20MB or so. I wonder, how can i achieve the same result? Anybody can help? My application is a simple monitoring app for my client company, contains 2 services, 3 Activities (1 service and Activity for saving the account into the device). And even in fresh state, the memory always takes around 20MB.
Thanks for any info

Detailed Info or even Education about LMK and Virtual Memory

Hi fellas.
Long story short: I seek detailed information about how LMK and especially Virtual Memory works so I can educate myself for teletubbic purposes.
Details:
I'm my old, 1gb Samsung Galaxy S3 device I suffer quite a lot because of poor ram management. Slow insufficient memory for even 1 app ooorr app transitions(multitasking), laggy apps, out of memory reboots drains my will to live.
So time to time I searched internet (especially most of the XDA forums) to find a solution for this, for months(again, time to time). In this process I learned a LOT but unfortunately its not enough since I still haven't found what some virtual memory values and related build prop entries does. Some people made guides but it's not specific and explanatory enough, unfortunately. Just some basic info from surface.
There are a lot of apps and roms that claims to provide better ram management through different ways but as you might guess, none of them completely solved my problems.
Don't get me wrong. I know that at the and, it all comes down to my 1gb device. But through my whole Android experience, I know what this device is capable of. So.. Yeah.
I want specific amounts of apps to stay in memory.
I want my system to kill apps without a second thought in out if memory situations. Fast as if I use "force stop" button in Apps/Settings. (this is important, huh)
I want to set priority to apps about using memory according to app's needs and my use frequency.
To do all of that, instead of crying in forums, I want to educate myself about ram management and do my thing by myself by optimizing system to the end.
Any help, guides, links, courses, piece of info appreciated.
Thanks in advance

Development: Avoid Samsung Device Care Wakeup alarms

Hello,
We have an Android SDK that many applications use for marketing purposes. Specifically, it allows to deliver personalized messages to their users based on geofences or bluetooth beacons detection.
We've dedicated tons of hours optimizing the thing so it does not drain user battery or annoys in any matter, however we are now facing a new challenge: Samsung Device Care (Samsung Maintenance).
As you may know, this application comes pre installed in (I think) all Samsung devices, and helps users to keep the battery consumption low by detecting apps that consume too much in the background among other features.
Our software behaves correctly in almost all categories, including battery consumption and background time execution, however the Samsung device care app sometimes shows an alert saying that the "application generates too many wake ups". In order to avoid this, we are being more aggressive by explicitly controlling the number wake ups when app is in the background, the only problem is that we are completely blind right now, as we don't know what is the threshold that Samsung Device care app uses to trigger this alarm.
I have decompiled the Samsung device care app, however the app seems to be written in C / C++, hampering the task.
I have also run tests for days in a couple of Samsung phones in order to see if I can trigger the alarm, so I can try to empirically found what the limits are, however I haven't been able to trigger any alarm, even though my testing code is requesting an AlarmManager callback every 30 seconds.
Finally, I have also opened a ticket in the Samsung Developer site, but no answer so far...
Do you have any idea where can I find this information? :crying:

How to keep an app since SDK 16 running foreground every time?

I’m building an app to monitoring the android device in Kotlin.
I’ve looked in 3 obstacles:
1 - The difference between android under and post 7.0.0 on foreground services
2 - Chinese ROMs, with an agressive kill of apps when user do a simple clean on last apps
3 - which android tool can I use for resolve it.
I’ve seen until now: AlarmManager, permanent notifications, accessibility service… Broadcast receiver to up application when system restart and battery optimization, but all my tries didn’t seem to help me in solving.
For example, the follow tutorial doesn’t work after I clean the lastest apps used in a Chinese ROM (Xiaomi): robertohuertas.com/2019/06/29/android_foreground_services
Showing permanent notification is the only way according to android docs. But chinese rom use there own task management to save battery which even closes permanent notification, If user manual cleans app from resent task. Currently i am ignoring those devices/ limited support. I am looking for better solution.

Bypass Background Processes Limit

Hello everybody
Search and search I could not find a solution for this I ask the forum for help: generally you want to limit the background processes to limit battery use blah blah blah and various things ... and generally this limit is around 20 applications (at least to myself)
Let's assume I want to get around this limit with Android 7 or higher. That is, I don't care about battery consumption or keeping the Ram free, but I need to have n processes running in the background
In this case how could I get around or eliminate the maximum number? From developer settings i can only choose a lower number and with an Android up to 4 you can use the command line "SERVICE CALL ACTIVITY 51 i32 x" where x is the maximum number of processes
But with the latest Android?
Thanks to those who want to dedicate time to me
@Neofita00
Take note that the Android low memory killer daemon (lmkd) process monitors the memory state of a running Android system and reacts to high memory pressure by killing the least essential processes to keep the system performing at acceptable levels.
More info here.
Thank you very much for your fast feedback... In my situation (emulating android on a pc) I don't have a saturable limit under standard conditions
So in your opinion, is it possible to bypass the system restriction?

Categories

Resources