disableDemoMode
Restore standard status bar functionality by disabling demo mode on Android or iOS devices. Supports platform-specific automation for streamlined mobile testing workflows.
Instructions
Disable demo mode and return to normal status bar behavior
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| platform | Yes | Target platform |
Implementation Reference
- src/server/utilityTools.ts:69-84 (handler)Handler function for the disableDemoMode tool, which creates a DemoMode instance and calls exitDemoMode on the device.const disableDemoModeHandler = async (device: BootedDevice) => { try { const demoMode = new DemoMode(device); const result = await demoMode.exitDemoMode(); return createJSONToolResponse({ message: "Demo mode disabled", observation: result.observation, ...result, demoModeEnabled: false }); } catch (error) { logger.error("Failed to disable demo mode:", error); throw new ActionableError(`Failed to disable demo mode: ${error}`); } };
- src/server/utilityTools.ts:22-24 (schema)Zod schema defining the input parameters for the disableDemoMode tool, requiring the target platform.export const disableDemoModeSchema = z.object({ platform: z.enum(["android", "ios"]).describe("Target platform") });
- src/server/utilityTools.ts:109-114 (registration)Registration of the disableDemoMode tool with the ToolRegistry, including name, description, schema, and handler.ToolRegistry.registerDeviceAware( "disableDemoMode", "Disable demo mode and return to normal status bar behavior", disableDemoModeSchema, disableDemoModeHandler );
- Supporting method in DemoMode class that executes the ADB command to exit demo mode on Android devices.async exitDemoMode(): Promise<DemoModeResult> { try { // Get current package name from active window const activeWindow = await this.window.getActive(true); logger.info("Exiting Android demo mode for current app:", activeWindow.appId); await this.adb.executeCommand("shell am broadcast -a com.android.systemui.demo -e command exit"); logger.info("Successfully exited demo mode"); return { success: true, message: "Demo mode disabled successfully", demoModeEnabled: false, packageName: activeWindow.appId, activityName: activeWindow.activityName }; } catch (err) { const errorMessage = err instanceof Error ? err.message : String(err); logger.error("Failed to exit demo mode:", err); return { success: false, error: `Failed to exit demo mode: ${errorMessage}`, demoModeEnabled: true }; } }