guide #043

Process Name Cleanup in Dashboard

Problem
Dashboard shows ugly raw Android package names, wastes space on 4.5-inch screen.

Solution
Regex chain to clean names: com.android.* -> *, com.motorola.* -> moto.*, com.termux -> termux.

Context

The PocketClaw dashboard displays a process list showing running Android services and their memory usage. On the Moto E2's 4.5-inch 540x960 screen, space is extremely limited. Raw Android package names like com.google.android.gms.persistent or com.motorola.android.providers.settings take up most of the screen width, leaving no room for memory values.

Android package names follow a reverse-domain convention that adds 15-30 characters of redundant prefix to every name. A cleanup pass makes the dashboard actually usable.

Implementation

Apply a regex chain to each process name before displaying it. The chain strips common prefixes in order from most specific to least:

// In dashboard rendering code (hijack.js or launcher):
function cleanProcessName(name) {
  return name
    .replace(/^com\.android\./, "")
    .replace(/^android\.process\./, "")
    .replace(/^com\.motorola\./, "moto.")
    .replace(/^com\.google\.android\./, "goog.")
    .replace(/^com\.pocketclaw\./, "")
    .replace(/^com\.qualcomm\./, "qc.")
    .replace(/^com\.termux\.?/, "termux");
}

// Examples:
// "com.android.systemui"              -> "systemui"
// "com.google.android.gms.persistent" -> "goog.gms.persistent"
// "com.motorola.process.system"       -> "moto.process.system"
// "com.pocketclaw.launcher"           -> "launcher"
// "com.termux"                        -> "termux"
// "com.qualcomm.qcrilmsgtunnel"       -> "qc.qcrilmsgtunnel"

The order matters — more specific prefixes are checked first so com.google.android.* matches before the fallthrough.

Verification

# Check the dashboard output on port 9003:
curl -s http://localhost:9003/dashboard | grep -o 'class="proc-name">[^<]*'
# Expected: cleaned names like "systemui", "goog.gms", "termux"

# Verify no raw "com.android" names remain:
curl -s http://localhost:9003/dashboard | grep "com\.android\."
# Expected: no output (all names cleaned)

Gotchas

  • The regex chain must be applied in order. If you check com.android. before com.google.android., Google packages won't match their specific prefix
  • Some package names don't follow the com.* convention (e.g., android.process.media). The android.process. rule catches these
  • On the native launcher (Hack #40), the cleanup runs in Java. The regex is the same but uses Java's String.replaceFirst() syntax
  • Don't strip too aggressively — names like system_server or zygote should remain as-is (they don't match any prefix)

Result

MetricBeforeAfter
Avg name length~35 chars~12 chars
Readable on 4.5" screenNoYes
Process list visible3-4 entries8-10 entries
Continue reading
guide
Pocket AI complete guide
Running self-hosted AI on portable hardware
guide
Edge AI hardware buyer's guide 2026
Pi 5 vs Mini PC vs Mac Mini
report
Self-hosted AI landscape 2026
Quarterly state of the ecosystem
section
Pocket AI hardware hub
All portable hosts reviewed
section
Agent tracker
Live stats on every agent
newsletter
Thursday digest
Weekly summary in your inbox