[OnePlus 6T  Questions & Answers] geeksquad2:
My background with android is long and rocky.

A long time ago in a galaxy far away, I had a Samsung Galaxy S, then a S2.

I can remember a Google Nexus phone in there somewhere.

Then at some point I switched over to Windows Mobile for many years.

A couple of hears ago I came back to android with a Samsung Galaxy S8+ and I hated it.

Recently I upgraded to a OnePlus 6T McLaren and here I am.

I had been expecting to see android happily use up 7, 8 or even 9GB of ram before the background task manager would begin to kill tasks.

Except that I seldom saw android use much more than 5GB of ram.

And worse, background tasks were being killed on a regular basis.

Widgets would stop working overnight, or even in just a few hours.

Spotify would close while a playing a playlist.

A quick search on XDA reveals that many users believe that Android will just use up as much ram as your phone has.

However, that is simply not true.

And so, I began my quest to have Android use as much ram as the phone could provide.

In my case, 10GB.

- I understand that there is an inherent trade-off between keeping background apps running and battery usage. I can live with extra battery usage in exchange for keeping my widgets running or Spotify running for an entire playlist.

- I realized very quickly that in order to achieve the results that I was looking for that the phone would have to be rooted. So rooting was one of the first things that I did.

Step 1.

I started with the basic stuff that a quick google search would provide;

- Settings -> Battery -> Battery Saver (off)

- Settings -> Battery -> Adaptive Battery (off)

- Settings -> Battery -> Battery Optimization -> widget app (don’t optimize)

- Settings -> Battery -> Battery Optimization -> Spotify (don’t optimize)

- Settings -> Battery -> Battery Optimization -> Advanced Optimization -> Deep Optimization (off)

- Settings -> Battery -> Battery Optimization -> Advanced Optimization -> Sleep standby optimization (off)

- Settings -> Apps -> Widget app -> Battery -> Background Restriction (app can use battery in background)

- Settings -> Apps -> Spotify -> Battery -> Background Restriction (app can use battery in background)

This helped but not enough to make the widgets or Spotify usable.

Step 2.

I supposed that my specific background tasks that I wanted to keep running were being killed because of the many other apps that were running in the background.

I searched for and found Tomatot DeBloater scripts for the Oneplus 6.

Excellent! Just what I was looking for.

I chose the Tomatot-Debloater-OOS-Light-2.3.zip and installed it.

This helped some more but not enough to make the widgets or Spotify usable.

Step 3.

I realised that there were still some apps running in the background that I didn’t use or want.

So I used Titanium Backup to freeze the following apps;

- Calendar

- Calendar Storage 9

- Contacts (O+)(I replaced with google contacts)

- Dashboard

- Drive

- Face Unlock

- Gboard

- Gmail

- Google

- Google partner setup 9

- Google play music 8

- McLaren AR

- Messaging (O+)(replaced with google messaging)

- OK google enrollment 9

- Oneplus system 1

- Youtube

Perfect! These apps were no longer competing for phone resources with the apps that I wanted to run.

This helped some more but not enough to make the widgets or Spotify usable.

This did make the phone feel faster and smoother.

The phone is much more responsive and fluid to my input.

This made me realize that the apps were being closed not due to a lack of phone resources, but a background task manager being aggressive.

Presumably for battery saving purposes.

I changed my focus to adjusting that background task manager.

Step 4.

Enable the recent screen ‘LOCK’ on the widget app and Spotify.

This didn’t do anything for me.

Everything that I’ve read on it says that it just stops the task from being killed when you click on kill all tasks.

The lock doesn’t lock the task from being killed by the background task manager.

Step 5.

Further google searching led me to believe that the OEM kernel was limiting background tasks.

I choose ElementalX-OP-3.09 and the EX Kernel Manager.

I had to read a lot of google university material to make any sense of the settings in here.

I’m not sure that I fully understand even now.

Eventually, I ended up with the following settings;

Memory

- Adaptive Low Memory Killer (disabled)

- dirty ratio (20)

- dirty background ratio (5)

- min free kbytes (12398)

- vfs cache pressure (100)

Memory -> Low Memory Killer

- apply on boot

- Foreground app (72mb)

- Visible apps (90mb)

- Secondary server (108mb)

- Hidden apps (200mb)

- Content Providers (587mb)

- Empty apps (783mb)

This helped a lot.

This almost made the phone usable to the state that I wanted.

But the widget and Spotify would still stop running overnight and by morning the apps would have to be reopened to get them to run again.

At least the apps would run most of the day without being killed.

Still not the behaviour that I expected from a phone with 10GB of ram.

Ram usage was still not going much over 5.5Gb even if I opened up many apps at once.

Can I ever get ram usage up to the 10Gb that I have?

Step 6.

The last thing that I tried yesterday afternoon was to increase the background task limit in the build.prop.

ro.vendor.qti.sys.fw.bservice_limit=5 (changed it to 60)

ro.vendor.qti.sys.fw.bservice_age=5000 (changed it to 10000)

Yes, I know that I am on PIE and there isn’t supposed to be any effect.

No, I don’t know yet if this had any effect.

I am hopeful.

The widget app didn’t close last night, but Spotify did.

I am getting closer!

This is the best that I could do on my own without asking for help.

So here I am posting my question and asking for help.

How do I get the apps that I want to run to not be killed by the background task manager?

OR

How do I get the phone to use the 10GB of ram?

I feel that I am missing something.

With any luck, one of you smarter persons will be able to point it out to me.

As an aside from all of these changes the phone feels very smooth and fluid.

Except for apps closing that I don’t want to, this phone is a great experience and a pleasure to use.

Apps that I want to run are staying open much longer then before I started.

It’s now just an overnight issue.

And getting the phone to use over 6Gb of ram.

I would suggest that I am 90% happy with it now.

KERNAL: ElementalX-OP6-3.10

ROM: STOCK OOS 9.0.11

PHONE MODEL: 6013 O+6T McLaren