main
1#!/data/data/com.termux/files/usr/bin/bash
2# Clean up background bloat on osaka (Boox Note Air 4C)
3# Frees ~1GB of memory from Google/Play Store services
4# Safe to run anytime — disabled packages stay disabled across reboots
5# Force-stopped packages may respawn, so re-run if memory gets tight
6set -euo pipefail
7
8# One-time setup (requires ADB shell, already done):
9# pm disable-user --user 0 com.google.android.tts
10# pm disable-user --user 0 com.google.android.apps.restore
11# pm disable-user --user 0 com.google.android.configupdater
12# settings put global app_auto_update_policy 0
13# These persist across reboots. Re-run via ADB only if factory reset.
14
15echo "==> Checking disabled packages..."
16for pkg in com.google.android.tts com.google.android.apps.restore com.google.android.configupdater; do
17 short="${pkg##*.}"
18 if pm list packages -d 2>/dev/null | grep -q "$pkg"; then
19 echo " ✓ $short disabled"
20 else
21 echo " ✗ $short NOT disabled (run cleanup-adb.sh from desktop)"
22 fi
23done
24
25echo ""
26echo "==> Force-stopping background bloat..."
27for pkg in \
28 com.google.android.gms.ui \
29 com.android.vending; do
30 echo -n " Stopping $pkg... "
31 am force-stop "$pkg" 2>/dev/null && echo "done" || echo "skipped"
32done
33
34echo ""
35echo "==> Memory status:"
36FREE=$(cat /proc/meminfo | awk '/^MemFree:/{print int($2/1024)}')
37AVAIL=$(cat /proc/meminfo | awk '/^MemAvailable:/{print int($2/1024)}')
38echo " Free: ${FREE}MB Available: ${AVAIL}MB"
39
40echo ""
41echo "✅ Cleanup complete!"