Adb App Control Extended Key — Must Read
adb shell am start -n com.shop.app/.ProductActivity --es "product_id" "12345" --ez "from_notification" true This bypasses the homepage and launches directly into a product detail screen with a simulated notification origin. Let’s build a real-world script that uses the extended key concept. Save this as advanced_app_control.sh (or .bat for Windows).
| Command | Effect | | :--- | :--- | | pm disable-user | Disables for the current user only. | | pm disable-until-used | Disables until the user manually launches the app. | | pm disable-dm | Disables package verification. (Dangerous; for development only) | | pm enable | Re-enables a disabled app. | adb app control extended key
./advanced_app_control.sh com.facebook.katana suspend ./advanced_app_control.sh com.facebook.katana deep-link "https://facebook.com/events" Even with the extended key, obstacles exist. Problem 1: "Security exception: Shell cannot change component state" Solution: Some system apps are protected. Use adb shell pm disable --user 0 com.android.app first. If that fails, you need root or adb shell pm uninstall -k --user 0 (which doesn't remove the app but hides it for the user). Problem 2: Extended keys don't persist after reboot Solution: Suspension and disable-until-used are persistent. However, --user flags are per-session. Create an init.d script (root) or use Tasker with ADB WiFi to reapply extended keys on boot. Problem 3: "Unknown option --ez" when using am Solution: Ensure your am syntax is correct. Extras come after the component name. adb shell am start -n com
adb shell pm suspend --user 0 com.tencent.mobilegame When you want to play again: | Command | Effect | | :--- |
#!/bin/bash # Extended ADB App Control Script PACKAGE=$1 ACTION=$2 USER_ID=$3:-0 # Default to user 0