A swollen battery can be avoided if it is allowed to discharge. There must be a charge-discharge cycle.
I have an old Nexus 9 plugged in a Wifi socket managed by openHAB.
The tablet runs Termux. A cron job checks if the battery is below 20 or above 80 and tells openHAB to start or stop the current.