Android/adb

ADB stands for Article description::Android Debug Bridge, and it is a part of the Android Software Development Kit (SDK). It can be installed with.

Install Android SDK Platform-Tools
Android SDK Platform-Tools is a component for the Android SDK. It includes tools that interface with the Android platform, primarily.

USB Communication
Enable the USB Debugging option on the Android device under Settings > Developer options.

For Android 4.2 and later, Developer options is hidden by default; use the following stepsː


 * 1) On the device, go to Settings > About.
 * 2) Tap the Build number seven times to make Settings > Developer options available enable.
 * 3) Go back to system settings and scroll down to bottom > Developer Options.
 * 4) Now hit Enable USB-Debugging.

Each user that wants to use ADB needs to be in the plugdev group. If you see an error message that says you're not in the plugdev group, add yourself to it using the following command:

Pair with a device for secure TCP/IP communication
Since Android 11 it is possible to connect to Wifi-debugging by pairing the device over wifi (access point)

On the android device, open Developer options, and enable Wireless debugging , then click the Pair device with pairing code , it will show the connecting information and pairing code on your android device and you will now be able to pair your device. (select pairing by code since qr-code is for android-studio and qemu emulator by default but there are third-party programs for this via the terminal such as "npm-wifi" but it is not default)

Port of adb server
Default port: 5037

Listen on given socket
Default: tcp:localhost:5037

Kill ADB daemon
Sometimes it may be necessary to kill adb if the device is not showing up connect. This can occur when adb is running before connecting the device. In this case kill and restart the adb server:

FastbootD mode
FastbootD is a new mode Android devices could boot to by using ADB Command, via Fastboot Command, and from the Stock Recovery as well for devices using A/B partitions for flashing. The easiest way to keep track of the difference between bootloader/fastboot and fastbootd is to first reboot to the bootloader via adb and then we gonna use fastboot command instead of adb command to fastbootd mode.

When device has rebooted and you got into bootloader mode now use fastboot to reboot to fastboot instead of adb command

Copy all files from device folder
Notice the trailing slash after the directory name:

Exampleː Print IMEI via a call service
Convert the output to a readable formatː

Print IMEI for slot 1 or 2
This works up to android 11

Imei 1:

Imei 2:

Print esim imei via uiautomator
The uiautomatorviewer tool provides a convenient visual interface to inspect the layout hierarchy and view the properties of UI components that are visible on the foreground of the device. This information lets you create more fine-grained tests using UI Automator. For example, you can create a UI selector that matches a specific visible property.

To launch IMEI (same result if you type in caller app: *#06#) we gonna dump screens output to /tmp/read_screen.txt via uiautomator and parse esim IMEI from our esim.

Set wallpaper
When an image is open in the photo gallery, set the image as wallpaper for all screens with below

Uninstall a package
Exampleː

Tip: Uninstalling several packages at once can be achieved by a loop:

Make a Demo Call
Establishes a fake Bluetooth connection to Dialer and must be called first to enable access to all call-related commands.

ADB Dumpsys
A tool that runs on Android devices and provides information about system services. To get a diagnostic output for all system services for the connected device, simply run. However, this outputs far more information than typically needed. For more manageable output, specify the service to examine by including it in the command.

List dumpsys options
Above command works on recent android versions, for older versions use

HTC backup
With a non rooted device, the only things you can backup locally is what the couple device/android will let you do. That is pretty much the same files you can copy with the already mentioned software. With the Android 4.x devices, a nice solution to make such a partial backup is the so-called "adb backup".

where:


 * -f : the path of the *.ab file that will be saved on your computer. This file is a compressed file that contains an archive of the data/apks from your device.
 * -apk|-noapk : indicates if the *.apk files should be backed up (default is -noapk)
 * -shared|-noshared: enable/disable backup of the device's shared storage / SD card contents (default is -noshared)
 * -all : indicates that you want the entire system backed up. you can use the packages filter to just backup specific packages, or use -all for a full system backup.
 * -system|-nosystem: indicates if all the system applications and data are included when backing up. (default is -system)
 * : this is where you can list specific packages to backup. Use these if you want to back up only specific applications. If using -all, you do not need to specify packages.

To backup the phone into

will start the daemon and show you the devices on the USB.

will backup every thing the device will let you to backup.

will restore the backup into the device.

To stop the daemon: