This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Java/Swing desktop app for managing many Android devices over adb. Packaged for Mac/Windows/Linux via jdeploy. Tested with up to 45 devices over USB hubs.
Java 17+, Maven. Entry point: com.jpage4500.devicemanager.MainApplication.
mvn compile exec:java— run from source (orscripts/run.sh)mvn -B package— build fat jar totarget/AndroidDeviceManager.jar(orscripts/build.sh)mvn install— also bundles a native.appfor macOS viamacosappbundler-maven-pluginscripts/createMacApp.sh— full Mac packaging + zip + copy to/Applicationsscripts/clear-preferences.sh— wipes saved JavaPreferences- No test suite is set up (
package.json'stestscript is a stub).
CI: .github/workflows/jdeploy.yml runs on push to develop — builds, publishes via jdeploy, creates a GitHub release. Version is the Maven build timestamp (yy.M.d-Hmm) injected into app.properties.
adb(Android platform-tools)scrcpy(for device mirroring)
The app shells out to platform-specific scripts in src/main/resources/scripts/ (mirror.sh/.bat, terminal.sh/.bat, start-server.sh/.bat, record-screen.sh/.bat, run-custom.sh, shell.sh). They are extracted to a temp dir at runtime; see DeviceManager constants SCRIPT_*.
MainApplication— boot, FlatLaf setup, taskbar icon, file-open handler (apk/xapk drag-onto-app), createsDeviceScreen.ui/— Swing screens. Each top-level screen extendsBaseScreen:DeviceScreen(main list),ExploreScreen(file browser),ViewLogsScreen,SaveLogsScreen,InputScreen,MessageViewScreen.ui/dialog/andui/views/hold dialogs and reusable Swing widgets.manager/— non-UI business logic.DeviceManageris a singleton coordinatingadbvia the bundled jadb library, holding the device list, scheduled refresh, and per-device logging state.RemoteConnectionManager+RemoteConnectionconnect to other ADM instances;RemoteServerManager+RemoteHttpServer(NanoHTTPD) expose this instance's devices over HTTP so another ADM instance can use them.NetworkDiscoveryManageruses jmDNS/SSDP to find peers.data/— POJOs (Device,DeviceFile,LogEntry,RemoteServerConfig, etc.). Annotate fields with@ExcludeFromSerializationto keep Gson from persisting them (seeAnnotationExclusionStrategy).table/—TableModels;table/utils/holds matchingCellRenderers,RowSorters,RowFilters.logging/— custom SLF4J binding (AppLoggerFactoryregistered viaMETA-INF/services/org.slf4j.spi.SLF4JServiceProvider). Levels are the Android-style ints inLog(VERBOSE=2 … ASSERT=7). File logs go to~/.device_manager/device_manager_log.txt.utils/— Swing helpers, file I/O, Gson wrapper, network/UPnP helpers,PreferenceUtils.
A vendored copy of jadb — a pure-Java ADB client. The app talks to the local adb server via JadbConnection/JadbDevice rather than spawning adb for every command. Treat this package as a third-party dep; prefer not to modify it.
ADM can act as both client and server. RemoteServerManager runs RemoteHttpServer on port 8765 with bearer-token auth and exposes /api/devices, /api/execute, /api/files/list|download|upload, /api/screenshot. Headers x-client-ip / x-client-name / authorization identify the caller. RemoteConnectionManager is the matching client. UpnpUtils does optional port forwarding; jmDNS handles LAN discovery.
- Java
PreferencesAPI viaPreferenceUtils— keys are enums (Pref,PrefBoolean,PrefInt).scripts/clear-preferences.shwipes them. ~/.device_manager/(fromUtils.getDeviceManagerFolder()) — log file, downloaded files, etc.
- All Swing work goes through
SwingUtilities.invokeLater. DeviceManagerowns two pools:commandExecutorService(blocking shell-outs like mirror/terminal) andscheduledExecutorService(periodic device refresh onDEVICE_REFRESH_MINS).
- Use SLF4J:
private static final Logger log = LoggerFactory.getLogger(Foo.class);— calllog.debug/info/warn/errorwith{}placeholders. - Layouts use MigLayout (
net.miginfocom.swing.MigLayout). TextUtilsmirrors Android's helper (useisEmpty,equalsIgnoreCase, etc. instead of rolling your own).- Gson via
GsonHelper; respect@ExcludeFromSerialization. - Log filter syntax (used in
ViewLogsScreen) is documented inLOGS.md.