ADB Commands & Configurations

Essential ADB commands and system configurations for Android customization and optimization.

πŸ“± Prerequisites

Before using these commands, ensure you have:

  • ADB Tools installed on your computer
  • Developer Options enabled on your Android device
  • USB Debugging enabled
  • Device connected via USB or wireless ADB

Installing ADB

Linux

# Debian/Ubuntu
sudo apt install android-tools-adb

# Arch Linux
sudo pacman -S android-tools

macOS

brew install android-platform-tools

Windows

Download from Android Developer Site


πŸ”§ System Settings Commands

These commands modify Android system settings using the settings command via ADB shell.

Display & UI Settings

Enable AOD with Super Wallpaper

adb shell settings put system aod_using_super_wallpaper 1

Description: Enables Always-On Display (AOD) using the super wallpaper feature (MIUI/HyperOS).

Performance Settings

Enable GPU Tuner

adb shell settings put global GPUTUNER_SWITCH true

Description: Enables GPU tuning for better graphics performance.

Security Settings

Allow Non-Market App Installation

adb shell settings put secure install_non_market_apps 1

Description: Permits installation of apps from sources other than the Play Store.

Network Settings

Disable WiFi Scanning When Off

adb shell settings put global wifi_scan_always_enabled 0

Description: Prevents WiFi scanning when WiFi is turned off, saving battery.


πŸ“‹ Settings Command Reference

Command Structure

The settings command follows this pattern:

adb shell settings put <namespace> <key> <value>

Namespaces

Namespace Description Persistence
system User-level settings (display, sound, UI) User-specific
secure Secure settings (security, privacy) User-specific
global System-wide settings (network, performance) Device-wide

Common Operations

Read a Setting

adb shell settings get <namespace> <key>

List All Settings

# List all system settings
adb shell settings list system

# List all secure settings
adb shell settings list secure

# List all global settings
adb shell settings list global

Delete a Setting

adb shell settings delete <namespace> <key>

Reset to Defaults

adb shell settings reset <namespace>

πŸ› οΈ Package Management

Grant Permissions

# Grant a specific permission
adb shell pm grant <package> <permission>

# Example: Grant write secure settings to SetBox
adb shell pm grant com.yn.setbox.plugin android.permission.WRITE_SECURE_SETTINGS

Disable System Apps

# Disable an app (without uninstalling)
adb shell pm disable-user --user 0 <package>

# Enable an app
adb shell pm enable --user 0 <package>

Uninstall Apps

# Uninstall for current user (keeps system app)
adb shell pm uninstall --user 0 <package>

# Full uninstall (requires root)
adb shell pm uninstall <package>

πŸ”Œ Wireless ADB

Enable Wireless ADB

  1. Connect via USB first:
    adb tcpip 5555
    
  2. Find device IP address:
    adb shell ip addr show wlan0
    
  3. Connect wirelessly:
    adb connect <device-ip>:5555
    
  4. Disconnect USB and verify:
    adb devices
    

Disable Wireless ADB

adb usb

🎯 Useful Commands

Device Information

# Device model
adb shell getprop ro.product.model

# Android version
adb shell getprop ro.build.version.release

# Device serial number
adb shell getprop ro.serialno

# Battery info
adb shell dumpsys battery

Screen Control

# Take screenshot
adb shell screencap /sdcard/screenshot.png
adb pull /sdcard/screenshot.png

# Record screen
adb shell screenrecord /sdcard/recording.mp4

# Turn screen off
adb shell input keyevent 26

# Unlock screen
adb shell input keyevent 82

Input Simulation

# Send text
adb shell input text "Hello World"

# Press home button
adb shell input keyevent 3

# Press back button
adb shell input keyevent 4

# Tap at coordinates
adb shell input tap 500 1000

# Swipe gesture
adb shell input swipe 300 1000 300 300 100

⚠️ Important Notes

Safety Considerations

  1. Backup First: Always backup your data before modifying system settings
  2. Know What You’re Doing: Incorrect settings can cause system instability
  3. Test One at a Time: Apply settings individually to identify issues
  4. Factory Reset Option: Be prepared to factory reset if something goes wrong

Persistence

  • Settings may reset after:
    • System updates
    • Factory reset
    • ROM changes
    • Some OEM optimizations

Automation

Consider using tools like Automate or Tasker to automatically reapply settings after reboot.


πŸ” Troubleshooting

ADB Not Recognized

# Kill and restart ADB server
adb kill-server
adb start-server

Device Not Found

# Check connected devices
adb devices

# Verify USB drivers (Windows)
# Reinstall platform-tools

Permission Denied

# Restart ADB with root
adb root

# Or use Shizuku apps as an alternative

πŸ“š Additional Resources


πŸ”™ Navigation