enableDemoMode
Configure device status bar indicators for consistent screenshots by setting time, battery level, signal strength, and notification visibility.
Instructions
Enable demo mode with consistent status bar indicators for screenshots
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| time | No | Time to display in statusbar in HHMM format (e.g., 1000 for 10:00) | |
| batteryLevel | No | Battery level percentage (0-100) | |
| batteryPlugged | No | Whether the device appears to be charging | |
| wifiLevel | No | WiFi signal strength (0-4) | |
| mobileDataType | No | Mobile data type to display | |
| mobileSignalLevel | No | Mobile signal strength (0-4) | |
| hideNotifications | No | Whether to hide notification icons | |
| platform | Yes | Target platform |
Implementation Reference
- src/server/utilityTools.ts:51-66 (handler)The enableDemoModeHandler function that executes the tool logic by instantiating DemoMode and calling its execute method with the provided arguments.const enableDemoModeHandler = async (device: BootedDevice, args: EnableDemoModeArgs) => { try { const demoMode = new DemoMode(device); const result = await demoMode.execute(args); return createJSONToolResponse({ message: "Demo mode enabled", observation: result.observation, ...result, demoModeEnabled: true }); } catch (error) { logger.error("Failed to enable demo mode:", error); throw new ActionableError(`Failed to enable demo mode: ${error}`); } };
- src/server/utilityTools.ts:11-20 (schema)Zod schema defining the input parameters for the enableDemoMode tool.export const enableDemoModeSchema = z.object({ time: z.string().optional().describe("Time to display in statusbar in HHMM format (e.g., 1000 for 10:00)"), batteryLevel: z.number().min(0).max(100).optional().describe("Battery level percentage (0-100)"), batteryPlugged: z.boolean().optional().describe("Whether the device appears to be charging"), wifiLevel: z.number().min(0).max(4).optional().describe("WiFi signal strength (0-4)"), mobileDataType: z.enum(["4g", "5g", "lte", "3g", "edge", "none"]).optional().describe("Mobile data type to display"), mobileSignalLevel: z.number().min(0).max(4).optional().describe("Mobile signal strength (0-4)"), hideNotifications: z.boolean().optional().describe("Whether to hide notification icons"), platform: z.enum(["android", "ios"]).describe("Target platform") });
- src/server/utilityTools.ts:102-107 (registration)Registration of the enableDemoMode tool in the ToolRegistry using the schema and handler.ToolRegistry.registerDeviceAware( "enableDemoMode", "Enable demo mode with consistent status bar indicators for screenshots", enableDemoModeSchema, enableDemoModeHandler );
- Core implementation of demo mode enabling in the DemoMode class's execute method, which sends specific ADB commands to configure the Android status bar.async execute(options: DemoModeOptions = {}): Promise<DemoModeResult> { const { time = "1000", batteryLevel = 100, batteryPlugged = false, wifiLevel = 4, mobileDataType = "4g", mobileSignalLevel = 4, hideNotifications = true, } = options; try { // Get current package name from active window const activeWindow = await this.window.getActive(true); logger.info("Setting up Android demo mode for current app:", activeWindow.appId); // Allow demo mode await this.adb.executeCommand("shell settings put global sysui_demo_allowed 1"); // Enter demo mode await this.adb.executeCommand("shell am broadcast -a com.android.systemui.demo -e command enter"); // Set battery status await this.adb.executeCommand( `shell am broadcast -a com.android.systemui.demo -e command battery -e plugged ${ batteryPlugged ? "true" : "false" } -e level ${batteryLevel}` ); // Set clock time await this.adb.executeCommand( `shell am broadcast -a com.android.systemui.demo -e command clock -e hhmm ${time}` ); // Handle notifications if (hideNotifications) { await this.adb.executeCommand( "shell am broadcast -a com.android.systemui.demo -e command notifications -e visible false" ); } // Set network status await this.adb.executeCommand( `shell am broadcast -a com.android.systemui.demo -e command network -e wifi show -e level ${wifiLevel} -e mobile show -e datatype ${mobileDataType} -e level ${mobileSignalLevel}` ); logger.info("Demo mode setup completed successfully"); return { success: true, message: "Demo mode enabled successfully", demoModeEnabled: true, packageName: activeWindow.appId, activityName: activeWindow.activityName }; } catch (err) { const errorMessage = err instanceof Error ? err.message : String(err); logger.error("Failed to set up demo mode:", err); return { success: false, error: `Failed to set up demo mode: ${errorMessage}`, demoModeEnabled: false }; } }