Some Android devices don't respect Android's rules when apps want to perform work in the background.
In Pachli this can result in delayed notifications, slow timelines, or crashes.
After reading this document you will know:
- How to tell if your device has this problem.
- How to configure your device to prevent this problem.
Pachli uses background workers to:
- Periodically fetch notifications.
- Remove cached copies of media you've shared.
- Remove cached posts that are no longer referenced by your timelines.
- Remove cached log entries.
If these workers are prevented from running Pachli will fail to work correctly. Symptoms include:
- Delayed or missing notifications.
- Very slow loading of your timelines (possibly crashes if it takes too long).
- Out of memory errors.
Manufacturers that are known to have these problems include:
- Huawei
- Xiaomi
- OnePlus
- Samsung
and many others. See https://dontkillmyapp.com/ for more.
To be very clear -- the manufacturers of these devices have introduced bugs that they need to fix. The changes you have to make, described below, are because of these bugs, not because of bugs in Pachli.
- Open Pachli.
- Open the left-side navigation menu, and choose "About"
- Navigate to the "Database" tab
In the section "Table sizes" look at the numbers for:
- StatusEntity
- TimelineAccountEntity
On a typical device these should be less than 1,000.
In the section "Query timings" press the "Run query timings" button.
After a few seconds timings should appear in this section. Less than 200ms is expected for all queries. Anything larger than that is cause for concern.
In the "Prune cache" section press the "Prune Cache" button.
You should see the numbers in the "Table sizes" section get a lot smaller, and performance should return to normal. Press the "Query timings" button again to confirm.
Unfortunately the precise instructions depend on your device's manufacturer and version.
First, check the comments in pachli/pachli-android#2114 -- someone else may have already left instructions for your specific make and model. If they have, follow those instructions.
Second, If they haven't, then in general you need to make two changes in your device's settings.
- Make sure Pachli is allowed unrestricted battery use. Typically, long-press the Pachli icon to bring up app-specific settings, and the battery options will be in there somewhere.
- If your device has an "Autostart" permission (sometimes in Settings > Apps > Permissions > Autostart), add Pachli to the list of apps with this permission.
Installing Don't Kill My App (Google Play) might also give you specific instructions to follow.
Pachli doesn't use these permission directly. Instead, these settings signal to Android that Pachli is allowed to perform work in the background.
If you make those changes and they solve the problem for you please leave a comment on pachli/pachli-android#2114 with:
- Your phone's make, model, and Android version (this information is at the top of Pachli's "About" screen).
- The precise changes you made, preferably with screenshots.
- We'll use the information provided by users in pachli/pachli-android#2114 to detect if Pachli is running on devices with these problems and prompt the user to fix them directly.
- We'll investigate other ways to run the cleanups on devices that are known to be broken in this way.
Why has this started happening? The changes to support quote posts means Pachli has to process more data in more complicated ways to display your feeds. Before now the data processing was simple enough that the number of cached posts wasn't a problem.
Why didn't the Pachli developers realise there was a problem? Pachli doesn't send any telemetry to the Pachli developers. So, for example, there's no way for the Pachli developers to notice "The database on devices by manufacturer X running Android version Y are much larger than normal, there must be a problem.". Pachli development uses Google Pixel devices and emulators, which don't have these problems.
I don't have to do this for WhatsApp and similar apps, why do I have to do this for Pachli? The device manufacturers (Huawei, etc) keep an allow-list of apps these restrictions don't apply to. Apps that aren't on this list have problems. For example, see this news article, https://www.theverge.com/2018/7/25/17614014/vlc-blacklisting-recent-huawei-devices-negative-app-reviews.